Exam 2: Java Fundamentals

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

What will be the value of z as a result of executing the following code? int x = 5, y = 28; Float z; Z = (float) (y / x);

(Multiple Choice)
4.8/5
(31)

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

(Multiple Choice)
4.9/5
(38)

What 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.9/5
(36)

Both character literals and string literals can be assigned to a char variable.

(True/False)
4.9/5
(38)

Which Scanner class method reads a String?

(Multiple Choice)
4.9/5
(34)

What will be displayed as a result of executing the following code? public class test { Public static void main(String[] args) { Int value1 = 9; System.out.println(value1); Int value2 = 45; System.out.println(value2); System.out.println(value3); Value = 16; } }

(Multiple Choice)
4.9/5
(32)

Which of the following statements correctly creates a Scanner object for keyboard input?

(Multiple Choice)
4.9/5
(35)

A Java program will not compile unless it contains the correct line numbers.

(True/False)
4.8/5
(44)

What will be displayed as a result of executing the following code? int x = 8; String msg = "I am enjoying java."; 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.8/5
(35)

Which of the following cannot be used as identifiers in Java?

(Multiple Choice)
4.7/5
(35)

What is the result of the following expression? 25 - 7 * 3 + 12 / 3

(Multiple Choice)
4.8/5
(38)

What is the result of the following expression? 25 / 4 + 4 * 10 % 3

(Multiple Choice)
4.8/5
(42)

Given the declaration double r;, which of the following statements is invalid?

(Multiple Choice)
4.8/5
(41)

If x has been declared an int, which of the following statements is invalid?

(Multiple Choice)
4.8/5
(28)

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

(Multiple Choice)
4.8/5
(35)

What will be displayed after the following statements have been executed? int x = 15, y = 20, z = 32; X += 12; Y /= 6; Z -= 14; System.out.println("x = " + x + ", y = " + y + ", z = " +z);

(Multiple Choice)
4.7/5
(31)

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

(Multiple Choice)
4.9/5
(43)

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.7/5
(42)

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

(Multiple Choice)
4.8/5
(37)

A variable's scope is the part of the program that has access to the variable.

(True/False)
4.7/5
(42)
Showing 21 - 40 of 61
close modal

Filters

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