C Language - Input/Output Questions and Answers

Practice Mode
Showing 10 of 54 questions
Q21
 Conversion specification includes 
  • A \ and a conversion character
  • B / and a conversion character
  • C & and a conversion character
  • D % and a conversion character
Answer: Option D
Q22
 Identify the correct statement given double x; 
  • A scanf ("%d", & x);
  • B scanf ("%f", x);
  • C sfanf ("%d", *x);
  • D scanf ("% | f ", & x) ;
Answer: Option D
Q23
 Identify the correct statement (s) given float y; 
  • A scanf ("%e", & y);
  • B scanf ("%i", & y);
  • C scanf ("%g", &y);
  • D options a and c
Answer: Option D
Q24
 For the given scanf () statementt, what is the form of input expected ? scanf ("%D, %d. %d", &date, &month, &year);
  • A 22.4.1972
  • B 22 4 1972
  • C 22/4/1972
  • D options a and b
Answer: Option A
Q25
 Identify the wrong statement given, int x; float y; char z;
  • A scanf ("%d, %f, %c", &x, &y, &z);
  • B scanf ("%d, %f, %c", &x, &y,z);
  • C scanf("Rs. %d, %f, %c"< &x, &y, &z);
  • D options a and c.
Answer: Option B
Q26
&nbsp;What are the values of x, y and z, if 25 20 30 are given as inputs for scanf(&quot;d %*d%d&quot;, &amp;x, &amp;y, &amp;z);
  • A x = 25,y is not assigned, z = 30
  • B x = 25, y = 20, z = 30
  • C x = 25, y = 30, z is not assigned
  • D x = 25, y is not assigned, z = 20
Answer: Option A
Q27
&nbsp;What are the values of a, b and c, given int a, c' float b; with inputs as 50, 3.52, 20 for the statement scanf(&quot;%2d % 2d', &amp;p, &amp;q); ?
  • A x = 356 y =47
  • B x = 35 y = 6
  • C x = 35 y = 4
  • D x = 35 y = 47
Answer: Option B
Q28
&nbsp;Char p,q; scanf(&quot;%c%Is', &amp;p, &amp;q); what are the values assigned, if x and y are given as inputs ?
  • A P = x and q = blank
  • B p = x and q is not assigned
  • C p = x and q = y
  • D p = x and q = x
Answer: Option C
Q29
&nbsp;Identify the correct statement(s) given the declaration char x, y;
  • A scanf ("%c%c', &x, &y);
  • B scanf ("%c%1s", &x, &y);
  • C scanf ("%* [] %c", &x, &y);
  • D all the above
Answer: Option D
Q30
What is the the value returned by printf () function, if an error occurs ?
  • A Positive value
  • B 0
  • C Negative value
  • D 1
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test