wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

Which of the following functions can help us to find the version of python that we are currently working on?

a)

sys.version(1)

b)

sys.version(0)

c)

sys.version()

d)

sys.version

2.

What is the order of precedence in python?

a)

Exponential, Parentheses, Multiplication, Division, Addition, Subtraction

b)

Exponential, Parentheses, Division, Multiplication, Addition, Subtraction

c)

Parentheses, Exponential, Multiplication, Division, Subtraction, Addition

d)

Parentheses, Exponential, Multiplication, Division, Addition, Subtraction

3.

What will be the output of the following Python code snippet if x=1?

x<<2

a)

4

b)

2

c)

1

d)

8

4.

What will be the output of the following Python function?

len(["hello",2, 4, 6])

a)

Error

b)

6

c)

4

d)

3

5.

What arithmetic operators cannot be used with strings in Python?

a)

*

b)

+

c)

-

d)

All of the mentioned

6.

To add a new element to a list we use which Python command?

a)

list1.addEnd(5)

b)

list1.addLast(5)

c)

list1.append(5)

d)

list1.add(5)

7.

What will be the output of the following Python expression?

round(4.576)

a)

4

b)

4.6

c)

5

d)

4.5

8.

What will be the output of the following code snippet?

example = ["Sunday", "Monday", "Tuesday", "Wednesday"];

print(example[-3:-1])

a)

['Monday', 'Tuesday',

Wednesday]

b)

['Monday', 'Tuesday']

c)

['Tuesday', 'Wednesday']

d)

['Wednesday', 'Monday']

9.

An exception is _______.

a)

a module

b)

a special function

c)

a special module

d)

None of the above

10.

What does ~~~~4 evaluates to ?

a)

-4

b)

+4

c)

-5

d)

+5

11.

Which statement is correct?

a)

List is mutable and tuple is immutable

b)

List is immutable and tuple is mutable

c)

Both are immutable

d)

Both are mutable

12.

Which one of the following is not a python's predefined datatype?

a)

List

b)

Dictionary

c)

Tuple

d)

Class

13.

Which one of these is floor division?

a)

/

b)

%

c)

//

d)

$

14.

In python programming, pass is a null statement.

a)

True

b)

False

15.

Which of the following is a python tuple?

a)

[1,2,3]

b)

[]

c)

([1,2],[2,3])

d)

None of the above