You are on page 1of 9

C Language MCQs [set-4]

Chapter: Managing IO Operations

76. The conversion characters d, i, o, u, and x may be preceded by h in


scanf() to indicate?

A. A pointer to short

B. A pointer to long o m
.c
C. Nothing
te
D. Error a
Answer: A
q M
c
M
77. The syntax of printf() function is printf(“control string”, variable list)
;what is the prototype of the control string?

A. %[flags][.precision][width][length]specifier

B. %[flags][length][width][.precision]specifier

C. %[flags][width][.precision][length]specifier

D. %[flags][.precision][length][width]specifier

Answer: C

78. The parameter control string in the printf () is a C String that contains
text to be __________

A. taken from a standard output device

B. written on to the standard output device

C. received from the standard output device

D. nothing can be said

Answer: B

Download more at McqMate.com


79. Output justification such as decimal point, numerical sign, trailing
zeros or octal are specified.

A. specifier

B. flags

C. precision

D. decimal

Answer: B

o m
.c
80. What symbol is used to Left-justify within the data given field width?
te
A. -(minus sign) a
B. +(plus sign)
q M
c
C. #

D. 0
M
Answer: A

81. What specifies the minimum number of characters to print after being
padded with zeros or blank spaces?

A. flags

B. length

C. width

D. precision

Answer: C

82. The maximum number of characters to be printed is specified by


__________

A. precision

B. width

C. length

Download more at McqMate.com


D. flags

Answer: A

83. ________is used to define the type and the interpretation of the value
of the corresponding argument.

A. precision

B. specifiers

C. flags

o m
D. decimal
.c
Answer: B
te
a
q M
84. A conversion specification %7.4f means ____________
c
M
A. print a floating point value of maximum 7 digits where 4 digits are allotted for the digits after the
decimal point

B. print a floating point value of maximum 4 digits where 7digits are allotted for the digits after the
decimal point

C. print a floating point value of maximum 7 digits

D. print a floating point value of minimum 7 digits where 4 digits are allotted for the digits after the
decimal point

Answer: A

85. Choose the correct description for control string %-+7.2f.

A. – means display the sign, + means left justify, 7 specifies the width and 2 specifies the precision

B. – means left justify, + means display the sign, 7 specifies the width and 2 specifies the precision

C. – means display the sign, + means left justify, 7 specifies the precision and 2 specifies the width

D. – means left justify, + means display the sign, 7 specifies the precision and 2 specifies the width

Answer: B

Download more at McqMate.com


86. What error is generated on placing an address operator with a variable
in the printf statement?

A. compile error

B. run-time error

C. logical error

D. no error

Answer: B

o m
.c
87. If by mistake you specify more number of arguments, the excess
arguments will ____________
te
a
A. be ignored
q M
B. produce compile error c
C. produce run-time error M
D. produce logical error

Answer: A

88. What happens when zero flag is used with left justification?

A. data is padded with zeros

B. zero flag is ignored

C. data is padded with blank spaces

D. will give error

Answer: B

89. For floating point numbers, the precision flag specifies the number of
decimal places to be printed. When no precision modifier is specified,
printf() prints _______

A. six decimal positions

B. five decimal positions

Download more at McqMate.com


C. four decimal positions

D. three decimal positions

Answer: A

90. What will the given code result in printf(“\n you are\”awesome \" ");?

A. compile error

B. run-time error

C. you are "awesome"


o m
D. you are awesome
.c
te
Answer: C
a
q M
91. What will be the output for the given code printf(“\n The number is
%07d”,1212); c
A. The number is 0001212
M
B. The number is 1212

C. The number is 1212

D. The number is 1212000

Answer: A

92. 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: A

Download more at McqMate.com


93. 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: A

o m
.c
94. What action is carried out by scanf if a user enters any blank spaces,
tabs, and newlines?
te
a
A. consider as input
q M
B. ignores it c
C. produces error M
D. nothing can be said

Answer: B

95. 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: B

96. _____ is an optional argument that gives the maximum number of


characters to be read.

A. modifiers

B. width

Download more at McqMate.com


C. precision

D. length

Answer: B

97. 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

o m
C. run-time error
.c
te
D. read first five characters as a decimal and ignore the rest

Answer: A a
q M
98. Select the correct value ofci from given options i=scanf("%d %d", &a,
&b); M
A. 1

B. 2

C. 3

D. No value assigned

Answer: B

99. If the user enters 1 3.2 s, what value will be returned by the
scanf()?scanf("%d %f %c", &s1, &s2, &s3);

A. 1

B. 2

C. 3

D. No return value

Answer: C

100. If the user enters 1 s 3.2, what value will be returned by the

Download more at McqMate.com


scanf()?scanf("%d %f %c", &a, &b, &c);

A. 1

B. 2

C. 3

D. no return value

Answer: A

o m
.c
te
a
q M
c
M

Download more at McqMate.com


Take Quick Mock/Practice test on this topic HERE

For Discussion / Reporting / Correction of any MCQ please visit discussion page by clicking on
'answer' of respective MCQ.

McqMate is also available on

PlayStore

o m
.c
te
a
q M
c
M

Download more at McqMate.com

You might also like