Indian Institute of Technology Madras
BS Degree Programme · Examination & Study Paper
Tools in Data Science
Apache log parsing & filtering
Examination Instructions & Guidelines
- Solve on notebook/paper first before checking solutions.
- MCQ: Exactly 1 option is correct. Negative marking applies.
- MSQ: One or more options correct. Select all to score.
- Scientific calculator allowed for all calculations.
- Official answer key is sealed at the end of this sheet.
End Term · 31 Aug 2025 (FN)End Term
Read the passage below, then answer Q1–Q10
Scenario 3: E-commerce Platform Log Analysis
You're analyzing Apache access logs from a major e-commerce platform. The logs contain customer browsing patterns, purchase behaviors, and system performance metrics during Black Friday sales.
Log Format Specification:

Analysis Requirements:
● Filter purchases (POST to /checkout/) during peak hours (12:00-15:59)
● Identify mobile vs desktop traffic patterns
● Track successful transactions (status codes 200-299)
● Analyze product category performance
Based on the above data, answer the given subquestions.
Q1MCQ1 Mark·Choose one optionWhich of the following Apache log entries correctly represents a successful mobile checkout transaction that occurred during the peak analysis window (12:00–15:59)?
- A

- B

- C

- D

- A
- Q2MCQ1 Mark·Choose one option
To extract essential fields for the analysis "mobile checkout transactions between 12:00-15:59 with successful status codes", which data elements are required?
- AIP, UserAgent, Referrer, VirtualHost
- BTimestamp, HTTP_METHOD, URL, StatusCode, UserAgent
- CRemoteUser, AuthUser, ResponseSize, ServerIP
- DIP, Timestamp, Referrer, ResponseSize
- Q3MCQ1 Mark·Choose one option

- A%d/%b/%Y:%H:%M:%S
- B%d/%b/%Y:%H:%M:%S %z
- C%Y-%m-%d %H:%M:%S %Z
- D%d-%b-%Y:%H:%M:%S GMT
- Q4MCQ1 Mark·Choose one option
To identify checkout transactions occurring between 12:00 and 15:59, which Python condition correctly validates the time range?
- A

- B

- C

- D

- A
- Q5MCQ1 Mark·Choose one option

- A

- B

- C

- D

- A
- Q6MCQ1 Mark·Choose one option
To identify mobile traffic from the UserAgent string, which Python approach provides the most reliable mobile device detection?
- A

- B

- C

- D

- A
- Q7MCQ1 Mark·Choose one option
For determining successful transactions, which condition correctly identifies HTTP status codes indicating success?
- A

- B

- C

- D

- A
- Q8MCQ1 Mark·Choose one option

- A

- B

- C

- D

- A
- Q9MCQ1 Mark·Choose one option
If the transaction count appears unexpectedly high, which systematic debugging approach would identify the root cause?
- AAssume data corruption and discard results
- BValidate each filter condition independently: time range → HTTP method → URL pattern → status code
- CReduce the dataset size randomly
- DCheck only the timestamp filter
- Q10MCQ1 Mark·Choose one option
When processing very large Apache log files (10GB+), which of the following Python approaches offers the best memory efficiency?
- A

- B

- C

- D

- A
End Term · 31 Aug 2025 (AN)End Term
Read the passage below, then answer Q11–Q20
Scenario 3: Gaming Platform User Behavior Analysis
You're analyzing server logs from a multiplayer gaming platform during a major tournament event. The logs contain player actions, performance metrics, and system resource utilization data.

Analysis Requirements:
●Filter competitive gaming actions (kills, deaths, objectives) during tournament hours (14:00- 20:59)
●Differentiate between PC and console gaming patterns
●Track successful game events (status codes 200-299)
●Analyze player performance across different game modes
Based on the above data, answer the given subquestions.
Q11MCQ1 Mark·Choose one optionWhich log entry correctly represents a successful console objective action during the tournament window?
- A

- B

- C

- D

- A
- Q12MCQ1 Mark·Choose one option
For analyzing "competitive gaming actions during tournament hours with successful responses", which log fields are essential?
- APlayerIP, PlayerID, Platform, MatchID
- BTimestamp, ACTION, GameMode, StatusCode, ActionType
- CPlayerID, ResponseTime, UserAgent, Level
- DPlayerIP, Timestamp, Platform, ResponseTime
- Q13MCQ1 Mark·Choose one option

