wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python 101

Total questions: 104

Worksheet time: 52mins

Name
Class
Date
1.

Why is Python called Python?

a)

Its cos its cool

b)

Guido van Rossum was reading Python script and wanted a unique name.

c)

It was devised using an algorithm.

d)

I don't know.

2.

There are two parts to Python programming

a)

The Shell and New files

b)

Head and the Tail

c)

The inside and the outside

3.

In Python programming what does the shell do?

a)

It lets you test out what your program will do

b)

Lets you write it and save it.

4.

What is the image an example of in Python?

a)

New file

b)

Shell

5.

In Python programming what does the the new file do?

a)

It lets you test out what your program will do

b)

Lets you write it and save it then you can test it in the shell

6.

What is python?

a)

A programming language 

b)

A code 

c)

Nothing

d)

A game 

7.

What is a variable?

a)

Its a special kind of ball.

b)

Its something that can have a value assigned to it - like a response to a question.

c)

Its something to do with something.

d)

I don't know.

8.

What would the following print statement do?

print("Good Morning Class")

a)

Display print("Good Morning Class")

b)

Display Good Morning Class

c)

Do nothing there is no capital P

9.

Which of the following lines of code is the correct one?

a)

Print ("Good Morning Class")

b)

Print "Good Morning Class"

c)

print ("Good Morning Class")

d)

print ("Good Morning Class)

10.

What is wrong with this line of code?

print ("Good Morning Class)

a)

Has a small letter for the word print.

b)

Missing a bracket at the end of the code.

c)

It doesn't have an equals between the variable and the code.

d)

Missing the speech marks at the end of the text.

11.

What is wrong with this line of code?

Print ("Good Morning Class")

a)

Has a capital letter for the word print.

b)

Missing a bracket at the end of the code.

c)

It doesn't have an equals between the variable and the code.

d)

Missing the speech marks at the end of the text.

12.

What is the image an example of in Python?

a)

New file

b)

Shell

13.

What is a integer?

a)

It is a piece of text

b)

It is a whole number

c)

It is a decimal number

d)

It is a true or false answer

14.

What is a real?

a)

It is a piece of text or a character.

b)

It is a whole number

c)

It is a decimal number

d)

It is a true or false answer

15.

What is Boolean?

a)

It is a piece of text or a character.

b)

It is a whole number

c)

It is a decimal number

d)

It is a true or false answer

16.

What is the symbol used when adding the string input from a user to a printed statement?

a)

+ (plus)

b)

, (comma)

17.

Why do you sometimes need to include (str) next to a number?

a)

Because you want to turn it into a integer rather than a string

b)

Because you want it to be turned into a string rather than be an integer

c)

Because that is what the teacher said

18.

What is the symbol used when adding the integer input from a user to a printed statement?

a)

+ (plus)

b)

, (comma)

19.

Why do you sometimes include int(input(...))?

a)

Because you want to turn the entered information into a integer rather than a string

b)

Because you want to turn the entered information into a string rather than a integer

c)

Because that is what the teacher said

20.

Which of the following code would you use to find out the length of a word?

a)

HELP!!

b)

word.length

c)

find length word

d)

len(word)

21.

Which symbol do you use to turn the rest of the line into a comment or to have the program skip over it?

a)

@

b)

£

c)

?

d)

#

22.

What colour should the text go if it has been turned into a comment?

a)

Blue

b)

Green

c)

Yellow

d)

Red

23.

If Star Wars was put as answer what would be the response?

a)

Nothing

b)

"What's Star Wars?"

c)

"May the force be with you"

d)

"Let it go!"

24.

If I were to put in the answer of "Cardiff" which reponse would I get back?

a)

Incorrect

b)

Correct

25.

Python language was developed in what year?

a)

1985

b)

2001

c)

1991

d)

1820

26.

Is python an interpreter or compiler programming language?

a)

Compiler

b)

Interpreter

27.

Python uses indentation to block code into chunks

a)

True

b)

False

28.

Python is a

a)

text language

b)

database language

c)

programming language

29.

Comments in Python are written with a special character, which one?

a)

brackets

b)

hashtag

c)

coma

30.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
31.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
32.
What is the name of the programming language we are learning?
a)
Scratch
b)
Python
c)
Pie thin
d)
Scribble
33.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

