
Quiz on f-strings in Python
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Easy
Haden Hiser
Used 4+ times
FREE Resource
Enhance your content in a minute
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

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Bài tập thực hành 1 (tiết 2)
Quiz
•
12th Grade
10 questions
MIL Reviewer 2 - DepEd Common
Quiz
•
12th Grade
11 questions
Python Function
Quiz
•
11th - 12th Grade
10 questions
DATAFRAME AND SERIES
Quiz
•
12th Grade
12 questions
Framing Quiz
Quiz
•
9th - 12th Grade
10 questions
python quiz
Quiz
•
6th Grade - Professio...
10 questions
Excel (9-րդ դասարան)
Quiz
•
9th Grade - University
11 questions
Ôn tập Lớp 3
Quiz
•
4th - 12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
