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

Question 1 Not yet answered Points out of 1.00 Flag question Question text enum

ID: 663131 • Letter: Q

Question

Question 1

Not yet answered

Points out of 1.00

Flag question

Question text

enum types are implicitly ________ and enum constants are implicitly ________.

Select one:

a. final, static.

b. static, static.

c. static, final.

d. final, final.

Question 2

Not yet answered

Points out of 1.00

Flag question

Question text

The static method ________ of class String returns a formatted String.

Select one:

a. printf.

b. format.

c. formatString.

d. toFormatString.

Question 3

Not yet answered

Points out of 1.00

Flag question

Question text

The _________ of a class are also called the public services or the public interface that the class provides to its clients.

Select one:

a. public constructors.

b. public instance variables.

c. public methods.

d. All of the above.

Question 4

Not yet answered

Points out of 1.00

Flag question

Question text

Which statement is false?

Select one:

a. An enum declaration is a comma-separated list of enum constants and may optionally include other components of traditional classes, such as constructors, fields and methods.

b. Any attempt to create an object of an enum type with operator new results in a compilation error.

c. An enum constructor cannot be overloaded.

d. An enum constructor can specify any number of parameters.

Question 5

Not yet answered

Points out of 1.00

Flag question

Question text

A constructor cannot:

Select one:

a. be overloaded.

b. initialize variables to their defaults.

c. specify return types or return values.

d. have the same name as the class.

Question 6

Not yet answered

Points out of 1.00

Flag question

Question text

Constructors:

Select one:

a. Initialize instance variables.

b. When overloaded, can have identical argument lists.

c. When overloaded, are selected by number, types and order of types of parameters.

d. a and c.

Question 7

Not yet answered

Points out of 1.00

Flag question

Question text

By default, the classpath consists only of the ________. However, the classpath can be modified by providing the ________ option to the javac compiler.

Select one:

a. root directory of the package, -d.

b. current directory, -d.

c. root directory of the package, -classpath.

d. current directory, -classpath.

Question 8

Not yet answered

Points out of 1.00

Flag question

Question text

Which of the following statements is true?

Select one:

a. Methods and instance variables can both be either public or private.

b. Information hiding is achieved by restricting access to class members via keyword public.

c. The private members of a class are directly accessible to the client of a class.

d. None of the above is true.

Question 9

Not yet answered

Points out of 1.00

Flag question

Question text

Which syntax imports all static members of class Math?

Select one:

a. static import java.lang.Math.*.

b. import static java.lang.Math.*.

c. static import java.lang.Math.

d. import static java.lang.Math.

Question 10

Not yet answered

Points out of 1.00

Flag question

Question text

When compiling a class in a package, the javac command-line option ________ causes the javac compiler to create appropriate directories based on the class's package declaration.

Select one:

a. -p.

b. -a.

c. -d.

d. -dir.

Question 11

Not yet answered

Points out of 1.00

Flag question

Question text

Which method returns an array of the enum's constants?

Select one:

a. values.

b. getValues.

c. constants.

d. getConstants.

Question 12

Not yet answered

Points out of 1.00

Flag question

Question text

Instance variables declared final do not or cannot:

Select one:

a. Cause syntax errors if used as a left-hand value.

b. Be initialized.

c. Be modified.

d. None of the above.

Question 13

Not yet answered

Points out of 1.00

Flag question

Question text

Using public set methods provides data integrity if:

Select one:

a. The instance variables are public.

b. The instance variables are private.

c. The methods perform validity checking.

d. Both b and c.

Question 14

Not yet answered

Points out of 1.00

Flag question

Question text

A class within a package must be declared public if

Select one:

a. It will only be used by other classes in the same package.

b. It will be used by classes that are not in the same package.

c. It is in the same directory as the other classes in the package.

d. It has a unique name.

Question 15

Not yet answered

Points out of 1.00

Flag question

Question text

Which of the following is false?

Select one:

a. A static method must be used to access private static instance variables.

b. A static method has no this reference.

