Deck 2: Using Objects

Full screen (f)
exit full mode
Question
The camel case naming convention uses _________ at intervals in the middle of the variable name.

A)uppercase letters
B)digits
C)dollar signs
D)the underscore character
Use Space or
up arrow
down arrow
to flip the card.
Question
By convention among Java programmers, class names begin with a(n) _____________.

A)lowercase letter
B)dollar sign
C)digit
D)uppercase letter
Question
What term is used to refer to text in a program that is an explanation for human readers of the code?

A)methods
B)comments
C)constants
D)[* and *]
Question
Which of the following declares a variable that will store a welcome message?

A)String welcome;
B)double welcome;
C)Char welcome;
D)int welcome;
Question
By convention among Java programmers, variables begin with a(n) _____________.

A)uppercase letter
B)digit
C)lowercase letter
D)dollar sign
Question
What is the name of the type that denotes a string of characters?

A)Characters
B)char
C)charString
D)String
Question
Which term is used to describe the name of a variable, method, or class?

A)type
B)literal
C)identifier
D)label
Question
You can invoke the println and print methods on which object?

A)the HelloWorld object
B)the String class
C)any PrintStream object
D)any object in Java
Question
In Java, a comment on a line begins with which characters?

A)''
B)//
C)()
D)" "
Question
A method is a sequence of ___ that accesses the data of an object.

A)data
B)objects
C)instructions
D)streams
Question
What is the name of the type that denotes whole numbers?

A)double
B)int
C)whole
D)integer
Question
Which of the following declares a variable that will store a count with an integer value?

A)integer count;
B)double count;
C)String count;
D)int count;
Question
Which of the following declares a variable that will store a measurement with fractional parts?

A)int measure;
B)double measure;
C)String measure;
D)integer measure;
Question
In Java, a(n) _________ specifies the kind of values that can be stored in a variable.

A)literal
B)class
C)operator
D)type
Question
What is the name of the type that denotes floating-point numbers that can have fractional parts?

A)double
B)floatingPoint
C)int
D)integer
Question
Which of the following is the best choice for a variable identifier that will store a name?

A)name
B)Name
C)n
D)nm
Question
The "building blocks" that Java programmers use to write computer programs are called _______.

A)windows
B)objects
C)internal data
D)entities
Question
In Java, objects within the same class share common _______.

A)behavior
B)data
C)instructions
D)comments
Question
Which statement about identifiers is correct?

A)Identifiers are not case sensitive.
B)Spaces are permitted inside identifiers.
C)Identifiers can use symbols such as ? or %.
D)Identifiers can be made up of letters, digits, and the underscore (_) character.
Question
What is a storage location in the computer's memory called that has a type, name, and contents?

A)identifier
B)literal
C)label
D)variable
Question
Which statement declares and stores an integer value in a variable?

A)count = 5;
B)int count = 5;
C)integer count = 5;
D)String count = 5;
Question
Which statement stores an integer value in a variable?

A)count = 5;
B)count = 5.0;
C)count == 5;
D)count != 5;
Question
What is the term used to specify the collection of things you can do with objects that belong to a class?

A)private interface
B)public interface
C)private implementation
D)hidden implementation
Question
A method name is ____________________ if a class has more than one method with that name (but different parameter types).

A)overridden
B)overimplemented
C)overwhelmed
D)overloaded
Question
What is the name of the = operator in Java?

A)inequality
B)assignment
C)identity
D)equality
Question
What is the purpose of the assignment operator?

A)to check for inequality
B)to check for identity
C)to check for equality
D)to change the value of a variable
Question
The type of an object is given by its ______ ?

A)variable
B)method
C)reference
D)class
Question
Input to a method, enclosed in parentheses after the method name, is known as ______________.

A)implicit parameters
B)interfaces
C)arguments
D)return values
Question
The Java compiler ignores any text between ____.

