Question 8Asked in UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)

while (87) printf ("computer"); The above C statement will

while (87) printf ("computer"); The above C statement will
  1. Aprint "computer" 87 times
  2. Bprint "computer" 0 times
  3. Cprint "computer" 1 times
  4. Dprint "computer" infinite times
Show answerHide answer

Correct answer: (D) print "computer" infinite times

Explanation

Parameter of a while statement in a languages takes two values true in the form of non-zero and false in the form of zero. Here 87 is a non-zero value and hence the while block gets true for infinite times.

From UGC NET Computer Science PYQ, June 2014 (Paper II & III, Selected Questions)

This is question 8 of UGC NET Computer Science PYQ, June 2014 (Paper II & III, Selected Questions). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.