Professional Documents
Culture Documents
Week 4 MCQ
Week 4 MCQ
Question 1
Correct
#include <stdio.h>
int main()
{
int i = 1024;
for ( ; i; i >>= 1)
printf("REC");
return 0;
}
a. 11
c. Infinite
d. 10
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
a. switch
b. for
c. while
d. do while
Correct
Marks for this submission: 1.00/1.00.
Question 3
Correct
a. for
b. switch
c. while
d. 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
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
int main()
{
while(true)
{
printf("RABBIT");
break;
}
return 0;
}
What is the output of the above program?
b. Prints nothing
c. Compile error
d. RABBIT
www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 4/14
6/1/2021 MCQ: Attempt review
Question 6
Correct
int main()
{
int a=5;
while(a==5)
{
printf("RABBIT");
break;
}
return 0;
}
b. RABBIT
c. Prints nothing
d. Compiler error
Question 7
Correct
int main()
{
int a=25;
while(a <= 27)
{
printf("%d ", a);
a++;
}
return 0;
}
a. 25 25 25
b. 27 27 27
c. 25 26 27
d. 26 27 28
www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 5/14
6/1/2021 MCQ: Attempt review
Question 8
Correct
int main()
{
int k, j;
for(k=1, j=10; k <= 5; k++)
{
printf("%d ", (k+j));
}
return 0;
}
a. 10 10 10 10 10
b. Insufficient data
c. compiler error
d. 10 11 12 13 14 15
Question 9
Correct
int main()
{
int k;
for(k=1; k <= 5; k++);
{
printf("%d ", k);
}
return 0;
}
a. 1 2 3 4 5
b. 1 2 3 4
c. 6
www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 6/14
6/1/2021 MCQ: Attempt review
Question 10
Correct
int main()
{
int k;
for(;;)
{
printf("TESTING\n");
break;
}
return 0;
}
a. Prints nothing
b. No Output
c. TESTING
d. Compiler error
Question 11
Correct
int main()
{
int k;
return 0;
}
a. Compiler error
b. FLOWER FRUITS
d. FLOWER YELLOW
www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 7/14
6/1/2021 MCQ: Attempt review
Question 12
Correct
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
Correct
Marks for this submission: 1.00/1.00. Accounting for previous tries, this gives 0.67/1.00.
Question 13
Correct
int main()
{
int a=32;
do
{
printf("%d ", a);
a++;
if(a > 35)
break;
}while(1);
return 0;
}
a. 32 33 34
b. Compile error
c. Prints nothing
d. 32 33 34 35
www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 8/14
6/1/2021 MCQ: Attempt review
Question 14
Correct
#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
www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 9/14
6/1/2021 MCQ: Attempt review
Question 15
Correct
#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
c. Compile error
d. Prints nothing
Question 16
Correct
#include <stdio.h>
void main()
double k = 0;
printf("Hello");
a. Compile error
c. HelloHelloHello
www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 10/14
6/1/2021 MCQ: Attempt review
Question 17
Correct
#include <stdio.h>
void main()
int i = 0;
if (i == 0)
{
printf("Hello");
continue;
}
}
a. Hello
b. Prints nothing
d. Compile error
www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 11/14
6/1/2021 MCQ: Attempt review
Question 18
Correct
#include <stdio.h>
int main()
{
printf("before continue ");
continue;
printf("after continue\n");
}
a. Compile error
c. after continue
d. before continue
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
#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");
}
a. In while loop
In while loop
After loop
b. In while loop
After loop
c. After loop
d. Compile error
www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 13/14
6/1/2021 MCQ: Attempt review
Question 20
Correct
{
int tally=0;
for( ; ; )
{
if(tally==10)
break;
printf("%d ",++tally);
}
return 0;
}
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
Correct
Marks for this submission: 1.00/1.00. Accounting for previous tries, this gives 0.67/1.00.
Jump to...
LAB EXERCISE ►
www.rajalakshmicolleges.net/moodle/mod/quiz/review.php?attempt=335125&cmid=3145 14/14