exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 1 question 71 discussion

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

You are creating a class named Employee. The class exposes a string property named EmployeeType. The following code segment defines the Employee class.
(Line numbers are included for reference only.)

The EmployeeType property value must meet the following requirements:
✑ The value must be accessed only by code within the Employee class or within a class derived from the Employee class.
✑ The value must be modified only by code within the Employee class.
You need to ensure that the implementation of the EmployeeType property meets the requirements.
Which two actions should you perform? (Each correct answer represents part of the complete solution. Choose two.)

  • A. Replace line 03 with the following code segment: public string EmployeeType
  • B. Replace line 06 with the following code segment: protected set;
  • C. Replace line 05 with the following code segment: private get;
  • D. Replace line 05 with the following code segment: protected get;
  • E. Replace line 03 with the following code segment: protected string EmployeeType
  • F. Replace line 06 with the following code segment: private set;
Show Suggested Answer Hide Answer
Suggested Answer: EF 🗳️

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
abelbm
Highly Voted 5 years, 2 months ago
E and F are correct
upvoted 13 times
...
jan_oratowski
Most Recent 4 years, 6 months ago
At first, I was thinking about E and F, but then realize it would expose EmployeeType to other classes without get or set, which can't be right. protected EmployeeType will hide it from other classes.
upvoted 2 times
noussa
4 years, 5 months ago
EmployeeType exists within the Employee class and the requirements are to make it just visible for classes that inherit from Employee so it needs to be protected. E and F are Correct
upvoted 2 times
...
...
banshee
5 years, 4 months ago
I think two solutions are good: first - the one from answer, but also the second, which is: 3: internal string EmployeeType //we don't change this line 5: protected get 6: private set So, answers D and F. Or am I missing something?
upvoted 2 times
whtvr
5 years, 4 months ago
You are missing this rule: You can use accessor modifiers only if the property or indexer has both set and get accessors. In this case, the modifier is permitted on only one of the two accessors as described in: https://docs.microsoft.com/en-US/dotnet/csharp/programming-guide/classes-and-structs/restricting-accessor-accessibility
upvoted 9 times
RedDev
4 years, 5 months ago
good explanation thanks so the answer EF is correct.
upvoted 1 times
...
...
...
ptarasov
5 years, 4 months ago
Why do you need A?
upvoted 3 times
...
founderDev
5 years, 5 months ago
my answer A,E,F
upvoted 1 times
RJRENEWED
4 years, 5 months ago
A is not needed, EF does the job
upvoted 2 times
...
noussa
4 years, 5 months ago
The EmployeeType property value must meet the following requirements: ✑ The value must be accessed only by code within the Employee class or within a class derived from the Employee class. ✑ The value must be modified only by code within the Employee class. It must be DF
upvoted 2 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 ...