Question bank
Pick an answer to see if you're right — with an explanation.
All topicsPythonSQL / MySQLData ScienceNumPyPandasMatplotlibMachine LearningDeep LearningArtificial IntelligenceLarge Language ModelsDjangoAPIsGit & GitHubPower BIExcelStatistics
PandasMedium
What does this code return?
s = df.set_index("date")["amount"]
s.resample("ME").sum()
aTotal amount for each calendar month, labelled by month end
bThe mean amount per week
cThe row with the largest amount
dA TypeError because ME is invalid
Explanation: resample('ME') groups a DatetimeIndex into month-end bins; sum totals each month.
Power BIMedium
What does this measure return in a matrix sliced by `Product[Brand]` and `Store[Region]`?
Brand Share % =
DIVIDE (
[Total Sales],
CALCULATE ( [Total Sales], REMOVEFILTERS ( Product[Brand] ) )
)
aThe brand's share of all sales ever recorded, ignoring region
bAlways 100% because numerator and denominator match
cThe brand's share of sales within the current region and other filters
dAn error, because REMOVEFILTERS cannot be used inside DIVIDE
Explanation: REMOVEFILTERS clears only the Brand filter; the region and any other filters still apply to both numerator and denominator.
PythonMedium
What does this print?
import re
print(re.findall(r'\d+', 'Order 12 costs 450 rupees'))
a['12 450']
b[12, 450]
c['12', '450']
d['1', '2', '4', '5', '0']
Explanation: `findall` returns every match as a string; `\d+` matches runs of digits.
SQL / MySQLMedium
Scores are 90, 80, 80, 70. What `DENSE_RANK()` (ORDER BY score DESC) does 70 get?
a3
b4
c2
d1
Explanation: DENSE_RANK doesn't leave gaps after ties, so 90→1, 80→2, 80→2, 70→3.
StatisticsMedium
Which statement correctly interprets a 95% confidence interval of [₹462, ₹510] for the mean bill?
a95% of bills lie between ₹462 and ₹510
bThere is a 95% probability the sample mean is in this range
cThe method produces intervals that contain the true mean in about 95% of repeated samples
dThe true mean is exactly ₹486
Explanation: Confidence refers to the long-run success rate of the procedure, not to individual bills.
PythonMedium
What does `len({'a': 1, 'b': 2})` return?
a2
b1
c4
dError
Explanation: len of a dict counts keys.
SQL / MySQLMedium
What does this return?
SELECT COALESCE(NULL, 0, 5);
aNULL
b5
cError
d0
Explanation: COALESCE returns the first non-NULL argument.
PandasEasy
Which attribute gives the number of rows and columns as a tuple?
adf.size
bdf.shape
cdf.length
ddf.count()
Explanation: `df.shape` returns (rows, columns); `df.size` is the total number of cells.
Machine LearningMedium
What does `random_state=42` do here?
X_tr, X_te, y_tr, y_te = train_test_split(
X, y, test_size=0.2, random_state=42)
aIt uses 42% of the rows for testing
bIt trains 42 models
cIt makes the model more accurate
dIt fixes the shuffling seed so the same split is produced on every run
Explanation: A fixed random_state makes the split reproducible, which is what lets you compare experiments fairly.
DjangoMedium
For the URL /posts/7/, what does the view receive?
path('posts/<int:pk>/', views.post_detail, name='post-detail')
aThe positional string '7'
bNothing; pk must be read from request.GET
cThe keyword argument pk=7 as an int
dThe whole path as one string
Explanation: The `int` converter matches digits and passes the captured value to the view as the integer keyword argument `pk`.
Large Language ModelsMedium
What is the system message for?
messages = [
{'role': 'system', 'content': 'You are a concise support agent for a bakery.'},
{'role': 'user', 'content': 'Do you deliver on Sundays?'},
]
aIt is displayed to the end user
bIt stores the model's answer
cIt is billed as free tokens
dIt sets the role and rules the model should follow for the conversation
Explanation: System instructions steer tone, role and constraints, while the user message carries the actual request.
Artificial IntelligenceMedium
How many facts does `forward_chain` end with here?
RULES = [
({"supplies_goods", "turnover_above_40l"}, "must_register_for_gst"),
({"must_register_for_gst"}, "files_monthly_returns"),
]
case = {"supplies_goods", "turnover_above_40l"}
print(len(forward_chain(case, RULES)))
a2
b3
c4
dIt loops forever
Explanation: Both rules fire in turn, adding two derived facts to the two starting facts.
APIsMedium
A logged-in user requests an admin-only endpoint. Which status code is correct?
a401 Unauthorized
b403 Forbidden
c404 Not Found
d400 Bad Request
Explanation: The user is authenticated but lacks permission, so 403; 401 is for missing or invalid credentials.
Data ScienceMedium
Why use a bound parameter like `:start` in `pd.read_sql(text(query), engine, params={...})` instead of an f-string?
aIt prevents SQL injection and handles quoting safely
bIt makes the query run on the GPU
cIt is required for SELECT statements
dIt automatically adds an index
Explanation: Parameters are sent separately from SQL text, so user input cannot change the query structure.
Deep LearningMedium
What is the output shape?
import torch, torch.nn as nn
conv = nn.Conv2d(3, 16, kernel_size=3, padding=1)
x = torch.randn(8, 3, 64, 64)
print(conv(x).shape)
atorch.Size([8, 16, 64, 64])
btorch.Size([8, 16, 62, 62])
ctorch.Size([8, 3, 64, 64])
dtorch.Size([16, 8, 64, 64])
Explanation: Padding 1 with a 3x3 kernel and stride 1 keeps height and width; channels become 16.