Top

Control Instructions

1.

When 1 is entered, The output of the code below is?

#include 
    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;
        }
    }

 

Answer: B

No answer description available for this question.
 

Enter details here

2.

When 2 is entered, The output of the code below is?

#include 
    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");
        }
    }

 

Answer: D

No answer description available for this question.
 

Enter details here

3.

When 1 is entered, The output of the code below is?

#include 
    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");
        }
    }

 

Answer: C

No answer description available for this question.
 

Enter details here

4.

The output of the code below is

#include 
    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;
        }
    }

 

Answer: C

No answer description available for this question.
 

Enter details here

5.

The output of the code below is

#include 
    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;
        }
    }

 

Answer: A

No answer description available for this question.
 

Enter details here

Loading…