exam questions

Exam 98-388 All Questions

View all questions & answers for the 98-388 exam

Exam 98-388 topic 1 question 34 discussion

Actual exam question from Microsoft's 98-388
Question #: 34
Topic #: 1
[All 98-388 Questions]

HOTSPOT -
You need to evaluate the following code. Line numbers are included for reference only.

Use the drop-down menus to select the answer choice that answers each question based on the information presented in the code.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Girul
3 years, 8 months ago
55 55 Out of scope. El método "add" tiene como parámetro "anum" del tipo primitivo "int". Un parámetro de tipo primitivo siempre es pasado por copia, no por referencia, por lo tanto, aunque se altere dentro del método, al acabar el método el valor queda como estuviera al principio, sin alteaciones. Por eso la segunda respuesta es 55, no 56, ni 63. As for the variable "cnt", it is local to the "for" loop, and outside its keys it no longer exists.
upvoted 2 times
...
lulzosad
3 years, 11 months ago
I checked everything. Correct answer is: 55 56 Out of scope.
upvoted 4 times
oussemadev
3 years, 7 months ago
he said line 10 not 11
upvoted 1 times
oussemadev
3 years, 7 months ago
Line 9*
upvoted 1 times
...
...
...
estherjq
4 years, 1 month ago
55 56 *the new anum is not saved, it is 55 when a new loop start) 10 (not sure, but i think when cnt reached 10, it ends the loop so code can run line06 which is out of scope for the loop) public static void main(String []args){ int anum = 55; for (int cnt = 0; cnt < 10; cnt++){ add(anum); System.out.println("line05 index" + cnt + " "+ anum); } System.out.println(anum); } public static void add(int anum){ anum++; System.out.println("line11 " + anum); }
upvoted 1 times
...
ahm3edtrig
4 years, 2 months ago
55 63 out of scope
upvoted 1 times
...
mtmoore
4 years, 9 months ago
At line 11 anum would be 56 because anum++ already ran and cnt doesn't exist when line 6 executes.
upvoted 2 times
...
MuzM
4 years, 11 months ago
wouldnt it be out of the scope for the last one? because the for loop has it's own scope and the maximum value cnt reaches is 9?
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...