Important Questions for C Programming
-
Basic Concepts
-
What are the main features of C programming language?
-
Explain the structure of a C program.
-
What are variables in C? List the rules for naming a variable.
-
What are data types in C? Explain with examples.
-
What are constants? How are they different from variables?
-
Control Structures
-
Differentiate between if-else and switch statements with examples.
-
Write a program to find the largest of three numbers using if-else.
-
Explain the syntax and usage of the for, while, and do-while loops.
-
Write a program to print the Fibonacci series up to n terms using a loop.
-
What are break and continue statements? Explain with examples.
-
Functions
-
What is the difference between a library function and a user-defined function?
-
Explain actual and formal arguments with an example.
-
Write a program to find the factorial of a number using recursion.
-
What is the purpose of the return statement in a function?
-
Explain the concept of call by value and call by reference.
-
Arrays and Strings
-
Explain how arrays are declared and initialized in C. Provide examples.
-
Write a program to find the largest element in an array.
-
What is the difference between one-dimensional and two-dimensional arrays?
-
Write a program to concatenate two strings without using library functions.
-
Explain any four string-handling functions with examples.
-
Pointers
-
What is a pointer in C? How is it declared?
-
Write a program to swap two numbers using pointers.
-
Explain the relationship between arrays and pointers.
-
What is NULL pointer? Explain its use.
-
What are dangling pointers? How can they be avoided?
-
Structures and File Handling
-
What is a structure in C? How is it different from an array?
-
Write a program to store and display information of 5 students using structures.
-
Explain different file-opening modes in C.
-
Write a program to read and write data into a file.
-
What is the difference between text files and binary files?
-
Advanced Topics
-
Explain dynamic memory allocation in C. Provide examples using malloc() and free().
-
What is the use of the sizeof operator? Provide examples.
-
Write a program to implement a simple calculator using functions.
-
What is a preprocessor directive? Explain #define and #include.
-
What are command-line arguments? Write a program to demonstrate their use.
-
Miscellaneous
-
Explain the use of the typedef keyword with examples.
-
Write a program to reverse a given string.
-
Explain the difference between stack and heap memory allocation.
-
What is an infinite loop? Provide an example.
-
Write a program to find whether a number is prime or not.