Question bank

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

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
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?
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
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
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
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
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)
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
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
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
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
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
PythonMedium
Output of the code?
s = 'BeeProton'
print(s[3:6])
aePr
bPro
cProt
deeP
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
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