Deck 2: Using Data
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Question
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Question
Match between columns
Question
Question
Match between columns
Question
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Question
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/81
Play
Full screen (f)
Deck 2: Using Data
1
In Java, ____ is a built-in class that provides you with the means for storing and manipulating character strings.
A) Escape
B) Type
C) String
D) Character
A) Escape
B) Type
C) String
D) Character
C
2
Even if a statement occupies multiple lines, the statement is not complete until the semicolon is reached.
True
3
A variable can hold more than one value at a time.
False
4
You use the ____ data type to hold any single character.
A) single
B) char
C) byte
D) float
A) single
B) char
C) byte
D) float
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
5
The term parse means to break into component parts.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
6
____ refers to the order in which values are used with operators.
A) Associativity
B) Initialization
C) Declaration
D) Floating
A) Associativity
B) Initialization
C) Declaration
D) Floating
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
7
The byte and short data types occupy less memory and can hold only smaller values.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
8
The term ____ refers to the mathematical accuracy of a value.
A) float data
B) real integers
C) significant digits
D) single-precision floating-point number
A) float data
B) real integers
C) significant digits
D) single-precision floating-point number
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
9
Primitive types serve as the building blocks for more complex data types, called ____ types.
A) integer
B) literal
C) reference
D) data
A) integer
B) literal
C) reference
D) data
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
10
A data item is ____ when it cannot be changed while a program is running.
A) variable
B) constant
C) primitive
D) literal
A) variable
B) constant
C) primitive
D) literal
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
11
In Java, you use variables of type ____ to store integers, or whole numbers.
A) num
B) double
C) var
D) int
A) num
B) double
C) var
D) int
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
12
The expression boolean isTenLarger = (10 < 5) will produce a value of true .
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
13
You can declare as many variables in a statement as you want, as long as the variables are different data types.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
14
A ____ is a named memory location that you can use to store a value.
A) cast
B) variable
C) reference
D) primitive
A) cast
B) variable
C) reference
D) primitive
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
15
A ____ data type can hold 14 or 15 significant digits of accuracy.
A) double
B) float
C) char
D) boolean
A) double
B) float
C) char
D) boolean
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
16
You can create a confirm dialog box with five arguments.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
17
A(n) ____ variable can hold only one of two values: true or false .
A) integer
B) boolean
C) true
D) comparison
A) integer
B) boolean
C) true
D) comparison
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
18
You are limited to declaring a maximum of three variables in a single statement.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
19
Multiplication, division, and remainder always take place after addition or subtraction in an expression.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
20
The int data type is the most commonly used integer type.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
21
Each primitive type in Java has a corresponding class contained in the java.lang package. These classes are called ____ classes.
A) case
B) primitive
C) type-wrapper
D) show
A) case
B) primitive
C) type-wrapper
D) show
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
22
The ____ is the type to which all operands in an expression are converted so that they are compatible with each other.
A) unifying type
B) data type
C) numbered
D) primitive
A) unifying type
B) data type
C) numbered
D) primitive
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
23
A(n) ____ number contains decimal positions.
A) char
B) int
C) float
D) boolean
A) char
B) int
C) float
D) boolean
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
24
A(n) ____ dialog box typically displays the options Yes, No, and Cancel.
A) confirm
B) input
C) message
D) answer
A) confirm
B) input
C) message
D) answer
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
25
When a numeric variable is concatenated to a String , the entire expression becomes a(n) ____ .
A) int
B) constant
C) method
D) String
A) int
B) constant
C) method
D) String
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
26
You use ____ operators to perform calculations with values in your programs.
A) calculation
B) arithmetic
C) integer
D) precedence
A) calculation
B) arithmetic
C) integer
D) precedence
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
27
The characters ____ move the cursor to the next line when used within a println() statement.
A) /n
B) \n
C) .+
D) $
A) /n
B) \n
C) .+
D) $
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
28
Which line of code correctly creates a Scanner object?
A) Scanner inputDevice = new Scanner(System);
B) Scanner inputDevice = new Scanner(System.in)
C) Scanner inputDevice = new Scanner(in);
D) Scanner inputDevice = new Scanner(System.in);
A) Scanner inputDevice = new Scanner(System);
B) Scanner inputDevice = new Scanner(System.in)
C) Scanner inputDevice = new Scanner(in);
D) Scanner inputDevice = new Scanner(System.in);
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
29
____ occurs when both of the operands are integers.
A) Data modeling
B) Type cast
C) Integer division
D) Unlike assignment
A) Data modeling
B) Type cast
C) Integer division
D) Unlike assignment
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
30
A(n)____ operator compares two items and the result has a Boolean value.
A) complex
B) relational
C) unary
D) remainder
A) complex
B) relational
C) unary
D) remainder
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
31
The percent sign is the ____ operator.
A) remainder
B) remaining
C) percentage
D) integer division
A) remainder
B) remaining
C) percentage
D) integer division
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
32
You may declare an unlimited number of variables in a statement as long as the variables are ____.
A) the same data type
B) initialized to the same value
C) properly commented
D) floating point numbers
A) the same data type
B) initialized to the same value
C) properly commented
D) floating point numbers
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
33
You can store any character, including nonprinting characters such as a backspace or a tab, in a(n) ____ variable.
A) int
B) char
C) boolean
D) set
A) int
B) char
C) boolean
D) set
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
34
Which of the following is NOT a component of a variable declaration statement?
A) data type identifier
B) ending colon
C) variable name
D) ending semicolon
A) data type identifier
B) ending colon
C) variable name
D) ending semicolon
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
35
A(n) ____ dialog box asks a question and provides a text field in which the user can enter a response.
A) question
B) JOptPane
C) confirm
D) input
A) question
B) JOptPane
C) confirm
D) input
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
36
What is the value of result after the following statement is executed? int result = 2 + 3 * 4;
A) 9
B) 10
C) 14
D) 20
A) 9
B) 10
C) 14
D) 20
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
37
In Java, when a numeric variable is concatenated to a String using the ____, the entire expression becomes a String .
A) plus sign
B) equal sign
C) concatenate statement
D) string statement
A) plus sign
B) equal sign
C) concatenate statement
D) string statement
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
38
____ forces a value of one data type to be used as a value of another type.
A) Type casting
B) Lossless conversion
C) A type-wrapper class
D) Parsing
A) Type casting
B) Lossless conversion
C) A type-wrapper class
D) Parsing
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
39
Which escape sequence will move the cursor to the beginning of the current line?
A) \b
B) \r
C) \\
D) \n
A) \b
B) \r
C) \\
D) \n
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
40
A(n) ____ is a simple data type.
A) reference type
B) lvalue
C) primitive type
D) unifying type
A) reference type
B) lvalue
C) primitive type
D) unifying type
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
41
Match between columns
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
42
Match between columns
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
43
Match between columns
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
44
Match between columns
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
45
A data item's ____ is the area in which it is visible to a program and in which you can refer to it using its simple identifier.
A) data type
B) token
C) case
D) scope
A) data type
B) token
C) case
D) scope
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
46
The Scanner class contains methods that retrieve values called ____.
A) prompts
B) whitespace
C) finals
D) tokens
A) prompts
B) whitespace
C) finals
D) tokens
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
47
Match between columns
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
48
Match between columns
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
49
Match between columns
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
50
Match between columns
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
51
Match between columns
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
52
Which statement declares a constant named SALESAMT with a value of 20.99?
A) double SALESAMT = 20.99;
B) final SALESAMT = 20.99;
C) final double SALESAMT = 20.99;
D) final double SALESAMT (20.99);
A) double SALESAMT = 20.99;
B) final SALESAMT = 20.99;
C) final double SALESAMT = 20.99;
D) final double SALESAMT (20.99);
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
53
Match between columns
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
54
The cast operator is a ____ operator.
A) unary
B) binary
C) ternary
D) boolean
A) unary
B) binary
C) ternary
D) boolean
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
55
Match between columns
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
56
A dialog box that displays the options Yes, No, and Cancel can be created using the ____ method in the JOptionPane class.
A) showDialog()
B) showConfirmDialog()
C) JOptionDialog()
D) ConfirmDialog()
A) showDialog()
B) showConfirmDialog()
C) JOptionDialog()
D) ConfirmDialog()
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
57
Match between columns
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
58
Match between columns
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
59
Match between columns
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
60
Match between columns
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
61
Describe how the use of named constants can provide advantages over the use of literal values.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
62
A variable declaration is a statement that reserves a named memory location. It includes what four elements?
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
63
import javax.swing.JOptionPane;
public class salesJune
{
public static void main(String[] args)
{
int storeSales = 250;
}
}
In the above code, complete the statement that will display a message dialog box that will appear centered on the screen and will display the following text:
Congratulations! June sales were $250!
public class salesJune
{
public static void main(String[] args)
{
int storeSales = 250;
}
}
In the above code, complete the statement that will display a message dialog box that will appear centered on the screen and will display the following text:
Congratulations! June sales were $250!
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
64
Describe and give an example of operator precedence.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
65
Write the statement that will declare a char data type named testScore that will hold a letter grade of your choice.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
66
final int COSTPERITEM = 10;
double sales2012 = amtSold * COSTPERITEM;
In the above statements, identify the named constant and describe how a programmer can recognize named constants.
double sales2012 = amtSold * COSTPERITEM;
In the above statements, identify the named constant and describe how a programmer can recognize named constants.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
67
What is an escape sequence and why would a Java programmer use it to store a character?
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
68
What is the difference between the float data type and the double data type?
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
69
Describe how the Scanner class works with the System.in object in order to provide flexibility. Provide an example of using the Scanner class with System.in.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
70
Describe three ways in which a named constant differs from a variable.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
71
How would you ask the user to confirm an action using a dialog box?
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
72
Write the statement to declare an uninitialized integer value for salesAmt . Then write the statement to declare a constant named SALESAMT with a value of 20.99.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
73
Write the statement that will declare and assign two integer variables, salesAmt and costAmt , in a single statement. Assign values of your choice to the variables.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
74
Describe how to use the boolean data type. Show two examples of a boolean variable assignment; one that uses true or false and one that uses a relational operator.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
75
How can you create and use an input dialog box in Java?
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
76
Explain how you can override a unifying type imposed by Java. Show an example.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
77
Define an integer and then list and describe the four integer data data types.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
78
In Java, how is it possible to perform mathematical operations on operands with unlike types?
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
79
Describe why it is important to assign an appropriate data type to variables in an application.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
80
100 = salesAmount;
In terms of assignment operators, why is the above statement illegal?
In terms of assignment operators, why is the above statement illegal?
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck