wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

Is Python case sensitive when dealing with identifiers?

a)

yes

b)

no

2.

What is the maximum possible length of an identifier?

a)

31 characters

b)

59 characters

c)

10 characters

d)

None of the mentioned

3.

Which of the following is invalid?

a)

_a = 1

b)

__a = 1

c)

__str__ = 1

d)

none of the mentioned

4.

Which of the following is an invalid variable?

a)

my_string_1

b)

1st_string

c)

__

5.

Which of the following is not a keyword?

a)

eval

b)

assert

c)

nonlocal

d)

pass

6.

All keywords in Python are in

a)

lower case

b)

UPPER CASE

c)

Capitalized

d)

True, False and None are capitalized while the others are in lower case.

7.

Which of the following is an invalid statement?

a)

abc = 1,000,000

b)

a b c = 1000 2000 3000

c)

a,b,c = 1000, 2000, 3000

d)

a_b_c = 1,000,000

8.

Which of the following cannot be a variable?

a)

__init__

b)

in

c)

it

d)

on

9.

What is the output of this expression, 3*1**3?

a)

27

b)

9

c)

3

d)

1

10.

Which of these in not a core data type?

a)

Lists

b)

Dictionary

c)

Class

11.

Given a function that does not return any value, What value is thrown by default when executed in shell.

a)

int

b)

bool

c)

void

d)

none

12.

Which of the following will run without errors ?

a)

round(45.8)

b)

round(6352.898,2,5)

c)

round()

d)

round(7463.123,2,1)

13.

What is the return type of function id ?

a)

int

b)

float

c)

bool

d)

dict

14.

What error occurs when you execute?

apple = mango

a)

SyntaxError

b)

NameError

c)

ValueError

d)

TypeError

15.

Which of the following results in a SyntaxError ?

a)

‘”Once upon a time…”, she said.’

b)

“He said, ‘Yes!'”

c)

‘3\’

d)

”’That’s okay”’