Content Frame
Note for screen reader users: There is text between the form elements on this page. To be sure that you do not miss any text, use item by item navigation methods, rather than tabbing from form element to form element.
Skip Breadcrumb Navigation
Home  arrow Student Resources  arrow Chapter Quizzes  arrow Chapter 2

Chapter 2

Console Input and Output

This activity contains 15 questions.

Question 1.
Can you use ConsoleIn.readLine() just like you'd use the readLine() method in BufferedReader?


Open Hint for Question 1 in a new window.
 
End of Question 1


Question 2.
Can you use the ConsoleIn methods to acquire input using windows (dialogs)?


Open Hint for Question 2 in a new window.
 
End of Question 2


Question 3.
In order to use the ConsoleIn methods you must:


Open Hint for Question 3 in a new window.
 
End of Question 3


Question 4.
JOptionPane can be used:


Open Hint for Question 4 in a new window.
 
End of Question 4


Question 5.

The DecimalFormat class:
  • Always is used with a pattern to specify how a number is to be formatted
  • Always requires an import statement if you intent to use the class
  • Can be used to format currency if you wish
  • Can format integers as well as floating point numbers
  • Only can be used within a print() or println() method

Open Hint for Question 5 in a new window.
 
End of Question 5


Question 6.
The showMessageDialog method in JOptionPane:


Open Hint for Question 6 in a new window.
 
End of Question 6


Question 7.
The System.out.println() method:


Open Hint for Question 7 in a new window.
 
End of Question 7


Question 8.
What does the phrase "echo input" mean?


Open Hint for Question 8 in a new window.
 
End of Question 8


Question 9.
What happens if you press the Cancel button when showInputDialog is displaying an input dialog?


Open Hint for Question 9 in a new window.
 
End of Question 9


Question 10.
What is a Java "package?"


Open Hint for Question 10 in a new window.
 
End of Question 10


Question 11.
What is one package that does not require an explicit import statement?


Open Hint for Question 11 in a new window.
 
End of Question 11


Question 12.
What is printed by this code fragment:
NumberFormat nf = 
                  NumberFormat.getCurrencyInstance();
System.out.println("value=" + nf.format(05.0505));


Open Hint for Question 12 in a new window.
 
End of Question 12


Question 13.
What is the difference between '0' and '#' in a format string used with DecimalFormat?


Open Hint for Question 13 in a new window.
 
End of Question 13


Question 14.
What is the function of JOptionPane.YES_NO_OPTION?


Open Hint for Question 14 in a new window.
 
End of Question 14


Question 15.
What is the most important difference between using JOptionPane for input and using BufferedReader for input?


Open Hint for Question 15 in a new window.
 
End of Question 15





Pearson Copyright © 1995 - 2010 Pearson Education . All rights reserved. Pearson Addison Wesley is an imprint of Pearson .
Legal Notice | Privacy Policy | Permissions

Return to the Top of this Page