exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 1 question 90 discussion

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

DRAG DROP -
You are developing a class named Temperature.
You need to ensure that collections of Temperature objects are sortable.
How should you complete the relevant code segment? (To answer, drag the appropriate code segments to the correct locations in the answer area. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:

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
Ofer
Highly Voted 5 years, 4 months ago
IComparable defines CompareTo not Equal.
upvoted 5 times
...
DaGrooveNL
Most Recent 4 years, 5 months ago
FINAL ANSWER: Public Class Temperature : IComparable CompareTo this.Fahrenheit.CompareTo(otherTemperature.Fahrenheit);
upvoted 1 times
...
noussa
4 years, 5 months ago
Same example from MS docs: using System; using System.Collections; public class Temperature : IComparable { // The temperature value protected double temperatureF; public int CompareTo(object obj) { if (obj == null) return 1; Temperature otherTemperature = obj as Temperature; if (otherTemperature != null) return this.temperatureF.CompareTo(otherTemperature.temperatureF); else throw new ArgumentException("Object is not a Temperature"); } public double Fahrenheit { get { return this.temperatureF; } set { this.temperatureF = value; } } public double Celsius { get { return (this.temperatureF - 32) * (5.0/9); } set { this.temperatureF = (value * 9.0/5) + 32; } } } So the last one needs to be: this. .......(other. .....)
upvoted 1 times
noussa
4 years, 5 months ago
In other words, the correct answer is 1, 3, 4
upvoted 1 times
noussa
4 years, 5 months ago
I mean 1, 3, 5
upvoted 2 times
...
...
...
hseagraves
4 years, 5 months ago
Confusing. This example shows IComparable https://docs.microsoft.com/en-us/dotnet/api/system.icomparable?view=netcore-3.1
upvoted 1 times
hseagraves
4 years, 5 months ago
Oops I was looking at the ones that were removed. Nevermind.
upvoted 1 times
...
...
Epit2021
4 years, 6 months ago
Won't a null reference exception be thrown if this.Fahrenheit is null?
upvoted 1 times
...
HgstExam
4 years, 10 months ago
Awnser seems Correct: https://docs.microsoft.com/en-us/dotnet/api/system.icomparable?view=netcore-3.1 All ValueTypes implement this interface too.
upvoted 4 times
...
favori3
4 years, 10 months ago
https://docs.microsoft.com/en-us/dotnet/api/system.icomparable?view=netcore-3.1
upvoted 1 times
...
CNTPD1
5 years ago
But last option will work to. https://dotnetfiddle.net/p1Lswb Is it just a matter of code styling?
upvoted 1 times
Dmn28
4 years, 10 months ago
Last option return wrong result. It has to return 1 (not -1) when this Fahrenheit is greater than in comparable object
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 ...