c. A static method can be accessed even when no objects of its class have been instantiated.

d. A static method can call instance methods directly.

Question 16

Not yet answered

Points out of 1.00

Flag question

Question text

When should a program explicitly use the this reference?

Select one:

a. Accessing a private variable.

b. Accessing a public variable.

c. Accessing a local variable.

d. Accessing a field that is shadowed by a local variable.

Question 17

Not yet answered

Points out of 1.00

Flag question

Question text

The classpath consists of a list of directories or archive files, each separated by a ________ on Windows or a ________ on UNIX/Linux/Max OS X.

Select one:

a. colon (:), semicolon (;).

b. semicolon (;), colon (:).

c. comma (,), semicolon (;).

d. semicolon (;), comma (,).

Question 18

Not yet answered

Points out of 1.00

Flag question

Question text

When implementing a method, use the class's set and get methods to access the class's ________ data.

Select one:

a. public.

b. private.

c. protected.

d. All of the above.

Question 19

Not yet answered

Points out of 1.00

Flag question

Question text

Composition is sometimes referred to as a[n] ________.

Select one:

a. is-a relationship.

b. has-a relationship.

c. Many-in-one relationship.

d. one-to-many relationship.

Question 20

Not yet answered

Points out of 1.00

Flag question

Question text

A final field should also be declared ________ if it is initialized in its declaration.

Select one:

a. private.

b. public.

c. protected.

d. static.

Question 21

Not yet answered

Points out of 1.00

Flag question

Question text

Which of the following is not true?

Select one:

a. Method finalize does not take parameters and has return type void.

b. Memory leaks using Java are rare because of garbage collection.

c. Objects are marked for garbage collection by method finalize.

d. The garbage collector reclaims unused memory.

Question 22

Not yet answered

Points out of 1.00

Flag question

Question text

In the UML, public visibility is indicated by placing a ________ before an operation or an attribute, whereas a ________ indicates private visibility.

Select one:

a. letter p, letter n.

b. letter n, letter p.

c. plus sign (+), minus sign (-).

d. minus sign (-), plus sign (+).

Question 23

Not yet answered

Points out of 1.00

Flag question

Question text

Consider the statement

      package com.deitel.jhtp6.ch08;

      Which of the following is true?

Select one:

a. The statement declares a package that exists at deitel.com.

b. The statement uses the Sun Microsystems convention of package naming.

c. The statement should be placed inside the class declaration.

d. The statement will generate a compile time error.

Question 24

Not yet answered

Points out of 1.00

Flag question

Question text

What happens when this is used in a constructor's body to call another constructor of the same class if that call is not the first statement in the constructor?

Select one:

a. A compile-time error occurs.

b. A runtime error occurs.

c. It is a syntax error.

d. Nothing happens. The program compiles and runs.

Question 25

Not yet answered

Points out of 1.00

Flag question

Question text

When no access modifier is specified for a method or variable, the method or variable:

Select one:

a. Is public.

b. Is private.

c. Has package access.

d. Is static.

Question 26

Not yet answered

Points out of 1.00

Flag question

Question text

Associations in a class diagram that do not have navigability arrows at both ends indicate ________.

Select one:

a. no navigability.

b. one-way clockwise navigability.

c. one-way counterclockwise navigability.

d. bidirectional navigability.

Question 27

Not yet answered

Points out of 1.00

Flag question

Question text

Which statement is false?

Select one:

a. The compiler always creates a default constructor for a class.

b. If a class has constructors, but none of the public constructors are no-argument constructors, and a program attempts to call a no-argument constructor to initialize an object of he class, a compilation error occurs.

c. A constructor can be called with no arguments only if the class does not have any constructors or if the class has a public no-argument constructor.

d. None of the above.

Question 28

Not yet answered

Points out of 1.00

Flag question

Question text

Abstract Data Types:

Select one:

a. Elevate the importance of data.

b. Are only approximations or models of real-world concepts and behaviors.

c. Capture two notions, data representation and operations.

d. All of the above.

