TECHTRIX2025 BUGHUNT SET5

TECHTRIX2025 BUGHUNT SET5

University

20 Qs

quiz-placeholder

Similar activities

Two Pointer Quiz

Two Pointer Quiz

University

20 Qs

c language

c language

University

25 Qs

Data Structures (Arrays)

Data Structures (Arrays)

University

15 Qs

JAVA QUIZ 2

JAVA QUIZ 2

University

25 Qs

Data Structures Prelimes

Data Structures Prelimes

University

16 Qs

Weekly Test - Batch C to F

Weekly Test - Batch C to F

University

25 Qs

Swf_test_1

Swf_test_1

University

23 Qs

Temel C Programlama Eğitimi

Temel C Programlama Eğitimi

University

20 Qs

TECHTRIX2025 BUGHUNT SET5

TECHTRIX2025 BUGHUNT SET5

Assessment

Quiz

Other

University

Hard

Created by

Sarmistha Moharer

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What's the correct replacement for the faulty line? #include int main() { char *ptr = "Hello"; *ptr = 'h'; // Faulty line printf("%s", ptr); return 0; }

char ptr[] = "Hello";

ptr[0] = 'h';

char *ptr = strdup("Hello");

Both A and C

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What’s the correct way to allocate memory? int *arr; arr = malloc(5 * sizeof(int)); What should be done before using arr?

if (arr == NULL) exit(1);

memset(arr, 0, sizeof(arr));

free(arr);

Nothing, malloc never fails

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What’s wrong with this pointer code? #include void func(int **ptr) { int val = 10; *ptr = &val; } int main() { int *p; func(&p); printf("%d", *p); return 0; }

val goes out of scope

p is uninitialized

No error

Memory leak

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What’s the output? #include int main() { int x = 5; int y = (x++, x + 5); printf("%d", y); return 0; }

5

10

11

Error

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be printed? #include int main() { int x = 5; printf("%d", x+++x); return 0; }

10

11

Error

Undefined behavior

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What does this bitwise code print? #include int main() { int a = 5; printf("%d", a & -a); return 0; }

5

1

-5

0

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Find the output. #include int main() { int x = 10; int y = x-- - --x; printf("%d", y); return 0; }

0

2

Undefined

10

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?