WorksheetsPython / Algorithms 7/3/19
Total questions: 70
Worksheet time: 58mins
people = ["John", "Rob", "Bob"]
print (people[1])
what would this result be?
people = ["John", "Rob", "Bob"]
print (people[-1])
what would this result be?
people = ["John", "Rob", "Bob"]
print (people[4])
what would this result be?
What is the name of this symbol (>>>)?
Chevrons
Hash tags
Colon
Semi Colon
Look at the Algorithm Below. In the corresponding Trace Table, what value should 'B' be?
1
3
5
7
Look at the Algorithm Below. In the corresponding Trace Table, what value should 'C' be?
1
3
8
13
Look at the Algorithm Below. In the corresponding Trace Table, what value should 'D' be?
11
13
8
1
An algorithm can be defined as...
...defined set of steps that can be used to complete a task
...a set of steps that can be used to complete a task
a random set of steps that can be used to complete a task
an order of doing things correctly to complete something
Sequence is when...
...instructions are executed one after another
instructions are executed one after another in a series
instructions are executed by the user
instructions are executed one after another but not always in series
Selection is when...
...a program will execute instructions regardless of what the user does
...a program will execute certain instructions based on the user's actions
...a program will execute certain instructions based on conditions
....a program will execute all instructions regardless of what the user does
Selection statements include...
IF, THEN, ELSE & CASE
IF, ELSE, & CASE
IF, THAN, ELSE & CASE
IF, THEN, ELSE, ELIF & CASE
In computer programming 'iteration' is used to...
... loop around and around a piece of code until the correct answer is chosen
...loop around a piece of code until a condition is met that activates the next part of the program
...loop around and around a piece of code until a condition is met that ends the iteration
...loop twice around a piece of code until a condition is met that ends the iteration
In programming a translator is used to convert different programming languages into machine code. There are three types...
Assembler, interpreter & compiler
Assembler, identifier & compiler
Assembler, identifier & interpreter
Compiler, identifier & interpreter
An assembler translator...
...converts assembly language programs into machine code
...converts programs created in any language into machine code
...converts programs created in any high level language into machine code
An integer is a data type that typically takes up 2 bytes of memory. Which of the follow is an integer?
2.6
"2.6"
26
26.0
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?
26
"26.0"
260
2.60
A string is a data type that typically takes up 1 byte per character. Which of the following is a string?
hello world
"!£llo world4"
"hello world
hello world"
What is the main difference between a constant and a variable?
A constant's value remains the same whereas a variable's value can change
A constant's value only changes if a variable's value changes
A constant's value remains the same whereas a variable's value can be changed by the user
A constant's value remains the same whereas a variable's value can be changed, but only once
What is a variable
A piece of data held in memory
A piece of code
An arithmetic operator
An algorithm
Which is NOT an arithmetic functon
+
*
/
:
Which symbol represents a decision?
What does this symbol represent in a flowchart?
Input or Output
The Flow of Data
A Start or End
A Process
What does this symbol represent in a flowchart?
A Decision
A Subprocess
A Start or End
The Flow of Data
What is an input?
read weight
display area
compute sum
x+y=z
Which are the basic structures of programs?
Sugar and Spice and All things nice
Sequence, Selection and Iteration
Variables and flowcharts
Arithmetic and logic
Breaking a problem down into its component parts
Algorithm
Decomposition
Abstraction
Iteration
What is Pseudocode?
Syntax code that is written in Plain English.
Syntax code that is simplified into code that is easier to understand.
Python code that is now syntax code
Syntax code that is python code
Pseudocode can be understood by:
Only Users
Only Computers
Both
How do you show something is printed in pseudocode?
SEND 'x' TO DISPLAY
RECEIVE 'x' FROM DISPLAY
SEND 'x' TO KEYBOARD
RECEIVE 'x' FROM KEYBOARD
How do you show the number 10 being received as an input?
RECEIVE '10' FROM KEYBOARD (STRING)
RECEIVE '10' FROM KEYBOARD (INTEGER)
RECEIVE '10' FROM KEYBOARD (FLOAT)
RECEIVE 10 FROM KEYBOARD (FLOAT)
There is a specific way to write pseudocode
True
False
How do you show 'Yes' being received as an input?
RECEIVE 'Yes' FROM DISPLAY (STRING)
SEND 'Yes' FROM DISPLAY (STRING)
RECEIVE 'Yes' FROM KEYBOARD (STRING)
RECEIVE 'YES' FROM KEYBOARD (STRING)
What is the variable name in this Pseudocode?
START
SEND 'Whats your name?' TO DISPLAY
RECEIVE agE FROM KEYBOARD (INT)
age
Age
AGE
agE
What must you start and end every pseudocode with?
Begin/End
Start/End
Begin/Finish
End/Finish
What is wrong with this pseudocode?
START
SEND 'x' TO SCREEN
RECEIVE 'x' FROM KEYBOARD(STRING)
END
Nothing
Should be Integer instead of string
Should say Display instead of Screen
Should say print instead of send
The pseudocode command to open the files called 'bob.txt' so it can be written to.
Fbob = openFile('bob.txt','r')
Fbob = openRead('bob.txt')
Fbob = openWrite('bob.txt')
Fbob.close()
WHILE NOT Fbob.endOfFile()
OUTPUT "Enter your name"
Yes
There is a specific way to write pseudocode
True
False
