Filters
Question type

Study Flashcards

Declaring instance variables ________ is known as data hiding or information hiding.


A) secure
B) private
C) static
D) masked

Correct Answer

verifed

verified

A __________ of a class called myClass is another class whose methods call the methods of myClass.


A) consumer
B) servant
C) caller
D) client

Correct Answer

verifed

verified

Which of the following statements is false?


A) Scanner method next reads characters until any white-space character is encountered,then returns the characters as a String.
B) To call a method of an object,follow the object name with a comma,the method name and a set of parentheses containing the method's arguments.
C) A class instance creation expression begins with keyword new and creates a new object.
D) A constructor is similar to a method but is called implicitly by the new operator to initialize an object's instance variables at the time the object is created.

Correct Answer

verifed

verified

Which of the following statements is false?


A) By convention class names begin with an uppercase letter,and method and variable names begin with a lowercase letter.
B) Instance variables exist before methods are called on an object,while the methods are executing and after the methods complete execution.
C) A class normally contains one or more methods that manipulate the instance variables that belong to particular objects of the class.
D) Instance variables can be declared anywhere inside a class.

Correct Answer

verifed

verified

Which class provides prebuilt dialog boxes that enable programs to display windows containing messages (such windows are called message dialogs) ?


A) JDialogBox.
B) JPrebuiltDialog.
C) JMessageDialog.
D) JOptionPane.

Correct Answer

verifed

verified

When a method terminates,the values of its local variables are ________.


A) saved
B) copied
C) restored
D) lost

Correct Answer

verifed

verified

Which of the following statements is false?


A) A primitive-type variable can store exactly one value of its declared type at a time.
B) Primitive-type instance variables are initialized by default.
C) Variables of types byte,char,short,int,long,float and double are initialized to 0.
D) Variables of type boolean are initialized to true.

Correct Answer

verifed

verified

Which of the following statements is true?


A) The UML models a parameter of an operation by listing the parameter name,followed by a colon and the parameter value between the parentheses after the operation name.
B) The UML indicates an operation's return type by placing a colon and the return value after the parentheses following the operation name.
C) UML class diagrams do not specify return types for operations that do not return values.
D) Declaring instance variables public is known as data hiding or information hiding.

Correct Answer

verifed

verified

Which of the following statements is true?


A) Each object (instance) of the class shares the class's instance variables.
B) Most instance-variable declarations are preceded with the keyword public,which is an access modifier.
C) Variables or methods declared with access modifier private are accessible only to methods of the class in which they're declared.
D) None of the above is true.

Correct Answer

verifed

verified

Java requires a ________ call for every object that's created.


A) constructor
B) destructor
C) parameterless
D) parameterized

Correct Answer

verifed

verified

You can declare new classes as needed;this is one reason Java is known as a(n) ________ language.


A) portable
B) incremental
C) extensible
D) virtual

Correct Answer

verifed

verified

Which of the following statements is false?


A) A reference to an object is required to invoke an object's methods.
B) A primitive-type variable does not refer to an object.
C) Reference-type instance variables are initialized by default to the value void.
D) A primitive-type variable cannot be used to invoke a method.

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

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

Showing 21 - 34 of 34

Related Exams

Show Answer