Practice high-yield Programming & Software Development MCQs on C Fundamentals — 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
String handling functions such as strcmp(), strcpy() etc can be used with enumerated types.
Correct Answer: Option B — False
Detailed Academic Explanation:
Enumerated types (enums) in C are used to give names to integer constants. For example: enum days {MON, TUE, WED, THU, FRI, SAT, SUN}; This creates an enum named days where MON is assigned 0, TUE is 1, and so on. String handling functions like strcmp() and strcpy() work with strings , which are arrays of characters ( char ). They don't directly work with enum types. You cannot directly use strcmp() to compare two enum values because strcmp() expects character arrays, not integer values that enums represent. Similarly, you cannot copy an enum value using strcpy() . Therefore, the statement "String handling functions such as strcmp(), strcpy() etc can be used with enumerated types" is False .
💡Key Conceptual Anchor:C Fundamentals
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the 'NULL' keyword represent in C?
Correct Answer: Option C — A pointer to nothing
Detailed Academic Explanation:
A pointer to nothing is the correct answer to “What does the 'NULL' keyword represent in C”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which library function is used to allocate memory dynamically in C?
Correct Answer: Option A — malloc
Detailed Academic Explanation:
malloc is the correct answer to “Which library function is used to allocate memory dynamically in C”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the 'scanf' function in C?
Correct Answer: Option B — Read formatted input
Detailed Academic Explanation:
Read formatted input is the correct answer to “What is the purpose of the 'scanf' function in C”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the 'goto' statement in C?
Correct Answer: Option C — Transfer control
Detailed Academic Explanation:
Transfer control is the correct answer to “What is the purpose of the 'goto' statement in C”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which header file is used for mathematical functions in C?
Correct Answer: Option C — <math.h>
Detailed Academic Explanation:
<math.h> is the correct answer to “Which header file is used for mathematical functions in C”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the significance of the 'volatile' keyword in C?
Correct Answer: Option B — Indicate a volatile variable
Detailed Academic Explanation:
Indicate a volatile variable is the correct answer to “What is the significance of the 'volatile' keyword in C”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Who is father of C Language?
Correct Answer: Option C — Dennis Ritchie
Detailed Academic Explanation:
Dennis Ritchie is the correct answer to “Who is father of C Language”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
C Language developed at _________?
Correct Answer: Option A — AT & T's Bell Laboratories of USA in 1972
Detailed Academic Explanation:
AT & T's Bell Laboratories of USA in 1972 is the correct answer to “C Language developed at _________”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
C was primarily developed as
Correct Answer: Option A — System programming language
Detailed Academic Explanation:
System programming language is the correct answer to “C was primarily developed as”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Standard ANSI C recognizes ______ number of keywords?
Correct Answer: Option B — 32
Detailed Academic Explanation:
32 is the correct answer to “Standard ANSI C recognizes ______ number of keywords”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the correct value to return to the operating system upon the successful completion of a program?
Correct Answer: Option C — 0
Detailed Academic Explanation:
0 is the correct answer to “What is the correct value to return to the operating system upon the successful completion of a program”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which is the only function all C programs must contain?
Correct Answer: Option C — main()
Detailed Academic Explanation:
main() is the correct answer to “Which is the only function all C programs must contain”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the difference between a declaration and a definition of a variable?
Correct Answer: Option D — A declaration occurs once, but a definition may occur many times.
Detailed Academic Explanation:
A declaration occurs once, but a definition may occur many times. is the correct answer to “What is the difference between a declaration and a definition of a variable”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
"My salary was increased by 15%" Select the statement, which will EXACTLY reproduce the line of text above.
Correct Answer: Option D — printf("My salary was increased by 15%%!")
Detailed Academic Explanation:
printf("My salary was increased by 15%%!") is the correct answer to “"My salary was increased by 15%" Select the statement, which will EXACTLY reproduce the line of text above.”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Will the following C code compile without any error? #include <stdio.h> int main() { for (int k = 0; k < 10; k++); return 0; }
Correct Answer: Option C — Depends on the C standard implemented by compilers
Detailed Academic Explanation:
Depends on the C standard implemented by compilers is the correct answer to “Will the following C code compile without any error? #include <stdio.h> int main() { for (int k = 0; k < 10; k++); return 0; }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Variable name resolution (number of significant characters for the uniqueness of variable) depends on . . . . . . . .
Correct Answer: Option A — Compiler and linker implementations
Detailed Academic Explanation:
Compiler and linker implementations is the correct answer to “Variable name resolution (number of significant characters for the uniqueness of variable) depends on . . . . . . . .”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { unsigned int a = 10; a = ~a; printf("%d\n", a); }
Correct Answer: Option C — -11
Detailed Academic Explanation:
-11 is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { unsigned int a = 10; a = ~a; printf("%d\n", a); }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int a = 1, b = 2; a += b -= a; printf("%d %d", a, b); }
Correct Answer: Option C — 2 1
Detailed Academic Explanation:
2 1 is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int a = 1, b = 2; a += b -= a; printf("%d %d", a, b); }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> void main() { int x = 1, y = 0, z = 5; int a = x && y || z++; printf("%d", z); }
Correct Answer: Option A — 6
Detailed Academic Explanation:
6 is the correct answer to “What will be the output of the following C code? #include <stdio.h> void main() { int x = 1, y = 0, z = 5; int a = x && y || z++; printf("%d", z); }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int a = 1, b = 1, d = 1; printf("%d, %d, %d", ++a + ++a+a++, a++ + ++b, ++d + d++ + a++); }
Correct Answer: Option D — Undefined (Compiler Dependent)
Detailed Academic Explanation:
Undefined (Compiler Dependent) is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int a = 1, b = 1, d = 1; printf("%d, %d, %d", ++a + ++a+a++, a++ + ++b, ++d + d++ + a++); }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int i = 2; int j = ++i + i; printf("%d\n", j); }
Correct Answer: Option A — 6
Detailed Academic Explanation:
6 is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int i = 2; int j = ++i + i; printf("%d\n", j); }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the final value of j in the following C code? #include <stdio.h> int main() { int i = 10, j = 0; if (i || (j = i + 10)) //do something ; }
Correct Answer: Option A — 0
Detailed Academic Explanation:
0 is the correct answer to “What will be the final value of j in the following C code? #include <stdio.h> int main() { int i = 10, j = 0; if (i || (j = i + 10)) //do something ; }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C function? #include <stdio.h> enum birds {SPARROW, PEACOCK, PARROT}; enum animals {TIGER = 8, LION, RABBIT, ZEBRA}; int main() { enum birds m = TIGER; int k; k = m; printf("%d\n", k); return 0; }
Correct Answer: Option D — 8
Detailed Academic Explanation:
8 is the correct answer to “What will be the output of the following C function? #include <stdio.h> enum birds {SPARROW, PEACOCK, PARROT}; enum animals {TIGER = 8, LION, RABBIT, ZEBRA}; int main() { enum birds m = TIGER; int k; k = m; printf("%d\n", k); return 0; }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the size of an int data type?
Correct Answer: Option C — Depends on the system/compiler
Detailed Academic Explanation:
Depends on the system/compiler is the correct answer to “What is the size of an int data type”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> void main() { int k = 8; int m = 7; int z = k < m ? k++ : m++; printf("%d", z); }
Correct Answer: Option A — 7
Detailed Academic Explanation:
7 is the correct answer to “What will be the output of the following C code? #include <stdio.h> void main() { int k = 8; int m = 7; int z = k < m ? k++ : m++; printf("%d", z); }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Pick the incorrect statement with respect to enums.
Correct Answer: Option A — Two enum symbols cannot have the same value
Detailed Academic Explanation:
Two enum symbols cannot have the same value is the correct answer to “Pick the incorrect statement with respect to enums.”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int x = 2, y = 0; int z; z = (y++, y); printf("%d\n", z); return 0; }
Correct Answer: Option B — 1
Detailed Academic Explanation:
1 is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int x = 2, y = 0; int z; z = (y++, y); printf("%d\n", z); return 0; }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int x = 1, y = 0; x &&= y; printf("%d\n", x); }
Correct Answer: Option A — Compile time error
Detailed Academic Explanation:
Compile time error is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int x = 1, y = 0; x &&= y; printf("%d\n", x); }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> void main() { int a = 5 * 3 % 6 - 8 + 3; printf("%d", a); }
Correct Answer: Option C — -2
Detailed Academic Explanation:
-2 is the correct answer to “What will be the output of the following C code? #include <stdio.h> void main() { int a = 5 * 3 % 6 - 8 + 3; printf("%d", a); }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> void main() { float x = 0.1; if (x == 0.1) printf("India"); else printf("Advanced C Classes"); }
Correct Answer: Option A — Advanced C Classes
Detailed Academic Explanation:
Advanced C Classes is the correct answer to “What will be the output of the following C code? #include <stdio.h> void main() { float x = 0.1; if (x == 0.1) printf("India"); else printf("Advanced C Classes"); }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the final value of j in the following C code? #include <stdio.h> int main() { int i = 0, j = 0; if (i && (j = i + 10)) //do something ; }
Correct Answer: Option A — 0
Detailed Academic Explanation:
0 is the correct answer to “What will be the final value of j in the following C code? #include <stdio.h> int main() { int i = 0, j = 0; if (i && (j = i + 10)) //do something ; }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Will the following C code compile without any error? #include <stdio.h> int main() { int k; { int k; for (k = 0; k < 10; k++); } }
Correct Answer: Option A — Yes
Detailed Academic Explanation:
Yes is the correct answer to “Will the following C code compile without any error? #include <stdio.h> int main() { int k; { int k; for (k = 0; k < 10; k++); } }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int a = 4, n, i, result = 0; scanf("%d", &n); for (i = 0;i < n; i++) result += a; }
Correct Answer: Option C — Multiplication of a and n
Detailed Academic Explanation:
Multiplication of a and n is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int a = 4, n, i, result = 0; scanf("%d", &n); for (i = 0;i < n; i++) result += a; }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include<stdio.h> enum hello { a,b=99,c,d=-1 }; main() { enum hello m; printf("%d\n%d\n%d\n%d\n",a,b,c,d); }
Correct Answer: Option C — 0 99 100 -1
Detailed Academic Explanation:
0 99 100 -1 is the correct answer to “What will be the output of the following C code? #include<stdio.h> enum hello { a,b=99,c,d=-1 }; main() { enum hello m; printf("%d\n%d\n%d\n%d\n",a,b,c,d); }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { j = 10; printf("%d\n", j++); return 0; }
Correct Answer: Option C — Compile time error
Detailed Academic Explanation:
Compile time error is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { j = 10; printf("%d\n", j++); return 0; }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> #define MAX 2 enum bird {SPARROW = MAX + 1, PARROT = SPARROW + MAX}; int main() { enum bird b = PARROT; printf("%d\n", b); return 0; }
Correct Answer: Option B — 5
Detailed Academic Explanation:
5 is the correct answer to “What will be the output of the following C code? #include <stdio.h> #define MAX 2 enum bird {SPARROW = MAX + 1, PARROT = SPARROW + MAX}; int main() { enum bird b = PARROT; printf("%d\n", b); return 0; }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include<stdio.h> enum shyam { a=2,b=3.56 }; enum shyam s; main() { printf("%d%d",a,b); }
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> enum shyam { a=2,b=3.56 }; enum shyam s; main() { printf("%d%d",a,b); }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int a[5] = {1, 2, 3, 4, 5}; int i; for (i = 0; i < 5; i++) if ((char)a[i] == '5') printf("%d\n", a[i]); else printf("FAIL\n"); }
Correct Answer: Option D — The program will compile and print FAIL for 5 times
Detailed Academic Explanation:
The program will compile and print FAIL for 5 times is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int a[5] = {1, 2, 3, 4, 5}; int i; for (i = 0; i < 5; i++) if ((char)a[i] == '5') printf("%d\n", a[i]); else printf("FAIL\n"); }”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
One of the major difference between typedef and #define is that typedef interpretation is performed by the . . . . . . . . whereas #define interpretation is performed by the . . . . . . . .
Correct Answer: Option C — compiler, pre-processor
Detailed Academic Explanation:
compiler, pre-processor is the correct answer to “One of the major difference between typedef and #define is that typedef interpretation is performed by the . . . . . . . . whereas #define interpretation is performed by the . . . . . . . .”. This question is standard in competitive examination syllabi for C Fundamentals.
💡Key Conceptual Anchor:C Fundamentals
✓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.