Basic C Programming MCQ

Basic C Programming MCQ
41. The program fragment int i = 263; purchar (i);
  • prints 263
  • prints the ASCII equivalent of 263
  • rings the bell
  • prints garbage
Show Answer
42. Which of the following comments regarding the reading of a string, using scanf (with %s option) and gets, is true ?
  • Both can be used interchangeably
  • scanf is delimited by end of line, while gets is not.
  • scanf is delimited by blank space, while gets is not.
  • none of the above
Show Answer
43. The following statement printf ("%f", 9/5); prints
  • 1.8
  • 1.0
  • 2.0
  • none of the above
Show Answer
44. The statements printf("%f", (float)9/5);
  • 1.8
  • 1.0
  • 2.0
  • none of the above
Show Answer
45. Which of the following are not keywords in C?
  • printf
  • main
  • IF
  • none of the above
Show Answer
46. The following program fragment unsigned i = 1; int j = -4; printf("%u", i + j ); prints
  • garbage
  • -3
  • aninteger that changes from machine to machine
  • none of the above
Show Answer
47. If the following program fragment (assume negative numbers are stored in 2's complement form) unsigned i = 1; int j = -4 ; printf "%u", i + j) ; prints x, then printf ("%d", 8*sizeof (int)); Outputs an integer that is same as (log in the answer are to the base two)
  • an unpredictable value
  • 8 * log (x+3)
  • log (x+3)
  • none of the above
Show Answer
48. The following statements for (i = 3; i < 15; i += 3) {printf ("%d", i); ++i; will result in the printing of
  • 3 6 9 12
  • 3 6 9 12 15
  • 3 7 11
  • 3 7 11 15
Show Answer
49. If a = 9, b = 5 and c = 3, then the expression (a - a/b * b%c) > a%b%c evaluates to
  • true
  • false
  • invaid
  • 0
Show Answer
50. In a for loop, if the condition is missing, then
  • it is assumed to be present and taken to be false
  • it is assumed to be present and taken to be true
  • It results a syntax error
  • execution will be terminated abruptly
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test