Sail E0 Webinar

MCQs

Total Questions : 97 | Page 8 of 10 pages
Question 71. What is the output of this C code?

    void main()

    {

        int k = 0;

        for (k < 3; k++)

        printf("Hello");

    }

  1.    Compile time error
  2.    Hello is printed thrice
  3.    Nothing
  4.    Varies
 Discuss Question
Answer: Option A. -> Compile time error


none


Question 72. What is the output of this C code?

    void main()

    {

        double k = 0;

        for (k = 0.0; k < 3.0; k++)

            printf("Hello");

    }

  1.    Run time error
  2.    Hello is printed thrice
  3.    Hello is printed twice
  4.    Hello is printed infinitely
 Discuss Question
Answer: Option B. -> Hello is printed thrice


none


Question 73. The output of the code below is?

    void main()

    {

        int x = 0;

        if (x == 0)

            printf("hi");

        else

           printf("how are u");

            printf("hello");

    }

  1.    hi
  2.    how are you
  3.    hello
  4.    hihello
 Discuss Question
Answer: Option D. -> hihello


none


Question 74. The output of the code below is(When 1 is entered)?

    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;

        }

    }

  1.    1
  2.    2
  3.    Compile time error
  4.    no Compile time error
 Discuss Question
Answer: Option C. -> Compile time error


none


Question 75. The output of the code below is(when 1 is entered)?

    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;

        }

    }

  1.    compile time error
  2.    1
  3.    2
  4.    Varies
 Discuss Question
Answer: Option A. -> compile time error


none


Question 76. The output of the code below is?

    void main()

    {

        int x = 5;

        if (x < 1);

            printf("Hello");

    }

  1.    Nothing
  2.    Run time error
  3.    Hello
  4.    Varies
 Discuss Question
Answer: Option C. -> Hello


none


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

    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");

        }

    }

  1.    1
  2.    2
  3.    1 2
  4.    Run time error
 Discuss Question
Answer: Option C. -> 1 2


none


Question 78. How many times i value is checked in the below code?

    int main()

    {

        int i = 0;

        do {

            i++;

            printf("in while loop\n");

        } while (i < 3);

    }

  1.    2
  2.    3
  3.    4
  4.    1
 Discuss Question
Answer: Option B. -> 3


none


Question 79. How many times i value is checked in the below code?

  int main()

    {

        int i = 0;

        while (i < 3)

            i++;

        printf("In while loop\n");

    }

  1.    2
  2.    3
  3.    4
  4.    1
 Discuss Question
Answer: Option C. -> 4


none


Question 80. What is the output of this C code?

    void main()

    {

        int i = 2;

        do

        {

            printf("Hi");

        } while (i < 2)

    }

  1.    Compile time error
  2.    Hi Hi
  3.    Hi
  4.    Varies
 Discuss Question
Answer: Option A. -> Compile time error


none


Latest Videos

Latest Test Papers