WorksheetsPython Programming
Total questions: 42
Worksheet time: 17mins
What in the name of the variable in this Python code?
name
input
("What is your name")
Why is it important that was use comments in our code?
They help the program run smoothly
So that when we come back to the code we can understand what it is doing
To help other people understand what is going on in our code
To add more colours into our code
Which of these is not an arithmetic operator?
+
-
*
=
What symbol is used for multiplication in Python coding?
x
+
#
*
When coding in Python what two instructions would I use if I want the program to select a choice?
IF
IF
COUNT
IF
ELSE
IF
INPUT
In Python coding what does the instruction PRINT do?
Instruct a printer to work
Add together two numbers
Print a statement on the screen
Input a number
What is missing from the Python code in the image?
() [brackets]
" " [speech marks]
: [colon]
; [semi-colon]
What word is missing from the Python code in the image?
birth_year
age
input
What will:
answer = input("Give me a number")
print(answer * 5)
output?
An error message
The value of answer multiplied by 5
answer * 5
The value of answer repeated 5 times
How do we change a user input from string to integer?
Casing
Flipping
Casting
Numerising
What does == mean?
Assign a value to a variable
Nothing, it's an error caused by typing == instead of =
Check that the value on the right of the == matches the value on the left
What can a variable not start with?
A special character
A capital letter
A number
A lower case letter
What are the three basic programming constructs?
Sequence, selection and iteration
Sequence, selection and looping
Sequence, iteration and looping
Sequence, execution and selection
Which of the following statements implement definite iteration?
STOP UNTIL
FOR ENDFOR
REPEAT UNTIL
WHILE ENDWHILE
What are the two possible results of testing a condition?
YES and NO
POSITIVE and NEGATIVE
TRUE and FALSE
0 or 1
What is the name given to the joining of strings?
Manipulation
Declaration
addition
Concatenation
Which logical operator represents greater than?
<
>
>=
==
Which of the following is a benefit of using local variables?
Other programmers cannot use them
They cannot accidentally be changed by other parts of a program
They make all variable names unique
They make selections work
What is an array?
A data structure that holds one or more items of data
A variable with more than one data type
A variable with more than one value
Sorting data in a list
Which data type represents whole numbers?
Real
String
Integer
Float
What is a constant?
A value that does not usually change as a program is running
A variable with more than one data type
A named piece of memory that holds a value which usually changes as a program is running
A named piece of memory that holds a value which cannot be changed as a program is running
What is a function?
A type of subroutine that calculates a value
A type of subroutine that returns a value
A type of subroutine that processes a value, but does not return it
A type of subroutine that only runs when called
What is recorded in a test/trace table?
Evidence of successful tests
Evidence of failed tests
Evidence of testing
Evidence the program run
What are two types of programming error?
Syntax errors and logic errors
Syntax errors and validation errors
Logic errors and validation errors
Error Erros
What is an algorithm?
How to make a jam sandwich
A way to solve a problem
instructions
Step by step instructions to solve a problem
Code repeated / looped until a condition has been met or a set number of times.
Iteration
While...
the end is never
the end is never
the end is never
the end is never
the end is never
the end is never
the end is never
the end is never
the end is never...
For...
people = ["jo", "maya", "jay"]
print (people[1])
what would this result be?
maya
jo
jay
error
What is the % used for in Python?
Integer division
Give the whole number
To give the remainder
Give the decimal only
