Programming for Problem Solving
JNTU (R25)
Important Questions
UNIT - I: Overview of C, Data Types, Selection &
Repetition Structures
1. Explain the basic elements of C language
(keywords, identifiers, constants, variables, data types)
with examples.
2. Differentiate between compiler and interpreter.
Draw the general structure/form of a C program and
explain each part.
3. What is an algorithm? Write an algorithm and
draw a flowchart to find the sum of first n natural
numbers / check whether a number is prime / find
factorial.
4. Explain different types of operators in C
(arithmetic, relational, logical, bitwise,
increment/decrement) with examples.
5. Discuss if, if-else, nested if, switch statements
with examples. Write a C program to find the largest
among three numbers.
6. Explain while, for, do-while loops. Write a C
program to compute sum/product of numbers in a loop
or generate Fibonacci series up to n terms.
7. Explain nested loops with an example (e.g.,
printing patterns like pyramid or multiplication table).
UNIT - II: Functions, Pointers & Modular
Programming
1. Explain top-down design and structure charts.
How do you build programs using library functions?
2. Differentiate between call by value and call by
reference using pointers. Write examples.
3. Explain the indirection operator (*) and address
operator (&). Write a program to swap two numbers
using pointers (without temporary variable).
4. Write a C program to demonstrate functions
with/without arguments, with input/output parameters,
and multiple calls to a function.
5. Explain scope of variables (local, global) and
formal vs actual parameters.
UNIT - III: Arrays & Strings
1. Explain declaration, referencing, and subscripting
of arrays. Write a C program to find max/min/average
in an array of integers.
2. Write programs using arrays:
Search and sort an array (linear search).
Addition/multiplication of two matrices.
Reverse an array using pointers.
3. Explain multidimensional arrays (2D) with
examples.
4. Explain string basics and string library functions
(strcpy, strcat, strcmp, strlen, etc.). Write a program for
string concatenation, comparison, or substring
operations.
5. Explain arrays of pointers and whole-line input
(e.g., using gets or fgets).
UNIT - IV: Recursion, Structures & Unions
1. Explain the nature of recursion with tracing a
recursive function. Write recursive programs for:
Factorial of a number.
Fibonacci series.
Towers of Hanoi (or GCD).
2. Write recursive functions with array/string
parameters (e.g., recursive linear search or string
reversal).
3. Define user-defined structure types. Write a C
program using structures for student details (name, roll,
marks) – input/output with functions.
4. Explain union types and difference between
structure and union with examples.
5. Write a program demonstrating functions returning
structured result values.
UNIT - V: File Handling, Searching & Sorting
1. Explain text and binary files in C. Write a program
to:
Copy one file to another.
Read/write student data to a file.
2. Explain file pointers (fopen, fclose, fread, fwrite,
fprintf, fscanf). Difference between text and binary
mode.
3. Explain linear search and binary search
techniques. Write C programs for both on an array.
4. Explain basic sorting algorithms:
Bubble Sort
Insertion Sort
Selection Sort Write C programs for any two.
5. Searching a database using files.