Quiz on f-strings in Python

Quiz on f-strings in Python

12th Grade

8 Qs

quiz-placeholder

Similar activities

javascript_1

javascript_1

10th - 12th Grade

10 Qs

Python - Year 8

Python - Year 8

3rd Grade - University

10 Qs

C++ dasar

C++ dasar

10th - 12th Grade

9 Qs

Midterm - MIL 12

Midterm - MIL 12

12th Grade

12 Qs

KRIPTOGRAFI DALAM PENGKOMPUTERAN

KRIPTOGRAFI DALAM PENGKOMPUTERAN

10th - 12th Grade

10 Qs

Mecatronica 5to IOQ 1

Mecatronica 5to IOQ 1

9th - 12th Grade

10 Qs

Day 6 PPT Quiz **Will close 12:30 pm on Thursday**

Day 6 PPT Quiz **Will close 12:30 pm on Thursday**

9th - 12th Grade

10 Qs

Standar Komunikasi Data 1

Standar Komunikasi Data 1

12th Grade - University

10 Qs

Quiz on f-strings in Python

Quiz on f-strings in Python

Assessment

Quiz

Computers

12th Grade

Practice Problem

Easy

Created by

Haden Hiser

Used 4+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

8 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of f-strings in Python?

To format strings and embed expressions directly into strings

To create functions

To manage file operations

To handle exceptions

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which version of Python introduced f-strings?

Python 2.7

Python 3.8

Python 3.6

Python 3.9

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you create an f-string?

Prefix the string with the letter 's'

Use the format() method

Use the str() function

Prefix the string with the letter 'f'

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? val = 'Geeks' print(f"{val}for{val} is a portal for {val}.")

GeeksforGeeks is a portal for Geeks.

Geeks for Geeks is a portal for Geeks.

GeeksforGeeks is a portal for Geeks

Geeks for Geeks is a portal for Geeks

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you print today's date using f-strings and the datetime module?

print(f"{datetime.datetime.today():%B %d, %Y}")

print(f"{datetime.date.now():%B %d, %Y}")

print(f"{datetime.date.today():%B %d, %Y}")

print(f"{datetime.datetime.now():%B %d, %Y}")

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? english = 78 maths = 56 hindi = 85 print(f"Ram got total marks {english + maths + hindi} out of 300")

Ram got total marks 219 out of 300

Ram got total marks 219 out of 100

Ram got total marks 219 out of 200

Ram got total marks 219 out of 400

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is NOT allowed in f-strings?

Using expressions

Using variables

Using curly braces

Using backslashes directly

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?