quiz2 - valid answers) E -> integer E...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Quiz 2 CS 2110 February 24 Name: NetId: 1. public int mystery(int n){ if (n == 0 || n == 1) return 3; if (n == 2) return 2; return n + mystery(n-1) - mystery(n-2); } What is the output of mystery(5)? (a) 6 (b) 7 (c) 8 (d) 9 2. Select the statement that is true. (a) BST stands for Binary Smart Tree. (b) A node in a binary tree has at most 3 children. (c) A node in a binary tree can have more than one parent. (d) A leaf node has no children. 3. Given the following language, which one is not a valid expression? (both (c) and (d) are
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: valid answers) E -> integer E -> (E + E - E) (a) 3 (b) (2 + (4 + 9 - 2) - 1) (c) ((2 + (3 + 5 - (7 + 11 - 2)) + 9 - (12 + 3 - 4)) + 4 - (3 + 2 - 1)) (d) 2 + 4 - 5 4. What is one advantage of using a LinkedList instead of an Array? (a) It uses less memory. (b) It has faster insertion time. (c) It does not have a xed size. (d) It has no advantages, Arrays are always a better choice. 1...
View Full Document

Ask a homework question - tutors are online