Exam 2: Console Input and Output

arrow
  • Select Tags
search iconSearch Question
  • Select Tags

The statement: System.out.printf"%6.2f",597.7231);displays:

Free
(Multiple Choice)
4.9/5
(37)
Correct Answer:
Verified

B

What Java package includes the class Scanner?

Free
(Multiple Choice)
5.0/5
(30)
Correct Answer:
Verified

D

What do the format specifiers d,f,e,g,s and c represent?

Free
(Essay)
4.8/5
(44)
Correct Answer:
Verified

The format specifiers d,f,e,and g are all used for numeric representation.Specifier d represents a decimal integer,specifier f represents a fixed-point floating-point number,specifier e represents E-notation floating-point,and specifier g represents general floating-point in which Java secedes whether to use E-notation.
The format specifiers s and c are used for string and character representation,respectively.

The class NumberFormat allows you to specify a constant representing which country's currency format should be used.To use this constant you must import:

(Multiple Choice)
4.8/5
(38)

If there is no loss of efficiency in importing an entire Java package instead of importing only classes you use into your program,why would you not just import the entire package?

(Essay)
4.8/5
(43)

Valid arguments to the System.out object's println method include:

(Multiple Choice)
4.7/5
(45)

The method printf is used the same way as the method println but has the added feature that allows you to add formatting instructions.

(True/False)
4.8/5
(43)

Write Java statements to apply currency formatting to the number 100.Indicate the package you need to import.

(Essay)
4.9/5
(35)

Efficiency is lost in importing the entire package instead of importing the classes you use.

(True/False)
4.9/5
(40)

What does the following code output? DecimalFormat dfQuestion = new DecimalFormat"#0.##E0"); System.out.printlndfQuestion.format12.7896987));

(Multiple Choice)
4.9/5
(33)

What does the following code output? DecimalFormat percent = new DecimalFormat"0.00%"); System.out.printlnpercent.format0.308));

(Multiple Choice)
4.9/5
(36)

Every Java program automatically imports the java.util package.

(True/False)
4.9/5
(40)

Standard code libraries in Java are called:

(Multiple Choice)
4.7/5
(41)

The printf method can be used to output multiple formatted values.

(True/False)
4.7/5
(34)

Write a Java program to create and display 57.32% using the DecimalFormat class.Include the necessary import statement to use the DecimalFormat class.

(Essay)
4.9/5
(39)

The Java method printf is based on the ________ language.

(Multiple Choice)
4.8/5
(43)

If a hyphen is added after the % in a format specifier,the output will be _________.

(Multiple Choice)
4.7/5
(43)

Explain the significance of the pattern string used by the DecimalFormat object,and give an example of a valid pattern.

(Essay)
4.9/5
(35)

Which statement or group of statements produces the output: Java programming is fun!

(Multiple Choice)
4.9/5
(38)

Write ONE Java statement to display your first and last name on two separate lines.

(Essay)
4.7/5
(36)
Showing 1 - 20 of 29
close modal

Filters

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