Question 29

Not yet answered

Points out of 1.00

Flag question

Question text

A package is:

Select one:

a. A directory structure used to organize classes and interfaces.

b. A mechanism for software reuse.

c. A group of related classes and interfaces.

d. All of the above.

Question 30

Not yet answered

Points out of 1.00

Flag question

Question text

Set methods are also commonly called ________ methods and get methods are also commonly called ________ methods.

Select one:

a. query, mutator.

b. accessor, mutator.

c. mutator, accessor.

d. query, accessor.

Question 31

Not yet answered

Points out of 1.00

Flag question

Question text

The term information hiding refers to:

Select one:

a. public methods.

b. Hiding implementation details from clients of a class.

c. Accessing static class members.

d. The process of releasing an object for garbage collection.

Question 32

Not yet answered

Points out of 1.00

Flag question

Question text

The import declaration import *; ________.

Select one:

a. causes a compilation error.

b. imports all classes in the library.

c. imports the default classes in the library.

d. imports the classes in package java.lang.

Question 33

Not yet answered

Points out of 1.00

Flag question

Question text

Java programmers do not focus on:

Select one:

a. Crafting new classes and reusing existing classes.

b. Understanding class library implementations

c. Carefully testing classes they design.

d. Carefully documenting classes they design.

Question 34

Not yet answered

Points out of 1.00

Flag question

Question text

Having a this reference allows:

Select one:

a. a method to refer explicitly to the instance variables and other methods of the object on which the method was called.

b. a method to refer implicitly to the instance variables and other methods of the object on which the method was called.

c. an object to reference itself.

d. All of the above.

Question 35

Not yet answered

Points out of 1.00

Flag question

Question text

The import declaration import java.util.*; is known as a ________.

Select one:

a. single-type-import declaration.

b. all-type-import declaration.

c. multiple-import declaration.

d. type-import-on-demand declaration.

Question 36

Not yet answered

Points out of 1.00

Flag question

Question text

Which of the following does not contribute to improved software reusability?

Select one:

a. Quickly creating new class libraries without testing them thoroughly.

b. Licensing schemes and protection mechanisms.

c. Descriptions of classes that allow programmers to determine whether a class fits their needs.

d. Cataloging schemes and browsing mechanisms.

Question 37

Not yet answered

Points out of 1.00

Flag question

Question text

Which statement is false?

Select one:

a. The actual data representation used within the class is of no concern to the class's clients.

b. Clients generally care about what the class does but not how the class does it.

c. Clients are usually involved in a class's implementation.

d. Hiding the implementation reduces the possibility that clients will become dependent on class-implementation details.

Question 38

Not yet answered

Points out of 1.00

Flag question

Question text

A programmer-defined constructor that has no arguments is called a ________.

Select one:

a. zero-argument constructor.

b. no-argument constructor.

c. default constructor.

d. main constructor.

Question 39

Not yet answered

Points out of 1.00

Flag question

Question text

Which of the following should usually be private?

Select one:

a. Methods.

b. Constructors.

c. Variables (or fields).

d. All of the above.

Question 40

Not yet answered

Points out of 1.00

Flag question

Question text

Static class variables:

Select one:

a. are final.

b. are public.

c. are private.

d. are shared by all objects of a class.

Explanation / Answer

I bolded the text option( which is correct answer)...please have a look...if you need any clarification..place a comment

-------------------------------------------**********************************************----------------------------------------------------

Question 1

enum types are implicitly ________ and enum constants are implicitly ________.

Select one:

a. final, static.

b. static, static.

c. static, final.

d. final, final.

Question 2

The static method ________ of class String returns a formatted String.

Select one:

a. printf.

b. format.

c. formatString.

d. toFormatString.

The _________ of a class are also called the public services or the public interface that the class provides to its clients.

Select one:

a. public constructors.

b. public instance variables.

c. public methods.

d. All of the above.

Which statement is false?

Select one:

a. An enum declaration is a comma-separated list of enum constants and may optionally include other components of traditional classes, such as constructors, fields and methods.

