Filters
Question type

Study Flashcards

If a class does not define constructors, the compiler provides a default constructor with no parameters, and the class's instance variables are initialized to ________.


A) zero
B) null
C) their default values.
D) false

Correct Answer

verifed

verified

Which of the following statements is false?


A) If a class does not define constructors, the compiler provides a default constructor with no parameters.
B) If you declare a constructor for a class, the compiler will not create a default constructor for that class.
C) The UML models constructors in the third compartment of a class diagram.
D) To distinguish a constructor from a class's operations, the UML places the word "constructor" between double quotes before the constructor's name.

Correct Answer

verifed

verified

An import declaration is not required if you always refer to a class with its ________ name, which includes its package name and class name.


A) compile-time
B) default package
C) paired
D) fully qualified name

Correct Answer

verifed

verified

Which of the following statements is false?


A) Most classes you'll use in Java programs must be imported explicitly.
B) There's a special relationship between classes that are compiled in the same directory. By default, such classes are considered to be in the same package-known as the default package.
C) Classes in the same package are implicitly imported into main.
D) An import declaration is not required when one class in a package uses another in the same package.

Correct Answer

verifed

verified

The format specifier ________ is used to output values of type float or double.


A) %f
B) %d
C) %fd
D) %r

Correct Answer

verifed

verified

Which of the following statements is false?


A) The javac command can compile multiple classes at once; simply list the source-code filenames after the command with each filename separated by a comma from the next.
B) If the directory containing the app includes only one app's files, you can compile all of its classes with the command javac *.java.
C) The asterisk (*) in javac *.java indicates that all files in the current directory ending with the filename extension ".java" should be compiled.
D) All of the above are true.

Correct Answer

verifed

verified

Which of the following statements is false?


A) Variables declared in the body of a particular method are local variables and can be used only in that method.
B) A method's parameters are local variables of the method.
C) Every method's body is delimited by left and right braces ({ and }) .
D) Keyword null indicates that a method will perform a task but will not return any information.

Correct Answer

verifed

verified

Showing 21 - 27 of 27

Related Exams

Show Answer