Question 1 | MCQ
THIS IS QUESTION PAPER FOR THE SUBJECT "DIPLOMA LEVEL : TOOLS IN DATA SCIENCE
(COMPUTER BASED EXAM)"
ARE YOU SURE YOU HAVE TO WRITE EXAM FOR THIS SUBJECT?
CROSS CHECK YOUR HALL TICKET TO CONFIRM THE SUBJECTS TO BE WRITTEN.
(IF IT IS NOT THE CORRECT SUBJECT, PLS CHECK THE SECTION AT THE TOP FOR THE SUBJECTS REGISTERED BY YOU)
(COMPUTER BASED EXAM)"
ARE YOU SURE YOU HAVE TO WRITE EXAM FOR THIS SUBJECT?
CROSS CHECK YOUR HALL TICKET TO CONFIRM THE SUBJECTS TO BE WRITTEN.
(IF IT IS NOT THE CORRECT SUBJECT, PLS CHECK THE SECTION AT THE TOP FOR THE SUBJECTS REGISTERED BY YOU)
Solution
Your frontend app on
tries to fetch data from your backend API on
. The browser shows a "CORS error". Why?
Choose the correct answer.
Choose the correct answer.
Solution
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.
Choose the correct answer.
Solution
You use Python's
library to get data from an API.
gives you the raw string. What does
do?
Choose the correct answer.
Choose the correct answer.
Solution
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.
Choose the correct answer.
Solution
Why is it highly recommended to use HTTPS instead of HTTP when sending an API token over the internet?
Choose the correct answer.
Choose the correct answer.
Solution
You run five network requests using
. Four finish in 1 second, one takes 10 seconds. How long does
take total?
Choose the correct answer.
Choose the correct answer.
Solution
Why is it highly important to put your secret API keys in an
file rather than typing them directly into the Python code?
Choose the correct answer.
Choose the correct answer.
Solution
A delivery app calculates distances between restaurants and customers using the Haversine formula. For a customer 15 km away, the app shows "8 km" instead. Investigation reveals coordinates are stored as
but the Haversine function expects
. Why does this swap cause incorrect distances?
Choose the correct answer.
Choose the correct answer.
Solution
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.
Choose the correct answer.
Solution
You have a Dockerfile for your Python web application. It copies your code and runs it. But it crashes because it can't find the
library. What is missing in the Dockerfile?
Choose the correct answer.
Choose the correct answer.
Solution
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.
Choose the correct answer.
Solution
You add a
header to your API's response. What is the main benefit of doing this?
Choose the correct answer.
Choose the correct answer.
Solution
Your server expects an integer for age. An API sends
(string, not number). Using Pydantic, what happens?
Choose the correct answer.
Choose the correct answer.
Solution
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.
Choose the correct answer.
Solution
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.
Choose the correct answer.
Solution
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.
Choose the correct answer.
Solution
Comprehension Passage
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.
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.
Choose the correct answer.
Solution
Comprehension Passage
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.
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 API uses
. How long does the cache hold data?
Choose the correct answer.
Choose the correct answer.
Solution
Comprehension Passage
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.
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 API expects
. The LLM outputs
. What happens with
?
Choose the correct answer.
Choose the correct answer.
Solution
Comprehension Passage
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.
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.
Choose the correct answer.
Solution
Comprehension Passage
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.
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.
malformed JSON?
Choose the correct answer.
Solution
Comprehension Passage
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.
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.
Choose the correct answer.
Solution
Comprehension Passage
FASTAPI_ENDPOINT_RELIABILITY
Scenario Context: A student develops a simplistic sentiment analysis API using FastAPI. However, during staging, the endpoint behaves inconsistently when invalid inputs are processed, and the overall API contract remains severely unclear to downstream clients.
For example, if the
parameter is entirely missing, the API occasionally fails silently without throwing clear errors. Moreover, if the
parameter is passed but is completely empty (e.g.
), the system defaults to returning a "positive" sentiment. This renders the inference service highly unreliable for real-world integration architectures.
Given Application State (
):