A)(* and *)
B)/* and */
C){* and *}
D)// and //
Question
The value calculated by a method is called its _____ value.

A)implicit
B)explicit
C)argument
D)return
Question
Which of the following code fragments will cause an error?

A) String greeting =" Hello, Dave !";
B) String greeting = "Hello, World!";
int n= greeting.length();
C) Int luckyNumber;
System. out. println(luckyNumber);
D) Printstream printer = System.out;
Question
The input to a method is called a(n) _______________.

A)overloaded
B)argument
C)interface
D)procedure
Question
Assume that the variable count has been declared as type int.Which statement adds 10 to count?

A)count = 10;
B)count == count + 10;
C)count = count + 10;
D)count + 10;
Question
"System.out" is an example of which class?

A)String
B)Println
C)System
D)PrintStream
Question
If greeting is a String object, which method call is incorrect?

A)greeting.length()
B)greeting.toLowerCase()
C)greeting.toUpperCase()
D)greeting.println()
Question
Assuming that the variable count has been declared as type int, which statement changes the value of count?

A)count = 6;
B)count == 6;
C)integer count = 6;
D)count = 6.0;
Question
Which method call represents the invocation of a method that does not have arguments?

A)greeting.replace("Hello", "Welcome");
B)greeting.length
C)greeting.length()
D)System.out.println(greeting);
Question
What is an object?

A)A sequence of instructions.
B)Any value stored in a variable.
C)An entity in your program that is manipulated by calling methods.
D)Any input to a method.
Question
Which of the following statements about objects is correct?

A)An object defines the methods for a class.
B)Every object belongs to a class.
C)An object is a sequence of instructions.
D)All entities, even numbers, are objects.
Question
Which statement about methods is true?

A)A method must return a value
B)The return value of a method must be stored in a variable
C)Some methods carry out an action; others return a value
D)All methods require multiple arguments
Question
What does API stand for?

A)Applet Programming Interface
B)Application Programmer Interaction
C)Application Programming Instance
D)Application Programming Interface
Question
A(n) _____________ is a collection of classes with a related purpose.

A)package
B)import
C)method
D)collection
Question
Which of the following statements about methods is correct?

A)A method is a sequence of instructions that could access the data of an object
B)A method name is unique across the entire program.
C)A method can be called on any object in any class.
D)Methods are stored in variables.
Question
Which operator constructs object instances?

A)new
B)instanceof
C)void
D)construct
Question
If greeting refers to a String object, which of the following is a syntactically correct Java statement?

A)System.out.println(length().greeting);
B)System.out.println(greeting());
C)System.out.println(greeting.length());
D)greeting.println("Hello");
Question
Which is not a method of the String class?

A)length
B)toUpperCase
C)toLowerCase
D)println
Question
Which of the following represents a method call to a method with a void return type?

A)greeting.toUpperCase()
B)System.out.println()
C)greeting.replace("Hello","World")
D)greeting.length()
Question
Which statement calls a constructor with no construction arguments?

A)Circle c = new Circle();
B)A call to a constructor must have construction arguments.
C)Circle c = new Circle;
D)Circle c = Circle()
Question
Which term describes a method of an object that modifies that object's internal data?

A)public
B)void
C)mutator
D)accessor
Question
Which statement declares a variable that references a Circle of radius 3, assuming the construction parameter is the radius value?

A)Circle c = Circle(3)
B)Circle c = new Circle(3);
C)Circle c.new.Circle(3);
D)c.Circle(3);
Question
Which of the following represents a method declaration with a void return type?

A)public void setValue(int value) { ...}
B)public void int getValue() { ...}
C)void public setValue(int value) { ...}
D)void int getValue() { ...}
Question
Which of the following constructs a Circle of radius 3, assuming the construction parameter is the radius value?

A)Circle(3).new
B)new Circle(3)
C)new.Circle(3)
D)Circle(3)
Question
Which package is automatically imported in any Java program?

