Basic C Programming MCQ Questions and Answers

Practice Mode
Showing 10 of 198 questions
Q61
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 a > b
  • B a < b
  • C a = = b
  • D none of the above
Answer: Option
Q62
The body of the following for loop for {putchar ('a'); putchar (0); putchar ('c')} will be executed
  • A 0 times
  • B 1 time
  • C infinitely many times
  • D will not be executed because of syntax error
Answer: Option A
Q63
The following statement if (a > b) if (c > b) printff("one"); else if (c == a) printf ("two); else printf ("three"); else printf ("four");
  • A results in a syntax error
  • B prints four in c <= b
  • C prints two if c <= b
  • D prints four in a <= b
Answer: Option D
Q64
The above statement can never print
  • A one
  • B two
  • C three
  • D four
Answer: Option B
Q65
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
  • A 8 * y
  • B y * (1 + 2, + 3 + 4)
  • C y * 4
  • D y * y
Answer: Option A
Q66
Choose the correct statements.
  • A All the elements of the array should be of the same data type and storage class.
  • B The number of subscripts determines the dimension of array.
  • C The array elements need not be of the same storage class.
  • D In an array definition, the subscript can be any expression yielding a non-zero integer value
Answer: Option
Q67
Consider the declaration static char hello [] = "hellow"; The output of printf ("%s\n", hellow); will be the same as that of
  • A puts ("hellow");
  • B puts (hellow);
  • C printf ("%s\n", "hellow");
  • D puts ("hellow\n");
Answer: Option
Q68
If storage class is missing in the array definition, by default it will be taken be
  • A automatic
  • B external
  • C static
  • D either automatic or external depending on the place of occurrence
Answer: Option D
Q69
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];
  • A transposes the given matrix x
  • B makes the given matrix x, symmetric
  • C doesn't alter the matrix x
  • D none of the above
Answer: Option B
Q70
Which of the following features of C is means provide reliable access to special memory locations?
  • A static_const
  • B pragma
  • C volatile
  • D immutable
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test