Exam 2: Java Fundamentals

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

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

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

B

Character literals are enclosed in __________ and string literals are enclosed in __________.

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

A

The Java API provides a class named Math that contains numerous methods which are useful for performing complex mathematical operations.

Free
(True/False)
4.9/5
(29)
Correct Answer:
Verified

True

Which Scanner class method reads a String?

(Multiple Choice)
4.8/5
(34)

What is the result of the following expression? 17 % 3 * 2 - 12 + 15

(Multiple Choice)
4.9/5
(37)

Named constants are initialized with a value and that value cannot change during the execution of the program.

(True/False)
4.8/5
(39)

Which of the following statements will correctly convert the data type, if x is a float and y is a double?

(Multiple Choice)
4.7/5
(43)

The primitive data types only allow a(n) __________ to hold a single value.

(Multiple Choice)
4.7/5
(40)

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
(38)

A Java source file must be saved with the extension

(Multiple Choice)
4.9/5
(39)

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

(Multiple Choice)
4.9/5
(39)

Unlike a console program, a program that uses the JOptionPane does not automatically stop executing when the end of the main method is reached.

(True/False)
4.7/5
(43)

The __________ method is used to display a message dialog.

(Multiple Choice)
4.8/5
(35)

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

(Multiple Choice)
4.7/5
(36)

The simplest way to use the System.out.printf method is

(Multiple Choice)
5.0/5
(37)

Which of the following is not a valid Java comment?

(Multiple Choice)
4.8/5
(30)

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
(33)

What output will be displayed as a result of executing the following code? int x = 5, y = 20; X += 32; Y /= 4; System.out.println("x = " + x + ", y = " + y);

(Multiple Choice)
4.8/5
(23)

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

(Multiple Choice)
4.7/5
(36)

The System.out.printf method allows you to format output in a variety of ways.

(True/False)
4.7/5
(47)
Showing 1 - 20 of 40
close modal

Filters

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