Computer Programming (3310701) MCQs

MCQs of Loop Control Statements

Showing 1 to 10 out of 39 Questions
1.

Choose correct C while loop syntax.

While લૂપ ની સાચી સિન્ટેક્સ સિલેક્ટ કરો.

(a)

while(condition)
{
       //statements
}

(b)

{
       //statements
}
while(condition)

(c)

while(condition);
{
       //statements
}

(d)

while(condition)
{
       if(condition);
       {
             //statements
        }
}

Answer:

Option (a)

2.

Choose a correct C for loop syntax.

For લૂપ ની સાચી સિન્ટેક્સ સિલેક્ટ કરો.

(a)

for(initalization; condition; incrementoperation)
{
      //statements
}

(b)

for(declaration; condition; incrementoperation)
{
      //statements
}

(c)

for(declaration; incrementoperation;condition )
{
      //statements
}

(d)

for(initalization; condition; incrementoperation);
{
      //statements
}

Answer:

Option (a)

3.

Choose a correct C do while loop syntax.

Do…while લૂપ ની સાચી સિન્ટેક્સ સિલેક્ટ કરો.

(a)

dowhile(condition)
{
        //statements
}

(b)

do  while(condition)
{
        //statements
}

(c)

do
{
        //statements
}while(condition)

(d)

do
{
        //statements
}while(condition);

Answer:

Option (d)

4.

What is the output of this C code?

void main()
{
    int a=5;
    while(a==5)    
    {
        printf("RABBIT");
        break;
    }
}

આપેલા C કોડનું આઉટપુટ શું હશે?

void main()
{
    int a=5;
    while(a==5)    
    {
        printf("RABBIT");
        break;
    }
}

(a)

RABBIT is printed unlimited number of times

(b)

RABBIT

(c)

Compiler error

(d)

No output

Answer:

Option (b)

5.

What is the output of this C code?

void main()
{
    int a=5;
    while(a==5)    
    {
        printf("RABBIT\n");
        break;
    }
    printf("GREEN");
}

આપેલા C કોડનું આઉટપુટ શું હશે?

void main()
{
    int a=5;
    while(a==5)    
    {
        printf("RABBIT\n");
        break;
    }
    printf("GREEN");
}

(a)

GREEN

(b)

RABBIT 
GREEN

(c)

RABBIT is printed unlimited number of times.

(d)

Compiler error.

Answer:

Option (b)

6.

What is the output of this C code?

void main()
{
    int a=25;
    while(a <= 27)
    {
        printf("%d ", a);
        a++;
    }
}

આપેલા C કોડનું આઉટપુટ શું હશે?

void main()
{
    int a=25;
    while(a <= 27)
    {
        printf("%d ", a);
        a++;
    }
}

(a)

25 25 25

(b)

25 26 27

(c)

27 27 27

(d)

Compiler error

Answer:

Option (b)

7.

What is the output of this C code?

void main()
{
    int a=32;
    do
    {
        printf("%d ", a);
        a++;
    }while(a <= 30);
}

આપેલા C કોડનું આઉટપુટ શું હશે?

void main()
{
    int a=32;
    do
    {
        printf("%d ", a);
        a++;
    }while(a <= 30);
}

(a)

32

(b)

33

(c)

30

(d)

No Output

Answer:

Option (a)

8.

What is the output of this C code?

void main()
{
    int k;
    for(;;)
    {
        printf("TESTING\n");
    }
}

આપેલા C કોડનું આઉટપુટ શું હશે?

void main()
{
    int k;
    for(;;)
    {
        printf("TESTING\n");
    }
}

(a)

No Output

(b)

TESTING

(c)

Compiler error

(d)

TESTING will be print infinite times

Answer:

Option (d)

9.

What is the way to suddenly come out of or Quit any Loop in C Language.?

C લેન્ગવેજ માં કોઈ લૂપ માંથી અચાનક બહાર આવવા શેનો ઉપયોગ થાય છે?

(a)

continue

(b)

break

(c)

leave

(d)

quit

Answer:

Option (b)

10.

What is the output of this C code?

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

આપેલા C કોડનું આઉટપુટ શું હશે?

#include <stdio.h>
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

Answer:

Option (b)

Showing 1 to 10 out of 39 Questions