NPTEL Joy Of Computing Using Python Week 11 Answers 2024

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

NPTEL Joy Of Computing Using Python


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 pytz
def 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, timedelta
def 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]

One Comment Please !

Post a Comment (0)
Previous Post Next Post