Font size
WorksheetsGetting to know Python Programming :Quiz
Total questions: 56
Worksheet time: 29mins
holds whole numbers
holds a decimal point in a number
Challenge Question
In python the ' BOOLEAN data type' can be defined as...?
holds alphanumerical data
holds whole numbers
holds a number with a decimal point
holds either true or false
What data type would be used for storing someone's telephone numbers?
Float (using a decimal point)
Integer (just whole numbers)
String (alphanumerical data)
Boolean (true or false)
If we needed to store information such as a POSTCODE in PYTHON, what data type would we use?
String (alphanumerical)
Float (decimal point)
Boolean (true or false)
Integer (Whole numbers)
What is missing from this program – print(my name is , firstname)?
‘‘ ’’
: :
??
*** ***
Challenge Question
What are these () called in programming?
brackets
quotation marks
half circles
parenthesis
print"What football team do you support?"
if answer == (“Man United”)
What does the equal sign mean in this code?
team = input(“Enter a team”)
variable holds data
variable is equal to
variable is greater than
variable should be an integer
colour = input(“Enter a colour”)
What is “team” in this line of code?
team = input()
constant
string
variable
Integer
Which has integer data type?
Phone number
Post Code
Student ID
Number of students in the class
There are 40 students in a classroom. We would like to get all students whose name starts with "A". Which looping is suitable?
For loop
While loop
Given a statement "All swan are white". To falsify this statement, you need to travel around the world and find at least one non-white swan. Which one is a indispensable command in your coding?
For loop
While loop
Conditional statement
Patients visit hospital everyday. You want to count for the "new patients" for each day. Which one is not necessary?
Set
While loop
For loop
Set difference
What will be the output if the user enters 'child' and 'friday'?
£4.00
£2.50
There will be a syntax error
£2.00
What is the process of identifying and fixing errors in your code?
Rebugging
Syntax Solving
Debugging
Abstraction
Read the code
firstname = input()
surname=input()
fullname = firstname + " " + surname
print(fullname)
Sarah Barnes
Sarah
Barnes
SarahBarnes
Challenge Questions
What can be used to create a line break in printed text?
\N
\\n
/n
\n
What is an Algorithm?
A chart showing the flow of a series of events
Step-by-step instructions used to solve a problem
A decision arrived at by following instructions
A computer program that follows a chart
What are algorithms used for?
To plan out the solution to a problem
As a platform to program a solution
To test a solution to a problem
Which of these is NOT a symbol of a flowchart
Decision
Sequence
Process
Input/output
Start or End
How do you insert COMMENTS in Python code?
#This is a comment
/* This is a comment */
// This is a comment
What is the correct file extension for Python files?
.pyt
.py
.pyth
.pt
What does != mean?
equal to
Not equal to
less than
greater than
Fill in the gaps. (2 answers)
itemPrice = _________(input("input item price £"))
quantity = int(input("quantity bought "))
discount = 0
totalCost = quantity * itemPrice
if totalCost ______ 50 :
discount = totalCost * 0.1
toPay = totalCost - discount
print ("You qualify for a discount of £", discount)
else : toPay = totalCost
print ("amount to pay is £", toPay)
integer
Float
>=
==
Which method can be used to return a string in upper case letters?
uppercase()
toUpperCase()
upperCase(
upper()
What is a correct syntax to return the first character in a string? such as Sarah would be S
print ("Your initials are," firstname[0])
print( "firstname"[1])
x = sub("firstname", 0, 1)
print(firstname[0])
Which of the following could be used as a variable name.( select 2)
firstname
age
class
Which of the following could be used as a variable name.( select 2)
firstname
age
class
_______throw != 6:
input("No good - press Enter to throw again... ")
throw = random.randint(1, 6)
print ("You threw",throw)
count += 1 #a short way or writing count = count + 1
print("That took "+ str(count) +" throws")
What is the missing code
Loop
Condition
While
Neither
Which search using the following approach
The list is examined one at a time from the beginning
Linear
Binary
Which search uses the following method
finds midpoint in range, established number and then continued to bisection each range until number is found.
Linear
Binary
Missing code line 8
attempts = 0
while attempts != 3:
password = input("Enter your password: ")
attempts = attempts + 1
if password == "abcd1234":
print("Access Granted")
attempts = 3 #What happens if this statement is left out?
line 8 ________:
print("password incorrect")
if password != "abcd1234":
print("You are locked out")
if
else
elif
then
Missing code line 6
if speed <= 5:
print("check value entered is correct")
else:
if speed >= 75:
print("Issue speeding fine")
line 6 _____________ speed > 60:
print("Issue warning")
else:
print("No action")
while
if
elif
else
Missing code line 2
grade = int(input("Enter your grade: "))
line 2_____grade >= 80:
print("Distinction")
elif grade >= 70:
print("Merit")
elif grade >= 60:
print("Pass")
else:
print("Fail")
while
if
elif
else
how can you reference a function
This is for a dice scenario
import random
random.randint(1,6)
variable.random[6]
random(1,6)
random.ranint[1,6]
