exam questions

Exam 70-486 All Questions

View all questions & answers for the 70-486 exam

Exam 70-486 topic 2 question 13 discussion

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

The date of the run must be displayed in Views\Runlog\GetLog.cshtml. The timestamp must not be displayed.
You need to display the date of the run according to the business requirements.
Which code segment should you use?

  • A. @Html.DisplayFor(model => log.ShortDate)
  • B. @log.RunDate.ToString()
  • C. @log.RunDate.ToShortDateString()
  • D. @Html.DisplayFor(model => log.RunDate)
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️
The log file has the ShortDate function which is defined as:
Return RunDate.ToLocalTime().ToShortDateString();
This meets the requirement.
Note:
Scenario:
✑ The application uses the \Models\LogModel.cs model.
✑ The Html.DisplayFor method is typically used to display values from the object that is exposed by the Model property.
The DisplayExtensions.DisplayFor<TModel, TValue> method (HtmlHelper<TModel>, Expression<Func<TModel, TValue>>)
Returns HTML markup for each property in the object that is represented by the Expression expression.
Incorrect:
Not D: The RunDate attribute is defined as DateTime, but the timestamp (the time of day), should not be displayed.
References:
https://msdn.microsoft.com/en-us/library/system.web.mvc.html.displayextensions.displayfor(v=vs.118).aspx

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
Lt_munchies
Highly Voted 4 years, 8 months ago
Final Answer: A
upvoted 5 times
...
Drazel
Most Recent 4 years, 8 months ago
"C" should by - DateTime have only ToShortDateString() method
upvoted 2 times
Abou_riyad
4 years, 6 months ago
"A" is correct; The log file has the ShortDate function which is defined as: Return RunDate.ToLocalTime().ToShortDateString();
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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago