CSE 240 EXAM 1 HIGH-YIELD ARRAYS, STACKS,
QUEUES, AND BASIC COMPLEXITY ANALYSIS
SUMMARY 2026
◉ Given the Scheme code, answer the following questions.
((lambda (x)
((lambda (x y)
(+ x y))
4 (* 6 x)))
3)
(1) The value to be passed to the parameter y is 18 .
(2) The final output of the piece of code is 22 .
Answer: (1) 18
(2) 22
◉ Given the Scheme code, answer the following two questions.
((lambda (x)
((lambda (x y)
(+ x y))
,5 (* 7 x)))
3)
(1) The value to be passed to the parameter y is 21 .
(2) The final output of the piece of code is 26 .
Answer: (1) 21
(2) 26
◉ Given this Scheme procedure:
(define foo (lambda (x)
(if (= x 0)
1
(* x (foo (- x 1))) )))
What does this procedure do?
Answer: compute x!
◉ Which of the following forms using a quote will return an error
when run?
Answer: ('+ 2 3)
(define a a)
, ◉ Which of the followings is a Scheme pair? Select all that apply.
Answer: '(x . y)
'(x . x)
'(() ())
◉ What is the correct method for constructing a pair in Scheme?
Answer: (cons 1 2)
◉ What is the return value of the code below? (min is a procedure
that returns the minimum of two values.)
(define lst '(3 5 2 9))
((min (car lst) (cadr lst)))
Answer: error message
◉ What statement is accurate and correct for Scheme lists and
pairs?
Answer: There exists a list that is not a pair.
◉ Which of the following is equivalent to the expression below?
(car (cdr '(1 2 3 4 5))
Answer: (cadr '(1 2 3 4 5))
QUEUES, AND BASIC COMPLEXITY ANALYSIS
SUMMARY 2026
◉ Given the Scheme code, answer the following questions.
((lambda (x)
((lambda (x y)
(+ x y))
4 (* 6 x)))
3)
(1) The value to be passed to the parameter y is 18 .
(2) The final output of the piece of code is 22 .
Answer: (1) 18
(2) 22
◉ Given the Scheme code, answer the following two questions.
((lambda (x)
((lambda (x y)
(+ x y))
,5 (* 7 x)))
3)
(1) The value to be passed to the parameter y is 21 .
(2) The final output of the piece of code is 26 .
Answer: (1) 21
(2) 26
◉ Given this Scheme procedure:
(define foo (lambda (x)
(if (= x 0)
1
(* x (foo (- x 1))) )))
What does this procedure do?
Answer: compute x!
◉ Which of the following forms using a quote will return an error
when run?
Answer: ('+ 2 3)
(define a a)
, ◉ Which of the followings is a Scheme pair? Select all that apply.
Answer: '(x . y)
'(x . x)
'(() ())
◉ What is the correct method for constructing a pair in Scheme?
Answer: (cons 1 2)
◉ What is the return value of the code below? (min is a procedure
that returns the minimum of two values.)
(define lst '(3 5 2 9))
((min (car lst) (cadr lst)))
Answer: error message
◉ What statement is accurate and correct for Scheme lists and
pairs?
Answer: There exists a list that is not a pair.
◉ Which of the following is equivalent to the expression below?
(car (cdr '(1 2 3 4 5))
Answer: (cadr '(1 2 3 4 5))