A)java.system
B)java.lang
C)java.language
D)java.util
Question
To use a class in another package you need to ________ it.

A)export
B)overload
C)rewrite
D)import
Question
Which of the following method calls illustrate using the return value of a method as an argument?

A)greeting.length();
B)greeting.println("Hello");
C)System.out.println(length.greeting());
D)System.out.println(greeting.length());
Question
Which of the following statements about methods is correct?

A)A method can have only one argument.
B)The return value of a method can be used as an argument to another method.
C)Every method must have a return value.
D)A method can have multiple arguments.
Question
What is the declared return type for a method that does not have a return value?

A)String
B)There is no declared return type when a method does not return a value.
C)void
D)A method must return a value.
Question
What terminology describes a method that returns information about an object and does not change the object's internal data?

A)mutator
B)accessor
C)void
D)public
Question
Which of the following statements about classes is correct?

A)By convention, class names begin with a lowercase letter.
B)A class declares the methods that you can apply to its objects.
C)All entities, even primitive numbers, are classes.
D)A class is a sequence of instructions that accesses the data of an object.
Question
Which of the following is a mutator method for the Rectangle class?

A)getHeight
B)translate
C)getWidth
D)isEmpty
Question
Based on the following statement, which of the following statements sets the title of the frame:
JFrame frame = new JFrame();

A)frame.title = "An Empty Frame";
B)frame.setTitle(JFrame.EMPTY);
C)frame.addTitle("An Empty Frame");
D)frame.setTitle("An Empty Frame");
Question
What is the output of the following code: <strong>What is the output of the following code:   </strong> A)6, 10 B)10, 6 C)6, 6 D)10, 10 <div style=padding-top: 35px>

A)6, 10
B)10, 6
C)6, 6
D)10, 10
Question
Assuming the following Java statement:
int num = 10;
What does the variable num store?

A)The memory location where the value 10 is stored.
B)A reference to the int primitive type.
C)An object representing the number 10.
D)The numeric value 10.
Question
Which class is part of the java.lang package?

A)Rectangle
B)PrintStream
C)String
D)Circle
Question
Assuming the following Java statement:
Circle c1 = new Circle(3);
What does the variable c1 store?

A)The constructed Circle object itself.
B)A reference to the Circle class.
C)A reference to the constructed Circle object.
D)The numeric value 3.
Question
Which of the following statements about test programs is true?

A)Test programs verify that methods have been implemented correctly.
B)A tester class does not contain the main method.
C)You do not have to display the expected results.
D)Writing test programs is not an important skill.
Question
What is the output of the following code: <strong>What is the output of the following code:   </strong> A)6 B)10 C)4 D)16 <div style=padding-top: 35px>

A)6
B)10
C)4
D)16
Question
What do object variables store?

A)objects
B)classes
C)object references
D)numbers
Question
Which method could you use to obtain the string "1234567890" from the string "123-456-7890"?

A)isEmpty
B)replace
C)trim
D)length
Question
What is the nickname for the graphical user interface library in Java?

A)Applet
B)GUI
C)JComponent
D)Swing
Question
What is the output of the following code: <strong>What is the output of the following code:   </strong> A)6, 10 B)16, 16 C)16, 22 D)16, 26 <div style=padding-top: 35px>

A)6, 10
B)16, 16
C)16, 22
D)16, 26
Question
What is the purpose of a test program?

A)The test program confirms that the Java compiler is correct.
B)The test program verifies that methods have been implemented correctly.
C)The test program checks the syntax of each object's methods.
D)The test program enforces that the types between arguments match correctly.
Question
Complete this code fragment to ensure that the frame is shown:
JFrame frame = new JFrame();

A)frame.setVisible(true);
B)frame.visible = true;
C)JFrame.setVisible();
D)frame.setVisible();
Question
What is the output of the following code: <strong>What is the output of the following code:   </strong> A)3 B)8 C)6 D)4 <div style=padding-top: 35px>

