adplus-dvertising

Welcome to the Control Flow Statements in C MCQs Page

Dive deep into the fascinating world of Control Flow Statements in C with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Control Flow Statements in C, a crucial aspect of C Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Control Flow Statements in C, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Control Flow Statements in C. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Control Flow Statements in C. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Control Flow Statements in C MCQs | Page 18 of 32

Explore more Topics under C Programming

Q171.
Point out the error, if any in the program.
#include<stdio.h>
int main()
{
    int i = 1;
    switch(i)
    {
        case 1:
           printf("Case1");
           break;
        case 1*2+4:
           printf("Case2");
           break;
    }
return 0;
}
Discuss
Answer: (d).No Error
Q172.
Point out the error, if any in the while loop.
#include<stdio.h>
int main()
{
    void fun();
    int i = 1;
    while(i <= 5)
    {
        printf("%d\n", i);
        if(i>2)
            goto here;
    }
return 0;
}
void fun()
{
    here:
    printf("It works");
}
Discuss
Answer: (c).Error: goto cannot takeover control to other function
Q173.
Point out the error, if any in the program.
#include<stdio.h> 
int main()
{
    int a = 10, b;
    a >=5 ? b=100: b=200;
    printf("%d\n", b);
    return 0;
}
Discuss
Answer: (c).Error: L value required for b
Q174.
Which of the following statements are correct about the below program?
#include<stdio.h>
int main()
{
    int i = 10, j = 20;
    if(i = 5) && if(j = 10)
        printf("Have a nice day");
    return 0;
}
Discuss
Answer: (c).Error: Expression syntax
Q175.
Which of the following statements are correct about the below program?
#include<stdio.h>
int main()
{
    int i = 10, j = 15;
    if(i % 2 = j % 3)
        printf("CompSciBits\n");
    return 0;
}
Discuss
Answer: (b).Error: Lvalue required
Q176.
Which of the following statements are correct about the program?
#include<stdio.h>
int main()
{
    int x = 30, y = 40;
    if(x == y)
        printf("x is equal to y\n");

    else if(x > y)
        printf("x is greater than y\n");

    else if(x < y)
        printf("x is less than y\n")
    return 0;
}
Discuss
Answer: (a).Error: Statement missing
Q177.
Which of the following statements are correct about an if-else statements in a C-program?

1: Every if-else statement can be replaced by an equivalent statements using   ?: operators
2: Nested if-else statements are allowed.
3: Multiple statements in an if block are allowed.
4: Multiple statements in an else block are allowed.
Discuss
Answer: (d).2, 3, 4
Q178.
Which of the following statements are correct about the below program?
#include<stdio.h>
int main()
{
    int i = 0;
    i++;
    if(i <= 5)
    {
        printf("CompSciBits\n");
        exit(0);
        main();
    }
    return 0;
}
Discuss
Answer: (b).The program prints 'CompSciBits' one time
Q179.
Which of the following statements are correct about the below C-program?
#include<stdio.h>
int main()
{
    int x = 10, y = 100%90, i;
    for(i=1; i<10; i++)
    if(x != y);
        printf("x = %d y = %d\n", x, y);
    return 0;
}



1 :
The printf() function is called 10 times.


2 :
The program will produce the output x = 10 y = 10


3 :
The ; after the if(x!=y) will NOT produce an error.


4 :
The program will not produce output.
Discuss
Answer: (b).2, 3
Q180.
Which of the following sentences are correct about a for loop in a C program?



1:
for loop works faster than a while loop.


2:
All things that can be done using a for loop can also be done using a while loop.


3:
for(;;); implements an infinite loop.


4:
for loop can be used if we want statements in a loop get executed at least once.
Discuss
Answer: (d).2, 3, 4

Suggested Topics

Are you eager to expand your knowledge beyond C Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!