C Language - Input/Output Questions and Answers

Practice Mode
Showing 10 of 54 questions
Q41
 main ( ) { double x = 1/2. 0 - 1/2; printf('x=%.2f\n',x); } What will be printed when the above code is executed ?
  • A x=0.00
  • B x=0.25
  • C x=0.50
  • D x=1.00
Answer: Option C
Q42
 main ( ) { int x = 5, y = 10; double z; z = (double) ( x / y); printf ("z = %. 2f\n',z) } What will be printed when the above code is executed ?
  • A z = 0.00
  • B z = 0.50
  • C z = 1.00
  • D 2.00
Answer: Option A
Q43
 What will be printed when the following code is executed ? main ( ) { int i = 4, a = 6; double z; z = a /i; printf ("z = %.2f\n",z) }
  • A z = 0.00
  • B z = 1.00
  • C z = 1.50
  • D z = 2.00
Answer: Option B
Q44
 main ( ) { int x = 3, y = 3, z = 3; z - = x - -    -   --y; printf ("x = %d y = % d z = %d', x, y, z); } What will be the value of x, y, and z ?
  • A x = 2 y = 2z = 2
  • B x = 1 y = 2 z = 2
  • C x = 2 x = 2 y = 0
  • D x 2 y = 2 z = 1
Answer: Option A
Q45
 main ( ) { int x, y, z ; printf (" %d \n', ( z > = y>= x ? 10 : 20)); } What might be the value of x, y, and z, if 20 has to be printed ?
  • A 0, 0, 0
  • B -1, -1, -2
  • C -1, 0, 1
  • D none
Answer: Option D
Q46
# include  <stdio.h> main () { int a = 0xfff; (a << 4 >> 12) ? printf ("Sandeep "): printf ("Ashok"); } What will be the output of the program ?                                 
  • A Ashok
  • B Sandeep
  • C Error: Incorrect Assignment
  • D None
Answer: Option A
Q47
 printf ("daily click !"); in the code segment above, the words Daily click ! will be printed to what output device ?
  • A to an E-mail message
  • B to the console
  • C to the default printer
  • D to wherever standard output has been directed to
Answer: Option B
Q48
 If x -= 2, y = 6, and z = 6 then, what will be the output of  x = y = = z; printf (%d", x) ;
  • A 0
  • B 1
  • C 2
  • D 6
Answer: Option B
Q49
 int i = 20; printf ( "%x", i); What is the output?
  • A x 14
  • B 14
  • C 20
  • D none of the above
Answer: Option B
Q50
 float x, y, z; scanf ("%f%f", &x, &y); printf ("%.2f, %.2f", x,y); if input stream contains "4.2 3.2 3..." what will be the output?
  • A 4.20, 3.00
  • B 4.2, 2.3
  • C 4.20, 2.30
  • D 4.20 3.20
Answer: Option D
Questions and Answers for Competitive Exams Various Entrance Test