Basic C Programming MCQ Questions and Answers

Practice Mode
Showing 10 of 198 questions
Q91
Which of the following statements are correct ?
  • A It is possible for a function to access a variable that is local to another function
  • B Two local variables may have the same name
  • C The scope of a local variable should be a function
  • D The scope of a local variable may be a single statement.
Answer: Option
Q92
The default parameter passing mechanism is
  • A call by value
  • B call by reference
  • C call by value result
  • D none of the above
Answer: Option A
Q93
Choose the correct statements.
  • A During external variable definition, storage is set aside by the compiler
  • B During external variable declaration, no storage is set aside by the compiler
  • C The use of external variables may make debugging difficult
  • D None of the above
Answer: Option
Q94
The storage class static can be used to
  • A restrict the scope of an external identifier
  • B preserve the exit value of variables
  • C provide privacy to a set of functions
  • D none of the above
Answer: Option
Q95
The following program main() {printf ("tim"); main ();}
  • A is illegal
  • B keeps on printing tim
  • C prints tim once
  • D none of the above
Answer: Option B
Q96
Consider the following program main() { putchar ('M'); first (); putchar ('m');} first () { _______ } second() { putchar ('d');} If madam is the required output, then the body of first () must be
  • A empty
  • B second(); putchar ('a');
  • C putchar ('a'); second (); printf ("%c", 'a')'
  • D none of the above
Answer: Option C
Q97
Use of functions
  • A helps to avoid drepeating a set of statements many times
  • B enhances the logical clarity of the program
  • C helps to avoid repeated programming across programs
  • D makes the debugging task easier
Answer: Option
Q98
Which of the following comments about wide character is/are true ?
  • A It is the binary representation of a character in the extended binary set.
  • B It is of intege type wchar_t
  • C End of file is represented by WEOF.
  • D None of the above
Answer: Option
Q99
Pick the correct statements.
  • A The body of a function should have only one returnf statement.
  • B The body of a function may have many return statements.
  • C A function can return only one value to the calling environment
  • D If return statement is omitted, then the function does itsd job but returns no value to the calling environment.
Answer: Option
Q100
max is a function that returns the larger of the two integers, given as arguments. Which of the following statements finds the largest of three given numbers ?
  • A max (max (a, b), max (a, c))
  • B max (a, max (a, c))
  • C max (max (a, b ), max (b, c))
  • D max (b, max (a, c))
Answer: Option
Questions and Answers for Competitive Exams Various Entrance Test