
Alsager - CT Block 4

Quiz
•
Computers
•
4th Grade
•
Medium

Richard Steed
Used 2+ times
FREE Resource
34 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of placeholders in the string.format() method in Python?
To repeat a string multiple times
To insert variables into a string
To change the font of the string
To calculate mathematical expressions within a string
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct way to use the string.format() method to include the number of cupcakes Alice has in the output?
print("Alice has {} cupcakes.".format("five"))
print("Alice has {5} cupcakes.")
print("Alice has {} cupcakes.".format(5))
print("Alice has {number} cupcakes.".format(5))
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many placeholders are used in the example: print("Bob has {} {}.".format(2, "kittens."))?
1
2
3
4
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following code output: print("Carl the {1} has a pet {0}!".format("llama", "python"))
Carl the llama has a pet python!
Carl the python has a pet llama!
Carl the {1} has a pet {0}!
Carl the 0 has a pet 1!
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following code output: print("Elaine submitted {0} {a}".format(10, a = "assignments"))
Elaine submitted {0} {a}
Elaine submitted 10 {a}
Elaine submitted assignments 10
Elaine submitted 10 assignments
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the "{0:.2f}" format specifier in the string.format() method do?
It selects the second item in the format list and formats it as a float with two decimal places.
It selects the first item in the format list and formats it as a float with two decimal places.
It converts the string into a float with two decimal places without selecting any items.
It selects the first item in the format list and formats it as an integer with two decimal places.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code snippet: print("Danny ate £{0:.2f} worth of chocolate!".format(15))?
Danny ate £15 worth of chocolate!
Danny ate £15.00 worth of chocolate!
Danny ate £0.15 worth of chocolate!
Danny ate £1500 worth of chocolate!
Create a free account and access millions of resources
Similar Resources on Wayground
30 questions
COMP 8 (2ND): Microsoft PowerPoint

Quiz
•
4th - 12th Grade
30 questions
Power point bagian 1

Quiz
•
4th - 5th Grade
30 questions
Python L2 Programming Challenge

Quiz
•
3rd - 12th Grade
30 questions
ICT grade 4

Quiz
•
4th Grade
36 questions
First Term Year Four

Quiz
•
4th Grade
30 questions
PTS TIK Kelas 5 Semester 2

Quiz
•
4th - 6th Grade
30 questions
Code.org Classic Maze

Quiz
•
3rd - 8th Grade
30 questions
ÔN TẬP GIỮA HỌC KỲ II LỚP 7

Quiz
•
1st - 5th Grade
Popular Resources on Wayground
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World

Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
20 questions
ELA Advisory Review

Quiz
•
7th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns

Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade