CS 5010: Guided Practice 4.2

Here is a series of questions about lists. Before doing these exercises, consult the text to review your knowledge of cons, list, and append.

    In the following examples, assume the value of lst1 is (list 11 22 33).
    
    1. Which of the following is the value of (cons 44 lst1)?
    
    a. (list 44 11 22 33)
    b. (list (list 44) 11 22 33)
    c. (list 44)
    d. (list 11 22 33)
    e. 44
    f. (list 44 55 11 22 33)
    
    2. Which of the following is the value of (append (list 44 55) lst1)?
    
    a. (list 44 11 22 33)
    b. (list (list 44) 11 22 33)
    c. (list 44)
    d. (list 11 22 33)
    e. 44
    f. (list 44 55 11 22 33)
    
    3. Which of the following is the value of (append (list 44) lst1)?
    
    a. (list 44 11 22 33)
    b. (list (list 44) 11 22 33)
    c. (list 44)
    d. (list 11 22 33)
    e. 44
    f. (list 44 55 11 22 33)
    
    4. Which of the following is the value of (first (cons 44 lst1))?
    
    a. (list 44 11 22 33)
    b. (list (list 44) 11 22 33)
    c. (list 44)
    d. (list 11 22 33)
    e. 44
    f. (list 44 55 11 22 33)
    
    5. Which of the following is the value of (rest (cons (list 44) lst1))?
    
    a. (list 44 11 22 33)
    b. (list (list 44) 11 22 33)
    c. (list 44)
    d. (list 11 22 33)
    e. 44
    f. (list 44 55 11 22 33)
  

[ANSWER]