Q2) How many times the following code prints the string “hello”
for(i=1;i<=50;i++)
printf(“Hello”);
1
50
Zero
None of them
Answer:- (B).
Q3.The first expression in a for… loop is?
Step value of loop
Value of the counter variable
Condition statement
None of the above
Answer:- (B).
Q4. Which among the following is a unconditional control structure.
goto
for
do-while
if-else
Answer:- (A).
Q5. Continue statement
Breaks loop and goes to next statement after loop
does not break loop but starts new iteration
exits the program
Starts from beginning of program
Answer:- (B).
Q6. How many times following loop will be executed?
void main();
{
int i = 32766;
while (i<= 32767)
{
printf("%d\n",i);
i = i + 1;
}
}
2 times
1 times
infinite times
loop will not be executed
Answer:- (A).
Q7. What is the output of the following code:
void main()
{
int i;
for(i=1; i<=10;i++);
printf(“%d\n”,i);
}
10
1 to 10
11
None of the above
Answer:- (C).
Q8. What is the output of the following code:?
void main()
{
int i;
for(i=65;i<70;i++)
printf(“%c,”,i);
}
65,66,67,68,69,70
a,b,c,d,e,
A,B,C,D,E,
A,B,C,D,E
Answer:- (C).
Q9. What is the output of following code:
void main()
{
int i=5;
switch(i)
{
case 3: printf(“three”);
case 4: printf(“four”);
case 5: printf(“five”);
case 6: printf(“six”);break;
case 7: printf(“seven”);
default: printf(“default”);
}
}