Alsager - CT Block 4

Alsager - CT Block 4

4th Grade

34 Qs

quiz-placeholder

Similar activities

Autocad

Autocad

3rd - 8th Grade

29 Qs

Access

Access

KG - University

30 Qs

CORRAD Advance

CORRAD Advance

1st Grade - University

30 Qs

Computer Vocabulary

Computer Vocabulary

4th - 8th Grade

30 Qs

computer 4c

computer 4c

4th Grade

30 Qs

Ms. Office

Ms. Office

1st Grade - University

30 Qs

Mengenal Program Pivot

Mengenal Program Pivot

4th Grade

35 Qs

GSlides02动画

GSlides02动画

1st Grade - University

35 Qs

Alsager - CT Block 4

Alsager - CT Block 4

Assessment

Quiz

Computers

4th Grade

Medium

Created by

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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?