C Programming Exam Questions

USICT/GGSIPU B.Tech Previous Year Papers (2023-2026)

Overview

Total Papers Analyzed

12

7 Mid-Term + 5 End-Term

Years Covered

2023-2026

Multiple Semesters

Subject Code

ES-101/ES-102

Programming in C

Total Questions

200+

With Solutions

Mid-Term Examination Papers

Paper 1: March 2025 (ES-102) - 30 Marks, 1.5 Hours

Instructions: Attempt Q.No.1 (compulsory) + any two more questions

Q1 (Compulsory) - 8 marks (2 marks each)

  • What is an algorithm? Write an algorithm to calculate factorial of a number.
  • Explain keywords & identifiers with example.
  • Predict the output of the following C code (integer division and float operations)
  • Why do we need a break and goto statement? Justify.
  • What is the difference between local variable and global variable in C.

Q2 (10 marks)

  • a) What is an operator? Explain different types of operators used in C programming. (5)
  • b) Write a program to determine whether a year is a leap year or not. (5)

Q3 (10 marks)

  • a) Define an array. Write a Program to print the Maximum and Minimum element in an array. (5)
  • b) Write two different C functions to compute area and perimeter of a triangle. (5)

Q4 (10 marks)

  • a) Write a C program to check whether a number is prime or not. (5)
  • b) What are storage classes? Explain with suitable example. (5)

Paper 2: April 2024 (ES-102) - 30 Marks, 1.5 Hours

Q1 (Compulsory) - 10 marks (2 marks each)

  • Describe the compilation process in C programming language.
  • What is variable? Discuss the visibility, scope, and initial value of a variable.
  • Find the output for the following C code (switch-case with continue)
  • Write difference between entry-controlled loop and exit controlled loop.
  • What is string? Write a program to find the length of a string?

Q2 (10 marks)

  • a) What is ternary operator? Design a flowchart and write a C program using ternary operator to check whether a given number is odd or even. (5)
  • b) What is an operator? Describe various operators used in C language? Find the output of the following C program code (octal output). (5)

Q3 (10 marks)

  • a) Explain the concept of call by value and call by reference with the help of example. (5)
  • b) What is array? Explain declaration and initialization of two-dimensional array? Write a C program to find matrix transpose. (5)

Q4 (10 marks)

  • a) What is recursion? Write a C program to find the factorial of number through recursion. (5)
  • b) What are datatypes? What are the basic datatypes in C? Explain format specifier and memory requirement of each datatype? (5)

Paper 3: March 2026 (ES-102) - 30 Marks, 1.5 Hours

Q1 (Compulsory) - 10 marks (2 marks each)

  • What are the basic data types supported in C programming language.
  • Describe the compilation process in C programming language.
  • Write the difference between entry-controlled loop and exit controlled loop.
  • Find the output of the following program (post/pre increment operations)
  • What are pre-processor directives? Discuss #define with example.

Q2 (10 marks)

  • a) Write a program in C to swap two numbers using third variable. (5)
  • b) Explain the difference between break, goto and Continue statement with example. (5)

Q3 (10 marks)

  • a) What is a function? Explain the four different categories of functions. (5)
  • b) Write a C program to read 5 number of values in an array and display it in reverse order. (5)

Q4 (10 marks)

  • a) Write a C program to check whether a number is prime or not. (5)
  • b) What are storage classes? Explain with suitable example. (5)

Paper 4: April 2026 (ES-02) - Midterm II - 30 Marks, 1.5 Hours

Q1 (Compulsory) - 8 marks (2 marks each)

  • What is Generic Pointer? Explain with suitable example.
  • Explain self-referential structure.
  • Explain command line arguments in C with the help of suitable example.
  • Sort the following numbers stepwise using insertion sort: 9 4 15 6 13 2 8

Q2 (5 marks)

  • a) Write any two library functions of the following header files: stdio.h, stdlib.h
  • b) What is the difference between Structure and Union? Explain with suitable example.
  • c) What is Dynamic Memory Allocation? Explain the difference between Malloc and Calloc.

Q3 (5 marks)

  • a) What is Binary Search? Search an item 12 from the following sorted data elements: 7 9 12 15 20 23 28
  • b) Explain Bubble Sort. Sort the following numbers using Selection Sort: 87 43 54 22 98 76 65

Q4 (5 marks)

  • a) Write a C program to create a file using write mode and display the contents using read mode.
  • b) Explain Stack. Sort the following numbers using...

Paper 5: May 2024 (ES-102) - Second Mid Term - 30 Marks

Q1 (Compulsory) - 10 marks (2 marks each)

  • Write a difference between malloc and calloc.
  • Write a short note on enumerable data type.
  • Find the output (structure vs union size)
  • Sort using selection sort: 5, 3, 10, 2, 1
  • Write some key features introduced in the C99 extension.

Q2 (5 marks)

  • a) Create a structure called "cricket" to store name of players, team name and batting average. Declare array of 5 players and write program to read information.
  • b) What is a pointer? Write a C program to multiply two number using pointers.

Q3 (5 marks)

  • a) What is File? What is the need for file handling? Discuss various file access mode.
  • b) What is header file? Explain one library function of: math.h, ctype.h, stdlib.h, time.h.

Q4 (5 marks)

  • a) Search item 35 using binary search: 10,17,23,35,44,54,65,70,88,92
  • b) Write a C program to implement Bubble sort.

Paper 6: April 2025 (ES-102) - 30 Marks

Q1 (Compulsory) - 10 marks (2 marks each)

  • Explain typedef in C with example.
  • What is the difference between #include <filename> and #include "filename"?
  • What is a generic pointer? What is the size of generic pointer for 32 bits and 64 bits?
  • Explain the command line arguments in C with the help of example.
  • Discuss file modes in C programming.

Q2 (5 marks)

  • a) What is the need of file handling? Write a program to count the no of words and characters in a file.
  • b) Define a structure. WAP in C to create an array of structures and print the details.

Q3 (5 marks)

  • a) Explain the concept of Dynamic memory allocation with an example.
  • b) Explain any one searching algorithm with example.

Q4 (5 marks)

  • a) What is a header file. Explain two library functions of: stdlib.h, string.h, ctype.h
  • b) Write a program to sort n number of elements in descending order using selection sort.

Paper 7: June 2024 (ES-102) - 60 Marks, 3 Hours

Q1 (Compulsory) - 20 marks (4 marks each)

  • Difference between while and do-while loop?
  • Define different types of sorting?
  • Define pre-processor and its use in programming?
  • Explain the basic structure and compilation process of C program?
  • Difference between structure and union?

UNIT-I

Q2 (10 marks)

  • a) What is a token? Explain different types of tokens with examples. (5)
  • b) Difference between flowchart and algorithm? Write algorithm and flowchart to find factorial. (5)

Q3 (10 marks)

  • a) Define Operator? Explain different types: arithmetic, logical, bitwise, ternary. (6)
  • b) Find the output (string operations with strcpy, strcat, strev, strlen). (4)

UNIT-II

Q4 (10 marks)

  • a) Define Recursion? Write C program to find Fibonacci series using recursion. (5)
  • b) Define an array? Advantages of array? Write C program to transpose of a matrix. (5)

Q5 (10 marks)

  • a) Explain call by value and call by reference with example. (5)
  • b) Define string? Declaration and initialization? Explain any five string functions. (5)

UNIT-III

Q6 (10 marks)

  • a) Explain File Handling? Need for file handling? Discuss file access modes: r, a, w, r+, a+, w+. (5)
  • b) Need of structure? Access members? Write program to read and print details of a person. (5)

Q7 (10 marks)

  • a) Define Pointer with example? Access variable through pointer? Write C program to add two variables. (5)
  • b) Define File Handling and explain its operations. (5)

End-Term Examination Papers

Paper 1: June 2025 (ES-102) - 60 Marks, 3 Hours

Instructions: Attempt five questions including Q.No.1 (compulsory). Internal Choice is indicated.

Q1 (20 marks)

  • What is an Algorithm?
  • Write a C statement to find maximum of two numbers using ternary operator.
  • Give any 2 differences between Structures & Union.
  • List any 5 Date and time functions.
  • What are preprocessor directives?