34.
When you have an error in your code what is the term to summarise finding and fixing that error?
a)
Error checking
b)
Debugging
c)
Syntax finder
d)
Error finder
35.
What is Python?
a)
text based programming language
b)
word processor 
c)
spreadsheet
d)
block based programming language
36.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
37.
Which statement correctly assigns the string "Tanner" to the variable name?
a)
name  = print( "Tanner")
b)
input("Tanner")
c)
name = "Tanner"
d)
name = input("Tanner")
38.
What is python named after
a)
The snake
b)
Television show called Monty Python
39.
What is the name of the environment in Python that write your programs and then test them out?
a)
Shell
b)
Window
c)
IDLE
d)
CLI
40.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
41.
What button do you press to compile (run) your program so that it runs in the shell?
a)
F3
b)
F5
c)
F7
d)
F9
42.
What does the term 'debug' mean?
a)
Identify errors and fix them.
b)
Making a calculation
c)
A set of instructions
d)
Looking at code
43.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
44.
What syntax can you use to insert a line break between strings so that they appear over multiple lines?
a)
/
b)
\n
c)
\l
d)
n
45.

If you want to create an empty list called colours in Python, which of the following is correct?

a)

colours = [ ]

b)

colours = ( )

c)

colours = { }

d)

colours = <>

46.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints
47.
What is the position of the name "Robert" in the following list:
a)
0
b)
1
c)
2
d)
3
48.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
49.

What will the output be from the following code?

print(3+4)

a)

3+4

b)

7

c)

SyntaxError

d)

print(3+4)

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

What will the output be from the following Python code?

print(Hello world!)

a)

Hello world!

b)

SyntaxError

c)

Hello world

d)

print(Hello world!)

52.

What is the Python built-in function to converts a number to a string?

a)

str()

b)

int()

c)

parseInt()

d)

convert

53.

Which of these is correct Python conditional statement?

a)

IF answer == "Yes":

b)

if answer == "Yes"

c)

if answer == "Yes":

d)

if answer = "yes":

54.

variable.sort() will do what?

a)

Sort the list into alphabetical order

b)

Sort the list into reverse order

c)

Create a new list

d)

Error

55.

x = 5

y = 6

print("x*y")


The code above displays the following:

a)

11

b)

x*y

c)

Syntax Error

d)

30

56.

cakeAmount = input()

print "We have", cakeAmount, " cakes"


The above code is run. You type:

six


Select the correct output.

a)

We have 6 cakes

b)

We have six cakes

c)

Error

57.

A String is a list of what?

a)

Shapes

b)

Characters

c)

Symbols

d)

Letters

58.

When finding the length of a String, how will the result be displayed?

a)

As a Real Number

b)

As an Integer

c)

As a Boolean Value

d)

As a Description

59.

what is a string?

a)

any numeric value

b)

any float value

c)

any character value

d)

any special symbol value

60.

how we store string value in variable?

a)

'string'

b)

"string"

c)

%string%

d)

#sring#

61.

The pseudocode below assigns two strings to two variables:

title = "computer science"

level = "gcse"

What would the Python code: len(level) return?

a)

2

b)

3

c)

4

d)

1

62.

The pseudocode below assigns two strings to two variables:

title = "computer science"

level = "gcse"

What is title[0]?

a)

'c'

b)

'o'

c)

'g'

d)

An error

63.

The pseudocode below assigns two strings to two variables:

title = "computer science"

level = "gcse"

What is level[3]?

a)

'g'

b)

'e'

c)

'c'

d)

's'

64.
What is a data structure?
a)
A list of variables
b)
A list of variables and strings
c)
A facility that holds more than one value
65.
How many elements would the array 'student_marks(10)' hold?
a)
Nine elements
b)
Ten elements
c)
Eleven elements
66.

Fruits = ["Apple","Pear","Orange","Grape","Pineapple",'Pen"]

What will be displayed if I type in:

print(Fruits[2])

a)

Orange

b)

Apple

c)

Pear

d)

Grape

67.

When talking about lists, what does append mean?

a)

Add a value to the end of a list

b)

Add a value to the begining of a list

c)

Add the word pen to a list

d)

Print out the list

68.

What does this line of code do?

Fruits.reverse()

a)

Reverse the order of a list

b)

Put a list into alphabetical order

c)

Put a list into numerical order

d)

Doesn't do anything a list

69.

In an list, what is the first numbered position in which data can be stored?

a)

Position 0

b)

Position 1

70.

Which of these is the correct code for creating a list of names?

a)

nameList = John, Harry, Jesse, John, Harry, Harry

