Search Header Logo

1st Controlled Work - Grade 10

Authored by Eugene Castro

Computers

10th Grade

Used 2+ times

1st Controlled Work - Grade 10
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

50 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the correct way to format a string using placeholders?

My name is {}
My name is %s
My name is format{}
My name is + {}

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which method is used for string formatting in Python?

replace()
join()
format()
insert()

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What will be the output of this code: "I am {} years old".format(15)?

I am 15 years old
I am {} years old
15
I am old 15 years

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the output of this code: "{} {} {}".format("apple", "banana", "cherry")?

apple banana cherry
cherry banana apple
apple cherry banana
banana apple cherry

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

How do you specify the order of values when using the format() method?

By using string indexes
By using curly braces
By using numbered indexes in braces
By putting numbers before the string

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the result of this code: "{1} {0} {2}".format("a", "b", "c")?

a b c
b a c
c a b
b c a

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which of the following will print a float number with 2 decimal places using format()?

%.2f.format(3.14159)
Value: {:.2f}.format(3.14159)
Value: %.2f.format(3.14159)
Value: {}.2f.format(3.14159)

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?