Q2 (10 marks)

  • Bit wise operator
  • Increment – Decrement operator
  • Operator Precedence

Q3 (10 marks)

  • a) Write algorithm and draw flowchart to find even numbers between 1 to 50. (5)
  • b) Variable and Constant, Data Types, Basic structure and execution of C Program. (5)

Q4 (10 marks)

  • a) What is an Array? Types of Array. Memory diagram. (5)
  • b) Write Program to print Fibonacci Series up to n numbers. (5)

Q5 (10 marks)

  • a) What is Function? Library and user defined functions. (5)
  • b) Call by Value and Call by reference? Write C program to show working of Recursion. (5)

Q6 (10 marks)

  • a) Write Short note on Pointers. Write C program to Swap two values using Pointer. (5)
  • b) What is Array of Structure? Write C Program to calculate Gross Salary (Minimum 5 Employees). (5)

Q7 (10 marks)

  • a) Write Program which accepts Pointer as function arguments. (5)
  • b) Define file and explain types of files, with examples. Explain different modes. (5)

Q8 (10 marks)

  • stdio.h
  • math.h
  • string.h

Q9 (10 marks)

  • a) Write algorithm for binary search. (5)
  • b) Write algorithm to find square root of inputted number. (5)

Paper 2: July 2023 (ES-102) - 75 Marks, 3 Hours

Q1 (Compulsory) - 15 marks (3 marks each)

  • What is Token? Types of token available in C.
  • Significance of library functions.
  • Actual parameters and formal parameters? Illustrate with example.
  • Describe header file and its usage.
  • Differentiate between put(), putchar() and puts().

UNIT-I

Q2 (15 marks)

  • a) Algorithm to find angle between hour and minutes hand of a clock. (7)
  • b) Bit wise AND, OR, NOT operation. Role of shift operators. (8)

Q3 (15 marks)

  • a) Type conversion? Two types with examples. (7)
  • b) Define pseudocode. Write pseudocode to find area of triangle. (8)

UNIT-II

Q4 (15 marks)

  • a) Quadratic equation roots program. (8)
  • b) What is array? Declaration and initialization of 1D and 2D arrays. (7)

Q5 (15 marks)

  • a) Return multiple values from a function. Explain with example. (8)
  • b) Eliminate multiple spaces from a sentence. (7)

Paper 3: December 2024 (ES-101) - 60 Marks, 3 Hours

Q1 (Compulsory) - 20 marks

  • What is a token? Types of tokens? Explain.
  • Evaluate expressions (logical and relational operators)
  • Formatted input and output statement with examples.
  • Show how break and continue statements are used.
  • What is an array? Single dimension and two dimension arrays.
  • Local, global, static, auto, register variables.
  • Static vs dynamic memory allocation. malloc() vs calloc().

Q2 (10 marks)

  • a) Electricity bill calculation program with surcharge. (5)
  • b) Sort N integers in ascending order. (5)

Q3 (10 marks)

  • a) String manipulation library functions. Check palindrome. (5)
  • b) Binary search algorithm and program. (5)

Q4 (10 marks)

  • a) Function classification based on parameter passing and return type. (5)
  • b) Fibonacci series using functions. (5)

Paper 4: January 2024 (ES-101) - 60 Marks, 3 Hours

Q1 (Compulsory) - 12 marks (2 marks each)

  • What is recursion? Differentiate direct and indirect recursion.
  • Return value of f(p,p) with p=5 (reference vs value parameter)
  • Discuss structure of C program with examples.
  • Output with call by reference (program P1)
  • Write C program to print Fibonacci series.
  • Explain file handling. Sequential vs random-access files.

UNIT-I

Q2 (12 marks)

  • a) What is an operator? Types: arithmetic, relational, logical, bitwise, assignment, comma. (6)
  • b) Storage classes: auto, extern, static, register. (6)

Q3 (12 marks)

  • a) What is a token? Keywords, identifiers, constants, special characters. (3)
  • b) Variable: scope, visibility, lifetime. (3)
  • c) Difference between call by value and reference? Write C program. (6)

