What is the purpose of the main() function in a C program?
A) It is where the program starts execution.
Which header file is required to use the printf() and scanf() functions in C?
B) stdio.h
What is the difference between ++i and i++ in C?
A) ++i increments the value before using it, while i++ increments the value after using it.
What is a pointer in C?
A) A variable that stores the address of another variable.
What is the use of the return statement in a function?
A) To exit from the function and optionally return a value to the calling function.
What is the purpose of the volatile keyword in C, and when should it be used?
B) It is used to prevent the compiler from optimizing the variable, ensuring that the value is always read from memory.
What is the difference between malloc() and calloc() in C?
A) malloc() allocates memory without initializing it, while calloc() allocates and initializes the memory to zero.
What is the purpose of the extern keyword in C?
A) It is used to declare a global variable or function that is defined in another file.
How does the sizeof() operator work with arrays and pointers?
A) For an array, it returns the total number of bytes of the array; for a pointer, it returns the size of the pointer type.
What is a union in C, and how does it differ from a structure?
A) A union allows storing different data types in the same memory location, while a structure allocates separate memory for each member.