
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
THỰC HÀNH SỐ 1
Quiz
•
12th Grade
10 questions
Lesson 01 Unit 1 Excel 2019/365 MOAC
Quiz
•
9th - 12th Grade
11 questions
Google Slides Quiz
Quiz
•
12th Grade
10 questions
TIN HỌC LỚP 3 - THI HK1
Quiz
•
3rd Grade - University
12 questions
Quizz Internet
Quiz
•
KG - Professional Dev...
13 questions
Loops Review
Quiz
•
12th Grade
11 questions
Syllabus Quiz
Quiz
•
9th - 12th Grade
10 questions
Python- Operators
Quiz
•
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
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
20 questions
Figurative Language Review
Quiz
•
6th Grade
