Explore topic-wise MCQs in C Multiple Choice.

This section includes 22 Mcqs, each offering curated multiple-choice questions to sharpen your C Multiple Choice knowledge and support exam preparation. Choose a topic below to get started.

1.

_____ is an optional argument that gives the maximum number of characters to be read.

A. modifiers
B. width
C. precision
D. length
Answer» C. precision
2.

Explain the format string "%5d%s %c"

A. five characters as a decimal integer, then reads the remaining as a string and then scans the first non-whitespace character
B. compile error
C. run-time error
D. read first five characters as a decimal and ignore the rest
Answer» B. compile error
3.

A fatal error will be generated if the format string is ended with a white space character.

A. true
B. false
Answer» B. false
4.

What form the data must be entered for the given C code?

A. 6  9
B. 6/9
C. compile error
D. run-time errorView Answer
Answer» C. compile error
5.

The syntax of the scanf() is scanf(“control string “, arg1,arg2,arg3,….,argn); the prototype of control string is ____________

A. [=%[width][modifiers]type=]
B. [=%[modifiers][width]type=]
C. [=%[width] [modifiers]]
D. [width][modifiers]
Answer» B. [=%[modifiers][width]type=]
6.

What is the meaning of the following C statement?

A. read all character except new line
B. read all characters
C. read only new line character
D. syntax errorView Answer
Answer» B. read all characters
7.

What does the C statement given below says?

A. read string with minimum 7 characters.
B. read string with maximum 7 characters
C. read string exactly to 7 characters
D. read string with any number of charactersView Answer
Answer» C. read string exactly to 7 characters
8.

scanf() is a predefined function in______header file.

A. stdlib. h
B. ctype. h
C. stdio. h
D. stdarg. h
Answer» D. stdarg. h
9.

Control string specifies the type and format of the data that has to be obtained from the keyboard.

A. true
B. false
Answer» B. false
10.

If the user enters 1 s 3.2, what value will be returned by the scanf()?

A. 1
B. 2
C. 3
D. no return valueView Answer
Answer» B. 2
11.

If the user enters 1 3.2 s, what value will be returned by the scanf()?

A. 1
B. 2
C. 3
D. No return valueView Answer
Answer» D. No return valueView Answer
12.

6_¬¨ Ć9?$#

A. 6/9
B. compile error
C. run-time error
Answer» C. run-time error
13.

SCANF()_IS_A_PREDEFINED_FUNCTION_IN______HEADER_FILE.?$

A. stdlib. h
B. ctype. h
C. stdio. h
D. stdarg. h
Answer» B. ctype. h
14.

What is the qualifying input for the type specifier G?

A. floating point numbers
B. floating point numbers in exponential format
C. floating point numbers in the shorter of exponential format
D. not a type specifier
Answer» C. floating point numbers in the shorter of exponential format
15.

read data for two

A. generate error
B. read data for three
C. nothing can be said
Answer» B. read data for three
16.

What is the prototype of scanf function?

A. scanf("controlstring",arg1,arg2,arg3,….,argn);
B. scanf("control string", variable list);
C. scanf(" varible list,", control string);
D. scanf("arg1,arg2,arg3,….,argn", control string);
Answer» D. scanf("arg1,arg2,arg3,‚Äö√Ñ√∂‚àö√묨‚àÇ.,argn", control string);
17.

compile error

A. run-time error
B. good
C. logical error
Answer» C. logical error
18.

What error will be generated on using incorrect specifier for the datatype being read?

A. compile error
B. run-time error
C. logical error
D. no error
Answer» B. run-time error
19.

What error will generate if the read and write parameters are not separated by commas?

A. run-time error
B. compile error
C. logical error
D. no error
Answer» C. logical error
20.

What action is carried out by scanf if a user enters any blank spaces, tabs, and newlines?

A. consider as input
B. ignores it
C. produces error
D. nothing can be said
Answer» C. produces error
21.

What is the use of symbol * in the control string as shown [=%[*][width] [modifiers] type=]?

A. * is optional and used when the data should be read from the stream but ignored
B. * is not optional, used to read data from the stream but it is not ignored
C. * is not optional, it is used to read data stream but ignored
D. * is optional and used to read data from stream but it is not ignored
Answer» B. * is not optional, used to read data from the stream but it is not ignored
22.

Select the correct value of i from given options i=scanf("%d %d", &a, &b);

A. 1
B. 2
C. 3
D. No value assigned
Answer» C. 3