Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python U II_AIDS

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Python provides two basic modes of operation for executing programs. What are they?

a)

Interpreter mode and Interactive mode

b)

Script mode and Command mode

c)

Interactive mode and Command mode

d)

Interpreter mode and Command mode

2.

What is the file extension used for Python scripts in Interpreter mode?

a)

.txt

b)

.py

c)

.exe

d)

.script

3.

Which mode allows the user to work directly with the Python interpreter from the command line and is used to test small pieces of code quickly?

a)

Interpreter mode

b)

Interactive mode

c)

Script mode

d)

Command mode

4.

In Interactive mode, what prompt does Python display for the user to type a command or expression?

a)

>>>

b)

$$

c)

--

d)

::

5.

Which mode is suitable for short code testing or debugging?

a)

Interpreter Mode

b)

Interactive Mode

c)

Both

d)

None

6.

Which type of error occurs before execution and is caused by violation of Python syntax rules?

a)

Syntax Error

b)

Logical Error

c)

Runtime Error

7.

Which type of error in Python gives wrong output due to faulty logic?

a)

Syntax Error

b)

Logical Error

c)

Runtime Error

8.

Which type of error occurs during execution and is caused by division by zero?

a)

Syntax Error

b)

Logical Error

c)

Runtime Error

9.

Which of the following is NOT a built-in data type in Python?

a)

Numbers

b)

String

c)

Array

d)

Tuple

10.

Fill in the blank: Floating point numbers are written with a ________ or in scientific notation.

a)

decimal point

b)

comma

c)

hyphen

d)

colon

11.

Which of the following is a valid string in Python?

a)

0x77

b)

'HELLO'

c)

3.17

d)

5 + 14j

12.

Fill in the blank: Lists in Python are enclosed in ________ brackets.

a)

square

b)

curly

c)

round

d)

angle

13.

Which of the following is an example of a list in Python?

a)

[1, 2, 3]

b)

'HELLO'

c)

3.0

d)

0b101

14.

The elements in a Python list can be changed.

a)

True

b)

False

15.

Which of the following statements about tuples in Python is correct?

a)

Tuples are mutable and can be changed after creation.

b)

Tuples are similar to lists but are immutable.

c)

Tuples are enclosed in square brackets [].

d)

Tuples can only contain numbers.

16.

Fill in the blank: Tuples in Python are enclosed in ___________.

a)

parentheses ( )

b)

curly braces { }

c)

square brackets [ ]

d)

angle brackets < >

17.

Fill in the blank: Sets in Python are defined using ___________.

a)

curly braces {}

b)

square brackets []

c)

parentheses ()

d)

angle brackets <>

18.

What will be the output of the following code? 2 < 3

a)

True

b)

False

c)

None

d)

Error

19.

Comments in a Python program are executable statements and are included using which of the following methods?

a)

No, comments are not executable and are included using the # symbol.

b)

Yes, comments are executable and are included using the // symbol.

c)

No, comments are not executable and are included using the /* */ symbols.

d)

Yes, comments are executable and are included using the symbols.

20.

The type() function in Python is used to determine the type of an object. For example, type(5) returns . Which of the following best describes the purpose of the type() function in Python?

a)

It determines the type of an object.

b)

It converts a string to an integer.

c)

It prints the value of a variable.

d)

It creates a new variable.