C Programming Viva Questions and Answers
1. What is C language?
C is a general-purpose, structured programming language developed by Dennis Ritchie. It is widely used for
developing system and application software.
2. What are the basic data types in C?
The basic data types in C are int, float, char, and double.
3. What is the difference between = and ==?
= is the assignment operator, and == is the equality comparison operator.
4. What is a pointer?
A pointer is a variable that stores the address of another variable.
5. What is the use of printf() and scanf()?
printf() is used to display output, and scanf() is used to take input from the user.
6. What is a loop?
A loop is used to repeat a block of code. Examples are for, while, and do-while loops.
7. What is an array?
An array is a collection of similar data types stored in contiguous memory locations.
8. What is the difference between while and do-while loop?
In while loop, the condition is checked before the loop runs. In do-while, the loop runs at least once before
checking the condition.
9. What is recursion?
Recursion is a technique where a function calls itself.
10. What is the difference between call by value and call by reference?
Call by value passes a copy of the variable; call by reference passes the address, allowing changes to
original value.
11. What are header files?
Header files contain predefined functions and macros. Example: stdio.h, conio.h.
12. What is the purpose of main() function?
It is the entry point of any C program. Execution starts from main().
13. What is the use of getch()?
getch() is used to hold the output screen until a key is pressed (mainly in Turbo C).
14. What is a structure?
A structure is a user-defined data type that allows grouping variables of different types.
15. What is the difference between structure and array?
An array stores similar data types, while a structure can store different data types.