C Programming MCQs & Practice Paper – 2026
Prepare for your upcoming C Programming exams with this expected question paper. Includes multiple-choice questions, short answer questions, and programming exercises with answer hints.
Section A – Multiple Choice Questions (1 mark each, 10 marks)
-
Which of the following is the correct syntax to declare a pointer in C?
a) int ptr; ✅
b) int ptr;
c) int ptr;
d) ptr int; -
Output of:
a) 5 ✅
b) 6
c) 0
d) Compiler Error
-
Function used for dynamic memory allocation:
a) malloc() ✅
b) alloc()
c) memalloc()
d) callocall() -
Operator with highest precedence:
a) * ✅
b) +
c) =
d) && -
Size of float in most compilers:
a) 2 bytes
b) 4 bytes ✅
c) 8 bytes
d) 1 byte -
Keyword to stop a loop:
a) exit
b) stop
c) break ✅
d) continue -
Default cases in switch statement:
a) 0 or 1 ✅
b) Multiple
c) Always 1
d) None -
Invalid storage class in C:
a) auto
b) register
c) dynamic ✅
d) extern -
Output of:
a) C
b) P
c) (space) ✅
d) o
-
Correct way to pass an array to a function:
a) void func(int arr[])
b) void func(int *arr)
c) Both a & b ✅
d) void func(int arr)
Section B – Short Answer Questions (Hints)
-
Difference between ++i and i++ → Pre-increment vs post-increment.
-
Pointer → Stores address of a variable; used for dynamic memory, arrays, and functions.
-
malloc() vs calloc() → malloc: uninitialized memory, calloc: initialized to zero.
-
For loop syntax →
for(initialization; condition; increment){}
-
Break vs Continue → Break exits loop, Continue skips current iteration.
-
Advantages of functions → Modularity, reusability, easy debugging.
-
Struct → Collection of different data types. Example:
struct student {int id; char name[20];};
-
#include <file> vs #include "file" → <> searches system directories, "" searches current directory first.
-
Recursion → Function calling itself. Example: factorial calculation.
-
sizeof → Returns memory size of variable or data type.
Section C – Programming / Coding Practice (Hints)
-
Largest of three numbers → Use if-else ladder.
-
Factorial using recursion → Function calling itself until n=1.
-
Reverse a string → Loop from end to start, print characters.
-
Check prime → Loop from 2 to n/2, check divisibility.
-
Sum of array elements → Loop through array and add values.
-
Linear search → Loop array to find element.
-
Swap numbers using pointers → Use temporary variable and * operator.
Section D – Advanced / Application-Based Practice (Hints)
-
Calculator using switch → Use switch-case for +, -, *, /.
-
Count vowels & consonants → Loop through string, use if-else.
-
Matrix multiplication → Nested loops multiplying rows & columns.
-
Stack implementation using array → Push: add element; Pop: remove last element.
-
Sum of digits using recursion → Return last digit + recursive call on remaining digits.
-
Merge two sorted arrays → Compare elements and store in new array.
Instructions:
-
Practice all sections carefully.
-
Write well-commented code for programming exercises.
-
Understand MCQs and short answer hints for quick revision.
For more programming practice and engineering project ideas, visit:
IT Educations – Engineering Projects
No comments:
Post a Comment