Saturday, November 26, 2016

Answer of MCQs based on Array

To store 1 subject marks of 10 students in C program; _____________ type of array is useful.
A. 1-D
B. 2-D
C. multi-dimensional
D. none of these
ANSWER: A

To store 5 subjects’ marks of 50 students, _____________ type of array is useful.
A. 1-D
B. 2-D
C. multi-dimensional
D. none of these
ANSWER: B

Identify the suitable variable declaration for storing name of 10 students in C program.
A.  int name[10];
B.  char name[10][30];
C.  char name;
D. none of these
ANSWER: B

How many array elements will be declared in following statement?
int marks[10];
A. 10
B. 9
C. 11
D. none of these
ANSWER: A

What is the first index number in the 1-D array of C language?
A. 0
B. 1
C. none of these
ANSWER: A

For the following C program variable declaration:
    int age[]={6,4,3,5,0};
what is the output of statement: printf(“%d”, age[1]);
A. 6
B. 4
C. 3
D. 0
ANSWER: B

Predict the output of following code:
int main() {
                int answer, num[5]={1,2,3,4,5};
                printf("%d\n", num[4]);
                return 0;
}
A. 1
B. 4
C. 5
D. none of these

ANSWER: 5

* * * * *

No comments:

Post a Comment