← All 1Z0-811 Flashcard Decks

Java Language Fundamentals Flashcards

7 cards from real 1Z0-811 practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 7 Java Language Fundamentals flashcards as text
  1. Which of the following is true about Java's 'char' data type?

    Answer: It is an unsigned 16-bit integer

    Java's char is an unsigned 16-bit integer representing Unicode characters, with a range of 0 to 65535.

  2. What is the output of this code? int x = 0; while (x < 5) { x += 2; } System.out.println(x);

    Answer: 6

    x goes 0→2→4→6; when x becomes 6, the condition 6<5 is false, so the loop exits with x=6.

  3. Which operator is used for bitwise AND in Java?

    Answer: &

    The single & operator performs bitwise AND on integer operands (and also non-short-circuit boolean AND).

  4. What is the scope of a variable declared inside a for-loop initializer?

    Answer: Only the loop block and update expression

    A variable declared in the for-loop initializer (e.g., int i=0) is scoped to the entire for statement including its body, condition, and update.

  5. What is the output of the following? System.out.println("Value: " + 1 + 2);

    Answer: Value: 12

    String concatenation is left-to-right: "Value: "+1 gives "Value: 1", then +2 gives "Value: 12".

  6. Which of the following correctly initializes a String using the string pool?

    Answer: String s = "hello";

    A string literal like "hello" is stored in the string pool and reused; 'new String()' always creates a new heap object.

  7. What is the output of this code? boolean b = true; System.out.println(b ? "yes" : "no");

    Answer: yes

    The ternary operator evaluates to 'yes' when the condition is true.