Top 80+ Solved C Language MCQ Questions Answer
Q. What is the use of getchar()?
a. The next input character each time it is called
b. EOF when it encounters end of file
c. The next input character each time it is called EOF when it encounters end of file
d. None of the mentioned
Q. Which of the following statement is true?
a. The symbolic constant EOF is defined in <stdio.h>
b. The value is -1
c. The symbolic constant EOF is defined in <stdio.h> & value is -1
d. Only value is -1
Q. What is the return value of putchar()?
a. The character written
b. EOF if an error occurs
c. Nothing
d. Both character written & EOF if an error occurs
Q. What is the purpose of sprintf?
a. It prints the data into stdout
b. It writes the formatted data into a string
c. It writes the formatted data into a file
d. None of the mentioned
Q. What are the Properties of the first argument of a printf() functions?
a. It is defined by a user
b. It keeps the record of the types of arguments that will follow
c. There may no be first argument
d. None of the mentioned
Q. Which of the following function with ellipsis are illegal?
a. void func(…);
b. void func(int, …);
c. void func(int, int, …);
d. none of the mentioned
Q. Which of the following data-types are promoted when used as a parameter for an ellipsis?
a. char
b. short
c. int
d. none of the mentioned
Q. Which header file includes a function for variable number of arguments?
a. stdlib.h
b. stdarg.h
c. ctype.h
d. both stdlib.h and stdarg.h
Q. Which of the following macro extracts an argument from the variable argument list (ie ellipsis) and advancethe pointer to the next argument?
a. va_list
b. va_arg
c. va_end
d. va_start
Q. The type va_list in an argument list is used ________
a. To declare a variable that will refer to each argument in turn;
b. For cleanup
c. To create a list
d. There is no such type
Q. In a variable length argument function, the declaration “…” can _______
a. Appear anywhere in the function declaration
b. Only appear at the end of an argument list
c. Nothing
d. None of the mentioned
Q. Each call of va_arg _______
a. Returns one argument
b. Steps va_list variable to the next
c. Returns one argument & Steps va_list variable to the next
d. None of the mentioned