Font size
S
M
L
XL
WorksheetsUser defined functions and Window functions Quiz
Total questions: 15
Worksheet time: 8mins
Name
Class
Date
1.
What does a SQL function do?
a)
Stores data
b)
Joins tables
c)
Calculates a result using inputs
d)
Deletes rows
2.
Which of the following is a built-in SQL function?
a)
JOIN()
b)
RANK()
c)
ADD_TABLE()
d)
DROP()
3.
Why would you create your own SQL function?
a)
To delete tables
b)
To avoid using SELECT
c)
To reuse custom logic
d)
To reduce memory usage
4.
What keyword is used to define a new function in BigQuery?
a)
DEFINE FUNCTION
b)
MAKE FUNCTION
c)
CREATE FUNCTION
d)
FUNCTION NEW
5.
In the function SAFE_DIVIDE(a, b), what does it help prevent?
a)
Repetition
b)
Syntax errors
c)
Division by zero
d)
Slow queries
6.
In CREATE FUNCTION course17.margin(x, y), what is course17?
(a)
7.
Which of these are good reasons to use user-defined functions?
a)
Reuse common logic
b)
Keep queries clean
c)
Enforce data consistency
d)
Format column names
8.
What clause indicates a window function is being used?
a)
WHERE
b)
OVER
c)
WITH
d)
FUNCTION
9.
Window functions always require a GROUP BY clause.
a)
True
b)
False
10.
Which function can be used to assign a unique row number to each result?
a)
COUNT()
b)
RANK()
c)
ROW_NUMBER()
d)
SUM()
11.
What does PARTITION BY do in a window function?
a)
Sorts values
b)
Removes duplicates
c)
Groups rows into frames
d)
Rounds numbers
12.
Which clause lets you control the order of rows within each partition in a window function?
a)
GROUP BY
b)
ORDER BY
c)
LIMIT
d)
WHERE
13.
Which function ranks rows but gives the same rank to ties?
a)
ROW_NUMBER()
b)
DENSE_RANK()
c)
COUNT()
d)
TOTAL()
14.
Why would you use window functions instead of GROUP BY?
a)
Show aggregated values next to original rows
b)
Filter rows faster
c)
Avoid subqueries
d)
Calculate proportions per row
15.
How do window functions help calculate running totals?
a)
They count how many rows are in a table
b)
They add values as you move down the rows
c)
They show one total for the whole table
d)
They group rows by column names
Reset
