Font size
WorksheetsPython - Tổng hợp
Total questions: 80
Worksheet time: 49mins
internet
input
iheanacho
integer
if, edit, else
if, elif, else
if, elif, edit
if, excited, scream
What is wrong with this code?
print"Do you enjoy eating Banh Mi?"
no quotation marks
no parentheses
no commas
no capital letters
What is wrong with this code?
if answer == (“Leicester City”)
no quotation marks
no parentheses
Poor choice in team
No colon
team = input(“Enter a team”)
colour = input(“Enter a colour”)
team = input()
What will be the output?
name = 'Jamie Vardy'
print (name)
Jamie Vardy
'Jamie Vardy'
name
(name)
What will be the output?
name = 'Mr Brown'
greeting = "Good morning " + name
print (greeting)
Good morning
'Mr Brown'
Good morning
Mr Brown
Good morning name
Good morning + Mr Brown
if a > b:
print(a)
a >= b
a != b
Get a job!
What will the following code do: print("What is your name?")
Allow you to type in your name
Display the words 'What is your name?' on the screen
Allow you to enter information
Print your name to the screen
Python correct naming convention for variables is?
new_user25
NewUser25
25_new_user
25NewUser
NEWUSER25
What output will the console show, if 15 and 30 are entered by the user?
Syntax error
The sum of the two numbers - 45
The concatenation of the two numbers - 1530
Complier error
Which one will display when this code is run?
print(Hello world!)
Which of the following evaluates to the variable z rounded to two decimal places?
round(x, 2)
round(2, z)
round(z), 2
round(z, 2)
#Find the error in this program
goals=int(input("Enter the number of goals you scored last season: "))
if goals>= 20:
print("You are good enough to sign for Leicester City")
else
print("Not good enough for Leicester, better sign for a rubbish team like Man united instead!")
Missing Colon somewhere
Missing Parenthesis somewhere
Missplet variable name
Leicester are not better than Man United
guess=input()
guess=input()
guess=input()
guess=input()
Which word completes this sentence: "Iteration makes code more ___________"
Complex
Efficient
Simple
Straightforward
A FOR loop is....
A COUNT controlled loop
A CONDITION controlled loop
A WHILE loop is....
A COUNT controlled loop
A CONDITION controlled loop
What will the output be for the code shown here?
3,2,1,0
0,1,2,3
3,2,1
1,2,3
What would the output be for the code shown here?
0,1,2,3,4,5,6,7,8,9
1,2,3,4,5,6,7,8,9,10
0,2,4,6,8,10
0,2,4,6,8
Anil is writing a "rock, scissors, paper" program. He wants the game to repeat until the user doesn't want to play anymore. What loop should he use?
a FOR loop
a WHILE loop
Clara is writing a program that will print out the first ten numbers of a times table (chosen by the user). Should she use....
a FOR loop
a WHILE loop
Tara has written a "Hide and Seek Simulator" - what will happen when she runs it?
It will print "1,2,3,4,5,6,7,8,9,10 Coming ready or not!"
The program will not run
It will print "1,2,3,4,5,6,7,8,9,11 Coming ready or not!"
It will print ("10 Coming ready or not!")
A type of error that occurs when a rule of the programming language code is broken?
Syntax error
Logic error
Run-time error
Program error
Which data type would be used in Python to store the value of pi to 2 decimal places?
Integer
Float
Boolean
String
What is this a description of?
A named piece of storage used by a computer program that can change its value
Variable
Constant
Function
Parameter
In what way is a constant different from a variable?
It can not change its value during program execution
It can store more than one value
It can only be used in the global scope
Its name must be written in UPPER CASE
Use the correct order of operations to evaluate this expression ...
6 * 8 / 2 + (15 - 6) + 3 ^ 2
42
32
52
72
The process of giving a value to a variable?
Assignment
Initialisation
Coercion
Declaration
Choose all the recognised control structures in a computer program ...
Sequence
Selection
Iteration
Duplication
Example of ... ?
Selection
Repetition
Sequence
Iteration
Example of ...?
Conditional loop
Unconditional loop
Selection
Sequence
Odd one out ...?
Example of ...?
Sequence
Selection
Repetition
Recursion
Example of ...?
Nested loop
Nested selection
Recursion
Sequence
Example of ...?
Nested selection
Nested loop
Repetition
Iteration
Type of loop to use when the number of repetitions is known before the loop starts?
FOR ... loop
WHILE ... loop
FOR ... EACH ... loop
REPEAT ... UNTIL ...
A special type of loop that never ends?
Infinite loop
Recursive loop
Nested loop
Unconditional loop
Symbols used for entering comments in Python ...?
# This is a Python comment
''' This is a Python comment '''
// This is a Python comment
/* This is a Python comment */
An error in the way a program works where program can run but does not do what it is expected to do is called a ...
Logic error
Syntax error
Runtime error
Catastrophe
What data type represents a whole number?
Float
Int
Boolean
String
What data type represents characters?
Float
Int
Boolean
String
What data type represents only two possible outcomes?
Float
Int
Boolean
String
How many errors are there in this code?
1
2
3
4
15. What is the output of the following code?
valueOne = 5 ** 2
valueTwo = 5 ** 3
print(valueOne)
print(valueTwo)
10
15
25
125
ERROR
2. What is the output of the following code?
p, q, r = 10, 20 ,30
print(p, q, r)
10 20
10 20 30
Error: invalid syntax
3. What is the Output of the following code?
for x in range(0.5, 5.5, 0.5):
print(x)
[0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5]
[0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5]
The Program executed with errors
6. Can we use the “else” clause for loops?
for example:
for i in range(1, 5):
print(i)
else:
print("this is else block statement" )
YES
NO
What would the output of this code be if the user entered the value 70?
Pass
Fail
Merit
Distinction
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 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
