Hey Folks, This article is about NPTEL Joy of Computing Using Python Week 11 Answers for April are provided here. Let's find out what are the answers.Â
Join Telegram:Â Â CLICK HEREÂ for more updates and answers.Â
NPTEL Joy Of Computing Using Python Week 11 Answers 2024
Last Date: 10-04-2024
Q1. Select the correct statement regarding the selenium library
Â
A. Selenium is primarily used for web browser automation
B. The web driver in Selenium allows a way to interact with web browsers
C. The Keys Class provides a set of special keys that can be used for keyboard interaction
D. All of the above
Answer: [ D ] All the above
Q2. Which of the following tasks in WhatsApp can be automated using Selenium?
Â
A. Sending Media Files
B. Reading Messages
C. Creating and Managing Groups
D. Updating Profile Information
Answer: [ A ] [ B ] [ C ] [ D ]Â
Q3. Read the given code and identify the correct statement.
import pytzdef does_something ( ):ÂÂ Â Â variable = [ tz for tz in pytz.all_timezones if tz. startswitch ('Asia') ]ÂÂ Â Â return variableÂx = does_something ( )for _ in x:ÂÂ Â Â print (_) {codeBox}
A. does_something returns a list of all time zones in Asia
B. the above code prints all time zones in Asia
C. The output of the code can change depending on the version of pytz used
D. All of the above
Answer: [ D ] All the above
Q4. Read the given code. What is the output of does_something(2022,2,29).
import calenderÂdef does_something (year, month, day):   variable = calender.monthrange(year,month)   Â    return int ( 1<= day <= variable [1] ) {codeBox}
Answer: 0
Q5. Read the given code.
def checks_something (year):ÂÂ Â Â return ( year % 4 = = 0 and year % 100 != 0) or (year % 400 = = 0 )ÂÂ Â Â Âfile_path = 'years.txt'Âwith open(file_path, ' r ' ) as file :ÂÂ Â Â Â years = [ int (line.strip ( ) ) for line in file ]Âcount = sum ( 1 for year in years if checks_something ( year ) ) {codeBox}
Assume the file years.txt contains the following dataÂ
2000
2007
2004
2009
2001
What is the output of the code?Â
Answer: 2
Q6. Read the given Code?Â
import calenderÂdef count_something (year):    count = 0    for month in range ( 1, 13 ):      Â      day_of_week = calender. weekday ( year, month, 13)      if day_of_week = = calender. FRIDAY :         count + = 1   return count {codeBox}Â
Enter the value of int(count_something(1996)==count_something(2024))
     Â
Answer: 1
Q7. Read the given Code:Â
def count_ (s,e) :    count = 0    for year in range (s, e+1):       if  ( year % 4 = = 0 and year % 100 != 0) or (year % 400 = = 0 ) :          count + = 1    Â    return count {codeBox}Â
Enter the amount returned by count _(1990, 2004)Â
Answer: 9
Q8. In addition to the first birthday celebration, Koreans often celebrate "MiSeDol," which marks the completion of the 100th day after a baby's birth. This is considered another significant milestone. Given an input birthdate, the following code tries to calculate the date of "MiSeDol", but the code might contain errors. Identify the line number corresponding to the error. In the absence of an error answer -1.
from datetime import datetime, timedeltadef calculate_(year, month, day ):   Â   input_date = datetime ( year, month, day)   date = input_date + timedelta (days=99)    year = date.year    month = date.month    day = date.day    return year, month, day {codeBox}
Answer:Â Â -1
Q9. Read the given code.
Find the value returned by finds_something (2000,12)
import calenderÂdef finds_something ( year, month):    first_day_of_month = calender.weekday ( year, month, 1)    x = ( first_day_of_month + 1 ) % 7    return x {codeBox}
Answer:Â 5
Q10. Read the following code. What does count_something(2024,1) return ?
import calenderÂ
def count_something ( year, month ):Â
    x,y = calender.monthrange ( year, month )Â
    last_day = yÂ
    count = 0Â
    for day in range (1, last_day + 1):Â
       if calender.weekday (year, month, day) < 5:Â
         count+=1Â
    return count {codeBox}Â
Answer:Â 23
Join Telegram:Â Â CLICK HEREÂ for more updates and answers.Â
ConclusionÂ
Follow us on Telegram for any Updates. Mail us at [email protected]