wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Programming

Total questions: 20

Worksheet time: 40mins

Name
Class
Date
1.

Can be executed by writing directly in the command line?

a)

Syntax

b)

Indentation

c)

Comments

d)

Variables

2.

Is a high-level programming language designed to be easy to read and simple to implement.

(a)  

3.

Refers to the spaces at the beginning of a code line to indicate a block of code.

a)

Syntax

b)

Indentation

c)

Comments

d)

Variables

4.

Starts with a "#" and can be used to explain Python code.

a)

Syntax

b)

Indentation

c)

Comments

d)

Variables

5.

Which of the following describes Comments in Python?

a)

Can be used to explain Python code.

b)

Can be used to make the code more readable.

c)

Can be used to prevent execution when testing code.

6.

Are containers for storing data values?

a)

Syntax

b)

Indentation

c)

Comments

d)

Variables

7.

Which of the following describes Variables in Python?

a)

A variable is created when you assign a value to it.

b)

Variables are case-sensitive.

c)

Can be used to prevent execution when testing code.

8.

Which of the following has the correct indentation?

a)
b)
c)
9.

Which technique in writing variables was used below?

myVariableName = “CodeCombat”

a)

Camel Case

b)

Pascal Case

c)

Snake Case

10.

Which technique in writing variables was used below?

MyVariableName = “CodeCombat”

a)

Camel Case

b)

Pascal Case

c)

Snake Case

11.

Which technique in writing variables was used below?

my_variable_name = “CodeCombat”

a)

Camel Case

b)

Pascal Case

c)

Snake Case

12.

Which of the following are vaild variables?

a)

myvar = “CodeCombat”

b)

my-var = “CodeCombat”

c)

MYVAR = “CodeCombat”

d)

2myvar = “CodeCombat”

13.

Are created using square [ ] brackets.

a)

List

b)

Tuple

c)

Set

d)

Dictionary

14.

Are created using round ( ) brackets.

a)

List

b)

Tuple

c)

Set

d)

Dictionary

15.

Are created using curly { } brackets. This collection is unordered, unchangeable, and unindexed.

a)

List

b)

Tuple

c)

Set

d)

Dictionary

16.

Are used to store data values in key:value pairs.

a)

List

b)

Tuple

c)

Set

d)

Dictionary

17.

The (a)   keyword is pythons way of saying “if the previous conditions were not true, then try this condition”.

18.

The (a)   keyword catches anything which isn't caught by the preceding conditions.

19.

What is the positive index of the item "mouse"


animals = ["cat", "dog", "mouse", "bird"]

a)

0

b)

1

c)

2

d)

3

20.

What is the negative index of the item "dog"


animals = ["cat", "dog", "mouse", "bird"]

a)

-1

b)

-2

c)

-3

d)

-4