Digital-Logic-Design
October 13, 2023UGC NET CS 2007 June-Paper-2
October 13, 2023UGC NET CS 2007 June-Paper-2
Question 11 |
The following loop in ‘C’ :
int i=0;
while (i++ < 0)
i– ;
int i=0;
while (i++ < 0)
i– ;
will terminate | |
will go into an infinite loop | |
will give compilation error | |
will never be executed |
Question 11 Explanation:
#include
void main()
{
int i=0;
while(i++ < 0)
{
i–;
printf(“%d”,i);
}
}
/* It will terminate null value */
void main()
{
int i=0;
while(i++ < 0)
{
i–;
printf(“%d”,i);
}
}
/* It will terminate null value */
Correct Answer: A
Question 11 Explanation:
#include
void main()
{
int i=0;
while(i++ < 0)
{
i–;
printf(“%d”,i);
}
}
/* It will terminate null value */
void main()
{
int i=0;
while(i++ < 0)
{
i–;
printf(“%d”,i);
}
}
/* It will terminate null value */
The question is about the loop not the whole program
Answer:
The loop will never be executed