NEW
Font size
S
M
L
XL
WorksheetsProgramming concepts: Revision
Total questions: 15
Worksheet time: 6mins
Name
Class
Date
1.
what is wrong with this Python code?
name = "Mr Little"
username = input ("What is your name?")
if Name == username:
print ("Hello sir")
name = "Mr Little"
username = input ("What is your name?")
if Name == username:
print ("Hello sir")
a)
name and Name are not the same
b)
You should use = to compare, not ==
c)
There is no colon (:) at the end of the if
d)
The print command is not indented.
2.
Which of the following best defines the term "algorithm"?
a)
A combination of zeroes and ones that represents an instruction to the computer
b)
The rules for writing instructions in a specific programming language
c)
A set of step-by-step instructions to solve a problem or perform a task
d)
A way to write programming code in short English phrases to describe the program components
3.
Which type of error occurs when a programmer misspells a word or instruction?
a)
Runtime
b)
Syntax
c)
Logic
d)
System
4.
Which statement will check to see if a is equal to b?
a)
if a == b
b)
if a = b:
c)
if a != b:
d)
if a == b:
5.
What will the following lines of code do?
a)
A
b)
B C
c)
A C
d)
Nothing, it will return an error
6.
Debug means
a)
changing order
b)
find and fix errors
c)
go around
7.
What is a variable?
a)
Something that can change and has a name
b)
A place on the hard disk that holds values
c)
A named place in memory that holds values that can change
8.
What is a procedure?
a)
A subprogram that returns a value
b)
A subprogram that does not return a value
c)
A subprogram that may or may not return a value
9.
In Python, an array is declared as:
a)
num = (1,2,3,4)
b)
num["1",2,3,"4"]
c)
num = [1,2,3,4]
10.
Comments are useful because:
a)
They let you know what's going on
b)
They help with maintainability and understandability
c)
They organise your code
11.
An iterator:
a)
Is another name for a "while" loop
b)
Keeps track of where you are in a loop
c)
Is a "repeat until" statement
12.
Casting is:
a)
Assigning a value to a variable
b)
Turning one data type to another data type
c)
Accessing a function inside of another function
13.
Which of the following is not a data type?
a)
Boolean
b)
Real
c)
Array
d)
Integer
14.
Which type of statement is an example of a selection programming structure?
a)
If/else
b)
while
c)
do while
d)
for
15.
Which control structure is used to check if a condition has been met or not?
a)
If statement
b)
Array
c)
Fixed Loop
d)
Variables
Reset
