Exam 2: Using Data

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

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.

Free
(Essay)
5.0/5
(40)
Correct Answer:
Verified

Boolean logic is based on true or false comparisons. Whereas an int variable can hold millions  of different values (at different times), a boolean variable can hold only one of two values-true  or false. Besides assigning true and false, you also can assign a value to a Boolean variable based on the result of a comparison.
boolean isItPayday = false; boolean isItPayday = (today="Friday");

Match each term with the correct statement below.
Premises:
Rules for the order in which parts of a mathematical expression are evaluated
Responses:
operand.
operator precedence.
primitive type.
Correct Answer:
Verified
Premises:
Responses:
Rules for the order in which parts of a mathematical expression are evaluated
operand.
Free
(Matching)
4.9/5
(34)
Correct Answer:
Verified

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.

Free
(Essay)
4.7/5
(41)
Correct Answer:
Verified

The System.in object is designed to read bytes only. Since it is common to accept data of other types, the Scanner object can connect to the System.in property. This creates a Scanner object that will be connected to the default input device.
Scanner inputDevice = new Scanner(System.in);

A variable declaration is a statement that reserves a named memory location. It includes what four elements?

(Essay)
4.9/5
(40)
Match each term with the correct statement below.
Premises:
A floating-point data type
Responses:
blank final
float.
lvalue
Correct Answer:
Verified
Premises:
Responses:
A floating-point data type
blank final
(Matching)
4.9/5
(34)

Which escape sequence will move the cursor to the beginning of the current line?

(Multiple Choice)
4.9/5
(39)

You may declare an unlimited number of variables in a statement as long as the variables are ____.

(Multiple Choice)
4.7/5
(32)

What is the difference between the float data type and the double data type?

(Essay)
4.9/5
(54)
Match each term with the correct statement below.
Premises:
true or false
Responses:
float.
boolean
operator precedence.
Correct Answer:
Verified
Premises:
Responses:
true or false
float.
(Matching)
4.9/5
(38)

Describe three ways in which a named constant differs from a variable.

(Essay)
4.7/5
(39)

Which line of code correctly creates a Scanner object?

(Multiple Choice)
4.7/5
(39)
Match each term with the correct statement below.
Premises:
Break into component parts
Responses:
lvalue
parse
assignment.
Correct Answer:
Verified
Premises:
Responses:
Break into component parts
lvalue
(Matching)
4.9/5
(47)

The expression   boolean isTenLarger = (10 < 5) will produce a value of true .

(True/False)
4.8/5
(41)
Match each term with the correct statement below.
Premises:
Also called the type-ahead buffer
Responses:
cast operator.
promotion
boolean
Correct Answer:
Verified
Premises:
Responses:
Also called the type-ahead buffer
cast operator.
(Matching)
4.7/5
(31)

The ____ is the type to which all operands in an expression are converted so that they are compatible with each other.

(Multiple Choice)
4.9/5
(43)

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!

(Essay)
4.8/5
(28)
Match each term with the correct statement below.
Premises:
Can appear on the left side of an assignment operator
Responses:
garbage value.
assignment.
boolean
Correct Answer:
Verified
Premises:
Responses:
Can appear on the left side of an assignment operator
garbage value.
(Matching)
4.8/5
(28)

In Java, when a numeric variable is concatenated to a String using the ____, the entire expression becomes a String .

(Multiple Choice)
4.9/5
(28)

A variable can hold more than one value at a time.

(True/False)
4.8/5
(36)

A(n) ____ number contains decimal positions.

(Multiple Choice)
4.9/5
(32)
Showing 1 - 20 of 81
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)