Module 5 Graded Quiz: APIs and Data Collection :Python for Data Science, AI & Development (IBM Data Analyst Professional Certificate) Answers 2025
1. Question 1
A web developer is troubleshooting an HTTP response with a status code of 404. What does this indicate?
-
❌ The server encountered an internal error while processing the request
-
❌ The client lacks proper authentication to access the resource
-
✅ The requested resource could not be found on the server
-
❌ The request was successful, and the resource was retrieved
Explanation:
404 = Not Found → The server couldn’t locate the requested URL/resource.
2. Question 2
Next step to extract all player names in h3 tags:
-
✅ Use soup.find_all(‘h3’) to create a list of all h3 elements
-
❌ Use soup.get_text()
-
❌ Use soup.navigate(‘h3’)
-
❌ Use soup.findAll(‘salary’)
Explanation:
find_all('h3') returns a list of all <h3> elements.
3. Question 3
Format conversion needed when using PyCoinGecko:
-
✅ Apply the json() method to the response object
-
❌ xml()
-
❌ csv()
-
❌ text
Explanation:
REST API responses are typically JSON → convert using .json().
4. Question 4
Data processing step before candlestick chart:
-
❌ Matplotlib date formatter
-
✅ Using pandas to_datetime to convert UNIX timestamps
-
❌ BeautifulSoup parser
-
❌ NumPy time function
Explanation:
UNIX timestamps must be converted into readable datetime using pd.to_datetime().
5. Question 5
HTML table hierarchy:
-
❌ td is parent of tr
-
❌ tr is parent of table
-
✅ table → tr → td (correct hierarchy)
-
❌ Not related
Explanation:
<table> contains <tr>, and each <tr> contains <td>.
6. Question 6
Structure of a query string:
-
❌ Exclamation mark + XML
-
✅ Begins with ? followed by key=value pairs separated by &
-
❌ Semicolon + JSON
-
❌ Hash symbol
Explanation:
Example:?name=John&age=25
7. Question 7
Definition of an API:
-
❌ DBMS
-
❌ Security protocol
-
✅ A set of rules for software components to communicate
-
❌ Programming language
Explanation:
API defines how applications talk to each other.
8. Question 8
Difference between CSV, JSON, XML:
-
❌ CSV encrypted…
-
❌ OS-specific
-
✅ CSV = tabular, JSON = key-value, XML = hierarchical tags
-
❌ Numeric/text/binary restrictions
Explanation:
Correct standard definitions of each file type.
9. Question 9
Correct GET request with parameters:
-
❌ Using POST
-
❌ json= for GET
-
✅ r = requests.get(…, params=payload)
-
❌ data= used incorrectly
Explanation:
params attaches query parameters to a GET request.
10. Question 10
Find all table rows in HTML:
-
❌ soup.search
-
✅ soup.find_all(‘tr’)
-
❌ read_table
-
❌ extract
Explanation:
All table rows in HTML are <tr> elements.
🧾 Summary Table
| Q No. | Correct Answer | Key Concept |
|---|---|---|
| 1 | Requested resource not found | HTTP 404 |
| 2 | soup.find_all(‘h3’) | BeautifulSoup extraction |
| 3 | response.json() | API JSON parsing |
| 4 | pandas to_datetime | Timestamp conversion |
| 5 | table > tr > td | HTML hierarchy |
| 6 | ?key=value&key2=value2 | Query string |
| 7 | API = communication rules | API concept |
| 8 | CSV vs JSON vs XML | File formats |
| 9 | requests.get(params=…) | GET with params |
| 10 | soup.find_all(‘tr’) | Parsing table rows |