WorksheetsPython programming Grade 7
Total questions: 46
Worksheet time: 23mins
What is the output of the following program?
for i in range(0, 5):
print(i)
i=i+1
1 to 5 numbers
1 to 4 numbers
0 to 4 numbers
0 to 5 numbers
WHICH ONE OF THE FOLLOWING IS THE CORRECT EXTENSION OF THE PYTHON FILE ?
.py
.python
.p
None of these
What would the outcome of this program be?
22
50
Nothing, it won't run due to errors in the code
38
What does this code do when run the following program:
name='Aluko'
print('Hello '+name)
hello aluko
Hello aluko
'Hello Aluko'
Hello Aluko
Python program 3, can carry out calculations. The arithmetic operators we use to do this are: Addition, Subtraction, Multiplication & Division?
Plus, Subtract, Times & Divide
+ - * /
+ - x \
+ - * \
What would this code print
name='Poppy'
name='Beka'
print('Hello '+name)
Poppy
Liz
Hello Poppy
Hello Beka
What would this code do?
print('Hello World!')
hello world
Hello World!
hello world!
'Hello World!'
What is the output of these code?
a = 7
b = 8
c = a + b
print(c)
51
15
c
= 7 + 8
Which decision statement will be triggered if the variable x is less than 20?
if x > 20:
if x <> 20:
if x == 20:
if x < 20:
What is the output of this code below?
name = input('What is your name? ') Dr Who
print(name + ' ' + name + ' ' + name + ' ' + name + ' ' + name)
Dr WhoDr WhoDr WhoDr WhoDr Who
Dr Who Dr Who Dr Who Dr Who Dr Who
Dr Dr Dr Dr Dr
Who Who Who Who Who
What symbol do you use to make a comment in Python?
@
:
?
#
You assign a value to a variable with which symbol
@
==
=
*
WHICH ONE OF THESE IS USED TO TAKE INPUT FROM THE USERS ?
input
system
What is the output of these code?
print(1 + 6)
print(7 - 5)
print(3 * 9)
print(7 / 2)
7
2
27
3.5
7
2
12
3
7
12
6
3.5
7
12
27
3.5
The code you use to receive and input from the keyboard
enter()
add()
receive()
input()
What is missing to complete this code:
language='Python'
print('I am learning to program in'______)
+ language
+ Language
language
Language
What would the output of this code be if the user entered the value 70?
Pass
Fail
Merit
Distinction
What is the correct definition for a VARIABLE?
a changeable value, such as a score in a computer game.
a value that cannot be changed
What is the output of the following program?
1 to 10 numbers
1 to 5 numbers
1
5
What would the outcome of this program be?
prints 5 to 50 numbers
prints 5 to 49 numbers
prints 5 to 55 numbers
prints multiples of 5 upto 50
WHICH ONE OF THE FOLLOWING IS NOT SHOWN IN THE SYNTAX ERROR ?
incorrect punctuation
undefined terms
low memory
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly.
True
False
What does the print function do in python?
It loops the code.
It's a variable.
It can input data.
It displays something like a string or integer
Which command will correctly ask the user for their age?
age = input("How old are you?")
age = input(How old are you?)
input("How old are you?") = age
How old are you = input()
What is a input?
To plug in something
A function that allows us to ask the user to enter some data
Data displayed on a screen
A routine
Which command will display the text 'Hello world!' on the screen?
print(Hello world!)
print "Hello world!"
print("Hello world!")
print = "Hello world!"
What is the output of the following program?
Yes
No
Error
No output
A program that asks for your first name, your last name and finally greets you with your full name.
name1 = input('What is your first name? ') James
name2 = input('What is your last name? ') Bond
print('Hello ' + name1 + ' ' + name2)
My Name is Bond James Bond
Mr Bond
Hello James Bond
Hello Bond James
What would the outcome of this program be?
prints 1 to 10 numbers
prints 10 to 1 numbers
prints 1 to 15 numbers
prints 1 to 14 numbers
What is the name of the programming language we are learning?
python
scratch
scribble
pie thin
What will be the output?
name = "Dave"
print (name)
Dave
name
"Dave"
(name)
What would this code print?
name='Chan'
name='Aluko'
name='WDF'
print(name)
Aluko
Chan
WDF
name
What is the output of the following program?
Yes
No
Error
No output
What does the term 'debug' mean?
Identify errors and fix them
Making a calculation
A set of instructions
Looking at code
Python is an example of a....
language written in java script
Visual-based programming language
Object orientated programming language
Text-based programming language
Returns the remainder from division.
DIV
MOD
A string
carries out an action
the elements of a command
a collection of characters
how elements in a commad are arranged
Python is ___________ level programming language and is ___________.
High, compiled
High, interpreted
Low, compiled
Low, interpreted
A data type consisting of whole numbers.
integer
float / real
string
boolean
A data type consisting of numbers with decimals.
integer
float / real
string
boolean
Which of these would work as a piece of code in Python?
IF answer == "Yes":
if answer == "Yes"
if answer == "Yes":
if answer = "yes":