b. Any attempt to create an object of an enum type with operator new results in a compilation error.

c. An enum constructor cannot be overloaded.

d. An enum constructor can specify any number of parameters.

Question 5

A constructor cannot:

Select one:

a. be overloaded.

b. initialize variables to their defaults.

c. specify return types or return values.

d. have the same name as the class.

Question 6

Constructors:

Select one:

a. Initialize instance variables.

b. When overloaded, can have identical argument lists.

c. When overloaded, are selected by number, types and order of types of parameters.

d. a and c.

Question 7

By default, the classpath consists only of the ________. However, the classpath can be modified by providing the ________ option to the javac compiler.

Select one:

a. root directory of the package, -d.

b. current directory, -d.

c. root directory of the package, -classpath.

d. current directory, -classpath.

Question 8

Which of the following statements is true?

Select one:

a. Methods and instance variables can both be either public or private.

b. Information hiding is achieved by restricting access to class members via keyword public.

c. The private members of a class are directly accessible to the client of a class.

d. None of the above is true.

Question 9

Which syntax imports all static members of class Math?

Select one:

a. static import java.lang.Math.*.

b. import static java.lang.Math.*.

c. static import java.lang.Math.

d. import static java.lang.Math.

Question 10

When compiling a class in a package, the javac command-line option ________ causes the javac compiler to create appropriate directories based on the class's package declaration.

Select one:

a. -p.

b. -a.

c. -d.

d. -dir.

Question 11

Which method returns an array of the enum's constants?

Select one:

a. values.

b. getValues.

c. constants.

d. getConstants.

Question 12

Instance variables declared final do not or cannot:

Select one:

a. Cause syntax errors if used as a left-hand value.

b. Be initialized.

c. Be modified.

d. None of the above.

Question 13

Using public set methods provides data integrity if:

Select one:

a. The instance variables are public.

b. The instance variables are private.

c. The methods perform validity checking.

d. Both b and c.

Question 14

A class within a package must be declared public if

Select one:

a. It will only be used by other classes in the same package.

b. It will be used by classes that are not in the same package.

c. It is in the same directory as the other classes in the package.

d. It has a unique name.

Question 15

Which of the following is false?

Select one:

a. A static method must be used to access private static instance variables.

b. A static method has no this reference.

c. A static method can be accessed even when no objects of its class have been instantiated.

d. A static method can call instance methods directly.

Question 16

When should a program explicitly use the this reference?

Select one:

a. Accessing a private variable.

b. Accessing a public variable.

c. Accessing a local variable.

d. Accessing a field that is shadowed by a local variable.

Question 17

The classpath consists of a list of directories or archive files, each separated by a ________ on Windows or a ________ on UNIX/Linux/Max OS X.

Select one:

a. colon (:), semicolon (;).

b. semicolon (;), colon (:).

c. comma (,), semicolon (;).

d. semicolon (;), comma (,).

Question 18

When implementing a method, use the class's set and get methods to access the class's ________ data.

Select one:

a. public.

b. private.

c. protected.

d. All of the above.

Question 19

Composition is sometimes referred to as a[n] ________.

Select one:

a. is-a relationship.

b. has-a relationship.

c. Many-in-one relationship.

d. one-to-many relationship.

Question 20

A final field should also be declared ________ if it is initialized in its declaration.

Select one:

a. private.

b. public.

c. protected.

d. static.

Question 21

Which of the following is not true?

Select one:

a. Method finalize does not take parameters and has return type void.

b. Memory leaks using Java are rare because of garbage collection.

c. Objects are marked for garbage collection by method finalize.

d. The garbage collector reclaims unused memory.

Question 22

In the UML, public visibility is indicated by placing a ________ before an operation or an attribute, whereas a ________ indicates private visibility.

Select one:

a. letter p, letter n.

b. letter n, letter p.

c. plus sign (+), minus sign (-).

d. minus sign (-), plus sign (+).

Question 23

