NPTEL The Joy of Computing using Python Week 11 Assignment Answers 2024

Sanket
By Sanket

NPTEL The Joy of Computing using Python Week 11 Assignment Answers 2024

1. Which Python library is commonly used for automating web browsers for tasks like testing or web scraping?

  • datetime
  • selenium
  • chrome
  • webdriver
Answer :- For Answers Click Here 

2. In Selenium, what is the purpose of the WebDriver (e.g., webdriver.Chrome())?

  • To interact with databases
  • To send HTTP requests
  • To control a web browser programmatically
  • To parse HTML and XML documents
Answer :- For Answers Click Here 

3. Which method is used in Selenium to open a specific URL in the web browser?

  • driver.open(url)
  • driver.load(url)
  • driver.navigate(url)
  • driver.get(url)
Answer :- 

4. In Selenium, how can you simulate pressing the Enter key in a text input field?

  • input field.send keys(Keys.ENTER)
  • input field.submit()
  • input field.send keys(Keys.RETURN)
  • input field.press(’Enter’)
Answer :- 

5. How can you get the current local date and time in Python using the datetime module?

  • datetime.date.today()
  • datetime.datetime.now()
  • datetime.time.now()
Answer :- 

6. Which function from the calendar module can be used to create a formatted string representing a month’s calendar?

  • calendar.printmonth()
  • calendar.month()
  • calendar.monthcalendar()
Answer :- For Answers Click Here 

7. Which function would you use to replace characters in a string in Python?

  • string.modify()
  • string.replace(old, new)
  • string.remove(old)
  • string.update(new)
Answer :- 

8. Which of the following statements correctly imports the datetime module in Python?

  • import datetime
  • from datetime import datetime
  • import datetime as dt
  • All of the given options
Answer :- 

9. What does the following Python code output?

import calendar
print(calendar.isleap(2024))

  • True
  • False
  • 2024.0
  • None
Answer :- 

10. Using the datetime module, how can you print the current date 7 times, each time increasing the day by 1 from the current date?

055b4363 0247 4344 8f1c 6a9d8cf57408
Answer :- For Answers Click Here 
Share This Article
Leave a comment