exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 2 question 32 discussion

Actual exam question from Microsoft's 70-483
Question #: 32
Topic #: 2
[All 70-483 Questions]

You are developing a game that allows players to collect from 0 through 1000 coins. You are creating a method that will be used in the game. The method includes the following code. (Line numbers are included for reference only.)
01 public string FormatCoins(string name, int coins)
02 {
04 }
The method must meet the following requirements:
✑ Return a string that includes the player name and the number of coins.
✑ Display the number of coins without leading zeros if the number is 1 or greater.
✑ Display the number of coins as a single 0 if the number is 0.
You need to ensure that the method meets the requirements.
Which code segment should you insert at line 03?

  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
patoyanez
Highly Voted 5 years, 10 months ago
correct answer: A
upvoted 47 times
...
supersunny
Highly Voted 5 years, 4 months ago
A is the answer.
upvoted 13 times
supersunny
5 years, 4 months ago
I mean to say D. D is the answer.
upvoted 4 times
...
...
DaGrooveNL
Most Recent 3 years, 10 months ago
FINAL ANSWER: A.
upvoted 2 times
...
FinderZ
3 years, 11 months ago
Correct answer is A A. "Player Alex, collected 0 coins" B. "Player Alex, collected 0000 coins" C. Unhandled exception. System.FormatException: Input string was not in a correct format. D. Unhandled exception. System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list. Proof: https://dotnetfiddle.net/f6h979
upvoted 3 times
...
johan2020
4 years, 1 month ago
Correct answer is A. Tested and verified.
upvoted 3 times
...
HgstExam
4 years, 3 months ago
A IS THE ONLY ANWSER THAT IS CORRECT IS B is incorrect because it will display multiple zeros when zero C is incorrect because string.Format does not use interpolation D is incorrect because the index starts at zero and even then the format is not correct.
upvoted 4 times
...
Sreyas
4 years, 4 months ago
Correct answer is A. Tested and verified.
upvoted 2 times
...
KT1978
4 years, 5 months ago
A is the answer. although the ### is pointless as its an int
upvoted 1 times
...
Sujay
4 years, 7 months ago
A is correct. D is incorect
upvoted 1 times
...
ArunPrem
4 years, 8 months ago
On working out through the code, A is the right answer.
upvoted 2 times
...
TonyBezerra
4 years, 9 months ago
I tried and both, A and B, worked fine, as the requisites asked for. D didn't work. neither B
upvoted 1 times
...
TonyBezerra
4 years, 9 months ago
I tried and both, A and B, worked fine, as the requisites asked for.
upvoted 1 times
...
Lamb0555
4 years, 9 months ago
It definitely A.
upvoted 1 times
...
saurin
4 years, 9 months ago
Ans is D but there was a typo
upvoted 1 times
...
whtvr
4 years, 9 months ago
I'm also pretty sure that A is correct. D uses {1} and {2} while there only could be 0 and 1... Also ###0 does exactly what is required
upvoted 2 times
...
jose1024
4 years, 11 months ago
D is incorrect. Apart from dakuan said, 1:D3 will print leading zeroes which is something that does not meet the requirements. A is the right one.
upvoted 4 times
XXXX
4 years, 10 months ago
D3 will print trailing zeros
upvoted 1 times
...
...
Aerologic
5 years ago
A is definitely the correct answer. I just tried them all and A is the only one that worked properly.
upvoted 13 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago