TECHTRIX2025 BUGHUNT SET6

TECHTRIX2025 BUGHUNT SET6

University

20 Qs

quiz-placeholder

Similar activities

UAS AKUNTANSI MANAJEMEN

UAS AKUNTANSI MANAJEMEN

University

15 Qs

Commercial Law - MCQs

Commercial Law - MCQs

University

20 Qs

Tes Awal Modul 4

Tes Awal Modul 4

University

20 Qs

FIM Week 5 Tutorial

FIM Week 5 Tutorial

University

20 Qs

TORNO ROMI T240

TORNO ROMI T240

University

16 Qs

BAB 7 : SALIRAN

BAB 7 : SALIRAN

University

20 Qs

Aleatório

Aleatório

University

15 Qs

SPS113: TUTORIAL 7

SPS113: TUTORIAL 7

University

20 Qs

TECHTRIX2025 BUGHUNT SET6

TECHTRIX2025 BUGHUNT SET6

Assessment

Quiz

Other

University

Practice Problem

Hard

Created by

Sarmistha Moharer

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the error in the following C code? #include int main() { int arr[3] = {1, 2, 3}; printf("%d", arr[3]); return 0; } Explanation: The array has indices from 0 to 2. Accessing arr[3] is out of bounds.

printf("%d", arr[2]);

printf("%d", arr[3]); (No error)

printf("%d", arr[0]);

printf("%d", arr[4]);

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What should be the correct condition in this code? #include int main() { int x = 5; if (x = 10) { printf("Hello"); } return 0; } Explanation: x = 10 is an assignment, not a comparison. Use == for comparison.

if (x = 10)

if (x == 10)

if x == 10;

if (x := 10)

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Identify the correct line to fix the segmentation fault. #include int main() { int *ptr; *ptr = 10; printf("%d", *ptr); return 0; } Explanation: The pointer is uninitialized, leading to undefined behavior. Assign a valid memory address.

int ptr = 10;

int *ptr = NULL;

int x = 10; int *ptr = &x;

int *ptr = 10;

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Find the correct way to swap two numbers using pointers. #include void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; } int main() { int x = 5, y = 10; swap(x, y); printf("%d %d", x, y); return 0; } Explanation: The function expects pointers, so we must pass the addresses of x and y.

swap(x, y);

swap(&x, &y);

swap(*x, *y);

swap(x, *y);

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Identify the correct loop termination condition. #include int main() { int i = 0; while (i = 10) { printf("%d", i); i++; } return 0; } Explanation: i = 10 is an assignment, not a condition. The loop should run until i < 10.

while (i = 10)

while (i == 10)

while (i < 10)

while (i <= 10)

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the output? #include int main() { printf("%d", printf("RCCIIT")); return 0; } Explanation: printf("RCCIIT") prints "RCCIIT" and returns 6, which is printed by the second printf.

RCCIIT

6

RCCIIT6

Error

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output? #include int main() { int x = 6, y = 1; if (x & y) { printf("Yes"); } else { printf("No"); } return 0; } Explanation: 6 & 1 results in 0 (bitwise AND), so the else block executes.

Yes

No

0

Error

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?