BUG@MASTER

BUG@MASTER

University

30 Qs

quiz-placeholder

Similar activities

Kuis 2

Kuis 2

University

35 Qs

TECHNOWIZ'S QUIDDITCH

TECHNOWIZ'S QUIDDITCH

University

25 Qs

COCSIT C language test 23_04_2023

COCSIT C language test 23_04_2023

University

30 Qs

Round_1 (B)| Coding Combat 2.0

Round_1 (B)| Coding Combat 2.0

University

30 Qs

Resumen Unidad 2 PP

Resumen Unidad 2 PP

University

30 Qs

2nd Class Test FEB 2021

2nd Class Test FEB 2021

University

25 Qs

Arrays and Strings in C

Arrays and Strings in C

12th Grade - University

32 Qs

OCS752_CP_MODEL 3_PART A

OCS752_CP_MODEL 3_PART A

University

30 Qs

BUG@MASTER

BUG@MASTER

Assessment

Quiz

Computers

University

Hard

Created by

Ayush Singh

FREE Resource

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Point out the error, if any in the program.

#include<stdio.h>

int main()

{

    int a = 10;

    switch(a)

    {

    }

    printf("This is c program.");

                    return 0;

}

Error: No case statement specified

Error: No default specified

No Error

Error: infinite loop occurs

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Point out the error, if any in the program.

#include<stdio.h>

int main()

{

    int i = 1;

    switch(i)

    {

        printf("This is c program.");

        case 1:

            printf("Case1");

            break;

        case 2:

            printf("Case2");

            break;

    }

return 0;

}

Error: No default specified

Error: Invalid printf statement after switch statement

No Error and prints "Case1"

None of above

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Point out the error, if any in the while loop.

#include<stdio.h>

int main()

{

    int i=1;

    while()

    {

        printf("%d\n", i++);

        if(i>10)

           break;

    }

    return 0;

}

There should be a condition in the while loop

There should be at least a semicolon in the while

The while loop should be replaced with for loop

No error

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

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;

}

Error: in case 1*2+4 statement

Error: No default specified

Error: in switch statement

No Error

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Point out the error, if any in the while loop.

#include<stdio.h>

int main()

{

    int i=1;

    while()

    {

        printf("%d\n", i++);

        if(i>10)

           break;

    }

    return 0;

}

  There should be a condition in the while loop

There should be at least a semicolon in the while

The while loop should be replaced with for loop

      No error

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which of the following errors would be reported by the compiler on compiling the program given below?

#include<stdio.h>

int main()

{

    int a = 5;

    switch(a)

    {

        case 1:

        printf("First");

 

        case 2:

        printf("Second");

 

        case 3 + 2:

        printf("Third");

 

        case 5:

        printf("Final");

        break;

 

    }

    return 0;

}

  There is no break statement in each case.

Expression as in case 3 + 2 is not allowed

Duplicate case case 5:

    No error will be reported.

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Point out the error in the program 

f(int a, int b)

{

    int a;

    a = 20;

    return a;

}

      Missing parenthesis in return statement

The function should be defined as int f(int a, int b

   Redeclaration of a

   None of above

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?