C Practice Test on Control Statements

This “C Practice Test on Control Statements” providing set of technical and objective type questions on Control Statements to test your programming skills.


1. What will be the output of following code?
#include<stdio.h>
int main()
{
if(!!0)
printf(“Hi\n”);
printf(“Hello\n”);
return 0;
}

 
 
 
 

2. What will be the output of following code?
#include<stdio.h>
int main()
{
int i=4,j=5;
while(i+1?i–:j++);
printf(“%d”,i);
return 1;
}

 
 
 
 

3. What will be the output of following code?
#include<stdio.h>
main()
{
int i=30 ;
while(i > 0)
{
printf(“%d\n”, i%=5);
}
}

 
 
 
 

4. What will be the output of following code?
#include<stdio.h>
main()
{
int s=0;
while(s++ <= 10)
{
if(s<4 && s<8)
continue;
printf(“s : %d\n”,s);
}
}

 
 
 
 

5. What will be the output of following code?
#include<stdio.h>
int main()
{
int a=3,b=3;
while(–a && –b);
printf(“%d,%d\n”,a,b);
return 0;
}

 
 
 
 

6. What will be the output of following code?
#include<stdio.h>
main()
{
int i=0, j=0;
while(++i <= 5)
{
while(++j <= 5)
{
printf(“%d\n”,j);
}
printf(“%d\n”,j);
}
}

 
 
 
 

7. What will be the output of following code?
#include<stdio.h>
int main()
{
signed char ch = 125;
while(ch++>0)
{
printf(“%d\n”,++ch);
}
return 0;
}

 
 
 
 

8. In a for loop, if the condition is missing, then infinite looping cannot be avoided by a

 
 
 
 

9. Which of the following statements is correct?

 
 
 
 

10. Which of the following statements is correct?

 
 
 
 

Question 1 of 10

Share this