DateTime module

Qus. 1 : <p>What will be the output of the following Python code if the system date is 18th June, 2017 (Sunday)?</p><pre><span style="font-size: 14px;">import datetime<br></span><span style="font-size: 14px;">tday=datetime.date.today()&nbsp;<br></span><span style="font-size: 14px;">print(tday)</span></pre><div><br></div>

  1. 18-06-2017
  2. 06-18-2017
  3. 2017-06-18
  4. Error
Qus. 2 : <p>What will be the output of the following Python code if the system date is 18th June, 2017 (Sunday)?</p><pre><span style="font-size: 14px;">import datetime<br></span><span style="font-size: 14px;">tday=datetime.date.today()<br></span><span style="font-size: 14px;">print(tday.weekday())</span></pre>

  1. 6
  2. 1
  3. 0
  4. 7
Qus. 3 : <p>What will be the output of the following Python code if the system date is 21st June, 2017 (Wednesday)?</p><pre><span style="font-size: 14px;">import datetime<br></span><span style="font-size: 14px;">tday=datetime.date.today()<br></span><span style="font-size: 14px;">print(tday.isoweekday())</span></pre><div><br></div>

  1. Wed
  2. Wednesday
  3. 2
  4. 3
Qus. 4 : <p>What will be the output of the following Python code if the system date is: 6/19/2017</p><pre><span style="font-size: 14px;">import datetime<br></span><span style="font-size: 14px;">tday=datetime.date.today()<br></span><span style="font-size: 14px;">tdelta=datetime.timedelta(days=10)&nbsp;<br></span><span style="font-size: 14px;">print(tday+tdelta)</span></pre><div><br></div>

  1. 2017-16-19
  2. 2017-06-9
  3. 2017-06-29
  4. Error
Qus. 5 : <p>What will be the output of the following Python code?</p> <pre><span style="font-size: 14px;">import time<br></span><span style="font-size: 14px;">print(time.asctime())</span></pre><div><br></div>

  1. Current date only
  2. UTC time
  3. Current date and time
  4. Current time only

Programs

python program to generate 3 random integers between 100 and 999 which is divisible by 5

View Solution


python program to generate 6 digit random secure OTP between 100000 to 999999

View Solution


python program to generate 6 random numbers and then print their mean median and mode

View Solution


python program to print the calendar of given month and year

View Solution


python program to print the calendar of given year

View Solution


Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad