C Functions MCQ


Q1. Choose correct statement about Functions in C Language.
  1. A Function is a group of c statements which can be reused any number of times
  2. Every Function has a return type
  3. Every Function may no may not return a value
  4. All the above

Answer:- (D).
Explanations :None
Q2. Choose a correct statement about C Function?
  void main() {
  printf("Hello");
}
  
  1. "main" is the name of default must and should Function
  2. main() is same as int main()
  3. By default, return 0 is added as the last statement of a function without specific return type
  4. All the above

Answer:- (D).
Explanations :None
Q3. A function which calls itself is called a ___ function.
  1. Self Function
  2. Auto Function
  3. Recursive Function
  4. Static Function

Answer:- (C).
Explanations :None
Q4. The keyword used to transfer control from a function back to the calling function is
int **a;;
  1. switch
  2. goto
  3. go back
  4. return

Answer:- (D).
Explanations :None
Q5. How many times the program will print "Algbly"?
int main() {
  printf("Algbly");
  main();
  return 0;
} 
  1. Infinite times
  2. 32767 times
  3. 65535 times
  4. Till stack overflows

Answer:- (D).
Explanations :A call stack or function stack is used for several related purposes, but the main reason for having one is to keep track of the point to which each active subroutine should return control when it finishes executing.
A stack overflow occurs when too much memory is used on the call stack. Here function main() is called repeatedly and its return address is stored in the stack. After stack memory is full. It shows stack overflow error.
Q6. Determine Output :
void show() {
  printf("PISTA ";
  show();
}

void main() {
  printf("CACHEW ");
  return 10;
} 
  1. PISTA CACHEW
  2. CASHEW PISTA
  3. PISTA CASHEW with compiler warning
  4. Compiler error

Answer:- (C).
Explanations :Here show() function should not return anything. So, return 10; is not recommended.
Q7. What are the types of functions in C Language?
  1. Library Functions
  2. User Defined Functions
  3. Both Library and User Defined
  4. None of the above

Answer:- (C).
Explanations :No explanation is given for this question.
Q8. Choose correct statements about C Language Pass By Value.
  1. Pass By Value copies the variable value in one more memory location
  2. Pass By Value protects your source or original variables from changes in outside functions or called functions
  3. All the above

Answer:- (D).
Explanations :No explanation is given for this question.
Q99. What is the limit for number of functions in a C Program?
  1. 16
  2. 31
  3. 32
  4. No Limit

Answer:- (D).
Explanations :None
Q10. Every C Program should contain which functionEvery C Program should contain which function?
  1. printf()
  2. show()
  3. scanf()
  4. main()

Answer:- (D).
Explanations :main() is a compulsory function with or without returning anything.