Programming for Problem Solving (3110003) MCQs

MCQs of Control structure in C

Showing 1 to 10 out of 41 Questions
1.
Which are not looping structures?
(a) For loop
(b) While loop
(c) Do...while loop
(d) if…else
Answer:

Option (d)

2.
How many times the following code prints the string “hello”

for(i=1;i<=50;i++)

    printf(“Hello”);

(a) 1
(b) 50
(c) Zero
(d) None of them
Answer:

Option (b)

3.
The first expression in a for… loop is
(a) Step value of loop
(b) Value of the counter variable
(c) Condition statement
(d) None of the above
Answer:

Option (b)

4.
Which among the following is a unconditional control structure.
(a) goto
(b) for
(c) do-while
(d) if-else
Answer:

Option (a)

5.
Continue statement
(a) Breaks loop and goes to next statement after loop
(b) does not break loop but starts new iteration
(c) exits the program
(d) Starts from beginning of program
Answer:

Option (b)

6.
How many times following loop will be executed?

void main()
{
    int i = 32766;
    while (i<= 32767)
        {
            printf("%d\n",i);
            i = i + 1;
        }
 }

(a) 2 times
(b) 1 times
(c) infinite times
(d) loop will not be executed
Answer:

Option (a)

7.
What is the output of the following code:
void main()
{
int i;
for(i=1;i<=10;i++);
 printf(“%d\n”,i);
}
(a) 10
(b) 1 to 10
(c) 11
(d) None of the above
Answer:

Option (c)

8.
What is the output of the following code:
void main()
{
int i;
for(i=65;i<70;i++)
 printf(“%c,”,i);
}
(a) 65,66,67,68,69,70
(b) a,b,c,d,e,
(c) A,B,C,D,E,
(d) A,B,C,D,E
Answer:

Option (c)

9.
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”);
}
}
(a) five
(b) fivesixsevendefault
(c) fivesix
(d) None of the above
Answer:

Option (c)

10.

What is the output?

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

(a) If Executed
(b) Else Executed
(c) Error
(d) Blank
Answer:

Option (a)

Showing 1 to 10 out of 41 Questions