C Programming Question Bank
C Programming Question Bank
3-Marks Questions
6-Marks Questions
10-Marks Questions
3-Marks
1. Explain the difference between arithmetic and relational operators with examples.
2. Write a program to demonstrate the use of logical operators (&&, ||, !).
3. Describe the role of assignment operators. Provide examples using compound
assignment operators (e.g., +=, -=).
4. Explain how increment (++) and decrement (--) operators work with a suitable
code snippet.
5. What are conditional operators? Write a program using the ternary (? :) operator.
6. Define bitwise operators. Explain any two bitwise operators with examples.
7. What is operator precedence? Explain with an example showing how precedence
affects the evaluation of an expression.
8. Differentiate between implicit and explicit type conversion in expressions with
examples.
9. Write a short program to demonstrate the use of special operators like sizeof and
the comma operator.
10. Explain associativity of operators with an example involving arithmetic and
logical operators.
11. What is the difference between formatted and unformatted input/output in C?
12. Write a program to read and display a single character using getchar() and
putchar().
13. How does scanf() differ from gets() for input operations? Explain with
examples.
14. Write a program to demonstrate formatted output using printf() to print a
floating-point number with two decimal places.
15. Explain the role of escape sequences in output formatting. Provide examples of
\n and \t.
6-Marks
1. Write a program to perform all arithmetic operations (+, -, *, /, %) and explain the
output with sample input values.
2. Explain relational operators with examples. Write a program to compare two
numbers and display the largest.
3. Demonstrate the use of logical operators (&&, ||, !) in a program that checks
whether a number lies in a specified range.
4. Write a program to show the difference between pre-increment and post-increment
operators with appropriate examples.
5. Explain the use of the conditional (ternary) operator with an example. Write a
program to find the greatest of three numbers using it.
6. Illustrate the use of bitwise operators (&, |, ^, ~) in manipulating binary values
with an example.
7. Explain the sizeof operator and write a program to display the size of different
data types in bytes.
8. Write a program to evaluate an expression involving mixed arithmetic, relational,
and logical operators. Highlight the importance of operator precedence and
associativity.
9. Explain the differences between implicit type conversion and explicit typecasting.
Provide examples of both.
10. Design a program that uses a comma operator in a loop and explain how it works
with sample input.
11.Write a program to read three integers using scanf() and print their sum, average,
and product using printf() with proper formatting.
12. Compare getchar() and scanf() for character input. Write a program to read and
display characters using both methods.
13. Explain the role of format specifiers in scanf() and printf() with examples of
%d, %f, %c, and %s.
14. Write a program to read a sentence using gets() and display it using puts().
Highlight the differences between gets() and scanf().
15. Explain how escape sequences like \n, \t, and \\ affect output. Write a program
that demonstrates their usage in formatted output.
10-Marks
1. Explain with examples the different types of arithmetic operators in C. How are
they used in expressions?
2. What are relational and logical operators? Compare them with examples and
explain their roles in decision-making statements.
3. Describe increment and decrement operators in C. How are pre-increment and
post-increment different? Provide examples.
4. Explain conditional (ternary) operators with syntax and examples. How can they
be used as an alternative to if-else statements?
5. Write a program to demonstrate the use of bitwise operators (&, |, ^, ~, <<, >>)
and explain the output for different inputs.
6. What are special operators in C? Discuss with examples the use of sizeof, comma
operator, and pointer-related operators.
7. Explain type conversion in expressions in C. Differentiate between implicit and
explicit type conversion with examples.
8. What is operator precedence and associativity? Discuss how they affect the
evaluation of expressions with suitable examples.
9. What are formatted input and output statements in C? Explain the use of scanf()
and printf() functions with examples.
10. Write a program that reads a character from the user, performs an operation based
on its ASCII value, and displays the result using formatted output. Explain the
code.
Module 3
3 mark Questions
6 mark Questions
10 mark Questions
1. Explain the working of the if-else ladder and switch statement. Write programs to
demonstrate both, comparing their use cases and limitations.
2. Write a program to find the grade of a student based on their marks using a nested
if-else statement. Include conditions for fail, pass, and distinctions.
3. Design a menu-driven program using a switch statement to perform arithmetic
operations (addition, subtraction, multiplication, division). Handle invalid options
as well.
4. What are the advantages and disadvantages of using the goto statement? Write a
program to demonstrate its usage. Explain why structured programming often
avoids goto.
5. Write a program to calculate the factorial of a number entered by the user using
the for loop. Then, modify the program to use a while loop. Compare the two
approaches.
6. Explain the difference between while, do-while, and for loops. Write a program
that prints the Fibonacci series up to a given number using a while loop.
7. Write a program to generate a multiplication table from 1 to 10 for a number
entered by the user. Use nested for loops.
8. Write a program to reverse the digits of a given number using a while loop.
Discuss how loop termination conditions work in this example.
9. Write a program to input elements into a 3x3 matrix, calculate the sum of its rows
and columns, and display the results.
10. Write a program to perform matrix multiplication for two 2D arrays. Ensure the
program checks for valid matrix dimensions before proceeding.
Module 4
3 Marks Questions
Functions
11. What are built-in functions in C? Provide two examples and their uses.
12. Why are user-defined functions necessary? List two advantages of using them.
13. What is a function prototype in C? Why is it important?
14. Explain the general format of a C function with an example.
15. What are return values in functions? How do you define the return type? Provide
an example.
16. What is the difference between calling a function by value and by reference?
Explain briefly.
17. Describe the process of passing arrays to a function in C. Provide an example.
18. What is recursion? Give an example of a recursive function.
19. Explain the concept of nested functions with an example.
20. What are storage classes in C? Briefly explain any two with examples.
6 Marks Questions
10 Marks Questions
Module 5
3 Marks Questions
6 Marks Questions
10 Marks Questions