CS I1IC Data Structures& Algo.: Java Seetion 001 Fall 2018 Midterm Exam 1 Prot.
ID: 3754761 • Letter: C
Question
CS I1IC Data Structures& Algo.: Java Seetion 001 Fall 2018 Midterm Exam 1 Prot. Johnson (7) What list of colors results from the following: ListArrayBased colors new ListArrayBasedO colors.add(0, "Red") colors.add(1, "Green"); colors.add(2, "Blue"); colors.add(1, "Yellow) colors.remove(1); a) item 0:Red item 1:Green item 2:Blue b) item 0 Red item 1:Yellow item 2:Blue c) item 0:Yellow item 1:Green item 2:Blue c) item 0:Yellow item 1:Red item 2-Green e) item 0:Yellow item 1:Green item 2:Blue (8) If the value of 1 was used for the n parameter, how many recursive function calls would the following function have: public static int f(int n) t if (n >-10) return n; if (n . 1) return 1 f (n 1) Hint: The number of recursive calls would be equal to the maximum number of arrows used in a box trace of this function. Note: Select the answer for the number of recursive function calls, not the number of total function calls! a) 10 b)9c) 12 d) 11 e)none of the other answers are correct (9) Which of the following is not inherited from the Java interface used by the List ADT? a) class variables b) class method visibility, name, and return data type c) throws statements used by class methods d) both answers b and c e) none of the other answers are correctExplanation / Answer
7)(b) item 0: Red item 1: Yellow item 2: Blue -> Hear I tem 1 will overwirte with Yellow
8)(a) 10 : because it is starting with 1 and ending with 10.
9)(c) throws statements used by class methods.