Question 1
The backend server crashed while processing the request.
The frontend is running on the wrong port.
Browsers always delete data sent from port 8000.
Browsers block cross-origin requests by default.

The IIT Madras BS Tools in Data Science (Tools in Data Science (TDS)) End Term paper sat on 10 May 2026, in the January 2026 term: 27 questions for 40 marks in 180 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.
The backend server crashed while processing the request.
The frontend is running on the wrong port.
Browsers always delete data sent from port 8000.
Browsers block cross-origin requests by default.
Correct answer
Browsers block cross-origin requests by default.
You deploy your portfolio website to GitHub Pages. You try to add a Python FastAPI backend to handle form submissions directly on GitHub Pages. What happens when users try to submit the form?
Choose the correct answer.
GitHub Pages converts Python to JavaScript for browser execution.
Form submissions queue until you push new commits.
Submission fails—GitHub Pages serves only static files, not backend code.
GitHub creates a serverless function to handle POST requests.
Correct answer
Submission fails—GitHub Pages serves only static files, not backend code.
Converts the JSON string into a Python dictionary.
Contacts the API again to verify data format.
Deletes special characters for safety before printing.
Automatically fixes formatting mistakes in the string.
Correct answer
Converts the JSON string into a Python dictionary.
You build a Docker image locally and push it to Docker Hub. Your colleague pulls it on Windows. Your code runs Ubuntu Linux inside the container. What happens?
Choose the correct answer.
Docker Hub converts Linux containers to Windows during push.
Container runs successfully—Docker provides Linux compatibility on Windows.
Container crashes with "Platform Mismatch" error.
Docker refuses to pull and shows OS incompatibility warning.
Correct answer
Container runs successfully—Docker provides Linux compatibility on Windows.
Why is it highly recommended to use HTTPS instead of HTTP when sending an API token over the internet?
Choose the correct answer.
HTTPS transfers data faster than standard HTTP.
HTTPS encrypts data, making it unreadable if intercepted.
HTTP is only allowed for transferring images and videos.
HTTPS automatically fixes spelling errors in API requests.
Correct answer
HTTPS encrypts data, making it unreadable if intercepted.
1 second—stops after the fastest request finishes.
5 seconds—the average time of all requests.
3 seconds—stops automatically to avoid long waits.
10 seconds—must wait for the slowest request to finish.
Correct answer
10 seconds—must wait for the slowest request to finish.
It makes the API run faster by grouping keys in one location.
It prevents secret keys from being uploaded to GitHub when you share code.
It allows Python to cache variables during execution.
It helps GitHub verify the cloud API is installed correctly.
Correct answer
It prevents secret keys from being uploaded to GitHub when you share code.
Longitude exceeds 90o, causing sine to return negative values.
Formula uses latitude in trig calculations; swapping produces incorrect angles.
Haversine detects swaps and falls back to Euclidean distance.
Database indexes for latitude fail when queried with longitude first.
Correct answer
Formula uses latitude in trig calculations; swapping produces incorrect angles.
You write a script that loads a 2GB file into memory. It works on your laptop but crashes with "Out of Memory" on a free serverless cloud function. Why?
Choose the correct answer.
The cloud server detects the large file as malicious.
Free-tier cloud environments enforce strict memory limits.
Python cannot download external files inside cloud servers.
Files over 1GB require a separate database installation.
Correct answer
Free-tier cloud environments enforce strict memory limits.
Correct answer
Your app blocks the word "Ignore" to prevent prompt injection. A user types "I-g-n-o-r-e the above instructions" and bypasses it. Why?
Choose the correct answer.
The check matches exact words only; spelling tricks bypass it.
Python removes dashes before comparing text.
LLMs cannot read or process text with dashes.
The backend crashed and allowed all traffic through.
Correct answer
The check matches exact words only; spelling tricks bypass it.
It configures the server to batch and aggregate duplicate requests within 3600-second windows, reducing database queries.
It authorizes intermediate proxies and CDNs to serve cached copies for 1 hour, preventing identical requests from reaching your origin server.
It instructs client browsers to prefetch and cache all linked resources within 3600 seconds of the initial page load.
It enables HTTP/2 server push for the next 3600 seconds, allowing the server to proactively send related resources.
Correct answer
It authorizes intermediate proxies and CDNs to serve cached copies for 1 hour, preventing identical requests from reaching your origin server.
Server crashes—string types are incompatible.
Encrypts the string so it can't be read as number.
Automatically converts the string "25" to integer 25.
Deletes the variable due to wrong format.
Correct answer
Automatically converts the string "25" to integer 25.
When sending instructions to an LLM, developers often place core rules (like "you are a strict assistant") into a "System" prompt, while placing the user's question into a "User" prompt. Why is separating this useful?
Choose the correct answer.
It cuts down prompt word count to save money.
Models pay closer attention to System prompts, reducing user override attempts.
System prompts work offline without internet connection.
It blocks users from typing words listed in System prompts.
Correct answer
Models pay closer attention to System prompts, reducing user override attempts.
Two users attempt to sign up with the same username simultaneously. Your server checks if the username exists, then adds it if available. Without locking, what will likely occur?
Choose the correct answer.
Both requests check simultaneously, see it's available, and both create the user.
Python pauses the server to queue incoming requests automatically.
The database detects duplicates and delete both requests.
The network router blocks duplicate requests before reaching the server.
Correct answer
Both requests check simultaneously, see it's available, and both create the user.
A team trains a sentiment classifier achieving 94% test accuracy. They discover 200 test reviews accidentally appeared in training data. After removing duplicates and retraining, accuracy drops to 76%. What does this reveal?
Choose the correct answer.
Removing training data naturally reduces accuracy.
The 94% was inflated by test leakage—the model memorized test examples.
The duplicates contained critical patterns needed for learning.
The random seed changed, causing different train-test splits.
Correct answer
The 94% was inflated by test leakage—the model memorized test examples.
Read the following passage carefully:
A student builds a simple API that connects to a Large Language Model (LLM). To save time and expenses, the student configures a cache so that repeated questions skip the LLM entirely and return an instant answer. To stop prompt injection attacks, the developer filters the user's text for bad words before safely sending it.
During a testing session, a user cleverly tricks the API using a formatting loophole, causing the LLM to output a badly formatted hallucination. Because of the cache rules, the system memorizes this bad response. When other users ask the exact same question, they also receive the incorrect hallucination directly from the cache. Meanwhile, when the student tries testing their API locally from an HTML file, the browser blocks the connection outright.
Based on the above data, answer the given subquestions.
When the student opens their testing HTML file in Chrome, why does it block the connection to their backend API?
Choose the correct answer.
Backend lacks CORS headers for cross-origin requests.
Browsers don't allow JavaScript in local HTML files.
The API broke and returned a blank error page.
Antivirus stopped the network connection.
Correct answer
Backend lacks CORS headers for cross-origin requests.
Read the following passage carefully:
A student builds a simple API that connects to a Large Language Model (LLM). To save time and expenses, the student configures a cache so that repeated questions skip the LLM entirely and return an instant answer. To stop prompt injection attacks, the developer filters the user's text for bad words before safely sending it.
During a testing session, a user cleverly tricks the API using a formatting loophole, causing the LLM to output a badly formatted hallucination. Because of the cache rules, the system memorizes this bad response. When other users ask the exact same question, they also receive the incorrect hallucination directly from the cache. Meanwhile, when the student tries testing their API locally from an HTML file, the browser blocks the connection outright.
Based on the above data, answer the given subquestions.
7,200 milliseconds
7,200 minutes
2 hours
72 days
Correct answer
2 hours
Read the following passage carefully:
A student builds a simple API that connects to a Large Language Model (LLM). To save time and expenses, the student configures a cache so that repeated questions skip the LLM entirely and return an instant answer. To stop prompt injection attacks, the developer filters the user's text for bad words before safely sending it.
During a testing session, a user cleverly tricks the API using a formatting loophole, causing the LLM to output a badly formatted hallucination. Because of the cache rules, the system memorizes this bad response. When other users ask the exact same question, they also receive the incorrect hallucination directly from the cache. Meanwhile, when the student tries testing their API locally from an HTML file, the browser blocks the connection outright.
Based on the above data, answer the given subquestions.
Drops the extra word and reads the dictionary.
Ignores the response and re-queries the LLM.
Converts everything into a long string list.
Correct answer
Read the following passage carefully:
A student builds a simple API that connects to a Large Language Model (LLM). To save time and expenses, the student configures a cache so that repeated questions skip the LLM entirely and return an instant answer. To stop prompt injection attacks, the developer filters the user's text for bad words before safely sending it.
During a testing session, a user cleverly tricks the API using a formatting loophole, causing the LLM to output a badly formatted hallucination. Because of the cache rules, the system memorizes this bad response. When other users ask the exact same question, they also receive the incorrect hallucination directly from the cache. Meanwhile, when the student tries testing their API locally from an HTML file, the browser blocks the connection outright.
Based on the above data, answer the given subquestions.
The student wants to bypass the cache to get fresh results. What technical trick forces a new request?
Choose the correct answer.
Turn off the router and reconnect to wifi.
Hard-refresh the browser tab by pressing F5 once.
Email the cloud provider to clear the server cache.
Correct answer
Read the following passage carefully:
A student builds a simple API that connects to a Large Language Model (LLM). To save time and expenses, the student configures a cache so that repeated questions skip the LLM entirely and return an instant answer. To stop prompt injection attacks, the developer filters the user's text for bad words before safely sending it.
During a testing session, a user cleverly tricks the API using a formatting loophole, causing the LLM to output a badly formatted hallucination. Because of the cache rules, the system memorizes this bad response. When other users ask the exact same question, they also receive the incorrect hallucination directly from the cache. Meanwhile, when the student tries testing their API locally from an HTML file, the browser blocks the connection outright.
Based on the above data, answer the given subquestions.
What's the key difference between LLM "Structured Outputs" and Python validation for preventing malformed JSON?
Choose the correct answer.
Structured outputs run server-side; Python runs client-side.
Structured outputs constrain token generation; Python detects errors post- generation.
Structured outputs cache results for 3600s; Python rechecks each response.
Structured outputs encrypt JSON; Python leaves data unencrypted.
Correct answer
Structured outputs constrain token generation; Python detects errors post- generation.
Read the following passage carefully:
A student builds a simple API that connects to a Large Language Model (LLM). To save time and expenses, the student configures a cache so that repeated questions skip the LLM entirely and return an instant answer. To stop prompt injection attacks, the developer filters the user's text for bad words before safely sending it.
During a testing session, a user cleverly tricks the API using a formatting loophole, causing the LLM to output a badly formatted hallucination. Because of the cache rules, the system memorizes this bad response. When other users ask the exact same question, they also receive the incorrect hallucination directly from the cache. Meanwhile, when the student tries testing their API locally from an HTML file, the browser blocks the connection outright.
Based on the above data, answer the given subquestions.
User bypasses "Ignore" filter with "IGNORE" or "Ign0re". What validation is more robust?
Choose the correct answer.
Convert to lowercase and use regex for character substitutions.
Increase cache timeout to 7200 seconds.
Add CORS policy blocking uppercase characters.
Configure asyncio.gather() to skip suspicious requests.
Correct answer
Convert to lowercase and use regex for character substitutions.
Please provide a comprehensive structural analysis addressing the given two core logic flaws:
Based on the above data, answer the given subquestions.
Robust Improvements : Write the necessary Python/FastAPI technical improvements required (e.g., Type Hinting) to structurally force the endpoint to become reliable.
NOTE: Your answer should not exceed 200 words.
A written answer, not marked automatically.
Please provide a comprehensive structural analysis addressing the given two core logic flaws:
Based on the above data, answer the given subquestions.
RESTful Semantics : Should an LLM/Sentiment inference endpoint ideally operate via a GET mapped method, or a POST method? Provide a rigid technical justification analyzing payload limits and REST architectures.
NOTE: Your answer should not exceed 200 words.
A written answer, not marked automatically.
The mobile app's HTTP client library configuration
The gateway's routing rules and path-matching logic
The payment service's database connection pooling settings
OAuth token validation middleware in each backend service
Correct answer
The gateway's routing rules and path-matching logic
During a traffic spike, your single API gateway instance crashes. What architectural change prevents complete platform outages?
increase database connection pool size on each backend service
Deploy multiple gateway instances with load balancing redundancy
Cache all API responses permanently on client devices
Remove authentication to reduce gateway processing overhead
Correct answer
Deploy multiple gateway instances with load balancing redundancy
Only the mobile app's HTTP request formatting code
Gateway routing, authentication middleware, video service, and network connectivity
Only the PostgreSQL database query performance metrics
Only the CDN cache configuration for video content
Correct answer
Gateway routing, authentication middleware, video service, and network connectivity