Saturday, November 26, 2016

Short questions (MCQs) based on Array

MCQs based on Array Set-1

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

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

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

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

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

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

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





More questions and answers will be added soon....

* * * * *


No comments:

Post a Comment