Basic C Programming MCQ Questions and Answers

Practice Mode
Showing 10 of 198 questions
Q51
In a for loop, if the condition is missing, then infinite looping can be avoided by a
  • A continue statement
  • B goto statement
  • C return statement
  • D break statement
Answer: Option
Q52
Choose the correct statement.
  • A 0 represents a false condition
  • B Non-zero value represents a false condition
  • C 1 represents a false condition
  • D Anything that is not 1, represents a false condition
Answer: Option A
Q53
Which of the following comments about for loop are correct ?
  • A Index value is retained outside the loop
  • B Index value can be changed ffrom within the loop
  • C goto can be used to jump, out of loop
  • D Body of the loop can be empty.
Answer: Option
Q54
Which of the following comments about for loop are correct ?
  • A Using break is equivalent to using a goto that jumps to the statement immediately following the loop.
  • B Continue is used to by-pass the remainder of the current pass of the loop.
  • C If comma operator is used, then the value returned is the value of the right operand.
  • D It can always be replaced by a while loop.
Answer: Option
Q55
Choose the correct answers.
  • A for loops can be nested
  • B Nested for loop can't use the same index variable
  • C Nested for loop can't overlap
  • D None of the above
Answer: Option
Q56
Consider the following program fragment if (a > b) if (b > c) s1; else s2; s2 will be executed if
  • A a <=b
  • B b > c
  • C b <=c and a <=b
  • D a >b and b<=c
Answer: Option D
Q57
If switch feature is used, then
  • A default case must be present
  • B default case, if used, should be the last case
  • C default case, if used, can be placed anywhere
  • D none of the above
Answer: Option C
Q58
The switch feature
  • A can always be replaced by a nested if-then-else clause
  • B enhances logical clarity
  • C can't always be replaced by a nested if-then-else clause
  • D none of the above
Answer: Option
Q59
Break statement can be simulated by using
  • A goto
  • B return
  • C exit
  • D any of the above features
Answer: Option A
Q60
The following program fragment if (2 < 1) ; else x = (2 < 0) ? printf ("one") : printf ("four"); printf ("%d), x);
  • A prints nothing
  • B results in a syntax error
  • C prints four0
  • D none of the above
Answer: Option D
Questions and Answers for Competitive Exams Various Entrance Test