AlgoMaster Logo

Built-in Functions - Quiz

Last Updated: January 3, 2026

Built-in Functions Exercises

28 quizzes

1
Code Completion

Apply a transformation to every temperature to convert the list from Celsius to Fahrenheit and store the result.

python
1
fahrenheit_values = map(, celsius_values)

Click an option to fill the blank:

2
Code Completion

Create an iterator that only keeps positive scores from a list of numbers.

python
1
positive_scores = filter(, scores)

Click an option to fill the blank:

3
Code Completion

Create a sequence of indexes for a list of tasks so you can iterate over their positions.

python
1
indexes = list((tasks))

Click an option to fill the blank:

4
Multiple Choice

Which built-in function is best to combine two lists element by element into pairs?

5
Multiple Choice

You have user records as a list of dictionaries. Which argument of sorted lets you sort by the 'age' key?

6
Multiple Choice

Which statement about any() is correct?

7
Multiple Choice

You need the total price from a list of numeric item prices. Which built-in is the most direct?

8
Multiple Choice

Which expression correctly checks that all items in scores are greater than or equal to 60?

9
Multiple Choice

Which call to range produces the sequence 2, 4, 6, 8?

10
Multiple Choice

You want to verify that user_input is specifically a str (not a subclass). Which is most precise?

11
Multiple Choice

Which built-in is best for turning several same-length lists into a list of tuples for each row of a table?

12
Multiple Choice

What does eval('3 * 5') return?

13
Multiple Choice

Which built-in would you use to quickly check how many key-value pairs are in a dictionary config?

14
Sequencing

Order the steps to use reduce to compute the product of all numbers in a list.

Drag and drop to reorder, or use the arrows.

15
Sequencing

Arrange the steps to safely evaluate a user-provided arithmetic expression with eval using a restricted namespace.

Drag and drop to reorder, or use the arrows.

16
Output Prediction

What is the output of this code?

1values = [1, 2, 3, 4]
2result = list(map(lambda x: x * 2, values))
3print(result[1] + result[-1])
17
Output Prediction

What does this code print?

1names = ['Ana', 'Bob', 'Cara']
2for index, name in enumerate(names, start=1):
3    labeled = f"{index}-{name}"
4print(labeled)
18
Output Prediction

What is the output of this code?

1scores = [70, 85, 90]
2passed = all(score >= 70 for score in scores)
3print(passed)
19
Output Prediction

What is printed by this code?

1letters = ['b', 'a', 'c']
2print(''.join(sorted(letters)))
20
Output Prediction

What is the output of this code?

1data = [10, 20, 30]
2total = sum(data)
3minimum = min(data)
4print(total - minimum)
21
Bug Spotting

Find the bug in this code that checks if all email addresses contain '@'.

Click on the line(s) that contain the bug.

python
1
def all_valid_emails(emails):
2
    checks = ["@" in email for email in emails]
3
    if any(checks):
4
        return True
5
    return False
22
Bug Spotting

Identify and fix the bug in this code intended to pair product IDs and names.

Click on the line(s) that contain the bug.

python
1
def pair_products(ids, names):
2
    pairs = list(zip(ids))
3
    if len(pairs) == len(ids):
4
        return pairs
5
    return []
23
Matching

Match each built-in with what it primarily returns.

Click an item on the left, then click its match on the right. Click a matched item to unmatch.

24
Matching

Match each concept with the most appropriate built-in function.

Click an item on the left, then click its match on the right. Click a matched item to unmatch.

25
Fill in the Blanks

Complete the code to filter even numbers and then compute their total.

python
1
numbers = [1, 2, 3, 4, 5, 6]
2
evens = filter(, numbers)
3
total_evens = (evens)
4
print(total_evens)

Click an option to fill blank 1:

26
Fill in the Blanks

Complete the code to sort students by age in descending order.

python
1
students = [{'name': 'Ana', 'age': 21}, {'name': 'Bob', 'age': 19}]
2
by_age_desc = sorted(students, key=, reverse=)
3
print(by_age_desc[0]['name'])

Click an option to fill blank 1:

27
Hotspot Selection

Click the line that will raise an error when run.

Click on the line to select.

python
1
items = None
2
print(len(items))
3
print(type(items))
28
Hotspot Selection

Click the line that incorrectly uses eval in a way that can run unexpected code.

Click on the line to select.

python
1
expression = input('Enter a number: ')
2
value = eval(expression)
3
print(value * 2)