Practice high-yield Programming & Software Development MCQs on C Preprocessor — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/40 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 40 questions answered.
Question 1 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Choose the correct statement. I. The scope of a macro definition need not be the entire program. II. The scope of a macro definition extends from the point of definition to the end of the file. III. New line is a macro definition delimiter. IV. A macro definition may go beyond a line.
Correct Answer: Option E — I, II, III and IV
Detailed Academic Explanation:
I, II, III and IV is the correct answer to “Choose the correct statement. I. The scope of a macro definition need not be the entire program. II. The scope of a macro definition extends from the point of definition to the end of the file. III. New line is a macro definition delimiter. IV. A macro definition may go beyond a line.”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In which stage the following code #include<stdio.h> gets replaced by the contents of the file stdio.h
Correct Answer: Option A — During Preprocessing
Detailed Academic Explanation:
During Preprocessing is the correct answer to “In which stage the following code #include<stdio.h> gets replaced by the contents of the file stdio.h”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be output after executing following code? #include<stdio.h> # define a 10 void main() { printf("%d..", a); foo(); printf("%d", a); } void foo() { #undef a #define a 50 }
Correct Answer: Option B — 10..10
Detailed Academic Explanation:
10..10 is the correct answer to “What will be output after executing following code? #include<stdio.h> # define a 10 void main() { printf("%d..", a); foo(); printf("%d", a); } void foo() { #undef a #define a 50 }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include<stdio.h> #define max 20 main() { #ifndef max #define min 10 #else #define min 30 #endif printf("%d",min); }
Correct Answer: Option C — 30
Detailed Academic Explanation:
30 is the correct answer to “What will be the output of the following C code? #include<stdio.h> #define max 20 main() { #ifndef max #define min 10 #else #define min 30 #endif printf("%d",min); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #define display(text) "$" #text main() { printf(display(hello world)); }
Correct Answer: Option C — $hello world
Detailed Academic Explanation:
$hello world is the correct answer to “What will be the output of the following C code? #define display(text) "$" #text main() { printf(display(hello world)); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> #define Shyam(x) #x int main() { int marks=100; printf("value of %s is = %d\n",Shyam(marks),marks); return 0; }
Correct Answer: Option B — value of marks=100
Detailed Academic Explanation:
value of marks=100 is the correct answer to “What will be the output of the following C code? #include <stdio.h> #define Shyam(x) #x int main() { int marks=100; printf("value of %s is = %d\n",Shyam(marks),marks); return 0; }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include<stdio.h> #define max 100 void main() { #if(max%10) printf("Exam"); #endif printf("Veda"); }
Correct Answer: Option C — Veda
Detailed Academic Explanation:
Veda is the correct answer to “What will be the output of the following C code? #include<stdio.h> #define max 100 void main() { #if(max%10) printf("Exam"); #endif printf("Veda"); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
. . . . . . . . is the preprocessor directive which is used to end the scope of #ifdef.
Correct Answer: Option C — #endif
Detailed Academic Explanation:
#endif is the correct answer to “. . . . . . . . is the preprocessor directive which is used to end the scope of #ifdef.”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In the directive #pragma pack(n), if the value of 'n' is given to be 5, then what happens?
Correct Answer: Option D — Ignores the pragma statement and executes the program
Detailed Academic Explanation:
Ignores the pragma statement and executes the program is the correct answer to “In the directive #pragma pack(n), if the value of 'n' is given to be 5, then what happens”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include<stdio.h> #define INDIA 1 #define US 2 #define CC US main() { #if CC==INDIA printf("Rupee"); #elif CC==US printf("Dollar"); #else printf("Euro"); #endif }
Correct Answer: Option C — Dollar
Detailed Academic Explanation:
Dollar is the correct answer to “What will be the output of the following C code? #include<stdio.h> #define INDIA 1 #define US 2 #define CC US main() { #if CC==INDIA printf("Rupee"); #elif CC==US printf("Dollar"); #else printf("Euro"); #endif }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code, if it is run on a 32 bit platform? #include<stdio.h> #pragma(1) struct test { int i; char j; }; main() { printf("%d",sizeof(struct test)); }
Correct Answer: Option D — 8
Detailed Academic Explanation:
8 is the correct answer to “What will be the output of the following C code, if it is run on a 32 bit platform? #include<stdio.h> #pragma(1) struct test { int i; char j; }; main() { printf("%d",sizeof(struct test)); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> #define p( m ) printf( "t*" #m " = %s", t##m ) char tram[]="tram"; int main() { int x; x=p(ram); }
Correct Answer: Option D — t*ram=tram
Detailed Academic Explanation:
t*ram=tram is the correct answer to “What will be the output of the following C code? #include <stdio.h> #define p( m ) printf( "t*" #m " = %s", t##m ) char tram[]="tram"; int main() { int x; x=p(ram); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include<stdio.h> #define sf 10 main() { if(sf==100) printf("good"); else { printf("bad"); sf=100; } printf("%d",sf); }
Correct Answer: Option D — error
Detailed Academic Explanation:
error is the correct answer to “What will be the output of the following C code? #include<stdio.h> #define sf 10 main() { if(sf==100) printf("good"); else { printf("bad"); sf=100; } printf("%d",sf); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include<stdio.h> void main() { #ifndef max printf("hello"); #endif printf("hi"); }
Correct Answer: Option B — hellohi
Detailed Academic Explanation:
hellohi is the correct answer to “What will be the output of the following C code? #include<stdio.h> void main() { #ifndef max printf("hello"); #endif printf("hi"); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The following C code results in an error. #include <stdio.h> #define world( n ) printf( "t^^" #n" = %c", t##n ) int t3=1; int main() { world(3); }
Correct Answer: Option B — False
Detailed Academic Explanation:
False is the correct answer to “The following C code results in an error. #include <stdio.h> #define world( n ) printf( "t^^" #n" = %c", t##n ) int t3=1; int main() { world(3); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #define F abc #define B def #define FB(arg) #arg #define FB1(arg) FB(arg) main() { printf(FB(F B)); FB1(F B); }
Correct Answer: Option A — F B
Detailed Academic Explanation:
F B is the correct answer to “What will be the output of the following C code? #define F abc #define B def #define FB(arg) #arg #define FB1(arg) FB(arg) main() { printf(FB(F B)); FB1(F B); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> #define p( n,m ) printf( "%d", m##n ) int main() { p(3,4); }
Correct Answer: Option D — 43
Detailed Academic Explanation:
43 is the correct answer to “What will be the output of the following C code? #include <stdio.h> #define p( n,m ) printf( "%d", m##n ) int main() { p(3,4); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #define example(s,n) #s #n main() { printf(example(hello,world)); }
Correct Answer: Option D — helloworld
Detailed Academic Explanation:
helloworld is the correct answer to “What will be the output of the following C code? #define example(s,n) #s #n main() { printf(example(hello,world)); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> #define hello( n ) a##n int a3; int main() { int x; x=hello(3); if(x!=0) printf("hi"); else printf("good"); }
Correct Answer: Option C — good
Detailed Academic Explanation:
good is the correct answer to “What will be the output of the following C code? #include <stdio.h> #define hello( n ) a##n int a3; int main() { int x; x=hello(3); if(x!=0) printf("hi"); else printf("good"); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include<stdio.h> #define hello main() { #ifdef hello #define hi 4 #else #define hi 5 #endif printf("%d",hi); }
Correct Answer: Option A — 4
Detailed Academic Explanation:
4 is the correct answer to “What will be the output of the following C code? #include<stdio.h> #define hello main() { #ifdef hello #define hi 4 #else #define hi 5 #endif printf("%d",hi); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #define display(text) printf(#text "@") main() { display(hello.); display(good morning!); }
Correct Answer: Option D — hello.@good morning!@
Detailed Academic Explanation:
hello.@good morning!@ is the correct answer to “What will be the output of the following C code? #define display(text) printf(#text "@") main() { display(hello.); display(good morning!); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> #define p( n ) printf( "t%%\n" #n " = %d", t##n ) int t3=10; int main() { int x; x=p(3); }
Correct Answer: Option A — t% 3=10
Detailed Academic Explanation:
t% 3=10 is the correct answer to “What will be the output of the following C code? #include <stdio.h> #define p( n ) printf( "t%%\n" #n " = %d", t##n ) int t3=10; int main() { int x; x=p(3); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> #define p( n,m ) printf( "%d", m##n ) #define q(a,b) printf("%d",a##b) main() { p(3,4); q(5,6); }
Correct Answer: Option A — 4356
Detailed Academic Explanation:
4356 is the correct answer to “What will be the output of the following C code? #include <stdio.h> #define p( n,m ) printf( "%d", m##n ) #define q(a,b) printf("%d",a##b) main() { p(3,4); q(5,6); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include<stdio.h> #define hello 10 void main() { printf("%d",hello); #undef hello printf("%d",hello); }
Correct Answer: Option C — error
Detailed Academic Explanation:
error is the correct answer to “What will be the output of the following C code? #include<stdio.h> #define hello 10 void main() { printf("%d",hello); #undef hello printf("%d",hello); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> #define display( n ) printf( "a" #n " = %d", a##n ) int main() { display(3); }
Correct Answer: Option D — error
Detailed Academic Explanation:
error is the correct answer to “What will be the output of the following C code? #include <stdio.h> #define display( n ) printf( "a" #n " = %d", a##n ) int main() { display(3); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The preprocessor directive used to give additional information to the compiler, beyond which is conveyed in the language . . . . . . . .
Correct Answer: Option C — #pragma
Detailed Academic Explanation:
#pragma is the correct answer to “The preprocessor directive used to give additional information to the compiler, beyond which is conveyed in the language . . . . . . . .”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following operators is used to concatenate two strings without space?
Correct Answer: Option D — ##
Detailed Academic Explanation:
## is the correct answer to “Which of the following operators is used to concatenate two strings without space”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
#pragma GCC poison should be followed by a list of identifiers that are . . . . . . . .
Correct Answer: Option D — invalid
Detailed Academic Explanation:
invalid is the correct answer to “#pragma GCC poison should be followed by a list of identifiers that are . . . . . . . .”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In the directive, #pragma pack(n), which of the following is not a valid value of n?
Correct Answer: Option C — 3
Detailed Academic Explanation:
3 is the correct answer to “In the directive, #pragma pack(n), which of the following is not a valid value of n”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> #define a 2 main() { int r; #define a 5 r=a*2; printf("%d",r); }
Correct Answer: Option A — 10
Detailed Academic Explanation:
10 is the correct answer to “What will be the output of the following C code? #include <stdio.h> #define a 2 main() { int r; #define a 5 r=a*2; printf("%d",r); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include<stdio.h> #define max 100 main() { #ifdef max printf("hello"); }
Correct Answer: Option D — error
Detailed Academic Explanation:
error is the correct answer to “What will be the output of the following C code? #include<stdio.h> #define max 100 main() { #ifdef max printf("hello"); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include<stdio.h> #define hello 10 main() { #ifdef hello #undef hello #define hello 100 #else #define hello 200 #endif printf("%d",hello); }
Correct Answer: Option C — 100
Detailed Academic Explanation:
100 is the correct answer to “What will be the output of the following C code? #include<stdio.h> #define hello 10 main() { #ifdef hello #undef hello #define hello 100 #else #define hello 200 #endif printf("%d",hello); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is not a preprocessor directive?
Correct Answer: Option D — #ifelse
Detailed Academic Explanation:
#ifelse is the correct answer to “Which of the following is not a preprocessor directive”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The preprocessor directive which is used to remove the definition of an identifier which was previously defined with #define?
Correct Answer: Option B — #undef
Detailed Academic Explanation:
#undef is the correct answer to “The preprocessor directive which is used to remove the definition of an identifier which was previously defined with #define”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The function of __attribute__((packed)); can also be performed using . . . . . . . .
Correct Answer: Option A — #pragma pack(1)
Detailed Academic Explanation:
#pragma pack(1) is the correct answer to “The function of __attribute__((packed)); can also be performed using . . . . . . . .”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The preprocessor directive which checks whether a constant expression results in a zero or non-zero value . . . . . . . .
Correct Answer: Option A — #if
Detailed Academic Explanation:
#if is the correct answer to “The preprocessor directive which checks whether a constant expression results in a zero or non-zero value . . . . . . . .”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include<stdio.h> void f() { #define sf 100 printf("%d",sf); } int main() { #define sf 99; f(); printf("%d",sf); }
Correct Answer: Option A — error
Detailed Academic Explanation:
error is the correct answer to “What will be the output of the following C code? #include<stdio.h> void f() { #define sf 100 printf("%d",sf); } int main() { #define sf 99; f(); printf("%d",sf); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #define HELLO(a) #a main() { printf(HELLO(good morning)); }
Correct Answer: Option C — error
Detailed Academic Explanation:
error is the correct answer to “What will be the output of the following C code? #define HELLO(a) #a main() { printf(HELLO(good morning)); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The purpose of the preprocessor directive #error is that . . . . . . . .
Correct Answer: Option C — It causes the preprocessor to report a fatal error
Detailed Academic Explanation:
It causes the preprocessor to report a fatal error is the correct answer to “The purpose of the preprocessor directive #error is that . . . . . . . .”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include<stdio.h> #define ram 10 main() { #ifdef ram #define ram 20 #endif printf("%d",ram); }
Correct Answer: Option B — 20
Detailed Academic Explanation:
20 is the correct answer to “What will be the output of the following C code? #include<stdio.h> #define ram 10 main() { #ifdef ram #define ram 20 #endif printf("%d",ram); }”. This question is standard in competitive examination syllabi for C Preprocessor.
💡Key Conceptual Anchor:C Preprocessor
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.