Web Scraping with Python Quiz: requests, BeautifulSoup and Ethics
Test your web scraping skills: how HTTP and HTML work, status codes and headers, the requests library, BeautifulSoup and CSS selectors, JavaScript-rendered pages, pagination, saving data, APIs versus scraping and scraping ethically.

Web Scraping Quiz
60 questions · 7 topics · timer · instant explanations · printable mark sheet.
- Questions60 in the bank, 10–30 per attempt
- Levels20 easy · 24 medium · 16 hard
- TimeAbout 5–20 minutes
- PriceFree, no login needed
- Made byDr. Aammar Tufail, Codanics
- Updated18 November 2026
In short: the Web Scraping Quiz is a free online multiple-choice quiz by Codanics with 60 questions on how the web works; requests library; parsing with BeautifulSoup; dynamic pages and APIs; pagination and saving data; ethics and legality; and errors and robustness. You choose the number of questions and the difficulty, answer against a timer, see an explanation after every answer and finish with a printable mark sheet.
What the Web Scraping Quiz covers
Web scraping turns websites into datasets for research, price tracking, job analysis and more. Doing it well means understanding HTTP, parsing HTML reliably and respecting website rules.
This quiz covers the full workflow with requests and BeautifulSoup, plus the ethical and legal points every scraper should know.
- How the web works 10 questions
- Requests library 9 questions
- Parsing with BeautifulSoup 10 questions
- Dynamic pages and APIs 8 questions
- Pagination and saving data 8 questions
- Ethics and legality 8 questions
- Errors and robustness 7 questions
Who it is for: Python learners collecting data for projects or research, freelancers offering data extraction and readers of the Codanics web scraping guide.
How the quiz works
- Type your name if you want it printed on the mark sheet (optional; it never leaves your browser).
- Choose 10, 20 or 30 questions, a difficulty (Easy, Mixed or Hard) and the timer: Standard, Relaxed or none.
- Answer each question before the timer runs out. Press A–D or 1–4 on a keyboard, or tap an option on your phone.
- Read the explanation after every answer, then press Next.
- At the end, get your score, grade, topic-wise breakdown and a full answer review. Print it or save it as a PDF.
- Retake the quiz for a fresh random set, or practise only the topics you found hard.
Free video lessons from Codanics
Score lower than you hoped? These free lessons from the Codanics YouTube channel cover the same topics, explained step by step.
Free on the Codanics YouTube channel, taught in Urdu/Hindi.
Sample questions with answers
Here are 9 questions from the bank, with answers and explanations. The quiz above draws from all 60.
1. Which HTTP method does a browser normally use to request a web page?
- POST
- DELETE
- PATCH
- GET
Answer: D. GET
GET asks the server to return a resource and is what a browser sends when you open a URL. POST is typically used to submit form data.
2. What is the difference between 403 and 404?
- 403 is a server crash; 404 is a client error
- 403: not found; 404: access is refused
- 403: access refused; 404: nothing at that URL
- Both mean the server is offline
Answer: C. 403: access refused; 404: nothing at that URL
403 Forbidden means the server understood the request but will not serve it, often because of blocking or missing login. 404 means nothing exists at that URL.
3. Which line downloads the page at url using the requests library?
- response = requests.get(url)
- response = requests.read(url)
- response = requests.download(url)
- response = requests.open(url)
Answer: A. response = requests.get(url)
requests.get sends an HTTP GET request and returns a Response object with the status code, headers and body.
4. What is the difference between response.text and response.content?
- text is a decoded str; content is raw bytes
- They are identical aliases
- text holds headers; content holds the body
- text is bytes; content is a decoded str
Answer: A. text is a decoded str; content is raw bytes
content gives the raw bytes (useful for images or PDFs), while text decodes those bytes into a string using the detected encoding.
5. What is the main difference between soup.find('p') and soup.find_all('p')?
- find returns a list; find_all returns the first match
- find searches text; find_all searches tags
- find_all only works with CSS classes
- find gives the first match; find_all gives all
Answer: D. find gives the first match; find_all gives all
find gives the first matching tag (or None if there is none), while find_all returns a list-like ResultSet of every match (empty if none).
6. Before scraping a site, why should you check whether it offers an official API?
- APIs never need any authentication
- Scraping is impossible if an API exists
- An API gives cleaner data, with permission
- APIs always return more data than web pages
Answer: C. An API gives cleaner data, with permission
Official APIs return clean JSON, change less often than page layouts and come with clear usage terms. Scraping is a fallback when no suitable API exists.
7. You collected a list of dicts called rows. Which pandas code saves it as a CSV file without an extra index column?
- pd.DataFrame(rows).save('books.csv', index=False)
- pd.DataFrame(rows).to_csv('books.csv', index=False)
- pd.DataFrame(rows).to_csv('books.csv', index=True)
- pd.read_csv(rows).to_csv('books.csv', index=False)
Answer: B. pd.DataFrame(rows).to_csv('books.csv', index=False)
Each dict becomes a row and its keys become columns. index=False stops pandas writing the 0, 1, 2 row index as an unnamed first column.
8. What is robots.txt?
- A list of usernames and passwords for a site
- An HTML tag that hides content from users
- A Python library for building scrapers
- A file telling bots which paths not to crawl
Answer: D. A file telling bots which paths not to crawl
robots.txt sits at the site root (e.g. https://site.com/robots.txt) and uses rules such as Disallow: /private/. Responsible scrapers read and follow it.
9. Why should a scraper add delays (e.g. time.sleep) between requests?
- Because Python cannot send two requests in a row
- To avoid overloading the site's server
- To get higher-quality data
- To make the HTML easier to parse
Answer: B. To avoid overloading the site's server
Rapid-fire requests can slow a site down for real users and may get you blocked. Polite crawling spaces out requests and limits concurrency.
Free guides and blogs to study
Free tools for your studies and research
Codanics also has 160+ free online tools for students and researchers: statistics calculators, meta-analysis, PDF and writing tools. They run in your browser, with no login.
Frequently asked questions
Is the Web Scraping Quiz free?
Yes. The Web Scraping Quiz is completely free, with no sign-up, no login and no limit on attempts.
How many questions are in the Web Scraping Quiz?
The question bank has 60 multiple-choice questions (20 easy, 24 medium and 16 hard) across 7 topics. Each attempt draws 10, 20 or 30 of them at random, so every attempt is different.
How does the timer work?
Each question has its own countdown: about 25 seconds for easy, 40 for medium and 55 for hard questions, plus 15 seconds when there is code to read. Choose Relaxed to double the time or switch the timer off to study at your own pace. Unanswered questions count as skipped.
Can I get a certificate or mark sheet?
Yes. When you finish, you get a mark sheet with your name, score, grade, time, topic-wise performance and every answer explained. Use Print or save as PDF to keep it. It is a self-assessment result, not an official certificate.
Are the answers and explanations correct?
Every question was written and reviewed for one clearly correct answer, and code questions were checked by running the code. If you think an answer is wrong, tell us on the Codanics WhatsApp channel or in the YouTube comments and we will fix it.
Is web scraping legal?
It depends on the website, the data and your country. Check the site’s terms and robots.txt, avoid personal data, use official APIs when they exist and keep your request rate low.
Which Python libraries does the quiz cover?
Mainly requests and BeautifulSoup, plus pandas for saving data and the concepts behind browser automation tools such as Selenium and Playwright.
Is my data stored anywhere?
No. The quiz runs entirely in your browser. Your name, answers and score are not uploaded. Your best score and settings are remembered only in this browser so you can track your progress.
More free quizzes
See all Codanics quizzes → · Courses · Free tools · Blog



