Exam 2: Basic Elements of Java

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

Suppose x = 8. After the execution of the statement y = x++; y is 8 and x is 10.

(True/False)
4.9/5
(35)

Suppose x = 18.6. The output of the statement System.out.println((int)(x) / 3); is 6.

(True/False)
4.9/5
(42)

Which of the following is NOT a reserved word in Java?

(Multiple Choice)
5.0/5
(45)

Which of the following is a valid int value?

(Multiple Choice)
4.7/5
(39)

Suppose that x and y are int variables and x = 7 and y = 8. After the statement: x = x * y - 2; executes, the value of x is ____.

(Multiple Choice)
4.9/5
(37)

The pair of characters // is used for single line comments.

(True/False)
5.0/5
(36)

The memory allocated for a double value is ____ bytes.

(Multiple Choice)
4.8/5
(33)

Suppose x = 4 and y = 2. If the statement x *= y; is executed once, what is the value of x?

(Multiple Choice)
4.8/5
(40)

Consider the following program. // Insertion Point 1 Public class CircleArea { // Insertion Point 2 Static final float PI = 3.14 public static void main(String[]args) { //Insertion Point 3 float r = 2.0; Float area; Area = PI * r * r; System.out.println( " Area = " + area); } // Insertion Point 4 } In the above code, where do the import statements belong?

(Multiple Choice)
4.9/5
(39)

The standard output object in Java is ____.

(Multiple Choice)
4.8/5
(33)

The value of the expression 5 + 10 % 4 - 3 is ____.

(Multiple Choice)
4.9/5
(35)

If a = 4; and b = 3;, then after the statement a = b; executes, the value of b is 4 and the value of a is 3.

(True/False)
4.9/5
(37)

Consider the following program. public class CircleArea { Static Scanner console = new Scanner(System.in); static final float PI = 3.14; public static void main(String[]args) { Float r; Float area; R = console.nextDouble(); Area = PI * r * r; System.out.println( " Area = " + area); } } To successfully compile this program, which of the following import statement is required?

(Multiple Choice)
4.7/5
(35)

The Java language is strongly typed.

(True/False)
4.8/5
(42)

____ are executable statements that inform the user what to do.

(Multiple Choice)
4.8/5
(34)

The symbol '5' does not belong to the char data type because 5 is a digit.

(True/False)
4.7/5
(33)

What type of Java statement(s) stores a value in a variable?

(Multiple Choice)
4.9/5
(36)

Java automatically initializes all variables.

(True/False)
4.7/5
(38)

The expression (int)8.7 evaluates to ____.

(Multiple Choice)
4.8/5
(36)

The ____ rules of a programming language tell you which statements are legal, or accepted by the programming language.

(Multiple Choice)
4.9/5
(34)
Showing 21 - 40 of 50
close modal

Filters

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