nerdexam
Oracle

1Z0-803 · Question #47

Given: What is the result?

The correct answer is A. 6. Within main z is assigned 6. z is printed. Output: 6 Within doStuff z is assigned 5.DoStuff2 locally sets z to 4 (but MyScope.z is set to 4), but in Dostuff z is still 5. z is printed. Output: 5 Again z is printed within main (with local z set to 6). Output: 6 Finally MyScope.z i

Using Operators and Decision Constructs

Question

Given:

What is the result?

Exhibit

1Z0-803 question #47 exhibit

Options

  • A6
  • B6
  • C6
  • D6

How the community answered

(32 responses)
  • A
    94% (30)
  • B
    3% (1)
  • C
    3% (1)

Explanation

Within main z is assigned 6. z is printed. Output: 6 Within doStuff z is assigned 5.DoStuff2 locally sets z to 4 (but MyScope.z is set to 4), but in Dostuff z is still 5. z is printed. Output: 5 Again z is printed within main (with local z set to 6). Output: 6 Finally MyScope.z is printed. MyScope.z has been set to 4 within doStuff2(). Output: 4

Topics

#operators#arithmetic operations#operator precedence

Community Discussion

No community discussion yet for this question.

Full 1Z0-803 Practice