wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Homework 4- Data Types and Selection

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the data type of the value `7.5` in Python?

a)

String

b)

Integer

c)

Float

d)

Boolean

2.

Which of the following is a common syntax error in Python?

a)

Forgetting to close a bracket

b)

Using a variable without declaring it

c)

Dividing by zero

d)

Accessing an index out of range

3.

What will be the output of the following code snippet? ```python if 2 < 4: print("Yes") else: print("No") ```

a)

No

b)

Yes

c)

Error

d)

Nothing

4.

Which of the following is a string in Python?

a)

`3.14`

b)

`42`

c)

`"Hello"`

d)

`False`

5.

What will be the output of the following code snippet? ```python x = 3 if x > 5: print("High") else: print("Low") ```

a)

High

b)

Low

c)

Error

d)

Nothing

6.

Which of the following is a Boolean value in Python?

a)

`0`

b)

`"False"`

c)

`False`

d)

`1.0`

7.

What will be the output of the following code snippet? ```python if True: print("Correct") else: print("Incorrect") ```

a)

Correct

b)

Incorrect

c)

Error

d)

Nothing

8.

Which mode in Python requires you to Save before executing code?

a)

Script Mode

b)

Interactive Mode

c)

Typing Mode

9.

Who benefits from the use of comments?

a)

Python

b)

The program

c)

The Human

d)

The PC

10.

The output of this code would be?

speed= 80

if speed > 70:

print "Speeding"

Else:

print "Continue"

a)

Speed

b)

Speeding

c)

80

d)

Continue