exam questions

Exam 98-388 All Questions

View all questions & answers for the 98-388 exam

Exam 98-388 topic 1 question 31 discussion

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

HOTSPOT -
You are writing a Java method named countdown.
The method must meet the following requirements:
✑ Accept an int parameter named start
✑ Display all numbers from start to zero in decrements of one
How should you complete the code? To answer, select the appropriate code segments in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
References:
https://docs.oracle.com/javase/tutorial/java/javaOO/arguments.html

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
VishalPt
3 years, 10 months ago
0>=i public class Test{ public static void main(String []args){ for (int i=5;i>=0;--i){ System.out.println("Value i :" + (i)); } } }
upvoted 1 times
...
mc
4 years, 1 month ago
correct!
upvoted 3 times
...
alejandro355416
4 years, 1 month ago
>0 for second option
upvoted 2 times
Qudaci
3 years, 8 months ago
for it to be 'from start to zero', it needs to be >= or the zero will be skipped. predecrementation takes no effect here
upvoted 1 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 ...