CS IIIC Data Structures&Algo.: Java Section 001 Fall 2018 Midterm Exam 1 Prof. J
ID: 3754760 • Letter: C
Question
CS IIIC Data Structures&Algo.: Java Section 001 Fall 2018 Midterm Exam 1 Prof. Johnson (4) For the following method: public static int A(int n) if (n 1) t return 0;) else When placed in the blank, which of the following answers will make A0 return the n even integer (where the first even integer is 0, the second even integer is 2, the third even integer is 4, the forth even integer is 6, and so on): a) return A(n 2: b) return A (2*n) c) return A (ntn): d) return A (n n) ; (5) The List ADT is fundamentally a generalization of an array, though there are some Which one of the following properties that a List ADT has that an array does not have. answers gives a property that the List ADT has that an array does not have? a) accesses contents by using numeric values to represent positions in the data structure b) has contents that are not all of the same data type c) has a fixed size of memory given to it when it is used as a part of an object's (or variable's) declaration statement d) has its contents stored in locations of memory that are physically next to each other e) none of the other answers are correct (6) The List ADT method size0 returns a value that represents the total number of items currently stored in the list. How does size0 get this value? a) uses a loop to count all of the items in the List ADT, and then returns that count as the value of size0 b) uses a constant that represents the maximum number of items possible in the List ADT, and then returns that constant as the value of size0 c) uses the new command in the List ADT constructor to declare the value of size, and then passes that value as a parameter to size0 d) counts the number of bytes used when the List ADT items are declared, and then passes that number of bytes as a parameter to size0 e) none of the other answers given are correctExplanation / Answer
4)b
5)b list is implemented using class and we can have as many as data variables in class
so we can have different type of data types can be impelemented using listADT
6)a