Search Header Logo

BUGHUNT

Authored by Sarmistha Moharer

Other

University

BUGHUNT
AI

AI Actions

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 code? def add(a, b): return a + b result = add(5, "10") print(result)

Syntax error in function definition

Type error (adding int and string)

Missing return statement

No error

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the error in the code? def greet(name): print("Hello, " + name) greet("Alice") greet("Bob", "Charlie")

Missing return statement

Too many arguments in the second function call

Syntax error in print statement

No error

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the error in the code? x = [1, 2, 3] y = x.append(4) print(y)

Syntax error in list append

`append` returns `None`, so `y` is `None`

Incorrect list initialization

No error

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the error in the code? def multiply(a, b): result = a * b return result print(multiply(2))

Missing return statement

Missing argument in function call

Syntax error in function definition

No error

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the error in the code? x = 10 if x > 5: print("x is greater than 5")

Missing colon

Incorrect indentation

Syntax error in condition

No error

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the error in the code? def square(n): return n ** 2 print(square("5"))

Syntax error in function definition

Type error (string cannot be squared)

Missing return statement

No error

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the error in the code? def is_even(n): if n % 2 == 0: return True else: return False print(is_even(5.5))

Syntax error in condition

Incorrect logic for checking even numbers

No error, but logic may not work for floats

No 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

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?