Monday, 25 August 2025

C Programming MCQs & Practice Paper – 2026

 

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)

  1. 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;

  2. Output of:

int x = 5; printf("%d", x++);

a) 5 ✅
b) 6
c) 0
d) Compiler Error

  1. Function used for dynamic memory allocation:
    a) malloc() ✅
    b) alloc()
    c) memalloc()
    d) callocall()

  2. Operator with highest precedence:
    a) * ✅
    b) +
    c) =
    d) &&

  3. Size of float in most compilers:
    a) 2 bytes
    b) 4 bytes ✅
    c) 8 bytes
    d) 1 byte

  4. Keyword to stop a loop:
    a) exit
    b) stop
    c) break ✅
    d) continue

  5. Default cases in switch statement:
    a) 0 or 1 ✅
    b) Multiple
    c) Always 1
    d) None

  6. Invalid storage class in C:
    a) auto
    b) register
    c) dynamic ✅
    d) extern

  7. Output of:

char str[] = "C Programming"; printf("%c", str[2]);

a) C
b) P
c) (space) ✅
d) o

  1. 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)

  1. Difference between ++i and i++ → Pre-increment vs post-increment.

  2. Pointer → Stores address of a variable; used for dynamic memory, arrays, and functions.

  3. malloc() vs calloc() → malloc: uninitialized memory, calloc: initialized to zero.

  4. For loop syntax → for(initialization; condition; increment){}

  5. Break vs Continue → Break exits loop, Continue skips current iteration.

  6. Advantages of functions → Modularity, reusability, easy debugging.

  7. Struct → Collection of different data types. Example: struct student {int id; char name[20];};

  8. #include <file> vs #include "file" → <> searches system directories, "" searches current directory first.

  9. Recursion → Function calling itself. Example: factorial calculation.

  10. sizeof → Returns memory size of variable or data type.


Section C – Programming / Coding Practice (Hints)

  1. Largest of three numbers → Use if-else ladder.

  2. Factorial using recursion → Function calling itself until n=1.

  3. Reverse a string → Loop from end to start, print characters.

  4. Check prime → Loop from 2 to n/2, check divisibility.

  5. Sum of array elements → Loop through array and add values.

  6. Linear search → Loop array to find element.

  7. Swap numbers using pointers → Use temporary variable and * operator.


Section D – Advanced / Application-Based Practice (Hints)

  1. Calculator using switch → Use switch-case for +, -, *, /.

  2. Count vowels & consonants → Loop through string, use if-else.

  3. Matrix multiplication → Nested loops multiplying rows & columns.

  4. Stack implementation using array → Push: add element; Pop: remove last element.

  5. Sum of digits using recursion → Return last digit + recursive call on remaining digits.

  6. 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: