Week - 11 Quiz Assignment

Week 11: Quiz Assignment 11

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

  • datetime
  • selenium
  • chrome
  • webdriver

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

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)

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’)

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()

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()

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)

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

9. What does the following Python code output?

import calendar
print(calendar.isleap(2024))
        
  • True
  • False
  • 2024.0
  • None

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?

  • for i in range(7):
        print(datetime.datetime.now() + datetime.timedelta(days=i))
  • for i in range(7):
        print(datetime.date.today() + datetime.timedelta(days=i))
  • for i in range(7):
        print(datetime.datetime.today().add(days=i))
  • for i in range(7):
        print(datetime.date.now().add(days=i))

Discussion makes the solution more accurate (social computing). Discuss the solution in comments. Do share this with your friends! Comment the queries, I will reach out to you.
Week 11 programming assignment solution coming soon

Comments

Popular posts from this blog

The Joy of Computing using python -Week 1