Exam 3: Introduction to Objects and Input/output

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Given int num; the value of num is directly stored in its memory space.

(True/False)
4.9/5
(40)

There are ____ type(s) of methods in a class.

(Multiple Choice)
4.9/5
(40)

The new operator is used to create an int variable.

(True/False)
4.9/5
(37)

The statement System.exit(0); is found at the end of every working Java program.

(True/False)
4.9/5
(39)

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

(True/False)
4.9/5
(37)

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

(Multiple Choice)
4.9/5
(38)

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

(True/False)
4.9/5
(43)

Which statement instructs a program to run the garbage collector?

(Multiple Choice)
4.9/5
(34)

Which of the following statements would store input in name?

(Multiple Choice)
4.8/5
(40)

String sentence; String str1, str2, str3, str4; Int length1;sentence = "First exam is on Monday.";str1 = sentence.substring(6, 12); Str2 = str1.substring(0, 4); Str3 = sentence.replace('i', '#'); Str4 = sentence.indexOf("on");length1 = sentence.length();Based on the code above, what is the value of str4?

(Multiple Choice)
4.9/5
(41)

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

(True/False)
4.9/5
(33)

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

(True/False)
4.9/5
(33)

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

(True/False)
4.8/5
(36)

If length denotes the length of a nonnull string, then length - 1 gives the index of the last character in the string.

(True/False)
4.8/5
(35)

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

(Multiple Choice)
4.9/5
(43)

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

(Multiple Choice)
4.7/5
(36)

When writing output to a file, if the file is not closed at the end of the program, you may not be able to view your output properly.

(True/False)
4.8/5
(36)

What will most probably happen if you omit the dot operator when accessing a method?

(Multiple Choice)
4.8/5
(34)

Which of the following is the member access operator?

(Multiple Choice)
4.7/5
(42)

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);

(Short Answer)
4.8/5
(39)
Showing 21 - 40 of 50
close modal

Filters

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