wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python-Variables, Expressions

Total questions: 12

Worksheet time: 7mins

Name
Class
Date
1.

Which of the following is a comment in Python?

a)

/* This is a test */

b)

// This is a test

c)

* This is a test

d)

# This is a test

2.

What does the following code print out?

print("123" + "abc")

a)

123 abc

b)

This is a syntax error because you cannot add strings

c)

123+abc

d)

123abc

3.

Which of the following is a bad Python variable name?

a)

Spam

b)

_spam

c)

23spam

d)

SPAM23

4.

Which of the following variables is the "most mnemonic"?

a)

x1q3z9ocd

b)

variable_173

c)

hours

d)

x

5.

Which of the following is not a Python reserved word?

a)

iterate

b)

continue

c)

break

d)

else

6.

Which of the following elements of a mathematical expression in Python is evaluated first?

a)

*

b)

/

c)

()

d)

+

7.

What will be the value of x after the following statement executes:

x = 1 + 2 * 3 - 8 / 4

a)

5.0

b)

4

c)

15

d)

3.0

8.

What does the Python input() function do?

a)

Take a screen shot from an area of the screen

b)

Connect to the network and retrieve a web page

c)

Read the memory of the running program

d)

Pause the program and read data from the user

9.

Assume the variable x has been initialized to an integer value (e.g., x = 3). What does the following statement do?

x = x + 2

a)

This would fail as it is a syntax error

b)

Produce the value "false" because "x" can never equal "x+2"

c)

Retrieve the current value for x, add two to it and put the sum back into x

d)

Create a function called "x" and put the value 2 in the function

10.

How to check the data type of 45.6

(a)  

11.

Python was coined by

a)

Charles Severence

b)

James Gosling

c)

Guido Van Rossum

d)

Dennis Ritchie

12.

Python Application Programming Subject Code:

a)

18EC61

b)

18EC646

c)

18EC664

d)

18EC466