Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

6/1/2021 MCQ: Attempt review

Dashboard / My courses / GE19141-2020-ES-F4.0 / Week 4 - Decision Making & Looping / MCQ

Started on Tuesday, 1 June 2021, 9:33 PM


State Finished
Completed on Tuesday, 1 June 2021, 9:42 PM
Time taken 9 mins 14 secs
Marks 17.00/20.00
Grade 8.50 out of 10.00 (85%)

Question 1
Correct

Mark 1.00 out of 1.00

#include <stdio.h>
int main()
{

int i = 1024;
for ( ; i; i >>= 1)

printf("REC");
return 0;
}

How many times REC will be printed in the above program?

a. 11 

b. Compile-time error will be displayed

c. Infinite

d. 10

Your answer is correct.


The correct answer is:
11

Correct
Marks for this submission: 1.00/1.00.

www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 1/14
6/1/2021 MCQ: Attempt review

Question 2
Correct

Mark 1.00 out of 1.00

The continue statment cannot be used with

a. switch 

b. for

c. while

d. do while

Your answer is correct.


The correct answer is:
switch

Correct
Marks for this submission: 1.00/1.00.

Question 3
Correct

Mark 0.33 out of 1.00

Which loop is guaranteed to execute at least one time?

a. for

b. switch

c. while

d. do while 

Your answer is correct.


The correct answer is:
do while

Correct
Marks for this submission: 1.00/1.00. Accounting for previous tries, this gives 0.33/1.00.

www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 2/14
6/1/2021 MCQ: Attempt review

Question 4
Correct

Mark 0.33 out of 1.00

Choose proper for statement syntax from the following-

a. for(declaration; condition; incrementoperation) 


{ //statements }

b. for(initalization; condition; incrementoperation;)


{
//statements
}

c. for(initalization; condition; incrementoperation) 


{
//statements
}

d. for(declaration; incrementoperation; condition)


{
//statements
}

Your answer is correct.


The correct answer is:
for(initalization; condition; incrementoperation)
{
//statements
}

Correct
Marks for this submission: 1.00/1.00. Accounting for previous tries, this gives 0.33/1.00.

www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 3/14
6/1/2021 MCQ: Attempt review

Question 5
Correct

Mark 1.00 out of 1.00

int main()
{

    while(true)    
  {
        printf("RABBIT");

        break;
    } 

    return 0;
}
What is the output of the above program?

a. RABBIT is printed many times

b. Prints nothing

c. Compile error 

d. RABBIT

Your answer is correct.


The correct answer is:
Compile error
Correct
Marks for this submission: 1.00/1.00.

www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 4/14
6/1/2021 MCQ: Attempt review

Question 6
Correct

Mark 0.00 out of 1.00

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

What will be the output of the above program?

a. RABBIT is printed unlimited number of times

b. RABBIT 

c. Prints nothing

d. Compiler error

Your answer is correct.

The correct answer is:


RABBIT
Correct
Marks for this submission: 1.00/1.00. Accounting for previous tries, this gives 0.00/1.00.

Question 7
Correct

Mark 1.00 out of 1.00

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

What will be the output of the above program?

a. 25 25 25

b. 27 27 27

c. 25 26 27 

d. 26 27 28

Your answer is correct.


The correct answer is:
25 26 27
Correct
Marks for this submission: 1.00/1.00.

www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 5/14
6/1/2021 MCQ: Attempt review

Question 8
Correct

Mark 1.00 out of 1.00

int main()
{
int k, j;
for(k=1, j=10; k <= 5; k++)
{
printf("%d ", (k+j));
}
return 0;
}

What will be the output of the above program?

a. 10 10 10 10 10

b. Insufficient data

c. compiler error

d. 10 11 12 13 14 15 

Your answer is correct.

The correct answer is:


10 11 12 13 14 15
Correct
Marks for this submission: 1.00/1.00.

Question 9
Correct

Mark 1.00 out of 1.00

int main()
{
int k;
for(k=1; k <= 5; k++);
{
printf("%d ", k);
}
return 0;
}

What will be the output of the above program?

a. 1 2 3 4 5

b. 1 2 3 4

c. 6 

Your answer is correct.

The correct answer is:


6
Correct
Marks for this submission: 1.00/1.00.

www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 6/14
6/1/2021 MCQ: Attempt review

Question 10
Correct

Mark 1.00 out of 1.00

int main()
{
int k;
for(;;)
{
printf("TESTING\n");
break;
}
return 0;
}

What will be the output of the above program?

a. Prints nothing

b. No Output

c. TESTING 

d. Compiler error

Your answer is correct.

The correct answer is:


TESTING
Correct
Marks for this submission: 1.00/1.00.

Question 11
Correct

Mark 1.00 out of 1.00

int main()
{
int k;

for(printf("FLOWER "); printf("YELLOW "); printf("FRUITS "))


{
break;
}

return 0;
}

What will be the output of the above program?

a. Compiler error

b. FLOWER FRUITS

c. FLOWER YELLOW FRUITS

d. FLOWER YELLOW 

Your answer is correct.


The correct answer is:
FLOWER YELLOW
Correct
Marks for this submission: 1.00/1.00.

www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 7/14
6/1/2021 MCQ: Attempt review

Question 12
Correct

Mark 0.67 out of 1.00

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

a. quit; statement

b. break; statement 

c. leave; statement

d. continue; statement

Your answer is correct.


The correct answer is:
break; statement

Correct
Marks for this submission: 1.00/1.00. Accounting for previous tries, this gives 0.67/1.00.

Question 13
Correct

Mark 1.00 out of 1.00

int main()
{
int a=32;

do
{
printf("%d ", a);
a++;
if(a > 35)
break;
}while(1);

return 0;
}

What will be the output of the above program?

a. 32 33 34

b. Compile error

c. Prints nothing

d. 32 33 34 35 

Your answer is correct.

The correct answer is:


32 33 34 35
Correct
Marks for this submission: 1.00/1.00.

www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 8/14
6/1/2021 MCQ: Attempt review

Question 14
Correct

Mark 1.00 out of 1.00

#include <stdio.h>
int main()

{
    int k=0;
    for(k)

      printf("Hello World!");
     return 0;

}
What will be the output of the above program?

a. Compile error 

b. Prints nothing

c. Hello World!

d. 0

Your answer is correct.

The correct answer is:


Compile error
Correct
Marks for this submission: 1.00/1.00.

www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 9/14
6/1/2021 MCQ: Attempt review

Question 15
Correct

Mark 1.00 out of 1.00

#include <stdio.h>
int main()

{
    int k=0;
    for(k<3;k++)

      printf("Hello!");
    return 0;

}
What will be the output of the above program?

a. 0

b. Hello! printed thrice

c. Compile error 

d. Prints nothing

Your answer is correct.

The correct answer is:


Compile error
Correct
Marks for this submission: 1.00/1.00.

Question 16
Correct

Mark 1.00 out of 1.00

#include <stdio.h>

void main()

      double k = 0;

        for (k = 0.0; k < 3.0; k++)

            printf("Hello");

What will be the output of the above program?

a. Compile error

b. Hello printed infinite times

c. HelloHelloHello 

d. Hello Hello Hello

Your answer is correct.

The correct answer is:


HelloHelloHello
Correct
Marks for this submission: 1.00/1.00.

www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 10/14
6/1/2021 MCQ: Attempt review

Question 17
Correct

Mark 1.00 out of 1.00

#include <stdio.h>

void main()

        int i = 0;

        if (i == 0)

    {

            printf("Hello");

            continue;

    }

  }

