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 1 of 32

Explore more Topics under C Programming

Q1.
The output of the code below is
#include <stdio.h>
    void main()
    {
        int x = 5;
        if (x < 1)
            printf("hello");
        if (x == 5)
            printf("hi");
        else
            printf("no");
    }
Discuss
Answer: (a).hi
Q2.
The output of the code below is
#include <stdio.h>
    int x;
    void main()
    {
        if (x)
            printf("hi");
        else
            printf("how are u");
    }
Discuss
Answer: (b).how are you
Q3.
Comment on the following code below
#include <stdio.h>
    void main()
    {
        int x = 5;
        if (true);
            printf("hello");
    }
Discuss
Answer: (b).It will throw an error
Q4.
The output of the code below is
#include <stdio.h>
    void main()
    {
        int x = 0;
        if (x == 0)
            printf("hi");
        else
            printf("how are u");
            printf("hello");
    }
Discuss
Answer: (d).hihello
Q5.
The output of the code below is
#include <stdio.h>
    void main()
    {
        int x = 5;
        if (x < 1);
            printf("Hello");
 
    }
Discuss
Answer: (c).Hello
Q6.
The output of the code below is(when 1 is entered)
#include <stdio.h>
    void main()
    {
        double ch;
        printf("enter a value btw 1 to 2:");
        scanf("%lf", &ch);
        switch (ch)
        {
        case 1:
            printf("1");
            break;
        case 2:
            printf("2");
            break;
        }
    }
Discuss
Answer: (a).Compile time error
Q7.
The output of the code below is(When 1 is entered)
#include <stdio.h>
    void main()
    {
        char *ch;
        printf("enter a value btw 1 to 3:");
        scanf("%s", ch);
        switch (ch)
        {
        case "1":
            printf("1");
            break;
        case "2":
            printf("2");
            break;
        }
    }
Discuss
Answer: (c).Compile time error
Q8.
When 1 is entered, The output of the code below is?
#include <stdio.h>
    void main()
    {
        int ch;
        printf("enter a value btw 1 to 2:");
        scanf("%d", &ch);
        switch (ch)
        {
        case 1:
            printf("1\n");
        default:
            printf("2\n");
        }
    }
Discuss
Answer: (c).1 2
Q9.
When 2 is entered, The output of the code below is?
#include <stdio.h>
    void main()
    {
        int ch;
        printf("enter a value btw 1 to 2:");
        scanf("%d", &ch);
        switch (ch)
        {
        case 1:
            printf("1\n");
            break;
            printf("Hi");
        default:
            printf("2\n");
        }
    }
Discuss
Answer: (d).2
Q10.
When 1 is entered, The output of the code below is?
#include <stdio.h>
    void main()
    {
        int ch;
        printf("enter a value btw 1 to 2:");
        scanf("%d", &ch);
        switch (ch, ch + 1)
        {
        case 1:
            printf("1\n");
            break;
        case 2:
            printf("2");
            break;
        }
    }
Discuss
Answer: (b).2

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!