int a = 0, b = 2;
if (a = 0)
b = 0;
else
b *=
Practice Control Instructions – int a = 0, b = 2;
if (a = 0)
b = 0;
else
b *= 10;
What is the value of b?
Practice Control Instructions – int a = 0, b = 2;
if (a = 0)
b = 0;
else
b *= 10;
What is the value of b?
Practice Control Instructions – int x = 2, y = 2, z = 1;
What is the value of x after the following statmements?
if (x = y%2)
z = x;
else
z=y;
Practice Control Instructions – What is the output of the following program ?
#include
int main()
{
int i,j;
i = j =2;
while ( --i && j++)
printf("%d %d",i,j);
return 0;
}
Practice Control Instructions – How many times “Nagarro” will get printed?
#include
int main()
{
int x;
for (x=-1; x<10;x++)
{
if (x<5)
continue;
else
break;
printf("Nagarro");
}
return 0;
}
Practice Control Instructions – The use of the break statement in switch statement is
Practice Control Instructions – What will be output of the following “C” code?
int main( )
{
for( ; ;);
printf("Hello
");
return 0;
}
Practice Control Instructions – What will be the output of the following C program?
void main()
{
sum = 0;
for (i = 1; i < = 10; i++)
if (i%2 == 0)
sum += i;
printf ("%d",sum);
}
Practice Control Instructions – How many times will while loop be executed in the following C program.
void main(){
x = 500;
while (x < = 500)
{
x=x-600;
if (x < 0)
break;
}
Practice Control Instructions – What is the output of the below fragment of C code, if i = 3?
if (i >1)c = 2;
else c = 3;
switch (c) {
case 2: printf("CAUTION");
break;
case 3: printf("GOOD BYE");
break;
default : printf("TERROR");
}
Practice Control Instructions – What is the output of the following program?
void main()
{
int B, X, Y, Z;
X=1; Y=2; Z=3;
jf ((X > 1) || (Y > 1))
if (Z > 1)
printf ("O.K /n");
else break;
if((X > 1 && (Z > 3))
printf ("Bye /n");
printf ("Hello!");
}
Practice Control Instructions – What is the final value of sum?
void main()
{
int sum= 1;
for (;sum <=9;)
printf("%d/n" ,++sum);
}
Practice Control Instructions – What will be the value of sum after the following C program is executed?
void main()
{
int sum, index
sum= 1;
index= 9;
do {
index = index - 1;
sum =2* sum;
} while(index > 9);
}
Practice Control Instructions – What will be output of the following “c” code?
#include
void main()
{
char ch;
for(ch =1; ch<=255; ch++)
printf("%d %c", ch, ch);
}
Practice Control Instructions – What will be output of the following “c” code?
#include
void main() {
int i= 0;
for(; i++; printf("%d", i));
printf("%d", i);
}
Practice Control Instructions – What is the output of the following C Program?
#include
void main()
{
for (i = 3; i < 15; i += 3);
printf ("%d", i);
}