Quiz for C (Iteration Statements/Loops)

Time left: 600 seconds

Q.1 How many different loops are there in C ?

2
4
3
5
Q.2 Which of the following is a also known exit-control loop in C ?

for loop
while loop
do-while loop
None of the above
Q.3 Is the syntax for, 'for' loop given below is correct ?

for(;i<=4;)
{
    //Statements
}                        


YES
NO
Q.4 Which loop will always execute some line codes even if the condition is not true ?

for loop
while loop
do-while loop
Not Possible
Q.5 Writing multiple conditions is allowed in which type of loop ?

Only while loop
for loop and while loop
do-while loop
All type of loops
Q.6 Which loops are known as Entry Control Loop ?

Only while loop
for loop and while loop
do-while loop
All type of loops
Q.7 What will be the output of this code snippet below:

#include<stdio.h>
void main()
{
    int a = 5;
    do
    {
        printf("%d ", a++);
    } while (a<=10); 
}                        


6 7 8 9 10
5 6 7 8 9 10
5 7 9
Compile Error
Q.8 What will be the output of this code ?

#include <stdio.h>
int main()
{
    int i, n;
    n = 10;
    for (i = 1; i < n; i++)
    {
        if (i % 2 != 0)
        {
            printf("%d ", i);
        }
    }
    return 0;
}                        


2 4 6 8 10
2 4 6 8
1 3 5 7 9 11
1 3 5 7 9
Q.9 Predict the output of the following Code.

#include <stdio.h>
void main()
{
    int i = 5;
    while (i-- >= 0)
        printf("%d,", i);

    i = 5;
    printf(" ");

    while (i-- >= 0)
        printf("%i,", i);

    while (i-- >= 0)
        printf("%d,", i);
}                        


4,3,2,1,0,-1, 4,3,2,1,0,-1,
4,3,2,1,0,-1 4,3,2,1,0,-1
Error
4,3,2,1,0, 4,3,2,1,0,
Q.10 What will be the output of the given Code Snip ?

#include <stdio.h> 
void main() 
{ 
    char j = 1;
    while(j<5)
    {
        printf("%d", j);
        j=j+1;
    }
    printf(" ");
}                        


1 2 3 4 5
1 3 5
Syntax error
1 2 3 4
Q.11 Loops are also called as Iteration Statements in C.

True
False
Q.12 What will be the output of the given Code Snip.

#include <stdio.h> 
void main() 
{ 
    int = 0;
    for (i<=5 && i>=-1 ; ++i; i>0)
    {
        printf("%d",i);
    }
}                        


1 3 5
1 2 3 4 5
Expression syntax Error
2 4
Q.13 Guess the Output of the follwing Code.

#include <stdio.h>
void main()
{
    int i = 65535;
    while (i++ != 0)
        printf("%d", ++i);
    printf(" ");
}                        


0 1 2 ..... 65535
No output
Infinite Loop
Error
Q.14 Can we use a do while loop inside a for loop ?

YES
NO
Q.15 Predict the Output of the below Code.

#include <stdio.h>
typedef enum
{
    F,
    T
} boolean;

void main()
{
    boolean condition = T;
    do
    {
        printf("Help For Coders !");
    } while (condition);
}                        


Help For Coders !
Help For Coders !Help For Coders !Help For Coders !
Syntax Error
Infinite Loop

Instructions:-

  1. This Quiz is based on the basic concepts of C.
  2. Each correct answer will carry 2 points.
  3. The time limit for this Quiz is 600 seconds i.e. 10 minutes.
  4. The timer will start immediately after clicking on the start button.
  5. Once an option is selected you cannot select any other, So choose wisely.
  6. Do not refresh the page as it will reset the quiz.
  7. Once the time is up the quiz will automatically get submitted with number of Questions responded.
  8. Your total score alongwith your name will be displayed after submission of the Quiz.
  9. Wish you ALL THE BEST. 👍👍

START

Results:-

Hi






Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post