OOPS
May 6, 2024Question 6133 – Computer-Networks
May 6, 2024Question 4619 – UGC NET CS 2006 June-Paper-2
What is the output of the following program segment ?
main ( )
{
int count, digit=0;
count=1;
while(digit <=9)
{
printf(”%d /n”” , ++count);
++digit;
}
}
Correct Answer: D
Question 11 Explanation:
The digit starts with 0 and will run 9 more times. It means, the loop will run 10 runs. The count variable we are given pre increment. So, it increments before assigning values.
It prints the result is
2 /n 3 /n 4 /n 5 /n 6 /n 7 /n 8 /n 9 /n 10 /n 11
It prints the result is
2 /n 3 /n 4 /n 5 /n 6 /n 7 /n 8 /n 9 /n 10 /n 11
10
9
12
11
Subscribe
Login
0 Comments