wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python

Total questions: 53

Worksheet time: 27mins

Name
Class
Date
1.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
2.
What will the output be from the following code?
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
3.

A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly.

a)

True

b)

False

4.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints
5.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
6.

What will the output be from the following code?

print(3+4)

a)

3+4

b)

7

c)

SyntaxError

d)

print(3+4)

7.
print("12"*3)
What would this print?
a)
36
b)
121212
c)
24
d)
12*3
8.

What will the output be from the following Python code?

Print("Hello world!")

a)

NameError

b)

Hello world!

c)

"Hello world"

d)

Print(Hello world!)

9.

What will the output be from the following Python code?

print(9/3)

a)

3

b)

3.0

c)

9/3

d)

SyntaxError

10.
The correct way to write a variable in Python?
a)
my_variable = 10
b)
my variable = 10
c)
my_variable is 10
d)
my_variable: 10
11.
What will the output be from the following code?
print("Hello" + "world!")
a)
Hello world!
b)
Helloworld!
c)
SyntaxError
d)
"Hello" "world!"
12.
What will the output be from the following code?
print(9/3*2+4-5)
a)
19
b)
5.0
c)
0.5
d)
5
13.
Which Python command is used to output information to the screen?
a)
read
b)
output
c)
print
d)
display
14.

Which of the following are the fundamental building blocks of a python program?

a)

identifiers

b)

constants

c)

punctuators

d)

tokens

15.

Identifier name cannot be composed of special characters other than _______________

a)

underscore(_)

b)

&

c)

$

d)

#

16.

Python takes __________ indented spaces after the function declaration statement by default.

a)

5

b)

6

c)

4

d)

1

17.

Single line comments in python begin with ___________ symbol.

a)

#

b)

"

c)

'''

d)

%

18.

What is the order of precendence of arithmetic operators given below in python?

1. Paranthesis 2.Exponential 3.Multiplication 4. Division 5. Addition 6.Subtraction

a)

1,2,3,4,5,6

b)

2,3,4,5,6,1

c)

1,3,2,6,4,5

d)

4,6,5,2,3,1

19.

What will be the output of the following code?

x,y=2,6

x,y=y,x+2

print(x,y)

a)

6 6

b)

4 4

c)

4 6

d)

6 4

20.

The reserved words used in python interpreter to recognize the structure of a program is termed as __________

a)

identifiers

b)

tokens

c)

literals

d)

keywords

21.

Which of the following operator is used for floor divivsion?

a)

*

b)

/

c)

**

d)

//

22.

Which of the following is a valid statement?

a)

a=b=c=20,60

b)

a,b,c=10,20,30

c)

a b c = 10 20 30

d)

a_b_c=20

23.

AN identifier must be a keyword of python

a)

True

b)

False

24.

Integers and strings are immutable data types

a)

True

b)

False

25.

3+a=c is a valid statement

a)

True

b)

False

26.

The input() always returns a value of an integer type

a)

True

b)

False

27.

The print() without any value or name or expression prints a blank line

a)

True

b)

False

28.

"AISSCE- 2020" is a valid string variable in python

a)

True

b)

False

29.

In python, integer data type has a fractional part

a)

True

b)

false

30.

None literal in python means "there is nothing here"

a)

True

b)

False

31.

Python supports multiple assignments to multiple variables

a)

True

b)

False

32.

The correct way to convert user input is:

a)

birth_year = number(input())

b)

birth_year = int(input())

c)

birth_year = (input(int))

d)

birth_year = int(input)

33.

You assign a value to a variable with which symbol

a)

@

b)

==

c)

=

d)

*

34.
what is 8%2
a)
0
b)
16
c)
24
d)
86
35.

Python is case sensitive?

a)

No

b)

Yes

c)

Both cases

d)

None of them

36.

Choose the INVALID identifiers from the following

a)

NUmbEr1

b)

1NUMBer

c)

A_B

d)

A&B

37.

________ are data items that have a fixed value

a)

Tokens

b)

Literals

c)

Keyword

d)

Operators

38.

Examples of String Literals

a)

"ABC1273"

b)

nfjdlsj@@$

c)

12638

d)

'7e920938'

39.

Which of the following is a Boolean literal ?

a)

True

b)

false

c)

False

d)

true

40.

Example of valid identifiers

a)

12Name

b)

name$

c)

total-mark

d)

total_marks

41.

What is a String?

a)

A data type that contains whole numbers. eg: 3, 45, 124

b)

Numbers with decimal point. eg: 0.5, 2.45, 56.04

c)

Group of characters between quotation marks. eg: "dog"

d)

Data type that can only be True or False.

42.

Which value is an Integer?

a)

64

b)

"cat"

c)

True

d)

0.5

43.

What is a Float?

a)

A data type that contains whole numbers. eg: 3, 45, 124

b)

Numbers with decimal point. eg: 0.5, 2.45, 56.04

c)

Group of characters between quotation marks. eg: "dog"

d)

Data type that can only be True or False.

44.

Which value is a Float?

a)

64

b)

"cat"

c)

True

d)

0.5

45.

Debugging is

a)

how characters are arranged in a statement

b)

detecting or removing errors from a program

c)

removing viruses from a computer

d)

the meaning of each of the characters and symbols in the program

46.

An exception is

a)

the structure of form of the code

b)

the meaning of the characters and words in the code

c)

the statement that is missing from the instructions

d)

an event occurring during execution of a program which disrupts the flow of the program's instructions

47.

A block is

a)

a statement including elements of a command

b)

the structure and form of the code

c)

source code that is grouped together

d)

meaning assigned to symbols, characters and words

48.
What is the output of this expression, 3*1**3?
a)
3
b)
27
c)
9
d)
1
49.
Which of the following is mutable dtatype?
a)
int
b)
str
c)
list
d)
bool
50.
Which of the following is immutable dtatype?
a)
int
b)
set
c)
list
d)
dict
51.

Output of ((5<10) and (5<2))

a)

true

b)

false

c)

Error

d)

None

52.

Escape sequence is represented by a ____ followed by one or more characters

a)

Front slash

b)

Double Quote

c)

Single Quote

d)

Back Slash

53.

Size of the string "Ant Man"

(a)