wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python / Algorithms 7/3/19

Total questions: 70

Worksheet time: 58mins

Name
Class
Date
1.
To create a newline at the end of prompt, you can use which of the following expressions?
a)
\new
b)
\n
c)
\break
d)
\return
2.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
3.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
4.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
5.
What is the name of the programming language we are learning?
a)
Scratch
b)
Python
c)
Pie thin
d)
Scribble
6.
What would print (10 + 16) produce?
a)
20
b)
22
c)
24
d)
26
7.
Which of these would work as a piece of code?
a)
IF answer == "Yes":
b)
if answer == "Yes"
c)
if answer == "Yes":
d)
if answer = "yes":
8.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif
9.
What is the answer to print (12/6)?
a)
1
b)
2
c)
6
d)
10
10.
How do you display text?
a)
input
b)
output
c)
print
d)
variable 
11.
What is python?
a)
a programming language 
b)
DTP software 
c)
Spreadsheet software
d)
Computer 
12.
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
13.
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
14.

people = ["John", "Rob", "Bob"]

print (people[1])

what would this result be?

a)
John
b)
Rob
c)
Bob
15.

people = ["John", "Rob", "Bob"]

print (people[-1])

what would this result be?

a)
John
b)
Rob
c)
Bob
16.

people = ["John", "Rob", "Bob"]

print (people[4])

what would this result be?

a)
John
b)
Rob
c)
Bob
d)
Error
17.
Python is an example of a....
a)
Text-based programming language
b)
Object orientated programming language
c)
language written in java script
d)
Visual-based programming language
18.

What is the name of this symbol (>>>)?

a)

Chevrons

b)

Hash tags

c)

Colon

d)

Semi Colon

19.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
20.
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
21.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
22.
To repeat a fixed number of times use a
a)
while loop
b)
for loop
c)
if loop
d)
indentation
23.
To repeat until a particular condition is true use
a)
while loop
b)
for loop
c)
if loop
d)
indentation
24.
Data type that can only be true or false
a)
int
b)
string
c)
bool
d)
float
25.
The character that must be at the end of the line for if, while, for etc.
a)
:
b)
;
c)
.
d)
,
26.
Decides if a string only contains numbers
a)
isalpha()
b)
isnumeric()
c)
int()
d)
string()
27.
Tells the interpreter that the code which follows is a function
a)
const
b)
int
c)
def
d)
while
28.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
29.

Look at the Algorithm Below. In the corresponding Trace Table, what value should 'B' be?

a)

1

b)

3

c)

5

d)

7

30.

Look at the Algorithm Below. In the corresponding Trace Table, what value should 'C' be?

a)

1

b)

3

c)

8

d)

13

31.

Look at the Algorithm Below. In the corresponding Trace Table, what value should 'D' be?

a)

11

b)

13

c)

8

d)

1

32.

An algorithm can be defined as...

a)

...defined set of steps that can be used to complete a task

b)

...a set of steps that can be used to complete a task

c)

a random set of steps that can be used to complete a task

d)

an order of doing things correctly to complete something

33.

Sequence is when...

a)

...instructions are executed one after another

b)

instructions are executed one after another in a series

c)

instructions are executed by the user

d)

instructions are executed one after another but not always in series

34.

Selection is when...

a)

...a program will execute instructions regardless of what the user does

b)

...a program will execute certain instructions based on the user's actions

c)

...a program will execute certain instructions based on conditions

d)

....a program will execute all instructions regardless of what the user does

35.

Selection statements include...

a)

IF, THEN, ELSE & CASE

b)

IF, ELSE, & CASE

c)

IF, THAN, ELSE & CASE

d)

IF, THEN, ELSE, ELIF & CASE

36.

In computer programming 'iteration' is used to...

a)

... loop around and around a piece of code until the correct answer is chosen

b)

...loop around a piece of code until a condition is met that activates the next part of the program

c)

...loop around and around a piece of code until a condition is met that ends the iteration

d)

...loop twice around a piece of code until a condition is met that ends the iteration

37.

In programming a translator is used to convert different programming languages into machine code. There are three types...

a)

Assembler, interpreter & compiler

b)

Assembler, identifier & compiler

c)

Assembler, identifier & interpreter

d)

Compiler, identifier & interpreter

38.

An assembler translator...

a)

...converts assembly language programs into machine code

b)

...converts programs created in any language into machine code

c)

...converts programs created in any high level language into machine code

39.

An integer is a data type that typically takes up 2 bytes of memory. Which of the follow is an integer?

a)

2.6

b)

"2.6"

c)

26

d)

26.0

40.

A real number (or float) is a data type for fractional numbers that typically takes up 4 bytes of memory. Which of the following is a real number?

a)

26

b)

"26.0"

c)

260

d)

2.60

41.

A string is a data type that typically takes up 1 byte per character. Which of the following is a string?

a)

hello world

b)

"!£llo world4"

c)

"hello world

d)

hello world"

42.

What is the main difference between a constant and a variable?

a)

A constant's value remains the same whereas a variable's value can change

b)