- A

- B

- C

- D

- A
- Q14MCQ1 Mark·Choose one option
To filter gaming actions between 14:00 and 20:59 tournament hours, which condition correctly validates the time range?
- A

- B

- C

- D

- A
- Q15MCQ1 Mark·Choose one option

- A

- B

- C

- D

- A
- Q16MCQ1 Mark·Choose one option
Which approach most accurately identifies console gaming platforms from the Platform field?
- A

- B

- C

- D

- A
- Q17MCQ1 Mark·Choose one option
For identifying successful gaming events, which status code condition is most appropriate?
- A

- B

- C

- D

- A
- Q18MCQ1 Mark·Choose one option
To efficiently count different action types (KILL, DEATH, OBJECTIVE) from filtered tournament data, which approach is optimal?
- A

- B

- C

- D

- A
- Q19MCQ1 Mark·Choose one option
If tournament action counts appear inconsistently high, which systematic debugging approach identifies the issue?
- AAssume tournament data corruption and exclude results
- BValidate each filter systematically: time range → game mode → action type → status codes → platform detection
- CReduce dataset randomly and extrapolate
- DFocus only on successful status codes
- Q20MCQ1 Mark·Choose one option
For processing massive gaming log files (100GB+) with memory constraints, which Python approach provides optimal performance?
- A

- B

- C

- D

- A
End Term · 13 Apr 2025 (FN)End Term
Read the passage below, then answer Q21–Q31
Scenario 3
You are provided with a Gzipped Apache log file from a website having the below data in each row.