b)

nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")

c)

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

d)

nameList = [John, Harry, Jesse, John, Harry, Harry]

71.

What is used to separate elements in a list?

a)

Bracket

b)

Comma

c)

Full Stop

d)

Space

72.

variable.sort() will do what?

a)

Sort the list into alphabetical order

b)

Sort the list into reverse order

c)

Create a new list

d)

Error

73.

An empty list can be declared as

a)

fruitList = ""

b)

fruitList = ["empty"]

c)

fruitList == []

d)

fruitList = []

74.

What is a loop?

a)

A loop without conditions

b)

A loop with an if statement

c)

In computer programming, a loop is an order of instructions that repeats for many times

75.

Should this be a loop?

a)

No, because there is no pattern.

b)

Yes, because every middle square has honey or nectar.

76.

The action of doing something over and over again.

a)

Looping

b)

Bugging

c)

Programming

77.

What is the action of doing something over and over again?

a)

Repeat

b)

Loop

c)

Debugging

78.

What does run mean?

a)

to make a code for a program

b)

to make a program complete an algorithm

c)

to make a website show up on your screen

79.

Is there more than one way to code a puzzle?

a)

No

b)

No, but you can make up your own design

c)

Yes

d)

Yes, but it will be counted wrong

80.

What does this code do?

a)

Moves forward 1 time

b)

Moves forward forever

c)

Moves forward 5 times

d)

Moves left

81.

What shape does this code make?

a)

Rectangle

b)

Triangle

c)

Square

d)

Circle

82.
Coding can be used to
a)
Program robots
b)
create websites, games & apps
c)
tell computers what to do
d)
all of the above
83.
The language of computer programming is 
a)
Spanish
b)
English
c)
Code
d)
Pig-latin
84.

In coding terms an action or event you want to repeat multiple times is called a

a)

loop

b)

do-over

c)

sequence

85.

Infinite loops are also called _________ loops.

a)

endless

b)

forever

c)

never ending

86.

A forever loop is a code pattern that repeats ___________________ .

a)

as long as the program is running

b)

for a set number of times

c)

until a condition is met

87.

An action that causes something to happen.

a)

A loop.

b)

A program.

c)

An event.

88.
a loop within a loop, an inner loop within the body of an outer one.
a)
Nested Loop
b)
Condition
c)
while loop
d)
For Loop
89.

Look at the following code, what will it generate

a)

1,2,3,4,5,6,7,8,9,10,11,12

b)

0,1,2,3,4,5,6,7,8,9,10,11,12

c)

1,2,3,4,5,6,7,8,9,10,11,12,13

d)

0,1,2,3,4,5,6,7,8,9,10,11,12,13

90.

What does the following program display?

a)

1,2,3,4

b)

1,2,3,4,5

c)

counter,counter,counter,counter,counter

d)

0,1,2,3,4,5

91.

When do you know when you come to the end of the loop?

a)

Its states End loop

b)

The command End is given

c)

The indentation stops

92.
What is the name of the environment in Python that write your programs and then test them out?
a)
Shell
b)
Window
c)
IDLE
d)
CLI
93.
What button do you press to compile (run) your program so that it runs in the shell?
a)
F3
b)
F5
c)
F7
d)
F9
94.
What does the print function do in python?
a)
It's a variable.
b)
It can input data.
c)
It displays something like a string or integer
d)
It loops the code.
95.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
96.

A part of the program that does not work correctly.

a)

Bug

b)

Break

c)

Loop

97.

How long are the sides of this shape?

a)

2 pixels

b)

120 pixels

c)

150 pixels

d)

Purple pixels

98.

Which of the following means not equal to

a)

==

b)

!=

c)

>

d)

=

99.

Why are arrows used in flowcharts

a)

To show a statement is equal to another

b)

To allow the computer to run the program

c)

To indicate a flow of direction

d)

To make them look nice

100.

Which of these is the python code for 'then'

a)

>

b)

<

c)

d)

:

101.
a)
5
4
3
2
1
b)
4
3
2
1
0
c)
5  4  3  2  1
d)
4  3  2  1  0
102.

What is the variable in this for loop?

a)

x

b)

(6)

c)

for

d)

range

103.

A condition is

a)

a statement that is either True or False

b)

a string

c)

an integer

d)

a list

104.

Which kind of loop would be used?


I need a program that will keep letting me add a monthly payment for 12 months.

a)

FOR Loop

b)

WHILE Loop