Filters
Question type

Study Flashcards

The method printf is used only to format the output of integers and decimal numbers.

A) True
B) False

Correct Answer

verifed

verified

In a format specifier, the option width specifies the maximum number of characters to be written to the output.

A) True
B) False

Correct Answer

verifed

verified

String variables are reference variables.

A) True
B) False

Correct Answer

verifed

verified

True

The classes Integer, Float, and Double are called wrapper classes.

A) True
B) False

Correct Answer

verifed

verified

Which of the following outputs 56734.9875 to three decimal places?


A) System.out.printf("3f%", 56734.9875) ;
B) System.out.printf(".3f%", 56734.9875) ;
C) System.out.printf(".03f%", 56734.9875) ;
D) System.out.printf("%.3f", 56734.9875) ;

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

Correct Answer

verifed

verified

Based on the code above, what is the value of length1?


A) 20
B) 21
C) 24
D) 26

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

Correct Answer

verifed

verified

C

In Java, all variables declared using a class are ____.


A) primitive variables
B) reference variables
C) constants
D) operators

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

Correct Answer

verifed

verified

Which statement instructs a program to run the garbage collector?


A) System.clearGarbage() ;
B) System.flushGarbage() ;
C) System.out() ;
D) System.gc() ;

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

Correct Answer

verifed

verified

Based on the code above, what is the value of str3?


A) "First exam is on Monday."
B) "F#rst exam #s on Monday."
C) "F#rst exam is on Monday."
D) "#i### #### i###########."

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

Correct Answer

verifed

verified

Suppose z = 1834.762. The output of the statement System.out.printf("%.1f", z); is 1834.800.

A) True
B) False

Correct Answer

verifed

verified

False

What is the value of the following statement? Math.pow(3,4)


A) 7
B) 12
C) 34
D) 81

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

Correct Answer

verifed

verified

The dot (.) operator is also called the member specific operator.

A) True
B) False

Correct Answer

verifed

verified

In a string, the index (position) of the first character is 1.

A) True
B) False

Correct Answer

verifed

verified

The value of the expression Integer.parseInt("+782") is "782".

A) True
B) False

Correct Answer

verifed

verified

Suppose that you have the declaration: int num = 94; double x = 73.92; String str = "Programming"; What is the output of the following statements? System.out.println("123456789012345678901234567890") ; System.out.printf("%5d%6.2f %15s%n", num, x, str) ;


A) 123456789012345678901234567890.
B) 123456789012345678901234567890.0
C) 1234567890123456789012345678900
D) 1234567890123456789012345678904

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

Correct Answer

verifed

verified

In order to use a predefined method, you only need to know the name of the method and the type of each parameter.

A) True
B) False

Correct Answer

verifed

verified

What is the output of the following statement? System.out.printf("%.2f", 48.9) ;


A) 48.00
B) 48.90
C) 49
D) 49.00

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

Correct Answer

verifed

verified

Which of the following statements would store input in name?


A) Which of the following statements would store input in name? A)   B)   C)   D)
B) Which of the following statements would store input in name? A)   B)   C)   D)
C) Which of the following statements would store input in name? A)   B)   C)   D)
D) Which of the following statements would store input in name? A)   B)   C)   D)

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

Correct Answer

verifed

verified

An expression such as str.length() ; is an example of a(n) ____.


A) system call
B) object call
C) class
D) method call

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

Correct Answer

verifed

verified

In the class String, the substring method inserts a string into another string.

A) True
B) False

Correct Answer

verifed

verified

Showing 1 - 20 of 50

Related Exams

Show Answer