Search Header Logo

20 Tough C Debugging Questions (MCQ)

Authored by Vishnu Vivek

Computers

Professional Development

Used 4+ times

20 Tough C Debugging Questions (MCQ)
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following C code?

int a = 10;

int *p = &a;

*p = *p + 1;

printf("%d", a);

10

11

Garbage value

Compilation error

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Identify the error in the following C program:

const int x=1;

x = 10;

x not initialized

const variable cannot be modified

main missing return

No error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of this C statement?

printf("%d", printf("C"));

C

1

C1

Compilation error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Find the bug in the following C code:

char arr[] = "ABC";

printf("%s", arr);

Prints ABC

Missing null terminator

Compilation error

Runtime crash

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of this C code?

int i;

for(i = 0; i < 5; i++);

printf("%d", i);

0

5

Infinite loop

Compilation error

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is wrong in this C code?

int *p;

scanf("%d", p);

segmentation fault

Wrong format specifier

scanf invalid

No error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output in C?

int x = 3;

printf("%d", x = x + 2 * x);

9

15

6

Undefined

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?