PRACTICE • LEARN • GROW
Module 2: Data Types, Variables & Operators - Final Quiz MCQs
Solve topic-wise placement questions and improve your skills.
Module 2: Data Types, Variables & Operators - Final Quiz Progress
0 of 10 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
How many reserved keywords exist in standard ANSI/C89 C?
A.
24
B.
32
C.
48
D.
64
Explanation & Key
Correct Answer:
2
Which of the following identifier names is INVALID according to C lexical syntax rules?
A.
_totalScore
B.
count123
C.
2ndValue
D.
user_name
Explanation & Key
Correct Answer:
3
What is the output of the following C program comparing floating-point literals?
#include <stdio.h>
int main() {
float x = 0.1f;
if (x == 0.1) {
printf("MATCH");
} else {
printf("MISMATCH");
}
return 0;
}
A.
MATCH
B.
MISMATCH
C.
Compile error
D.
Undefined behavior
Explanation & Key
Correct Answer:
4
What is the output of the following code snippet?
#include <stdio.h>
int main() {
int a = 5, b = 2;
int c = a++ * ++b;
printf("%d %d %d", a, b, c);
return 0;
}
A.
6 3 15
B.
5 3 15
C.
6 3 18
D.
5 2 10
Explanation & Key
Correct Answer:
5
What is the output of the following code testing logical short-circuit evaluation?
#include <stdio.h>
int main() {
int x = 0, y = 10;
if (x && ++y) {
printf("Passed ");
}
printf("%d %d", x, y);
return 0;
}
A.
0 11
B.
0 10
C.
Passed 0 11
D.
Passed 0 10
Explanation & Key
Correct Answer:
6
What is the output of the following C code testing the sizeof operator?
#include <stdio.h>
int main() {
int a = 10;
printf("%zu ", sizeof(a++));
printf("%d", a);
return 0;
}
A.
4 11
B.
4 10
C.
8 11
D.
1 10
Explanation & Key
Correct Answer:
7
What is the output of this code with an assignment inside the condition?
#include <stdio.h>
int main() {
int x = 0;
if (x = 5) {
printf("True:%d", x);
} else {
printf("False");
}
return 0;
}
A.
True:5
B.
False
C.
True:0
D.
Compile error
Explanation & Key
Correct Answer:
8
Which C storage class specifier causes a local variable inside a function to retain its value across successive calls?
A.
auto
B.
register
C.
static
D.
extern
Explanation & Key
Correct Answer:
9
What is the output of the following bitwise shift operations?
#include <stdio.h>
int main() {
int a = 16 >> 2;
int b = 4 << 2;
printf("%d %d", a, b);
return 0;
}
A.
4 16
B.
8 8
C.
32 2
D.
64 1
Explanation & Key
Correct Answer:
10
What happens when an unsigned char exceeds its maximum 8-bit capacity (255)?
#include <stdio.h>
int main() {
unsigned char ch = 255;
ch = ch + 1;
printf("%u", ch);
return 0;
}
A.
256
B.
0
C.
-1
D.
Undefined behavior
Explanation & Key
Correct Answer:
Question Palette
Answered
Current
Not Attempted
Wrong