Paper 5: March 2023 (ES-101) - 75 Marks, 3 Hours

Q1 (Compulsory)

  • Code output prediction questions with operators

Q2

  • a) Algorithm and flowchart to find factorial. (6)
  • b) Storage classes with examples. (6)

Q3

  • a) Operators: arithmetic, relational, logical, bitwise, assignment, comma. (6)
  • b) Call by value vs reference with program. (6)

Q4

  • a) Function with argument vs without argument. Function definition, prototype, call. (6)
  • b) Control structures: sequence, selection, loop, jump statements. (6)

Q5

  • a) Multi-dimensional arrays vs 2D arrays. Initialize and print 2D array. (6)

Topics Covered

1. Basic Concepts

  • History and features of C
  • Structure of C program
  • Compilation process
  • Tokens: keywords, identifiers, constants
  • Variables: scope, visibility, lifetime
  • Data types and format specifiers
  • Type conversion

2. Operators

  • Arithmetic operators
  • Relational operators
  • Logical operators
  • Bitwise operators
  • Assignment operators
  • Increment/Decrement operators
  • Ternary operator
  • Operator precedence

3. Control Structures

  • if-else, nested if-else
  • switch-case
  • for, while, do-while loops
  • Entry vs exit-controlled loops
  • break, continue, goto, return

4. Arrays

  • 1D and 2D arrays
  • Declaration and initialization
  • Array operations
  • Matrix operations (transpose)
  • Array of structures

5. Strings

  • String declaration and initialization
  • String handling functions
  • strlen, strcpy, strcat, strcmp
  • Palindrome check
  • String manipulation

6. Functions

  • Function definition and declaration
  • Function prototype and call
  • Parameter passing
  • Recursion (direct/indirect)
  • Storage classes

7. Pointers

  • Pointer declaration
  • Pointer arithmetic
  • Pointer to array/structure
  • Dynamic memory allocation
  • malloc, calloc, realloc, free

8. Structures & Unions

  • Structure definition
  • Nested structures
  • Self-referential structures
  • Array of structures
  • Structure vs Union
  • typedef and enumerations

9. File Handling

  • File operations
  • File modes (r, w, a, r+, w+, a+)
  • Text vs binary files
  • Sequential vs random access
  • fseek, ftell, rewind

10. Preprocessor

  • #include, #define
  • #ifdef, #ifndef, #endif
  • Header files
  • Macros
  • C99 features

11. Searching & Sorting

  • Linear search
  • Binary search
  • Bubble sort
  • Selection sort
  • Insertion sort
  • Time complexity

12. Advanced Topics

  • Command line arguments
  • Variable argument lists
  • Bit manipulation
  • Complex numbers

Frequently Asked Programs

Basic Programs

  • Hello World
  • Addition of two numbers
  • Swap two numbers (with/without third variable, using pointers)
  • Area and perimeter calculations
  • Simple and compound interest

Control Structure Programs

  • Leap year check
  • Even/odd check
  • Largest of three numbers
  • Calculator using switch
  • Print patterns (pyramids, triangles)

Loop Programs

  • Factorial
  • Fibonacci series
  • Prime numbers in range
  • Sum of digits
  • Reverse of number
  • Armstrong number
  • Palindrome number

Array Programs

  • Linear search
  • Binary search
  • Bubble sort
  • Selection sort
  • Insertion sort
  • Matrix transpose
  • Matrix multiplication
  • Sum of diagonal elements

String Programs

  • String length without strlen
  • String copy without strcpy
  • String concatenation
  • String comparison
  • Palindrome string
  • Reverse string

Function Programs

  • Factorial using recursion
  • Fibonacci using recursion
  • GCD using recursion
  • Tower of Hanoi
  • Call by value vs reference demonstration

Pointer Programs

  • Swap using pointers
  • Array access using pointers
  • String manipulation using pointers
  • Dynamic memory allocation examples

Structure Programs

  • Student record management
  • Employee salary calculation
  • Complex number operations
  • Date manipulation

File Programs

  • Copy file content
  • Count words, characters, lines
  • Student record in file
  • Merge two files