Output-based

Question 1
Consider the following C program: #include <stdio.h> int main() {<br int a = 6; int b = 0; while(a < 10) { a = a / 12 + 1; a += b; } printf("%d", a); return 0; } Which one of the following statements is CORRECT?
A
The program prints 9 as output
B
The program prints 10 as output
C
The program gets stuck in an infinite loop
D
The program prints 6 as output
Question 2
Consider the following C program: Assume that the input to the program from the command line is 1234 followed by a newline character. Which one of the following statements is CORRECT?
A
The program will not terminate
B
The program will terminate with no output
C
The program will terminate with 4321 as output
D
The program will terminate with 1234 as output
Question 3
While(87) printf(“computer”); The above C statement will
A
print “computer” 87 times
B
print “computer” 0 times
C
print “computer” 1 times
D
print “computer” infinite times
Question 3 Explanation: 
When we are giving any positive number in while loop. It considered into TRUE value.
So, printf(“computer”); will execute infinite number of times.
while(1) or while(87) are same. It consider like TRUE only.
There are 3 questions to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access