What will be the output of the above program?

a. Hello

b. Prints nothing

c. Hello printed infinite times

d. Compile error 

Your answer is correct.

The correct answer is:


Compile error
Correct
Marks for this submission: 1.00/1.00.

www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 11/14
6/1/2021 MCQ: Attempt review

Question 18
Correct

Mark 1.00 out of 1.00

#include <stdio.h>
int main()

{
        printf("before continue ");
        continue;

        printf("after continue\n");
}

What will be the output of the above program?

a. Compile error 

b. before continue after continue

c. after continue

d. before continue

Your answer is correct.


The correct answer is:
Compile error

Correct
Marks for this submission: 1.00/1.00.

www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 12/14
6/1/2021 MCQ: Attempt review

Question 19
Correct

Mark 1.00 out of 1.00

#include <stdio.h>
int main()

{
        int i = 0;
        while (i < 2)

    {
            if (i == 1)

                break;
                i++;
                if (i == 1)

                    continue;
                    printf("In while loop\n");

    }
        printf("After loop\n");
}

What will be the output of the above program?

a. In while loop
In while loop
After loop

b. In while loop
After loop

c. After loop 

d. Compile error

Your answer is correct.


The correct answer is:
After loop
Correct
Marks for this submission: 1.00/1.00.

www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 13/14
6/1/2021 MCQ: Attempt review

Question 20
Correct

Mark 0.67 out of 1.00

#include < stdio.h >


int main()

{
    int tally=0;
    for( ; ; )

  {
        if(tally==10)

            break;
        printf("%d ",++tally);
  }

    return 0;
}

What will be the output of the above program?

a. 0 1 2 3 4 5 6 7 8 9 10 ...

b. 1 2 3 4 5 6 7 8 9 10 

c. 0 1 2 3 4 5 6 7 8 9

d. 0 1 2 3 4 5 6 7 8 9 10

Your answer is correct.


The correct answer is:
1 2 3 4 5 6 7 8 9 10

Correct
Marks for this submission: 1.00/1.00. Accounting for previous tries, this gives 0.67/1.00.

◄ Jump Statements PPT

Jump to...

LAB EXERCISE ►

www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 14/14

You might also like