A)3
B)8
C)6
D)4
Question
Drawing instructions should be placed inside the ____ method, which is called whenever the component needs to be repainted.

A)paintComponent
B)draw
C)paint
D)drawComponent
Question
Which import statement allows for the use of the Rectangle class?

A)import java.geom.Rectangle2D;
B)import java.geom.Rectangle;
C)import java.geom.RectangularShape;
D)import java.awt.Rectangle;
Question
The setVisible method of the JFrame class returns what kind of argument?

A)The setVisible method does not return a result.
B)The setVisible method returns an integer value.
C)The setVisible method returns a String object.
D)The setVisible method returns a JFrame object.
Question
Assume the class Circle has an accessor called getRadius and a mutator called setRadius.What is the output of the following code? <strong>Assume the class Circle has an accessor called getRadius and a mutator called setRadius.What is the output of the following code?   </strong> A)4 B)3 C)6 D)8 <div style=padding-top: 35px>

A)4
B)3
C)6
D)8
Question
Which of the following terms denotes the memory location of an object?

A)implicit parameter
B)mutator method
C)encapsulation
D)object reference
Question
Based on the following code, which of the following statements sets the frame to a width of 400 and a height of 200: <strong>Based on the following code, which of the following statements sets the frame to a width of 400 and a height of 200:   </strong> A)frame.size = (FRAME_WIDTH, FRAME_HEIGHT); B)frame.addSize(FRAME_WIDTH, FRAME_HEIGHT); C)frame.setSize(FRAME_WIDTH, FRAME_HEIGHT); D)frame.setSize(FRAME_HEIGHT, FRAME_WIDTH); <div style=padding-top: 35px>

A)frame.size = (FRAME_WIDTH, FRAME_HEIGHT);
B)frame.addSize(FRAME_WIDTH, FRAME_HEIGHT);
C)frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
D)frame.setSize(FRAME_HEIGHT, FRAME_WIDTH);
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/82
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 2: Using Objects
1
The camel case naming convention uses _________ at intervals in the middle of the variable name.

A)uppercase letters
B)digits
C)dollar signs
D)the underscore character
uppercase letters
2
By convention among Java programmers, class names begin with a(n) _____________.

A)lowercase letter
B)dollar sign
C)digit
D)uppercase letter
uppercase letter
3
What term is used to refer to text in a program that is an explanation for human readers of the code?

A)methods
B)comments
C)constants
D)[* and *]
comments
4
Which of the following declares a variable that will store a welcome message?

A)String welcome;
B)double welcome;
C)Char welcome;
D)int welcome;
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
5
By convention among Java programmers, variables begin with a(n) _____________.

A)uppercase letter
B)digit
C)lowercase letter
D)dollar sign
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
6
What is the name of the type that denotes a string of characters?

A)Characters
B)char
C)charString
D)String
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
7
Which term is used to describe the name of a variable, method, or class?

A)type
B)literal
C)identifier
D)label
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
8
You can invoke the println and print methods on which object?

A)the HelloWorld object
B)the String class
C)any PrintStream object
D)any object in Java
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
9
In Java, a comment on a line begins with which characters?

A)''
B)//
C)()
D)" "
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
10
A method is a sequence of ___ that accesses the data of an object.

A)data
B)objects
C)instructions
D)streams
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
11
What is the name of the type that denotes whole numbers?

A)double
B)int
C)whole
D)integer
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
12
Which of the following declares a variable that will store a count with an integer value?

A)integer count;
B)double count;
C)String count;
D)int count;
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
13
Which of the following declares a variable that will store a measurement with fractional parts?

A)int measure;
B)double measure;
C)String measure;
D)integer measure;
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
14
In Java, a(n) _________ specifies the kind of values that can be stored in a variable.

A)literal
B)class
C)operator
D)type
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
15
What is the name of the type that denotes floating-point numbers that can have fractional parts?

