Filters
Question type

Study Flashcards

A message dialog is a quick and simple way to ask the user to enter data.

A) True
B) False

Correct Answer

verifed

verified

Variables are classified according to their


A) names
B) values
C) locations
D) data types

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

Correct Answer

verifed

verified

What would be displayed as a result of executing the following code? 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) None of the above
F) A) 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) A) and C)
F) A) and D)

Correct Answer

verifed

verified

To print "Hello, world" on the monitor, which of the following Java statements should be used?


A) System.out.println("Hello, world") ;
B) System Print = "Hello, world";
C) SystemOutPrintln('Hello, world') ;
D) system.out.println(Hello, world) ;

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

Correct Answer

verifed

verified

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 D)
F) B) and C)

Correct Answer

verifed

verified

A variable's scope is the part of the program that has access to that variable.

A) True
B) False

Correct Answer

verifed

verified

Which of the following is a value that is written into the code of a program?


A) a literal
B) an assignment statement
C) an operator
D) a variable

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

Correct Answer

verifed

verified

Which of the following is a named storage location in the computer's memory?


A) a literal
B) an operator
C) a constant
D) a variable

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

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) A) and D)
F) All of the above

Correct Answer

verifed

verified

Which statement tells the compiler where to find the JOptionPane class and makes it available to your program?


A) import javax.swing.JOptionPane;
B) import Java.Swing.JOptionPane;
C) import JOptionPane;
D) import javax.JOptionPane;

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

Correct Answer

verifed

verified

Programming style includes techniques for consistently putting spaces and indentation in a program to help create visual cues.

A) True
B) False

Correct Answer

verifed

verified

What is the value of z after the following statements have been executed? int x = 4, y = 33; Double z; Z = (double) (y / x) ;


A) 8.25
B) 4
C) 0
D) 8.0

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

Correct Answer

verifed

verified

The boolean data type may contain which of 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) C) and D)
F) All 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 the 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) A) and D)
F) None of the above

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) A) and C)
F) A) and B)

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

If you want to use the System.out.printf method to print a string argument , use the __________ format specifier.


A) % d
B) %b
C) %f
D) % s

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

Correct Answer

verifed

verified

What is the value of z after the following code is executed? int x = 5, y = 28; Float z; Z = (float) (y / x) ;


A) 5.6
B) 3.0
C) 5.0
D) 5.60

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

Correct Answer

verifed

verified

If you use a flag in a format specifier, you must write the flag before the field width and the precision.

A) True
B) False

Correct Answer

verifed

verified

Showing 21 - 40 of 40

Related Exams

Show Answer