Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

QUESTION 11 To convert the double variable, d = 543.98, to a string, use the fol

ID: 3831201 • Letter: Q

Question

QUESTION 11

To convert the double variable, d = 543.98, to a string, use the following statement.

String str = Double.toString(d);

String str = d.Double.toString(str);

String str = double.toString(d);

String str = double(d);

5 points   

QUESTION 12

An abstract class is not instantiated, but serves as a superclass for other classes.

True

False

5 points   

QUESTION 13

For an optimal OOD design it is best to have

classes that are tightly coupled with high cohesion

classes that are loosely coupled with low cohesion

classes that are tightly coupled with low cohesion

classes that are loosely coupled with high cohesion

5 points   

QUESTION 14

A search algorithm

Arranges elements in ascending order

Arranges elements in descending order

Is a way to locate a specific item in a larger collection of data

Is rarely used with arrays

5 points   

QUESTION 15

In an interface all methods have

private access

public access

protected access

packaged access

5 points   

QUESTION 16

Given the generic method below, what data types can be passed in?

public static   

void displayArray(E[ ] array) {

for (E element : array)

::

}

any data type

any reference type

any data type that is a sub class of Number

any type that a super class of Number

5 points   

QUESTION 17

The following statement creates an ArrayList object. What is the purpose of the notation?

ArrayList arr = new ArrayList<>();

It specifies that everything stored in the ArrayList object will be converted to a String

It specifies that only String objects may be stored in the ArrayList object

Nothing as the statement is invalid.

It specifies that the get method will return only String objects

5 points   

QUESTION 18

The String[] args parameter in the main method header allows the program to receive arguments from the operating system command-line.

True

False

5 points   

QUESTION 19

In a class hierarchy      

the more general classes are toward the left of the tree and the more specialized are toward the right

the more general classes are toward the bottom of the tree and the more specialized are toward the top

the more general classes are toward the top of the tree and the more specialized are toward the bottom

the more general classes are toward the right of the tree and the more specialized are toward the left

5 points   

QUESTION 20

Which of the following correctly tests the char variable chr to determine whether it is not equal to the character B?

if (chr < 'B')

if (chr != "B")

if (chr != 'B')

if (chr > 'B')

String str = Double.toString(d);

String str = d.Double.toString(str);

String str = double.toString(d);

String str = double(d);

Explanation / Answer

11. To convert the double variable, d = 543.98, to a string, we uses

Option A: String str = Double.toString(d);

12. True

Abstract methods are commonly used in abstract classes. An abstract class is not instantiated itself, but serves as a superclass for other classes. The abstract class represents the generic or abstract form of all the classes that inherit from it.

13. Option D

For an optimal OOD design it is best to have classes that are loosely coupled with high cohesion.

In general, good OO design calls for loose coupling and shuns tight coupling and also good OO design calls for high cohesion, and shuns low cohesion.

14. Option C

A search algorithm is a way to locate a specific item in a larger collection of data.

15. In an interface all methods have public access.

16. Option A

any data type

17. OPTION B

It specifies that only String objects may be stored in the ArrayList object

18. TRUE

19. Option C

The more general classes are towards the top of the tree and the more specialized are toward the bottom.

20. Option C

if (char != 'B').

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote