Basic C Programming MCQ

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