Exam 2: Java Fundamentals

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

What is the result of the following expression? 10 + 5 * 3 - 20

Free
(Multiple Choice)
4.8/5
(35)
Correct Answer:
Verified

C

Which of the following is not a rule that must be followed when naming identifiers?

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

B

A Java program must have at least one of the following:

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

B

A Java source file must be saved with the extension

(Multiple Choice)
4.9/5
(43)

What would be displayed as a result of executing the following code? final int x = 22, y = 4; Y += x; System.out.println("x = " + x + ", y = " + y)

(Multiple Choice)
4.8/5
(33)

Which Scanner class method reads a String?

(Multiple Choice)
4.7/5
(35)

Which of the following is not a primitive data type?

(Multiple Choice)
4.8/5
(33)

When you call one of the Scanner class's methods to read a primitive value, such as nextInt or nextDouble, and then call the nextLine method to read a string, an annoying and hard-to-find problem can occur.

(True/False)
4.9/5
(31)

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

(True/False)
4.8/5
(40)

Which of the following statements is invalid?

(Multiple Choice)
4.9/5
(37)

To display the output on the next line, you can use the println method or use the __________ escape sequence in the print method.

(Multiple Choice)
4.8/5
(31)

Which of the following would contain the translated Java byte code for a program named Demo?

(Multiple Choice)
4.7/5
(28)

Variables of the boolean data type are useful for

(Multiple Choice)
4.9/5
(34)

Which of the following is valid?

(Multiple Choice)
4.8/5
(41)

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

(Multiple Choice)
4.7/5
(43)

In the following Java statement, what value is stored in the variable name? String name = "John Doe";

(Multiple Choice)
4.8/5
(31)

If the compiler encounters a statement that uses a variable before the variable is declared, an error will result.

(True/False)
4.9/5
(29)

What will be displayed as a result of executing the following code? int x = 6; String msg = "I am enjoying this class."; String msg1 = msg.toUpperCase(); String msg2 = msg.toLowerCase(); Char ltr = msg.charAt(x); Int strSize = msg.length(); System.out.println(msg); System.out.println(msg1); System.out.println(msg2); System.out.println("Character at index x = " + ltr); System.out.println("msg has " + strSize + "characters.");

(Multiple Choice)
4.9/5
(26)

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

(Multiple Choice)
4.9/5
(34)

What would be displayed as a result of executing the following code? int x = 578; System.out.print("There are " + X + 5 + "\n" + "hens in the hen house.");

(Multiple Choice)
4.9/5
(37)
Showing 1 - 20 of 52
close modal

Filters

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