PRACTICE • LEARN • GROW
Module 3: Input and Output - Final Quiz MCQs
Solve topic-wise placement questions and improve your skills.
Module 3: Input and Output - Final Quiz Progress
0 of 8 completed
0%
Topic Track
You are viewing MCQs in preview mode. Log in to select options, submit answers, and track your progress.
Log In to Answer
1
Which format specifier is used in printf to display a pointer memory address in standard hexadecimal format?
A.
%x
B.
%p
C.
%d
D.
%a
Explanation & Key
Correct Answer:
2
Why does adding a leading space in
scanf(" %c", &ch) solve common character input skipping issues?
A.
It converts the character to uppercase
B.
It instructs scanf to skip any leading whitespace characters (including newlines leftover in the buffer)
C.
It forces scanf to allocate 2 bytes of memory
D.
It causes scanf to flush stdout
Explanation & Key
Correct Answer:
3
Why is the return type of
getchar() an int instead of a char?
A.
Because C has no char data type
B.
So it can return the special EOF (End-Of-File) marker (-1), which cannot fit in an unsigned char
C.
Because getchar() reads 4 bytes at a time
D.
To automatically calculate ASCII hash values
Explanation & Key
Correct Answer:
4
What is the return value of scanf in the following execution when the user enters: 42 hello?
#include <stdio.h>
int main() {
int a, b;
// Input provided: 42 hello
int res = scanf("%d %d", &a, &b);
printf("%d", res);
return 0;
}
A.
2
B.
1
C.
0
D.
-1
Explanation & Key
Correct Answer:
5
Which standard I/O stream is completely unbuffered by default in C, allowing error diagnostics to appear immediately without waiting for a newline?
A.
stdin
B.
stdout
C.
stderr
D.
stdlog
Explanation & Key
Correct Answer:
6
What is printed by the following code formatting precision?
#include <stdio.h>
int main() {
float pi = 3.14159f;
printf("%.2f", pi);
return 0;
}
A.
3.14
B.
3.14159
C.
3.1
D.
3.142
Explanation & Key
Correct Answer:
7
What is the output of the following character manipulation code?
#include <stdio.h>
int main() {
putchar('A' + 3);
return 0;
}
A.
D
B.
68
C.
A3
D.
C
Explanation & Key
Correct Answer:
8
What does scanf("%s", str) store in str when the user types "Ready To Go"?
A.
"Ready To Go"
B.
"Ready"
C.
"Ready\n"
D.
"ToGo"
Explanation & Key
Correct Answer:
Question Palette
Answered
Current
Not Attempted
Wrong