A constant's value only changes if a variable's value changes

c)

A constant's value remains the same whereas a variable's value can be changed by the user

d)

A constant's value remains the same whereas a variable's value can be changed, but only once

43.

What is a variable

a)

A piece of data held in memory

b)

A piece of code

c)

An arithmetic operator

d)

An algorithm

44.

Which is NOT an arithmetic functon

a)

+

b)

*

c)

/

d)

:

45.

Which symbol represents a decision?

a)
b)
c)
d)
46.

What does this symbol represent in a flowchart?

a)

Input or Output

b)

The Flow of Data

c)

A Start or End

d)

A Process

47.

What does this symbol represent in a flowchart?

a)

A Decision

b)

A Subprocess

c)

A Start or End

d)

The Flow of Data

48.
What is a flowchart?
a)
A textual representation of algorithms.
b)
A graphical representation of algorithms.
c)
A cluster of different shapes.
d)
A program code written in Logo.
49.

What is an input?

a)

read weight

b)

display area

c)

compute sum

d)

x+y=z

50.

Which are the basic structures of programs?

a)

Sugar and Spice and All things nice

b)

Sequence, Selection and Iteration

c)

Variables and flowcharts

d)

Arithmetic and logic

51.

Breaking a problem down into its component parts

a)

Algorithm

b)

Decomposition

c)

Abstraction

d)

Iteration

52.
What is the correct definition of an algorithm?
a)
An algorithm is a step by step instructions to solve a problem.
b)
An algorithm is a process of baking bread.
c)
An algorithm is a software used to compute numbers.
d)
An algorithm is the process of breaking problems.
53.
Abstraction is.....
a)
The process of drawing abstract pictures.
b)
The process of assigning values to variables.
c)
The process of breaking down problems.
d)
The process of removing unnecessary details from a problem.
54.

What is Pseudocode?

a)

Syntax code that is written in Plain English.

b)

Syntax code that is simplified into code that is easier to understand.

c)

Python code that is now syntax code

d)

Syntax code that is python code

55.

Pseudocode can be understood by:

a)

Only Users

b)

Only Computers

c)

Both

56.

How do you show something is printed in pseudocode?

a)

SEND 'x' TO DISPLAY

b)

RECEIVE 'x' FROM DISPLAY

c)

SEND 'x' TO KEYBOARD

d)

RECEIVE 'x' FROM KEYBOARD

57.

How do you show the number 10 being received as an input?

a)

RECEIVE '10' FROM KEYBOARD (STRING)

b)

RECEIVE '10' FROM KEYBOARD (INTEGER)

c)

RECEIVE '10' FROM KEYBOARD (FLOAT)

d)

RECEIVE 10 FROM KEYBOARD (FLOAT)

58.

There is a specific way to write pseudocode

a)

True

b)

False

59.

How do you show 'Yes' being received as an input?

a)

RECEIVE 'Yes' FROM DISPLAY (STRING)

b)

SEND 'Yes' FROM DISPLAY (STRING)

c)

RECEIVE 'Yes' FROM KEYBOARD (STRING)

d)

RECEIVE 'YES' FROM KEYBOARD (STRING)

60.

What is the variable name in this Pseudocode?


START

SEND 'Whats your name?' TO DISPLAY

RECEIVE agE FROM KEYBOARD (INT)

a)

age

b)

Age

c)

AGE

d)

agE

61.

What must you start and end every pseudocode with?

a)

Begin/End

b)

Start/End

c)

Begin/Finish

d)

End/Finish

62.

What is wrong with this pseudocode?


START

SEND 'x' TO SCREEN

RECEIVE 'x' FROM KEYBOARD(STRING)

END

a)

Nothing

b)

Should be Integer instead of string

c)

Should say Display instead of Screen

d)

Should say print instead of send

63.

The pseudocode command to open the files called 'bob.txt' so it can be written to.

a)

Fbob = openFile('bob.txt','r')

b)

Fbob = openRead('bob.txt')

c)

Fbob = openWrite('bob.txt')

d)

Fbob.close()

e)

WHILE NOT Fbob.endOfFile()

64.
What is this symbol used for in a flowchart?
a)
A decision/question
b)
A task to carry out
c)
An input or output
65.
What does the word Pseudo mean?
a)
False/Fake
b)
Unfinished
66.
This is an example of pseudocode:
OUTPUT "Enter your name"
a)
True
b)
False
67.
What is the Output if the user enters:
Yes
a)
Leave umbrella at home
b)
Take an umbrella
68.

There is a specific way to write pseudocode

a)

True

b)

False

69.
Which of the following is the definition of a constant?
a)
A container which is used to store values such as the number of attempts a person tries to log on to a network.
b)
A language that is similar to a real programming language, but is easier for humans to understand although it doesn’t actually run on a computer. It can easily be converted to a regular programming language.
c)
A value that cannot be altered by the program during normal execution: the value stays the same. 
d)
Messages to explain to others, and often to remind yourself, what the code is intended to do. 
70.
Which of the following assignment statements is assigning text.
a)
myName = "David"
b)
myAge = 21