
Python Date library
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Medium
Shafaque Riaz
Used 1+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
.Which of the following will import the datetime module in Python?
a) import date
b) import datetime
c) from datetime import date
d) from date import datetime
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you get the current date and time in Python using the datetime module?
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
3. What is the correct way to create a date object representing March 15, 2024?
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If you want to add 10 days to the current date, which function can you use?
datetime.now() + datetime.timedelta(days=10)
datetime.now() + datetime.date(10)
datetime.today() + datetime.timedelta(10)
datetime.now().date() + timedelta(days=10)
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How would you convert a string "2024-08-29" into a date object in Python?
datetime("2024-08-29")
datetime.strptime("2024-08-29", "%Y-%m-%d")
datetime.strptime("2024/08/29", "%d-%m-%Y")
datetime("2024/08/29", "%Y/%m/%d")
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the strftime() method do in Python?
Converts a string to a datetime object
Formats a datetime object to a string
Returns the current date as a string
Subtracts dates
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which code snippet will return the current year using the datetime module?
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
15 questions
2425.GENAP.XII.02
Quiz
•
12th Grade
10 questions
Excel
Quiz
•
12th Grade - University
15 questions
Online communities & cloud computing - BTEC IT unit 1
Quiz
•
11th - 12th Grade
13 questions
Gaming!
Quiz
•
12th Grade
15 questions
Y7 Computational Thinking Quiz
Quiz
•
12th Grade
15 questions
Introduction to MIL (Reviewer)
Quiz
•
12th Grade
11 questions
eSafety
Quiz
•
9th Grade - University
10 questions
C.A.R.S. Evaluate Digital Resources
Quiz
•
6th - 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
