LearnFrenzy
Sign in Take a free test

C Input / Output · Exercise 1 of 4

C Input / Output Input/Output MCQ

  • 12 questions
  • Page 2 of 2
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Twelve multiple-choice questions on printf and scanf, their return values, line input, file modes, fseek, feof, text and binary mode and the standard streams. Pick an option to check your answer instantly.

Question 11 Medium

snprintf(buf, 8, "%s", "programming") – what does it return?

A 7, the characters written
B 11, the length the full output needed
C -1, because it did not fit
D 8, the buffer size
Question page & discussion
Question 12 Medium

Is fflush(stdin) a portable way to discard pending input?

A Yes, it clears the input buffer everywhere
B No – fflush is defined only for output (or update) streams; on input streams the behaviour is undefined
C Yes, but only on Linux
D No, it closes stdin
Question page & discussion
Up next · Exercise 2Predict the Output12 questions

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links