Question bank

Pick an answer to see if you're right — with an explanation.

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
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
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']
SQL / MySQLMedium
Scores are 90, 80, 80, 70. What `DENSE_RANK()` (ORDER BY score DESC) does 70 get?
a3
b4
c2
d1
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
PythonMedium
What does `len({'a': 1, 'b': 2})` return?
a2
b1
c4
dError
SQL / MySQLMedium
What does this return?
SELECT COALESCE(NULL, 0, 5);
aNULL
b5
cError
d0
PandasEasy
Which attribute gives the number of rows and columns as a tuple?
adf.size
bdf.shape
cdf.length
ddf.count()
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
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
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
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
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
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
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])