C Language - Control Statements

You Are Here :: Home > C Language > Control Statements - General Questions

 
25.

for(i=0;i<5;i++)

printf("Hello");

A. It will print Hello word 4 times B. It will print Hello word 5 times
C. It will print Hello word 6 times D. Compilation error




26.

What is the output of this C code?

#include
int main()
{
short i;
for (i = 1; i >= 0; i++)
printf("%d\n", i);
}

A. The control won't fall into the for loop B. Numbers will be displayed until the signed limit of short and throw a runtime error
C. Numbers will be displayed until the signed limit of short and program will successfully terminate D. This program will get into an infinite loop and keep printing numbers with no errors




27.

What is the output of this C code?

#include
void main()
{
double k = 0;
for (k = 0.0; k < 3.0; k++)
printf("Hello");
}

A. Run time error B. Hello is printed thrice
C. Hello is printed twice D. Hello is printed infinitely




28.

#include

void main(){
int a=10;
if(printf("%d",a>=10)-10)
for(;;)
break;
else;
}
Choose all that apply:

A. It will print nothing B. 0
C. 1 D. Compilation error: Misplaced else




29.

#include

void main()
{
int num=10;
if(num)
printf("If Executed");
else
printf("Else Executed");
}

A. If Executed B. Else Executed
C. Compile Error : If Statement must have Condition D. Run-Time Error




30.

#include

void main()
{
if(-100)
printf("negative number");
else
printf("Positive Number");
}

A. Positive Number B. negative number
C. Compile Error : Negative number not allowed D. Random Behavior




« previous

1

2

3

4

5

6

7

next »

 
 
 



© 2013 freshersindia.in ® | Copyrights | Terms & Conditions
   Designed by Freshers India
Catch Us on