Filters
Question type

Study Flashcards

Variables of the boolean data type are useful for


A) evaluating conditions that are either true or false.
B) working with small integers.
C) working with very large integers.
D) evaluating scientific notation.

E) A) and C)
F) B) and D)

Correct Answer

verifed

verified

Which of the following statements correctly creates a Scanner object for keyboard input?


A) Scanner kbd = new Scanner(System.keyboard) ;
B) Scanner keyboard = new Scanner(System.in) ;
C) Scanner keyboard(System.in) ;
D) Keyboard scanner = new Keyboard(System.in) ;

E) C) and D)
F) A) and D)

Correct Answer

verifed

verified

The ________ method is used to display a message dialog.


A) showMessageDialog
B) messageDialog
C) messageDialogShow
D) showDialog

E) C) and D)
F) A) and D)

Correct Answer

verifed

verified

Which of the following statements will correctly convert the data type, if x is a float and y is a double?


A) x = float y;
B) x = <float>y;
C) x = (float) y;
D) x = y;

E) A) and D)
F) C) and D)

Correct Answer

verifed

verified

Programming style includes techniques for consistently putting spaces and indentation in a program so visual cues are created.

A) True
B) False

Correct Answer

verifed

verified

What will be the displayed when the following code is executed? Final int x = 22, y = 4; Y += x; System.out.println("x = " + x + ", y = " + y) ;


A) x = 22, y = 26
B) x = 22, y = 4
C) x = 22, y = 88
D) Nothing. There is an error in the code.

E) B) and C)
F) A) and C)

Correct Answer

verifed

verified

The Java API provides a class named Math, which contains numerous methods that are useful for performing complex mathematical operations.

A) True
B) False

Correct Answer

verifed

verified

When you call one of the Scanner class's methods to read a primitive value, such as nextInt or nextDouble, and then call the nextLine method to read a string, an annoying and hard-to-find problem can occur.

A) True
B) False

Correct Answer

verifed

verified

Both character literals and string literals can be assigned to a char variable.

A) True
B) False

Correct Answer

verifed

verified

Unlike a console program, a program that uses JOptionPane does not automatically stop executing when the end of the main method is reached.

A) True
B) False

Correct Answer

verifed

verified

Which of the following statements is invalid?


A) double r = 9.4632E15;
B) double r = 9.4632e15;
C) double r = 2.9X106;
D) double r = 326.75;

E) B) and C)
F) A) and D)

Correct Answer

verifed

verified

Named constants are initialized with a value, and that value cannot change during the execution of the program.

A) True
B) False

Correct Answer

verifed

verified

Character literals are enclosed in ________, and string literals are enclosed in ________.


A) single quotes, double quotes
B) double quotes, single quotes
C) single quotes, single quotes
D) double quotes, double quotes

E) None of the above
F) A) and C)

Correct Answer

verifed

verified

This is a named storage location in the computer's memory.


A) Operator
B) Constant
C) Literal
D) Variable

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

What is the result of the following expression? 17 % 3 * 2 - 12 + 15


A) 105
B) 12
C) 7
D) 8

E) A) and D)
F) All of the above

Correct Answer

verifed

verified

C

The boolean data type may contain the following range of values:


A) -128 to +127.
B) true or false.
C) -2,147,483,648 to +2,147,483,647.
D) -32,768 to +32,767.

E) All of the above
F) A) and B)

Correct Answer

verifed

verified

A(n) ________ is a dialog box that prompts the user for input.


A) input box
B) user prompt
C) adaptive dialog
D) input dialog

E) All of the above
F) None of the above

Correct Answer

verifed

verified

D

What will be displayed after the following statements have been executed? Int x = 15, y = 20, z = 32; X += 12; Y /= 6; Z -= 14; System.out.println("x = " + x + ", y = " + y + ", z = " + z) ;


A) x = 27, y = 3.333, z = 18
B) x = 27, y = 2, z = 18
C) x = 37, y = -14, z = 4
D) x = 27, y = 3, z = 18

E) A) and B)
F) B) and C)

Correct Answer

verifed

verified

When saving a Java source file, save it with an extension of


A) .java.
B) .javac.
C) .src.
D) .class.

E) C) and D)
F) None of the above

Correct Answer

verifed

verified

Which of the following is not a rule that must be followed when naming identifiers?


A) After the first character, you may use the letters a-z, A-Z, an underscore, a dollar sign, or digits 0-9.
B) Identifiers can contain spaces.
C) Uppercase and lowercase characters are distinct.
D) The first character must be one of the letters a-z, A-Z, an underscore or a dollar sign.

E) All of the above
F) B) and D)

Correct Answer

verifed

verified

B

Showing 1 - 20 of 40

Related Exams

Show Answer