Un-conditional MCQ


Q1) Which are not looping structures?
  1. For loop
  2. While loop
  3. do Do...while loop
  4. if…else

Answer:- (D).
Q2) How many times the following code prints the string “hello”
for(i=1;i<=50;i++)

    printf(“Hello”);
  1. 1
  2. 50
  3. Zero
  4. None of them

Answer:- (B).
Q3.The first expression in a for… loop is?
  1. Step value of loop
  2. Value of the counter variable
  3. Condition statement
  4. None of the above

Answer:- (B).
Q4. Which among the following is a unconditional control structure.
  1. goto
  2. for
  3. do-while
  4. if-else

Answer:- (A).
Q5. Continue statement
  1. Breaks loop and goes to next statement after loop
  2. does not break loop but starts new iteration
  3. exits the program
  4. 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;
        }
 }
  1. 2 times
  2. 1 times
  3. infinite times
  4. 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);
}
  1. 10
  2. 1 to 10
  3. 11
  4. 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);
}
  1. 65,66,67,68,69,70
  2. a,b,c,d,e,
  3. A,B,C,D,E,
  4. 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”);
}
}
  1. five
  2. fivesixsevendefault
  3. fivesix
  4. None of the above

Answer:- (C).
Q10. What is the output?
void main()
{
 int num=10;
if(num)
 printf("If Executed");
 else
 printf("Else Executed");
}
  1. If Executed
  2. Else Executed
  3. Error
  4. Blank

Answer:- (A).