exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 1 question 35 discussion

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

You are developing an application that accepts the input of dates from the user.
Users enter the date in their local format. The date entered by the user is stored in a string variable named inputDate. The valid date value must be placed in a
DateTime variable named validatedDate.
You need to validate the entered date and convert it to Coordinated Universal Time (UTC). The code must not cause an exception to be thrown.
Which code segment should you use?

  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️
AdjustToUniversal parses s and, if necessary, converts it to UTC.
Note: The DateTime.TryParse method converts the specified string representation of a date and time to its DateTime equivalent using the specified culture-specific format information and formatting style, and returns a value that indicates whether the conversion succeeded.

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
monkaS
Highly Voted 4 years, 8 months ago
Correct answer is A
upvoted 8 times
...
noussa
Most Recent 4 years, 5 months ago
A is correct cause it will convert the time anyway using universal or local if universal formatting failed.
upvoted 3 times
...
DarkApprentice
4 years, 7 months ago
A is correct. From Microsoft documentation for DateTimeStyles.AdjustToUniversal: https://docs.microsoft.com/en-us/dotnet/api/system.globalization.datetimestyles?view=net-5.0
upvoted 4 times
...
wingchuihk
4 years, 10 months ago
Answer: B
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 ...