wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

ByteBattle 2.0(3)

Total questions: 30

Worksheet time: 20mins

Name
Class
Date
1.

Hey Aashi, Aditi, and Ria! Can you guess which function is the superstar for displaying output in Python?

a)

display

b)

output

c)

print

d)

show

2.

To take user input in Python, we use the ________ function.

a)
write()
b)
scan()
c)
read()
d)
input()
3.

Hey Avni, can you help Tisha figure out the correct syntax for declaring a variable in Python? Which one do you think it is?

a)

variable_name = value

b)

variable_name -> value

c)

variable_name : value

d)

value = variable_name

4.

Which of the following is the correct way to create a list in Python?

a)

list = []

b)

list = ()

c)

list = {}

d)

list = <>

5.

What symbol is used for comments in Python?

a)

//

b)

#

c)

/*

d)

6.

Hey there, coding wizards! If Advait and Shreya were to divide 5 by 2 in Python, what would their magical result be?

a)

3

b)

1.5

c)

2.5

d)

2

7.

____________ operator is used for exponentiation in Python.

a)
**
b)
%%
c)
//
d)
^
8.

Which of the following bitwise operators is used to perform a bitwise AND operation in Python?

a)

&

b)

|

c)

^

d)

~

9.

What will be the result of the expression: 5 & 3 in Python?

a)

1

b)

2

c)

3

d)

0

10.

Which operator is used for bitwise NOT in Python?

a)

!

b)

~

c)

^

d)

&

11.

Variable names in Python can start with a number.

a)
True
b)
False
12.

What will be the output of the following code: print(5++3) in Python?

a)

8

b)

5

c)

Syntax Error

d)

None

13.

In Python, what does the ++ operator do?

a)

Increments the value by 1

b)

Decrements the value by 1

c)

Has no effect

d)

Causes a syntax error

14.

Which of the following statements is true regarding the ++ operator in Python?

a)

It is a valid operator

b)

It can be used to increment variables

c)

It does not exist in Python

d)

It is used for string concatenation

15.

What will be the output of the following code: print(True and False)?

a)

True

b)

False

c)

None

d)

Syntax Error

16.

In Python, which operator is used to negate a boolean value?

a)

!

b)

~

c)

NOT

d)

^

17.

What will be the output of the following code: print(True or False)?

a)
0
b)
None
c)
True
d)
False
18.

What will be the output of the following code: print(!False)?

a)
SyntaxError
b)
None
c)
True
d)
0
19.

What will be the output of the following code: print((True or False) and False)?

a)
None
b)
False
c)
True
d)
True and False
20.

What will be the output of the following code: print((True and False) or True)?

a)
None
b)
False
c)
True
d)
Error
21.

What will be the output of the following code?

import math

print(math.ceil(4.3)))

a)
3
b)
6
c)
4
d)
5
22.

What is the output of the following code?

x = 5

y = "5"

print(x + y)

a)
5 is not a valid operation
b)
TypeError
c)
TypeError: unsupported operand type(s)
d)
5
23.

What is the output of the following code?

x = "7"

y = "5"

print(x + y)

a)
75
b)
55
c)
75.0
d)
12
24.

Which of the following is used to define a block of code (body of loop, function, etc.) in Python?

a)
Braces
b)
Semicolons
c)
Parentheses
d)
Indentation
25.

What will be the output of the following code?

x = 5

y = 10

print(x == y)

a)
False
b)
10
c)

5==10

d)
True
26.

What is the output of this code?

x = "Hello"

y = "World"

print(x + y)

a)
HelloWorld!
b)
Hello World
c)
HelloWorld
d)
WorldHello
27.

What is the result of this operation?

3 * "abc"

a)
3abc
b)
abcabc
c)
abcabcabc
d)
abcabcabcabc
28.

Which of the following will not raise a syntax error in Python?

a)

Print("Hello, World!")

b)

print("Hello, World!");

c)

printf("Hello, World!")

d)

print("Hello, World!")

29.

What will be the output of the following code?

x = 5

y = "10"

print(x + int(y))

a)
15.0
b)
5
c)
10
d)
15
30.

Which of the following is not a valid Python keyword?

a)

if

b)
def
c)
hello
d)

else