A)double
B)floatingPoint
C)int
D)integer
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
16
Which of the following is the best choice for a variable identifier that will store a name?

A)name
B)Name
C)n
D)nm
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
17
The "building blocks" that Java programmers use to write computer programs are called _______.

A)windows
B)objects
C)internal data
D)entities
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
18
In Java, objects within the same class share common _______.

A)behavior
B)data
C)instructions
D)comments
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
19
Which statement about identifiers is correct?

A)Identifiers are not case sensitive.
B)Spaces are permitted inside identifiers.
C)Identifiers can use symbols such as ? or %.
D)Identifiers can be made up of letters, digits, and the underscore (_) character.
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
20
What is a storage location in the computer's memory called that has a type, name, and contents?

A)identifier
B)literal
C)label
D)variable
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
21
Which statement declares and stores an integer value in a variable?

A)count = 5;
B)int count = 5;
C)integer count = 5;
D)String count = 5;
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
22
Which statement stores an integer value in a variable?

A)count = 5;
B)count = 5.0;
C)count == 5;
D)count != 5;
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
23
What is the term used to specify the collection of things you can do with objects that belong to a class?

A)private interface
B)public interface
C)private implementation
D)hidden implementation
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
24
A method name is ____________________ if a class has more than one method with that name (but different parameter types).

A)overridden
B)overimplemented
C)overwhelmed
D)overloaded
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
25
What is the name of the = operator in Java?

A)inequality
B)assignment
C)identity
D)equality
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
26
What is the purpose of the assignment operator?

A)to check for inequality
B)to check for identity
C)to check for equality
D)to change the value of a variable
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
27
The type of an object is given by its ______ ?

A)variable
B)method
C)reference
D)class
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
28
Input to a method, enclosed in parentheses after the method name, is known as ______________.

A)implicit parameters
B)interfaces
C)arguments
D)return values
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
29
The Java compiler ignores any text between ____.

A)(* and *)
B)/* and */
C){* and *}
D)// and //
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
30
The value calculated by a method is called its _____ value.

A)implicit
B)explicit
C)argument
D)return
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
31
Which of the following code fragments will cause an error?

A) String greeting =" Hello, Dave !";
B) String greeting = "Hello, World!";
int n= greeting.length();
C) Int luckyNumber;
System. out. println(luckyNumber);
D) Printstream printer = System.out;
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
32
The input to a method is called a(n) _______________.

A)overloaded
B)argument
C)interface
D)procedure
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
33
Assume that the variable count has been declared as type int.Which statement adds 10 to count?

A)count = 10;
B)count == count + 10;
C)count = count + 10;
D)count + 10;
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
34
"System.out" is an example of which class?

A)String
B)Println
C)System
D)PrintStream
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
35
If greeting is a String object, which method call is incorrect?

A)greeting.length()
B)greeting.toLowerCase()
C)greeting.toUpperCase()
D)greeting.println()
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
36
Assuming that the variable count has been declared as type int, which statement changes the value of count?

A)count = 6;
B)count == 6;
C)integer count = 6;
D)count = 6.0;
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
37
Which method call represents the invocation of a method that does not have arguments?

A)greeting.replace("Hello", "Welcome");
B)greeting.length
C)greeting.length()
D)System.out.println(greeting);
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
38
What is an object?

A)A sequence of instructions.
B)Any value stored in a variable.
C)An entity in your program that is manipulated by calling methods.
D)Any input to a method.
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
39
Which of the following statements about objects is correct?

A)An object defines the methods for a class.
B)Every object belongs to a class.
C)An object is a sequence of instructions.
D)All entities, even numbers, are objects.
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
40
Which statement about methods is true?

A)A method must return a value
B)The return value of a method must be stored in a variable
C)Some methods carry out an action; others return a value
D)All methods require multiple arguments
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
41
What does API stand for?

