Deck 3: Introduction to Classes and Objects
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/18
Play
Full screen (f)
Deck 3: Introduction to Classes and Objects
1
A default constructor has how many parameters?
A)0.
B)1.
C)2.
D)a variable number.
A)0.
B)1.
C)2.
D)a variable number.
A
2
What is the difference between a float and a double?
A)double variables store integers and float variables store floating-point numbers.
B)double variables store numbers with smaller magnitude and coarser detail.
C)double variables store numbers with larger magnitude and finer detail.
D)None of the above.
A)double variables store integers and float variables store floating-point numbers.
B)double variables store numbers with smaller magnitude and coarser detail.
C)double variables store numbers with larger magnitude and finer detail.
D)None of the above.
C
3
Which of the following is a valid fully qualified name?
A)Scanner.
B)java.Scanner.
C)util.Scanner.
D)java.util.Scanner.
A)Scanner.
B)java.Scanner.
C)util.Scanner.
D)java.util.Scanner.
D
4
Which of the following is a Scanner method?
A)nextLine.
B)nextText.
C)nextWord.
D)readNext.
A)nextLine.
B)nextText.
C)nextWord.
D)readNext.
Unlock Deck
Unlock for access to all 18 flashcards in this deck.
Unlock Deck
k this deck
5
What is the default value of a reference?
A)0.
B)"".
C)null.
D)default.
A)0.
B)"".
C)null.
D)default.
Unlock Deck
Unlock for access to all 18 flashcards in this deck.
Unlock Deck
k this deck
6
A class instance creation expression contains:
A)Parentheses.
B)The new keyword.
C)The name of the class.
D)All of the above.
A)Parentheses.
B)The new keyword.
C)The name of the class.
D)All of the above.
Unlock Deck
Unlock for access to all 18 flashcards in this deck.
Unlock Deck
k this deck
7
How many significant digits does a double variable have?
A)7.
B)8.
C)14.
D)15.
A)7.
B)8.
C)14.
D)15.
Unlock Deck
Unlock for access to all 18 flashcards in this deck.
Unlock Deck
k this deck
8
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.
A)JDialogBox.
B)JPrebuiltDialog.
C)JMessageDialog.
D)JOptionPane.
Unlock Deck
Unlock for access to all 18 flashcards in this deck.
Unlock Deck
k this deck
9
What type of methods allow a client of a class to assign values to a private instance variable?
A)Get methods.
B)Replace methods.
C)Assign methods.
D)Set methods.
A)Get methods.
B)Replace methods.
C)Assign methods.
D)Set methods.
Unlock Deck
Unlock for access to all 18 flashcards in this deck.
Unlock Deck
k this deck
10
Which of the following statements is false?
A)You must create an object of class JOptionPane to use its static method showMessageDialog.
B)JOptionPane method showInputDialog displays an input dialog containing a prompt and a field (known as a text field)in which a user can enter text.
C)String method format works like method System.out.printf,except that format returns the formatted String rather than displaying it in a command window.
D)An input dialog allows the user to enter data into a program.
A)You must create an object of class JOptionPane to use its static method showMessageDialog.
B)JOptionPane method showInputDialog displays an input dialog containing a prompt and a field (known as a text field)in which a user can enter text.
C)String method format works like method System.out.printf,except that format returns the formatted String rather than displaying it in a command window.
D)An input dialog allows the user to enter data into a program.
Unlock Deck
Unlock for access to all 18 flashcards in this deck.
Unlock Deck
k this deck
11
Method headers contain all of the following except:
A)Access modifier.
B)Left brace.
C)Name of method.
D)Return type.
A)Access modifier.
B)Left brace.
C)Name of method.
D)Return type.
Unlock Deck
Unlock for access to all 18 flashcards in this deck.
Unlock Deck
k this deck
12
Multiple parameters are separated with what symbol?
A)Dot separator
B)Comma.
C)Parentheses.
D)Braces.
A)Dot separator
B)Comma.
C)Parentheses.
D)Braces.
Unlock Deck
Unlock for access to all 18 flashcards in this deck.
Unlock Deck
k this deck
13
How many significant digits does a double variable have?
A)7.
B)8.
C)14.
D)15.
A)7.
B)8.
C)14.
D)15.
Unlock Deck
Unlock for access to all 18 flashcards in this deck.
Unlock Deck
k this deck
14
Which two Java primitive types store floating-point numbers?
A)decimal and float.
B)point and double.
C)float and double.
D)decimal and point.
A)decimal and float.
B)point and double.
C)float and double.
D)decimal and point.
Unlock Deck
Unlock for access to all 18 flashcards in this deck.
Unlock Deck
k this deck
15
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.
A)JDialogBox.
B)JPrebuiltDialog.
C)JMessageDialog.
D)JOptionPane.
Unlock Deck
Unlock for access to all 18 flashcards in this deck.
Unlock Deck
k this deck
16
What is the default initial value of a String instance variable?
A)""
B)"default"
C)default
D)null
A)""
B)"default"
C)default
D)null
Unlock Deck
Unlock for access to all 18 flashcards in this deck.
Unlock Deck
k this deck
17
Attributes of a class are also known as:
A)Constructors.
B)Local variables.
C)Fields.
D)Classes.
A)Constructors.
B)Local variables.
C)Fields.
D)Classes.
Unlock Deck
Unlock for access to all 18 flashcards in this deck.
Unlock Deck
k this deck
18
What is the name of the values the method call passes to the method for the parameters?
A)Arguments.
B)References.
C)Objects.
D)Values.
A)Arguments.
B)References.
C)Objects.
D)Values.
Unlock Deck
Unlock for access to all 18 flashcards in this deck.
Unlock Deck
k this deck