Suppose that we say:

Cons lst = null;
for (int i = 0; i < 3; i++ )
    lst = append( lst, list(i) );

What is the value of lst?

  • A: (1 2 3)
  • B: (3 2 1)
  • C: (0 1 2 3)
  • D: (0 1 2)
  • E: (2 1 0)

    Answer: D

    This use of append is putting the new item at the back of the list, so the list comes out in the order of item creation.

    Contents    Page-10    Prev    Next    Page+10    Index