A)Applet Programming Interface
B)Application Programmer Interaction
C)Application Programming Instance
D)Application Programming Interface
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
42
A(n) _____________ is a collection of classes with a related purpose.

A)package
B)import
C)method
D)collection
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
43
Which of the following statements about methods is correct?

A)A method is a sequence of instructions that could access the data of an object
B)A method name is unique across the entire program.
C)A method can be called on any object in any class.
D)Methods are stored in variables.
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
44
Which operator constructs object instances?

A)new
B)instanceof
C)void
D)construct
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
45
If greeting refers to a String object, which of the following is a syntactically correct Java statement?

A)System.out.println(length().greeting);
B)System.out.println(greeting());
C)System.out.println(greeting.length());
D)greeting.println("Hello");
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
46
Which is not a method of the String class?

A)length
B)toUpperCase
C)toLowerCase
D)println
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
47
Which of the following represents a method call to a method with a void return type?

A)greeting.toUpperCase()
B)System.out.println()
C)greeting.replace("Hello","World")
D)greeting.length()
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
48
Which statement calls a constructor with no construction arguments?

A)Circle c = new Circle();
B)A call to a constructor must have construction arguments.
C)Circle c = new Circle;
D)Circle c = Circle()
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
49
Which term describes a method of an object that modifies that object's internal data?

A)public
B)void
C)mutator
D)accessor
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
50
Which statement declares a variable that references a Circle of radius 3, assuming the construction parameter is the radius value?

A)Circle c = Circle(3)
B)Circle c = new Circle(3);
C)Circle c.new.Circle(3);
D)c.Circle(3);
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
51
Which of the following represents a method declaration with a void return type?

A)public void setValue(int value) { ...}
B)public void int getValue() { ...}
C)void public setValue(int value) { ...}
D)void int getValue() { ...}
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
52
Which of the following constructs a Circle of radius 3, assuming the construction parameter is the radius value?

A)Circle(3).new
B)new Circle(3)
C)new.Circle(3)
D)Circle(3)
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
53
Which package is automatically imported in any Java program?

A)java.system
B)java.lang
C)java.language
D)java.util
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
54
To use a class in another package you need to ________ it.

A)export
B)overload
C)rewrite
D)import
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
55
Which of the following method calls illustrate using the return value of a method as an argument?

A)greeting.length();
B)greeting.println("Hello");
C)System.out.println(length.greeting());
D)System.out.println(greeting.length());
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
56
Which of the following statements about methods is correct?

A)A method can have only one argument.
B)The return value of a method can be used as an argument to another method.
C)Every method must have a return value.
D)A method can have multiple arguments.
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
57
What is the declared return type for a method that does not have a return value?

A)String
B)There is no declared return type when a method does not return a value.
C)void
D)A method must return a value.
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
58
What terminology describes a method that returns information about an object and does not change the object's internal data?

A)mutator
B)accessor
C)void
D)public
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
59
Which of the following statements about classes is correct?

A)By convention, class names begin with a lowercase letter.
B)A class declares the methods that you can apply to its objects.
C)All entities, even primitive numbers, are classes.
D)A class is a sequence of instructions that accesses the data of an object.
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
60
Which of the following is a mutator method for the Rectangle class?

A)getHeight
B)translate
C)getWidth
D)isEmpty
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
61
Based on the following statement, which of the following statements sets the title of the frame:
JFrame frame = new JFrame();

A)frame.title = "An Empty Frame";
B)frame.setTitle(JFrame.EMPTY);
C)frame.addTitle("An Empty Frame");
D)frame.setTitle("An Empty Frame");
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
62
What is the output of the following code: <strong>What is the output of the following code:   </strong> A)6, 10 B)10, 6 C)6, 6 D)10, 10

A)6, 10
B)10, 6
C)6, 6
D)10, 10
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
63
Assuming the following Java statement:
int num = 10;
What does the variable num store?

