TECHTRIX2025 BUGHUNT SET5

TECHTRIX2025 BUGHUNT SET5

University

20 Qs

quiz-placeholder

Similar activities

Temel C Programlama Eğitimi

Temel C Programlama Eğitimi

University

20 Qs

Arrays

Arrays

University

20 Qs

Electroblitz---Software

Electroblitz---Software

University

25 Qs

APTITUDE PRACTICE MOCK TEST-1@15-7-2020

APTITUDE PRACTICE MOCK TEST-1@15-7-2020

University

25 Qs

Funções e Estruturas em Programação C - Parte I

Funções e Estruturas em Programação C - Parte I

9th Grade - Professional Development

22 Qs

C PROGRAMMING

C PROGRAMMING

University

15 Qs

CodeMavarick

CodeMavarick

University

20 Qs

TECHTRIX2025 BUGHUNT SET6

TECHTRIX2025 BUGHUNT SET6

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?