0% found this document useful (0 votes)
13 views

Assignment

Uploaded by

ro6162
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Assignment

Uploaded by

ro6162
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Q1.

Web API ProtocolUnsolved

Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.

Web API supports which of the following protocols?

Choose the correct answer from below:


TCP
HTTP
Soap
UDP
Submit

Q2. Web Page Retrieval ProcessUnsolved

Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.

What is the process by which search engines retrieve webpages and build a search index
called?

Choose the correct answer from below:


Spider
BeautifulSoup
Urllib
Scraper
Submit
Q3. Scraping from InternetUnsolved

Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.

What does the following block of code do with respect to the image 'image.jpg'

import requests
img = requests.get('http://data.pr4e.org/cover.jpg').content
fhand = open('cover.jpg', 'wb')
fhand.write(img)
fhand.close()
Choose the correct answer from below:
Display that particular image from corresponding URL
Retrieves image and saves it locally
Downloads the image and shows the output.
Opens the image as pop-up in the notebook without downloading.
Submit

Q4. HTML parser BeautifulSoupUnsolved

Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.

How does one parse the HTML into a BeautifulSoup object given a response object from
request.get()?

Choose the correct answer from below:

soup = BeautifulSoup(response.text, 'html.parser')

soup = BeautifulSoup(response.content, 'html.parser')

soup = BeautifulSoup(response.string, 'html.parser')

soup = BeautifulSoup(response.html, 'html.parser')


Submit
Q5. Scraped result is...?Unsolved

Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.

Suppose we run the following code:

import requests
from bs4 import BeautifulSoup
url =
"https://d2beiqkhq929f0.cloudfront.net/public_assets/assets/0
00/000/803/original/Value_of_cost.html?1637754792"
res = requests.get(url)
soup = BeautifulSoup(res.content, 'html.parser')
nm = soup.find_all("span", attrs = {"class": "___?___"})[0]
print(nm.text)

Which is the correct value or string to put in place of the ____?_____ so that the code
prints the name of customer who gave the review i.e. "tarun teja sanapala"?

Choose the correct answer from below:


a-profile-name
a-profile-content
a-row a-spacing-none
profile-content
profile-name
Submit

Q6. Scraping Website QuestionUnsolved

Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.

What would be the type of bookshelf which is obtained after scrapping contents of 'li'
tag from "https://books.toscrape.com/"?

page_html = "https://books.toscrape.com/"
res = requests.get(page_html)
page_soup = BeautifulSoup(res.content, "html.parser")
bookshelf = page_soup.find_all("li", {"class": "col-xs-6 col-
sm-4 col-md-3 col-lg-3"})
Choose the correct answer from below:
A container with all the elements with mentioned tag and class.
Pointer to contents of all 'li' tags
Dictionary of each 'li' tag with their content
Dictionary of each tag inside 'li' tag with their content
Submit

Q7. Web API Successful ExecutionUnsolved

Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.

The Web API returns which of the following status code on successful execution of a GET
request - when the resource has been fetched?

Choose the correct answer from below:


404
100
200
500
Submit

Q8. Books dataUnsolved

Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.

After scraping the URL, submit a CSV consisting of the details of the books present on
the link. The details of the books are expected to include the following data fields:

['product_page_url', 'title', 'universal_product_code', 'price_including_tax',


'price_excluding_tax', 'number_available', 'category', 'review_rating'].

Sample submission CSV:

This link consists of the sample submission file, but the number of rows and data in this
file doesn't refer to the actual number of books and actual data on the URL. The purpose
of the Sample CSV is just to show the format and columns.
Note:

1. Make sure that the submitted CSV shouldn't have index column.

2. The name of the data fields should be exactly what is mentioned above.

Submission
Submissions left for today: 3
Restart Submission
1
Upload Code

2
Upload Project Files

3
Upload Output file
1. Upload Code File
Upload Code
(only .py or .r files are accepted)
Select Language
Python (Python-2.7)

Instructions
 You are allowed to make maximum of 20 submissions per day. The system will reject
any further submission.
 The last submission will be considered final and will be used for your evaluation.
 Please follow the output format as specified in the section.

You might also like