Basic C Programming MCQ
Basic C Programming MCQ
71. Consider the array definition
int num [10] = (3, 3, 3);
Pick the correct answers.
- num[9] is the last element of the array num
- The value of num [8] is 3
- The value of num [3] is 3
- None of the above
72. Consider the following type definition
typedef char x[10];
x myArray [5];
What will sizeof(my Array) be? Assume one character occupied 1 byte)
- 15 bytes
- 10 bytes
- 50 bytes
- 30 bytes
73. While passing an array as an actual argument, the function call must have the array name
- with empty brackets
- with its size
- alone
- none of the above
74. The following program
main ()
{
Static int a[] = {7, 8, 9}
printf ("%d", 2[a]) + a[2]));}
- results in bus error
- results in segmentation violation error
- will not compile successfully
- none of the above
75. The parameter passing mechanism for an array is
- call by value
- call by value-result
- call by reference
- none of these
76. Consider the statement
int val[2] [4] = {1, 2, 3, 4, 5, 6, 7, 8,};
4 will be the value o
- val [1] [4]
- val [0] [4]
- val [1] [1]
- none of the above
78. The following program fragment
int m, n, b = m n = 8;
char wer [80];
sprintf (wer, "%d%d%d", m n, b);
puts (wer);
- prints the string 8 8 8
- prints the string 888
- prints the null string
- none of the above
79. Under which of the following conditions, the size of an one-dimensional array need not be specified?
- when initialization is a part of definition
- when it is a declaration
- when it is a formal parameter
- when it is an actual argument
80. If a two dimensional array is used as a formal parameter, then
- both the subscripts may be left empty
- the first (row) subscript may be left empty
- the first subscript must be left empty
- both the subscripts must be left empty