Unit 2 Two Truths & A LieTwo of the following statements are true, and one is false. Identify the false statement:

Ace your homework & exams now with Quizwiz!

Two of the following statements are true, and one is false. Identify the false statement:

a. System.in refers to the standard input device, which normally is the keyboard. b. When a user types data followed by the Enter key, the Enter key character is left in the keyboard buffer after Scanner class methods retrieve the other keystrokes. c. **System.in is more flexible than System.out because it can read all the basic Java data types.**

Two of the following statements are true, and one is false. Identify the false statement:

a**. A floating-point constant, such as 5.6, is a float by default.** b. As with integers, you can perform the mathematical operations of addition, subtraction, multiplication, and division with floating-point numbers. c. Java supports two floating-point data types: float and double. The double data type requires more memory and can hold more significant digits.

Two of the following statements are true, and one is false. Identify the false statement:

a. **The arithmetic operators are examples of unary operators, which are so named because they perform one operation at a time.** b. Floating-point arithmetic might produce imprecise results. c. In Java, operator precedence dictates that multiplication, division, and remainder always take place prior to addition or subtraction in an expression.

Two of the following statements are true, and one is false. Identify the false statement:

a. **When you perform arithmetic operations with operands of unlike types, you must make an explicit conversion to a unifying type.** b. You can explicitly override the unifying type imposed by Java by performing a type cast; type casting forces a value of one data type to be used as a value of another type. c. Summing a double, int, and float results in a double.

Two of the following statements are true, and one is false. Identify the false statement:

a. A variable declaration is a statement that reserves a named memory location and includes a data type, an identifier, an optional assignment operator and assigned value, and an ending semicolon. b. A variable is a named memory location that you can use to store a value; it can hold only one value at a time, but the value it holds can change. c. **An item's data type determines what legal identifiers can be used to describe variables and whether the variables can occupy memory.**

Two of the following statements are true, and one is false. Identify the false statement:

a. An expression that contains a relational operator has a Boolean value. **b. Java supports six relational operators that are used to make comparisons: =, <, >, = <, = >, and =!.** c. A Boolean variable can hold only one of two values—true or false.

Two of the following statements are true, and one is false. Identify the false statement:

a. When you assign a value to an int variable, you do not type any commas; you type only digits and an optional plus or minus sign to indicate a positive or negative integer. b. A variable of type int can hold any whole number value from approximately negative two billion to positive two billion. **c. You can use the data types byte or short to hold larger values than can be accommodated by an int.**

Two of the following statements are true, and one is false. Identify the false statement:

a. You can create an input dialog box using the showInputDialog() method; the method returns a String that represents a user's response. b. **A confirm dialog box can be created using the showConfirmDialog() method in the JOptionPane class; a confirm dialog box displays the options Accept, Reject, and Escape.** c. You can use methods from the Java classes Integer and Double when you want to convert a dialog box's returned values to numbers.

Two of the following statements are true, and one is false. Identify the false statement:

a. You use the char data type to hold any single character; you place constant character values within single quotation marks. b. **To store a string of characters, you use a data structure called a Text; string constants are written between parentheses.** c. An escape sequence always begins with a backslash followed by a character; the pair represents a single character.


Related study sets

NUR3010: CHAPTER 3- PrepU Quizzes

View Set

Chapter 15: Social-Cognitive Perspective

View Set

Lifespan Development Chapters 1-3

View Set