Basic C Programming MCQ
Basic C Programming MCQ
61. Consider the following program fragment
if (a > b)
printf ("a > b) ;
else
printf ("else part");
printf ("a <= b");
a < = b will be printed if
- a > b
- a < b
- a = = b
- none of the above
62. The body of the following for loop
for {putchar ('a'); putchar (0); putchar ('c')}
will be executed
- 0 times
- 1 time
- infinitely many times
- will not be executed because of syntax error
63. The following statement
if (a > b)
if (c > b)
printff("one");
else
if (c == a) printf ("two);
else printf ("three");
else printf ("four");
- results in a syntax error
- prints four in c <= b
- prints two if c <= b
- prints four in a <= b
65. The following program fragment
int x = 4, y = x, i;
for (i = 1; i < 4; ++i)
x += x;
outputs an integer that is same as
- 8 * y
- y * (1 + 2, + 3 + 4)
- y * 4
- y * y
66. Choose the correct statements.
- All the elements of the array should be of the same data type and storage class.
- The number of subscripts determines the dimension of array.
- The array elements need not be of the same storage class.
- In an array definition, the subscript can be any expression yielding a non-zero integer value
67. Consider the declaration
static char hello [] = "hellow";
The output of printf ("%s\n", hellow);
will be the same as that of
- puts ("hellow");
- puts (hellow);
- printf ("%s\n", "hellow");
- puts ("hellow\n");
68. If storage class is missing in the array definition, by default it will be taken be
- automatic
- external
- static
- either automatic or external depending on the place of occurrence
69. The following program fragment
int x[5][5], i, j;
for (i = 0; i < 5; ++i)
for (j = 0; j < 5 ; j++)
x[i][j] = x[j][i];
- transposes the given matrix x
- makes the given matrix x, symmetric
- doesn't alter the matrix x
- none of the above
70. Which of the following features of C is means provide reliable access to special memory locations?
- static_const
- pragma
- volatile
- immutable