TECHTRIX2025 BUGHUNT SET5

TECHTRIX2025 BUGHUNT SET5

University

20 Qs

quiz-placeholder

Similar activities

Luyện tập 1

Luyện tập 1

University

20 Qs

Tech quiz Round 1

Tech quiz Round 1

University

15 Qs

CodeQuest-R1

CodeQuest-R1

University

20 Qs

Blind coding

Blind coding

University

15 Qs

Funções e Estruturas - Matrizes & Strings & Apontadores

Funções e Estruturas - Matrizes & Strings & Apontadores

9th Grade - Professional Development

24 Qs

QUIZERIA

QUIZERIA

University

20 Qs

Temel C Programlama Eğitimi

Temel C Programlama Eğitimi

University

20 Qs

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

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

University

25 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?