The fields are separated by spaces and quoted by double quotes ("). Unlike CSV files, quoted fields are escaped via "and not". All data is in the GMT-0500 timezone and the questions were based in this same time zone.
Use the information given and answer the sub-questions.
Note: Assume that you are using Python codes for log analysis
Q21MCQ2 Marks·Choose one optionWhich of the following is a valid log entry based on the provided format?
- A192.168.1.1 - - [12/Dec/2024:14:05:59 -0500] "GET /image.jpg HTTP/1.1" 200 1234 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" www.s-anand.net 192.254.190.217
- B192.168.1.1 - - [12/Dec/2024:14:05:59 -0500] "POST /image.jpg INVALID" 200 1234 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" www.s-anand.net 192.254.190.217
- C192.168.1.1 - - [12/Dec/2024:14:05:59 -0500] "PUT /image.jpg HTTP/1.1" OK 1234 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" www.s-anand.net 192.254.190.217
- D203.0.113.7 - - [14/Dec/2024:16:45:11 -0500] "GET /index.html HTTP/1.1" 200 3500 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36" www.s-anand.net 192.254.190.219
- Q22MCQ1 Mark·Choose one option
Which of the following fields are necessary to filter "POST requests made for pages under /images/ from 15:00 to 18:00 on Mondays"?
- ATime, Request, Method, URL
- BTime, Method, Status, Size
- CTime, Method, URL, Referer
- DTime, Status, URL, Server
- Q23MCQ1 Mark·Choose one option
If the time in the log is stored in the format [01/May/2024:00:00:00 -0500], which of the following time formats should you use to parse it correctly?
- A

- B

- C

- D

- A
- Q24MCQ2 Marks·Choose one option
Which of the following methods is best for identifying if a log entry’s timestamp corresponds to a Sunday?
- ACheck if timestamp.dayname() == 'Sunday'
- BCheck if timestamp.weekday() == 5
- CCheck if timestamp.strftime('%A') == 'Sunday'
- DCheck if timestamp.weekday() == 6
- Q25MCQ1 Mark·Choose one option
How would you identify log entries where the time is between 16:00 and 18:59 on Sundays?
- ACheck if 16 <= timestamp.hour < 18
- BCheck if 16 <= timestamp.hour < 19
- CCheck if 16 < timestamp.hour < 19
- DCheck if timestamp.hour in range(16, 20)
- Q26MCQ1 Mark·Choose one option
How would you extract the HTTP protocol version (e.g., HTTP/1.1) from the Request field "GET /blog/ HTTP/1.1"?
- AUse request.split('/')[1]
- BUse request.split(' ')[2]
- CUse request.split(' ')[1]
- DUse request.split('/')[2]
- Q27MCQ1 Mark·Choose one option

- A

- B

- C

- D

- A
- Q28MCQ1 Mark·Choose one option

- A

- B

- C

- D

- A
- Q29MCQ1 Mark·Choose one option
How would you identify if the log entry’s HTTP status code indicates a redirection request? (Assume that status is correctly stored in the variable ‘status’)
- Astatus in [301, 302, 303]
- B200 < status < 400
- C300 <= status < 400
- Dstatus in range(299, 400)
- Q30MCQ1 Mark·Choose one option
After filtering the log entries (in a list filtered_entries), which of the following is the best way to count the number of requests with a 404 status code for pages under /error/?
- AUse len(filtered_entries)
- BUse len(entries)
- CUse sum(1 for entry in entries)
- DNone of these
- Q31MCQ1 Mark·Choose one option
If the count of log entries appears much larger than expected, which of the following could be the reason?
- AThe filter for Monday is incorrect.
- BThe filter for time range is incorrect.
- CThe filter for HTTP method is incorrect.
- DAny of these could be the reason.
End Term · 22 Dec 2024 (FN)End Term
Read the passage below, then answer Q32–Q42
Q32MSQ2 Marks·Choose all correct optionsWhich of the below can be a valid log file entry based on the descriptions provided in the main question?
- A40.77.167.48 - - [30/Apr/2024:07:12:09 -0500] "GET /mplayer2.jsz HTTP/1.1" 200 7416 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/116.0.1938.76 Safari/537.36" www.s-anand.net 192.254.190.216
- B40.77.167.48 - - [30/Apr/2024:07:12:09 -0500] "POST /mplayer2.jsz HTTP/1.1" 200 7416 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/116.0.1938.76 Safari/537.36" www.s-anand.net 192.254.190.216
- C40.77.167.48 - - [30-Apr-2024 07:12:09 -0500] "GET /mplayer2.jsz HTTP/1.1" 200 7416 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/116.0.1938.76 Safari/537.36" www.s-anand.net 192.254.190.216
- D40.77.167.48 - - [30/Apr/2024:07:12:09 -0500] "GET /mplayer2.jsz HTTP/1.1" OK 7416 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/116.0.1938.76 Safari/537.36" www.s-anand.net 192.254.190.216
- Q33MCQ1 Mark·Choose one option
Which of the following fields are necessary to filter "GET requests made for pages under /telugump3/ from 10:00 until before 21:00 on Saturdays"?
- ATime, Request, URL, Method
- BTime, Request, Status, Size
- CTime, Method, URL, Status
- DTime, Status, URL, Referer
- Q34MCQ1 Mark·Choose one option

- A

- B

- C

- D

- A
- Q35MCQ1 Mark·Choose one option
Which of the following methods is best for identifying if a log entry's timestamp corresponds to a Saturday? (timestamp is a method in datetime library)
- A

- B

- C

- D

- A
- Q36MSQ1 Mark·Choose all correct options
How would you identify log entries where the time is between 10:00 and 20:59 on Saturdays?
- A

- B

- C

- D

- A
- Q37MCQ1 Mark·Choose one option

- A

- B

- C

- D

- A
- Q38MCQ1 Mark·Choose one option

- A

- B

- C

- D

- A
- Q39MCQ1 Mark·Choose one option

- A

- B

- C

- D

- A
- Q40MCQ1 Mark·Choose one option
How would you identify if the Status code of a log entry indicates a successful request? (Assume that status is correctly stored in the variable ‘status’)
- A

- B

- C

- D

- A
- Q41MCQ1 Mark·Choose one option

- A

- B

- C

- D

- A
- Q42MCQ1 Mark·Choose one option
If the count of log entries appears much smaller than expected, which of the following could be the reason?
- AThe filter for Saturday is incorrect.
- BThe filter for time range is incorrect.
- CThe filter for successful status codes is incorrect.
- DAny of the given option could be the reason.
Official KeyMaster Answer Key & Explanations
Official answer keys from IIT Madras BS past papers. Click any question to review.
Reveal KeyCollapse Key
Master Answer Key & Explanations
Official answer keys from IIT Madras BS past papers. Click any question to review.