A)The memory location where the value 10 is stored.
B)A reference to the int primitive type.
C)An object representing the number 10.
D)The numeric value 10.
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
64
Which class is part of the java.lang package?

A)Rectangle
B)PrintStream
C)String
D)Circle
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
65
Assuming the following Java statement:
Circle c1 = new Circle(3);
What does the variable c1 store?

A)The constructed Circle object itself.
B)A reference to the Circle class.
C)A reference to the constructed Circle object.
D)The numeric value 3.
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
66
Which of the following statements about test programs is true?

A)Test programs verify that methods have been implemented correctly.
B)A tester class does not contain the main method.
C)You do not have to display the expected results.
D)Writing test programs is not an important skill.
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
67
What is the output of the following code: <strong>What is the output of the following code:   </strong> A)6 B)10 C)4 D)16

A)6
B)10
C)4
D)16
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
68
What do object variables store?

A)objects
B)classes
C)object references
D)numbers
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
69
Which method could you use to obtain the string "1234567890" from the string "123-456-7890"?

A)isEmpty
B)replace
C)trim
D)length
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
70
What is the nickname for the graphical user interface library in Java?

A)Applet
B)GUI
C)JComponent
D)Swing
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
71
What is the output of the following code: <strong>What is the output of the following code:   </strong> A)6, 10 B)16, 16 C)16, 22 D)16, 26

A)6, 10
B)16, 16
C)16, 22
D)16, 26
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
72
What is the purpose of a test program?

A)The test program confirms that the Java compiler is correct.
B)The test program verifies that methods have been implemented correctly.
C)The test program checks the syntax of each object's methods.
D)The test program enforces that the types between arguments match correctly.
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
73
Complete this code fragment to ensure that the frame is shown:
JFrame frame = new JFrame();

A)frame.setVisible(true);
B)frame.visible = true;
C)JFrame.setVisible();
D)frame.setVisible();
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
74
What is the output of the following code: <strong>What is the output of the following code:   </strong> A)3 B)8 C)6 D)4

A)3
B)8
C)6
D)4
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
75
Drawing instructions should be placed inside the ____ method, which is called whenever the component needs to be repainted.

A)paintComponent
B)draw
C)paint
D)drawComponent
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
76
Which import statement allows for the use of the Rectangle class?

A)import java.geom.Rectangle2D;
B)import java.geom.Rectangle;
C)import java.geom.RectangularShape;
D)import java.awt.Rectangle;
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
77
The setVisible method of the JFrame class returns what kind of argument?

A)The setVisible method does not return a result.
B)The setVisible method returns an integer value.
C)The setVisible method returns a String object.
D)The setVisible method returns a JFrame object.
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
78
Assume the class Circle has an accessor called getRadius and a mutator called setRadius.What is the output of the following code? <strong>Assume the class Circle has an accessor called getRadius and a mutator called setRadius.What is the output of the following code?   </strong> A)4 B)3 C)6 D)8

A)4
B)3
C)6
D)8
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
79
Which of the following terms denotes the memory location of an object?

A)implicit parameter
B)mutator method
C)encapsulation
D)object reference
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
80
Based on the following code, which of the following statements sets the frame to a width of 400 and a height of 200: <strong>Based on the following code, which of the following statements sets the frame to a width of 400 and a height of 200:   </strong> A)frame.size = (FRAME_WIDTH, FRAME_HEIGHT); B)frame.addSize(FRAME_WIDTH, FRAME_HEIGHT); C)frame.setSize(FRAME_WIDTH, FRAME_HEIGHT); D)frame.setSize(FRAME_HEIGHT, FRAME_WIDTH);

A)frame.size = (FRAME_WIDTH, FRAME_HEIGHT);
B)frame.addSize(FRAME_WIDTH, FRAME_HEIGHT);
C)frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
D)frame.setSize(FRAME_HEIGHT, FRAME_WIDTH);
Unlock Deck
Unlock for access to all 82 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 82 flashcards in this deck.