TECHTRIX2025 BUGHUNT SET6

TECHTRIX2025 BUGHUNT SET6

University

20 Qs

quiz-placeholder

Similar activities

General Knowledge (hard)

General Knowledge (hard)

KG - Professional Development

20 Qs

Sals of Goods Act 1930

Sals of Goods Act 1930

University

20 Qs

Tax Goes to School

Tax Goes to School

University

15 Qs

SIMULACRO DEL CURSO ADMISION

SIMULACRO DEL CURSO ADMISION

University

20 Qs

TRANSFORMAR - 001

TRANSFORMAR - 001

University

20 Qs

WEBINAR NASIONAL

WEBINAR NASIONAL

University

16 Qs

C-L-S-spine Position

C-L-S-spine Position

University

15 Qs

A QUICK REFRESH

A QUICK REFRESH

University

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