Java Phyton & Scheme Questionnaire
Description
1. Consider the following Scheme function:
(define (f n x y z)
(if (> n 0)(and
(f (- n 1) x z y)
(display (cons n(cons x (cons y ‘()))))
(f (- n 1) z y x))))
The return value of the call: (f 3 ‘a ‘c ‘b)
is:
(3 a c)(2 a b)(1 c b)(3 a c)(1 b a)(2 b c)(1 a c)
Question 7 options:True
False
2. Consider the following Scheme function:
(define (f n)
(if (= (/ n 2) 0)
#t
#f))
Which is the right answer for the call: (f 5)
Question 10 options:
5
2
#f
#t
3. Suppose the content of the variable: lst is a list:
(1 2 3 4 5 6).
In the functional programming Scheme, we can replace:
(caddr lst)
by:
Question 11 options:
(car (cdr (cdr lst)))
(cdddr lst)
(caaar lst)
(cdadr lst)
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."