Please provide a comprehensive structural analysis addressing the given two core logic flaws:
Based on the above data, answer the given subquestions.
Scenario Context: A student develops a simplistic sentiment analysis API using FastAPI. However, during staging, the endpoint behaves inconsistently when invalid inputs are processed, and the overall API contract remains severely unclear to downstream clients.
For example, if the
Given Application State (
Please provide a comprehensive structural analysis addressing the given two core logic flaws:
Based on the above data, answer the given subquestions.
Inscript
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.
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.
Solution
Comprehension Passage
FASTAPI_ENDPOINT_RELIABILITY
Scenario Context: A student develops a simplistic sentiment analysis API using FastAPI. However, during staging, the endpoint behaves inconsistently when invalid inputs are processed, and the overall API contract remains severely unclear to downstream clients.
For example, if the
parameter is entirely missing, the API occasionally fails silently without throwing clear errors. Moreover, if the
parameter is passed but is completely empty (e.g.
), the system defaults to returning a "positive" sentiment. This renders the inference service highly unreliable for real-world integration architectures.
Given Application State (
):

Please provide a comprehensive structural analysis addressing the given two core logic flaws:
Based on the above data, answer the given subquestions.
Scenario Context: A student develops a simplistic sentiment analysis API using FastAPI. However, during staging, the endpoint behaves inconsistently when invalid inputs are processed, and the overall API contract remains severely unclear to downstream clients.
For example, if the
Given Application State (
Please provide a comprehensive structural analysis addressing the given two core logic flaws:
Based on the above data, answer the given subquestions.
Inscript
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.
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.
Solution
Comprehension Passage
Read the passage carefully and answer the given subquestions.
StreamFlix, a video streaming platform, serves 50 million users across 200 countries. Their mobile app, web player, and smart TV apps all connect to over 80 different backend microservices—user profiles, recommendations, video encoding, billing, analytics, and more. Managing 80 different API endpoints created chaos: mobile developers hardcoded URLs that broke during server migrations, and each service implemented its own authentication logic inconsistently.
The engineering team deployed an API gateway—a single entry point at
that routes requests to appropriate backends. Now the mobile app calls one endpoint, and the gateway forwards
to the profile service,
to the content service, and
to the payment service. Authentication happens once at the gateway using OAuth tokens, eliminating redundant auth code across 80 services.
However, last month the gateway crashed during a traffic spike, taking down the entire platform for 12 minutes despite all backend services running fine. The incident report revealed that debugging was harder—errors could originate from the gateway's routing logic, authentication middleware, backend services, or network issues between layers. The team now implements health checks, circuit breakers, and runs multiple gateway instances for redundancy.
StreamFlix, a video streaming platform, serves 50 million users across 200 countries. Their mobile app, web player, and smart TV apps all connect to over 80 different backend microservices—user profiles, recommendations, video encoding, billing, analytics, and more. Managing 80 different API endpoints created chaos: mobile developers hardcoded URLs that broke during server migrations, and each service implemented its own authentication logic inconsistently.
The engineering team deployed an API gateway—a single entry point at
However, last month the gateway crashed during a traffic spike, taking down the entire platform for 12 minutes despite all backend services running fine. The incident report revealed that debugging was harder—errors could originate from the gateway's routing logic, authentication middleware, backend services, or network issues between layers. The team now implements health checks, circuit breakers, and runs multiple gateway instances for redundancy.
You need to add a new
endpoint to the API gateway. Which component handles routing this request to the payment service?
Solution
Comprehension Passage
Read the passage carefully and answer the given subquestions.
StreamFlix, a video streaming platform, serves 50 million users across 200 countries. Their mobile app, web player, and smart TV apps all connect to over 80 different backend microservices—user profiles, recommendations, video encoding, billing, analytics, and more. Managing 80 different API endpoints created chaos: mobile developers hardcoded URLs that broke during server migrations, and each service implemented its own authentication logic inconsistently.
The engineering team deployed an API gateway—a single entry point at
that routes requests to appropriate backends. Now the mobile app calls one endpoint, and the gateway forwards
to the profile service,
to the content service, and
to the payment service. Authentication happens once at the gateway using OAuth tokens, eliminating redundant auth code across 80 services.
However, last month the gateway crashed during a traffic spike, taking down the entire platform for 12 minutes despite all backend services running fine. The incident report revealed that debugging was harder—errors could originate from the gateway's routing logic, authentication middleware, backend services, or network issues between layers. The team now implements health checks, circuit breakers, and runs multiple gateway instances for redundancy.
StreamFlix, a video streaming platform, serves 50 million users across 200 countries. Their mobile app, web player, and smart TV apps all connect to over 80 different backend microservices—user profiles, recommendations, video encoding, billing, analytics, and more. Managing 80 different API endpoints created chaos: mobile developers hardcoded URLs that broke during server migrations, and each service implemented its own authentication logic inconsistently.
The engineering team deployed an API gateway—a single entry point at
However, last month the gateway crashed during a traffic spike, taking down the entire platform for 12 minutes despite all backend services running fine. The incident report revealed that debugging was harder—errors could originate from the gateway's routing logic, authentication middleware, backend services, or network issues between layers. The team now implements health checks, circuit breakers, and runs multiple gateway instances for redundancy.
During a traffic spike, your single API gateway instance crashes. What architectural change prevents complete platform outages?
Solution
Comprehension Passage
Read the passage carefully and answer the given subquestions.
StreamFlix, a video streaming platform, serves 50 million users across 200 countries. Their mobile app, web player, and smart TV apps all connect to over 80 different backend microservices—user profiles, recommendations, video encoding, billing, analytics, and more. Managing 80 different API endpoints created chaos: mobile developers hardcoded URLs that broke during server migrations, and each service implemented its own authentication logic inconsistently.
The engineering team deployed an API gateway—a single entry point at
that routes requests to appropriate backends. Now the mobile app calls one endpoint, and the gateway forwards
to the profile service,
to the content service, and
to the payment service. Authentication happens once at the gateway using OAuth tokens, eliminating redundant auth code across 80 services.
However, last month the gateway crashed during a traffic spike, taking down the entire platform for 12 minutes despite all backend services running fine. The incident report revealed that debugging was harder—errors could originate from the gateway's routing logic, authentication middleware, backend services, or network issues between layers. The team now implements health checks, circuit breakers, and runs multiple gateway instances for redundancy.
StreamFlix, a video streaming platform, serves 50 million users across 200 countries. Their mobile app, web player, and smart TV apps all connect to over 80 different backend microservices—user profiles, recommendations, video encoding, billing, analytics, and more. Managing 80 different API endpoints created chaos: mobile developers hardcoded URLs that broke during server migrations, and each service implemented its own authentication logic inconsistently.
The engineering team deployed an API gateway—a single entry point at
However, last month the gateway crashed during a traffic spike, taking down the entire platform for 12 minutes despite all backend services running fine. The incident report revealed that debugging was harder—errors could originate from the gateway's routing logic, authentication middleware, backend services, or network issues between layers. The team now implements health checks, circuit breakers, and runs multiple gateway instances for redundancy.
A request to
returns a 500 error. Which layers should you check when debugging?
Solution
Shape
Thickness [ / ]
3
All colors