Module 5 Graded Quiz: APIs and Data Collection:Python for Data Science, AI & Development (Applied Data Science Specialization) Answers 2025
1. HTTP 404 status code
✅ The requested resource could not be found on the server
— 404 = Not Found.
❌ Internal error → That’s 500
❌ Lacks authentication → That’s 401
❌ Successful → That’s 200
2. Extract all h3 tags
✅ Use soup.find_all(‘h3’) to create a list of all h3 elements
— Correct method to extract multiple matching tags.
❌ get_text → Gets all text
❌ navigate → Not a valid BS method
❌ findAll(‘salary’) → Wrong tag
3. Convert API response to dictionary
✅ Apply the json() method to the response object
— Converts JSON API response into Python dict.
❌ xml → Wrong
❌ csv → Wrong
❌ text attribute → Gives raw text only
4. Prepare timestamps for candlestick chart
✅ Using pandas to_datetime to convert UNIX timestamps to readable dates
— Required to convert epoch time.
❌ matplotlib weekday — Unrelated
❌ BeautifulSoup — Not for timestamps
❌ NumPy moving averages — Not relevant
5. HTML table structure
✅ The <table> element is the parent of <tr> elements, which are parents of <td> elements.
— Correct DOM hierarchy.
❌ td parent of tr → Wrong
❌ tr parent of table → Wrong
❌ all siblings → Wrong
6. GET request query string
✅ It begins with a question mark followed by parameter-value pairs separated by ampersands.
— Correct structure: ?key=value&key2=value2
❌ ! → Wrong
❌ ; JSON → Wrong
❌ # → Fragment identifier
7. API definition
✅ A set of rules that allows two software components to communicate with each other
— Correct API meaning.
❌ DB system → Not API
❌ Security protocol → Not API
❌ Programming language → Wrong
8. CSV vs JSON vs XML
✅ CSV is tabular; JSON is key-value; XML uses hierarchical tags
— Correct characteristics.
❌ Encrypted/compressed — Wrong
❌ OS-specific — Wrong
❌ Only numeric/text/binary — Wrong
9. Correct GET request with parameters
✅ import requests; payload = {‘name’: ‘John’, ‘ID’: ‘123’}; r = requests.get(‘https://api.example.com/data‘, params=payload)
— Correct approach using GET + params.
❌ POST — Wrong method
❌ GET with JSON — Not typical
❌ GET with data={} — Wrong usage
10. Extract table rows with BeautifulSoup
✅ soup.find_all(‘tr’) to identify all table rows
— Correct method to extract all row elements.
❌ search(‘players’) → Invalid
❌ read_table() → Not a BS method
❌ extract(‘statistics’) → Wrong
🧾 Summary Table
| Q | Correct Answer |
|---|---|
| 1 | Requested resource not found |
| 2 | soup.find_all(‘h3’) |
| 3 | response.json() |
| 4 | pandas.to_datetime |
| 5 | table > tr > td hierarchy |
| 6 | ?key=value&key2=value2 |
| 7 | API = communication rules |
| 8 | CSV = tabular, JSON = key-value, XML = hierarchical |
| 9 | requests.get(…, params=payload) |
| 10 | soup.find_all(‘tr’) |