C Programming - MCQ Practice Questions
Practice free C Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.
978 questions | 100% Free
What is the output of: int add(int a, int b) { int result = a + b; return result; } If called as add(5, 3)?
What will be the output? int func(int *p) { return *p; } int main() { int x = 10; printf("%d", func(&x)); }
In the context of recursion, which of the following is essential to avoid infinite recursion?
Which storage class specifier allows a function to be called only within the file where it is defined?
What is the return type of a function that performs an action but doesn't return any value?
In C, what happens when a function is called before its declaration?
Which of the following is an example of call by value in C?
What is the main difference between function declaration and function definition?
What is the primary purpose of function prototypes in C?
Which of the following is a valid function declaration in C?
What happens when a function is called without a return statement reaching the end?
What will be the output of the following code? int add(int a, int b) { return a + b; } int main() { printf("%d", add(5, add(3, 2))); return 0; }
What is the output of this recursive function? int fact(int n) { if(n<=1) return 1; return n*fact(n-1); } main() { printf("%d", fact(4)); }
In C, what is the purpose of the return statement in a void function?
Which of the following is a correct function prototype in C?
What is the scope of a static function in C?
Which keyword is used to pass arguments by reference in C?
What is the difference between declaring a function and defining a function?
Consider the function declaration: void func(int x); and later in the code: int result = func(5);. What will be the compilation result?
What is the correct way to declare a 1D array of 10 integers in C?