NTA UGC NET Dec 2023 Paper-2
November 27, 2024
Computer-Networks
November 27, 2024
NTA UGC NET Dec 2023 Paper-2
November 27, 2024
Computer-Networks
November 27, 2024

KVS 30-12-2018 Part B

Question 12
What is the following program segment doing?
main()
{
int d=1;
do
{
printf(“%d”\n”,d++);
}while(d<=9);
}
A
Adding 9 integers
B
Adding integers from 1 to 9
C
Displaying integers from 1 to 9
D
No output
Question 12 Explanation: 
The code consists of do-while loop in which action performs first and later condition checking.
In the printf() statement, d++ means first it will display d value and increment the d value later condition checking.So the integer values 1 to 9 will be printed.
Correct Answer: C
Question 12 Explanation: 
The code consists of do-while loop in which action performs first and later condition checking.
In the printf() statement, d++ means first it will display d value and increment the d value later condition checking.So the integer values 1 to 9 will be printed.

Leave a Reply

Your email address will not be published. Required fields are marked *