back to course
Lesson 38 / 3997%· free preview
Exam Prep1/2
C Exam Questions
Master common C exam questions with essential theory, programs, and pro-level tips for top marks.
Overview
This lesson covers C exam questions frequently asked in theory, practical, and viva sections. Use it to target study for high scores.
1. Basic Theory Questions
- What is C programming? Explain its key features.
- Who developed C language?
- Structure of a C program (describe components).
- Tokens in C: types include keywords, identifiers, constants, operators, special symbols.
- Compiler vs Interpreter
- Variables and Constants: definitions and usages.
- Data types: int, float, char, double
- Keywords: definition with examples (int, if, else, while)
- Local vs Global variables
- Operators: types with examples (+, -, *, /, %, ==, etc.)
- Header File: what it is and examples (#include <stdio.h>)
2. Control Statements (Very Important)
- if, if-else, and switch: differences.
- Loop syntax and examples for for, while, and do-while loops.
- break vs continue: distinction.
- Nested loops: structure and examples.
- Writing programs using switch-case
3. Functions (High Weightage)
- What is a function?
- Types: library vs user-defined.
- Call by Value vs Call by Reference
- Recursion: meaning and example.
- Function Prototype: purpose and syntax.
Common Function Programs:
- Program to find factorial using function.
- Program to check if a number is prime using function.
4. Arrays (Very Important)
- What is an array? Types described (1D, 2D).
- 1D vs 2D array: usage and syntax.
- Array Initialization: methods.
- Passing array to a function
Common Array Programs:
- Find the largest element.
- Reverse an array.
- Matrix addition.
- Matrix multiplication.
5. Strings
- String in C: definition.
- Char array vs String: comparison.
- String Functions: strlen(), strcpy(), strcmp().
Common String Programs:
- Reverse a string.
- Check if a string is a palindrome.
- Count vowels and consonants.
6. Pointers (Most Important Topic)
- Pointer: definition, declaration, and initialization.
- Pointer arithmetic
- Pointer to pointer: usage.
- Pointer vs Array: differences.
Common Pointer Programs:
- Swap two numbers using pointers.
- Access an array using a pointer.
7. Structures & Unions
- Structure: definition, example.
- Structure vs Union: memory and usage differences.
- Nested Structures: example of a structure within a structure.
- Array of Structures: definition and usage.
Common Structures Program:
- Store and display student details using structure.
8. File Handling
- File handling in C: purpose.
- File modes: 'r', 'w', 'a'.
- Functions: fopen(), fclose(), fprintf(), fscanf().
Common File Handling Programs:
- Write data to a file.
- Read data from a file.
9. Preprocessor & Header Files
- Header files: definition and common files.
- #include directive: purpose.
- Macros: what they are and how to define.
- #define vs variables: differences.
10. Important Programs (Must Practice)
- Hello World
- Even or Odd number
- Prime number
- Factorial of a number
- Fibonacci series
- Reverse a number
- Palindrome number
- Armstrong number
- Swap two numbers (with & without third variable)
- Sum of digits
11. Output-Based Questions
Examiner may give a code and ask you to predict output. Practice examples:
c#include <stdio.h> int main() { int a = 5; printf("%d %d %d", a, a++, ++a); return 0; }
Output
text5 5 7
Focus areas:
- Increment operators (++ and --)
- Operator precedence
- Loop outputs
12. Viva / Interview Questions
- Why is C called a middle-level language?
- Difference between = and ==
- What is a NULL pointer?
- What is segmentation fault?
- Why use return 0 in main()?
13. Most Repeated Questions (Exam Focus)
Focus on these topics for scoring well:
- Pointers (theory and programs)
- Arrays & Strings
- Functions & Recursion
- Loops (for, while)
- Basic programs (prime, factorial, Fibonacci)
Pro Tips for Exams
- Practice writing code, not just reading.
- Understand the logic, do not memorize.
- Solve previous year papers.
- Write proper syntax, as marks are deducted for mistakes.
Key Takeaways
- Most exams cover core concepts: variables, loops, arrays, functions, pointers, and file handling.
- Practice both theory and practical coding for comprehensive preparation.
- Output-based prediction questions are common in exams.
- Proficiency in functions, pointers, and arrays provides a clear edge.
- Syntax precision is essential—minor mistakes can cost marks.
Interview Questions
Practice Questions
- Write a program to check if a number is prime using a user-defined function.
- Implement matrix multiplication using 2D arrays in C.
- Swap two variables using pointers.
- Write a code to count vowels and consonants in a string.
- Predict the output of a code that uses both a++ and ++a in a printf statement.
Pro Tips
- Always declare variables before using them.
- Regularly comment your code for better readability.
- Pay attention to operator precedence in expressions.
- Memorize syntax for loops, if-else, and function declarations.
- Practice output-based and error-finding questions under timed conditions.
- Revise library functions and commonly used headers before exams.
AI-powered recap
Quick recap quiz?
We'll generate 5 MCQs from this lesson and check your understanding instantly. Takes ~30 seconds.
# program
Program
C
#include <stdio.h>
// Program: Swap two numbers using pointers
void swap(int *x, int *y) {
int temp = *x;
*x = *y;
*y = temp;
}
int main(void) {
int a, b;
printf("Enter two numbers: ");
scanf("%d %d", &a, &b);
printf("Before swap: a = %d, b = %d\n", a, b);
swap(&a, &b);
printf("After swap: a = %d, b = %d\n", a, b);
return 0;
}Ready to move on?
// example library
Practice C Exam Questions with runnable code
Browse 360 runnable examples · across 36 chapters · short, copy-paste-friendly · grouped by topic
// suggested companion course
Data Structures with C
Comfortable with C? Level up — arrays · linked lists · stacks · queues · trees · graphs · sorting algorithms.
// deep-dive
Go deeper — hand-picked articles
Long-form guides, shortcuts, and mental models that won't fit in a single lesson.
// feedback.matters()
Did this lesson help you?