Consider the statement

      package com.deitel.jhtp6.ch08;

      Which of the following is true?

Select one:

a. The statement declares a package that exists at deitel.com.

b. The statement uses the Sun Microsystems convention of package naming.

c. The statement should be placed inside the class declaration.

d. The statement will generate a compile time error.

Question 24

What happens when this is used in a constructor's body to call another constructor of the same class if that call is not the first statement in the constructor?

Select one:

a. A compile-time error occurs.

b. A runtime error occurs.

c. It is a syntax error.

d. Nothing happens. The program compiles and runs.

Question 25

When no access modifier is specified for a method or variable, the method or variable:

Select one:

a. Is public.

b. Is private.

c. Has package access.

d. Is static.

Question 26

Associations in a class diagram that do not have navigability arrows at both ends indicate ________.

Select one:

a. no navigability.

b. one-way clockwise navigability.

c. one-way counterclockwise navigability.

d. bidirectional navigability.

Question 27

Which statement is false?

Select one:

a. The compiler always creates a default constructor for a class.

b. If a class has constructors, but none of the public constructors are no-argument constructors, and a program attempts to call a no-argument constructor to initialize an object of he class, a compilation error occurs.

c. A constructor can be called with no arguments only if the class does not have any constructors or if the class has a public no-argument constructor.

d. None of the above.

Question 28

Abstract Data Types:

Select one:

a. Elevate the importance of data.

b. Are only approximations or models of real-world concepts and behaviors.

c. Capture two notions, data representation and operations.

d. All of the above.

Question 29

A package is:

Select one:

a. A directory structure used to organize classes and interfaces.

b. A mechanism for software reuse.

c. A group of related classes and interfaces.

d. All of the above.

Question 30

Set methods are also commonly called ________ methods and get methods are also commonly called ________ methods.

Select one:

a. query, mutator.

b. accessor, mutator.

c. mutator, accessor.

d. query, accessor.

Question 31

The term information hiding refers to:

Select one:

a. public methods.

b. Hiding implementation details from clients of a class.

c. Accessing static class members.

d. The process of releasing an object for garbage collection.

Question 32

The import declaration import *; ________.

Select one:

a. causes a compilation error.

b. imports all classes in the library.

c. imports the default classes in the library.

d. imports the classes in package java.lang.

Question 33

Java programmers do not focus on:

Select one:

a. Crafting new classes and reusing existing classes.

b. Understanding class library implementations

c. Carefully testing classes they design.

d. Carefully documenting classes they design.

Question 34

Having a this reference allows:

Select one:

a. a method to refer explicitly to the instance variables and other methods of the object on which the method was called.

b. a method to refer implicitly to the instance variables and other methods of the object on which the method was called.

c. an object to reference itself.

d. All of the above.

Question 35

The import declaration import java.util.*; is known as a ________.

Select one:

a. single-type-import declaration.

b. all-type-import declaration.

c. multiple-import declaration.

d. type-import-on-demand declaration.

Question 36

Which of the following does not contribute to improved software reusability?

Select one:

a. Quickly creating new class libraries without testing them thoroughly.

b. Licensing schemes and protection mechanisms.

c. Descriptions of classes that allow programmers to determine whether a class fits their needs.

d. Cataloging schemes and browsing mechanisms.

Question 37

Which statement is false?

Select one:

a. The actual data representation used within the class is of no concern to the class's clients.

b. Clients generally care about what the class does but not how the class does it.

c. Clients are usually involved in a class's implementation.

d. Hiding the implementation reduces the possibility that clients will become dependent on class-implementation details.

Question 38

A programmer-defined constructor that has no arguments is called a ________.

Select one:

a. zero-argument constructor.

b. no-argument constructor.

c. default constructor.

d. main constructor.

Question 39

Which of the following should usually be private?

Select one:

a. Methods.

b. Constructors.

c. Variables (or fields).

d. All of the above.

Question 40

Static class variables:

Select one:

a. are final.

b. are public.

c. are private.

d. are shared by all objects of a class.

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