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
DjangoMedium
What is wrong with this view?
class OrderCreate(CreateView, LoginRequiredMixin):
model = Order
fields = ['items']
aMixins cannot be used with CreateView
bLoginRequiredMixin must come before CreateView to take effect
c`fields` must be a tuple
dCreateView requires a success_url
Explanation: Python's method resolution order checks classes left to right, so access mixins must be listed first.
ExcelMedium
Cell D2 holds the formula below and D5 already contains text. What happens?
=SORT(UNIQUE(Sales[City]))
aExcel returns #SPILL! because a cell in the spill range is occupied
bExcel overwrites D5
cExcel returns only the first city
dExcel returns #NAME?
Explanation: A dynamic array needs empty cells to spill into; any obstruction gives #SPILL!.
Git & GitHubMedium
Why is `git push --force-with-lease` preferred over `git push --force` after a rebase?
aIt refuses to overwrite commits someone else pushed since your last fetch
bIt is faster
cIt also pushes tags
dIt avoids the need to rebase
Explanation: force-with-lease checks that the remote branch is still where you last saw it before overwriting.
Large Language ModelsMedium
A chatbot's cost keeps growing as conversations get longer. The most likely reason is…
aTemperature increases over time
bThe model gets slower
cThe full chat history is re-sent as input tokens on every turn
dOutput tokens are free
Explanation: Each request includes prior messages, so input tokens rise with every turn unless you trim or summarise.
Machine LearningMedium
For a churn dataset with only 3% positives, which scoring is most informative during tuning?
aaccuracy
br2
caverage_precision
dneg_mean_squared_error
Explanation: PR-AUC (average precision) focuses on the rare positive class, whereas accuracy is inflated by the majority class.
MatplotlibMedium
By default, what do the bar heights in `sns.barplot(data=df, x='city', y='sales')` show?
aThe sum of sales per city
bThe count of rows per city
cThe mean of sales per city with a confidence interval
dThe median of sales
Explanation: Seaborn's barplot uses the mean as its estimator and adds an error bar by default.
NumPyMedium
What is the difference between `np.stack([a, b])` and `np.concatenate([a, b])` for two 1-D arrays of length 3?
astack gives shape (2, 3); concatenate gives shape (6,)
bBoth give shape (6,)
cstack gives shape (6,); concatenate gives (2, 3)
dBoth give shape (2, 3)
Explanation: stack adds a new axis while concatenate joins along an existing one.
PandasMedium
`df.pivot(index='branch', columns='month', values='sales')` raises `ValueError: Index contains duplicate entries`. What is the fix?
aUse df.melt instead
bUse pd.pivot_table with an aggfunc such as 'sum'
cSort the DataFrame first
dConvert month to category
Explanation: pivot needs unique pairs; pivot_table aggregates duplicates.
Power BIMedium
What is the purpose of the `"31/3"` argument here?
Sales FYTD =
CALCULATE ( [Total Sales], DATESYTD ( 'Date'[Date], "31/3" ) )
aIt filters the result to 31 March only
bIt sets the fiscal year end to 31 March so the running total restarts on 1 April
cIt formats the output as a date
dIt limits the calculation to the year 2031
Explanation: DATESYTD takes an optional year-end date; "31/3" gives the Indian April-March fiscal year.
PythonMedium
Why should CSV files be opened with `newline=''` when using the csv module?
aIt lets the csv module handle line endings correctly and avoids blank rows on Windows
bIt removes the header row
cIt makes reading faster by skipping empty lines
dIt is required for UTF-8
Explanation: The csv module does its own newline handling; `newline=''` stops Python translating line endings underneath it.
SQL / MySQLMedium
Why can this query return zero rows even though some customers never ordered?
SELECT name FROM customers
WHERE id NOT IN (SELECT customer_id FROM orders);
aNOT IN only works with numbers
bThe subquery must use DISTINCT
cIf `orders.customer_id` contains a NULL, NOT IN evaluates to unknown for every row
dSubqueries cannot be used in WHERE
Explanation: Any NULL in the list makes `x NOT IN (...)` unknown; use NOT EXISTS instead.
StatisticsMedium
A one-way ANOVA across four campaigns gives p = 0.002. What can you conclude?
aAt least one campaign mean differs; use a post-hoc test to find which
bAll four means are different from each other
cCampaign D is the best
dThe data are normally distributed
Explanation: ANOVA only says not all means are equal; Tukey HSD or similar identifies the pairs.
PythonMedium
Output of the code?
s = 'BeeProton'
print(s[3:6])
aePr
bPro
cProt
deeP
Explanation: Slicing is start-inclusive, end-exclusive: indexes 3,4,5.
SQL / MySQLMedium
What does this query return?
SELECT name FROM staff
ORDER BY salary DESC
LIMIT 3 OFFSET 2;
aThe three lowest salaries
bThe 3rd, 4th and 5th highest-paid staff
cThe three highest-paid staff
dThree rows in random order
Explanation: OFFSET 2 skips the first two rows of the ordered result, then LIMIT 3 returns the next three.
PandasMedium
What does `top` contain?
top = df.sort_values('sales', ascending=False).head(3)
aThe 3 rows with the smallest sales
bThe first 3 rows of the original order
cThe 3 rows with the largest sales
dA Series of 3 sales values
Explanation: ascending=False puts the largest sales first, so head(3) takes the top three rows.