• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 135 pages
Exam (elaborations)

University of California — CS 61A — Final Exam 150+ Practice Questions with Answers & Rationales

Document preview thumbnail
Preview 4 out of 135 pages

COURSE TOPICS COVERED CS 61A covers three programming paradigms across three languages: Paradigm Language Key Topics Functional Python Higher-order functions, recursion, lists, tree recursion, streams Object-Oriented Python Classes, inheritance, composition, special methods Declarative SQL SELECT statements, joins, aggregation, subqueries Interpreters Scheme Lists, cons/car/cdr, lambda, macros, metacircular evaluator

Content preview

University of California — CS 61A — Final
Exam
150+ Practice Questions with Answers &
Rationales


COURSE TOPICS COVERED
CS 61A covers three programming paradigms across
three languages:

Paradigm Language Key Topics

Higher-order functions, recursion,
Functional Python
lists, tree recursion, streams

Object- Classes, inheritance, composition,
Python
Oriented special methods

SELECT statements, joins,
Declarative SQL
aggregation, subqueries

,Paradigm Language Key Topics

Lists, cons/car/cdr, lambda, macro
Interpreters Scheme
metacircular evaluator

Key concepts across all topics:
• Environment diagrams and scoping
• Iterators and generators
• Recursion and tree structures
• Higher-order functions


PART I: PYTHON — FUNCTIONS & HIGHER-ORDER
FUNCTIONS (Questions 1-30)


1. What is the output of the following code?
python
def square(x):
return x * x

,def apply_twice(f, x):
return f(f(x))


print(apply_twice(square, 3))
• A) 9
• B) 27
• C) 81
• D) 18
• E) 12
Answer: C
Rationale: apply_twice(square,
3) applies square twice: square(3) = 9, then square(9)
= 81.


2. Which of the following is a higher-order function?
• A) def add(x, y): return x + y
• B) def apply(func, x): return func(x)
• C) def square(x): return x * x

, • D) def increment(x): return x + 1
• E) def multiply(x, y): return x * y
Answer: B
Rationale: A higher-order function takes a function as
an argument or returns a function. apply takes func as
an argument.


3. What is the output of the following code?
python
def make_adder(n):
def adder(x):
return x + n
return adder


add5 = make_adder(5)
print(add5(3))
• A) 3
• B) 5

Document information

Uploaded on
July 3, 2026
Number of pages
135
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$15.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
MREXAMS
2.5
(4)
Sold
25
Followers
1
Items
979
Last sold
3 months ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions