With 100% Verified Solutions |
Updated | GRADED A+
Encapsulation is about assigning responsibilities to objects. - ANSWER -True
Which object oriented element is used to define "is a" relationships? - ANSWER -
Inheritence
A name defined in an inner scope is not available outside that block. - ANSWER -
True
The "inherits" keyword is used to specify inheritance in Java. - ANSWER -False,
(extends keyword is used to specify inheritance in java.)
The Java keyword throw is used to catch an exception. - ANSWER -False
Any recursive algorithm can be written iteratively. - ANSWER -True
The index of the last element of an array with a size of 5 elements is _____. -
ANSWER -4
We can use a variable as an index expression to access an array element in Java. -
ANSWER -True
To help us collect information from the user through the keyboard in Java, we use
a(n) _____. - ANSWER -Scanner
Java Boolean literal values are expressed in all lowercase. - ANSWER -True
Which of the following would have a exponential Big O run-time complexity?
Compute the area of a circle given the radius
Determine if two logical statements are equivalent by brute force
Find the phone number in a phone book, given a person's name
Delete a value from an ArrayList
,none of these - ANSWER -Determine if two logical statements are equivalent by
brute force
Which of the following would have a logarithmic Big O run-time complexity?
Determine if two logical statements are equivalent by brute force
Compute the area of a circle given the radius
Delete a value from an ArrayList
Find the phone number in a phone book, given a person's name
none of these - ANSWER -Delete a value from an ArrayList
Which of the following run-time complexity orders is best?
O(log n) Logarithmic time
none of these
O(n) Linear time
O(2^n) Exponential - ANSWER -O(log n) Logarithmic time
Which of the following run-time complexity orders is worst?
O(n) Linear time
O(log n) Logarithmic time
none of these
O(1) Constant time - ANSWER -O(n) Linear time
A name defined in an outer scope is not available in all blocks nested inside that
scope. - ANSWER -True
Which keyword is used in Java to create an object?
none of these
create
build
make
new - ANSWER -new
Which object oriented element is best defined as "objects best viewed as packages
of responsibility"?
Data Hiding
Message Passing
Encapsulation
, Polymorphism
Inheritance
none of these
Composition - ANSWER -Encapsulation
We can more easily debug a program when the responsibilities are well
encapsulated. - ANSWER -True
A Queue is a First In First Out (FIFO) data structure. - ANSWER -True
The finally block of a try/catch structure will execute if no exception occurs in the
try block. - ANSWER -True
In a Binary Search Tree, all elements below a given a node have values that are <
that node's value. - ANSWER -False
Stacks can only be implemented as LinkedLists, while Queues can only be
implemented as ArrayLists. - ANSWER -False
In a Binary Search Tree, all elements to one side of a node are < that node's value,
and all elements to the other side are > that node's value. - ANSWER -True
The finally block of a try/catch structure will execute if an exception occurs in the
try block. - ANSWER -True
Which of the following run-time complexity orders is best?
O(log n) Logarithmic time
none of these
O(2^n) Exponential
O(n) Linear time - ANSWER -none of these
Which of the following would have a quadratic Big O run-time complexity?
none of these
Bubble Sort an unsorted array
Insert a value into an ArrayList
Efficiently find the phone number in a phone book, given a person's name
Determine if a binary number is even or odd - ANSWER -Bubble sort
Which of the following would have a quadratic Big O run-time complexity?
Efficiently find the definition of a given word in a dictionary