Python Date library

Python Date library

12th Grade

10 Qs

quiz-placeholder

Similar activities

Tutoring PY Practice 2025

Tutoring PY Practice 2025

12th Grade

10 Qs

Data 251-257 + 309-311

Data 251-257 + 309-311

12th Grade

10 Qs

Викторина по работе с датами и временем в SQL Server

Викторина по работе с датами и временем в SQL Server

12th Grade

14 Qs

L29 Python

L29 Python

12th Grade

8 Qs

Business Documents

Business Documents

8th - 12th Grade

12 Qs

Unit D Review - Exploring Classes

Unit D Review - Exploring Classes

12th Grade

11 Qs

Tipe Data dalam Basisdata

Tipe Data dalam Basisdata

1st - 12th Grade

15 Qs

Python Basics

Python Basics

KG - University

15 Qs

Python Date library

Python Date library

Assessment

Quiz

Computers

12th Grade

Medium

Created by

Shafaque Riaz

Used 1+ times

FREE Resource

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?

  • c) datetime.current()

  • d) datetime.time()

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

3. What is the correct way to create a date object representing March 15, 2024?

  • a) date(15, 3, 2024)

  • b) date(2024, 3, 15)

  • c) datetime(2024, 3, 15)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If you want to add 10 days to the current date, which function can you use?

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?

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?