WITH COMPLETE SOLUTIONS
/.______ can be used to enforce the walls of an ADT. - Answer-Encapsulation
/.A __________ allocates memory for an object and can initialize the object's data. -
Answer-Constructor
/.A linked list does not always have a head. - Answer-False
/.A linked list with a null head is full. - Answer-False
/.A recursive binary search algorithm always reduces the problem size by half at each
recursive call. - Answer-True
/.A recursive method always calls itself. - Answer-False
/.A recursive solution can have more than one base case. - Answer-True
/.A reference based implementation of the ADT list does impose a fixed maximum list
length. - Answer-False
/.A reference variable contains the location of an object in memory. - Answer-True
/.A reference-based implementation of a linked list has a density factor of 1. - Answer-
False
/.A reference-based implementation of the ADT list does not shift items during insertion
or deletion. - Answer-True
/.A test for the base case enables recursive calls to stop. - Answer-True
/.According to the basic tenets of software engineering, more than 50% of the cost and
time for software is perpetuated within the maintenance phase of the software life cycle.
- Answer-True
/.ADT - Answer-Abstract Data Type
/.An array of objects is actually an array of references to the objects. - Answer-True
/.An array-based implementation of an ADT list: - Answer-requires less memory to store
a data element than a reference-based implementation.
, /.An object encapsulates only data, not operations on that data. - Answer-False
/.Check all of the following that are true of an array-based implementation of a linked
list: - Answer-Generally has a fixed size
/.Check all of the following that are true of an array-based implementation of a linked
list: - Answer-Has a density factor of 1
/.CompareTo cannot compare two different types of numbers. - Answer-True
/.Consider the following Java program. What is output by the program?
public static void main( void )
{
int a, b, result;
a = 3;
b = 4;
result = value( a, b );
System.out.printf("%d\n",result);
}
public static int value( int x, int n )
{
if ( n > 0 )
return x * value( x, n - 1 );
else
return 1;
} - Answer-81
/.Constructor - Answer-Creates and initializes a new instance of a class