exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 2 question 22 discussion

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

HOTSPOT -
You have the following code:

For each of the following statements, select Yes if the statement is true. Otherwise, select No.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Note:
CustomerID is declared private.
CompanyName is declted protected.
State is declared protected.
The protected keyword is a member access modifier. A protected member is accessible from within the class in which it is declared, and from within any class derived from the class that declared this member.

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
kartal
Highly Voted 5 years, 11 months ago
No, yes, yes. CustomerID private
upvoted 50 times
...
supersunny
Highly Voted 5 years, 11 months ago
I vote for No, Yes, yes since the question is about which property will be available not necessarily inheritable.
upvoted 14 times
...
Roro2011
Most Recent 4 years, 4 months ago
No, Yes, Yes
upvoted 1 times
...
DaGrooveNL
4 years, 5 months ago
FINAL ANSWER: Yes, Yes, Yes.
upvoted 1 times
...
Knarfy
4 years, 6 months ago
I dont see the answers
upvoted 1 times
...
SamSerpieol
4 years, 6 months ago
its no , yes , yes , private fields are on accessible within the containing class , protected fields are accessible in derived classes and public fields are available everywhere
upvoted 1 times
...
MarcoFlorian
4 years, 6 months ago
First statement is about HAVING the property, but not about being inherited. When Customer is extended, CustomerID is not part of the derived class. You can create a new property with the same name without restrictions, and both properties will exist in their corresponding layer. It is the same behavior as using NEW. https://dotnetfiddle.net/z8Aj6G The answer is NO YES YES.
upvoted 2 times
...
Loki93
5 years ago
Correct answer No, Yes, No Proof here https://dotnetfiddle.net/8qn1HU
upvoted 4 times
Loki93
5 years ago
Sorry, proof here https://dotnetfiddle.net/hPauZa
upvoted 3 times
nickname0815
4 years, 11 months ago
As some stated before, this is not was the answers are about. The wording ist "have xyz as a property". Sure, only the public one is actually accessible but the other ones EXIST. So the anwer is Yes,Yes,Yes
upvoted 2 times
Bart_v_M
4 years, 10 months ago
No, the first and the third question show fields, not properties. Only the second question shows a property because it has a public access modifier. So the correct answer should indeed be No, Yes, No.
upvoted 1 times
...
...
ndlp43
4 years, 11 months ago
Add this line to your proof: var none = a.none; and check syntax then. Answer is yes, yes, yes
upvoted 1 times
...
taotao
4 years, 9 months ago
The proof is not a valid proof. The answer should be No, Yes, Yes. In the proof the code tried to access a.State in Main function, which is outside of the derived class hence the compilation failed. Here is how the proof should be: One can add function in the derived class MyCustomerClass, such as public string GetStateFromBase() { return this.State;}. But one can NOT add the following function in the derived class MyCustomerClass: public string GetCustomerIdFromBase() {return this.CustomerId;} One cannot access CustomerId or State outside of Customer class or derived class as the properties are private or protected - such as from Main in the invalid "Proof".
upvoted 2 times
...
...
...
san0659
5 years ago
Yes,Yes,Yes Derived classes inherit members from all of their base classes. The keywords private, public and protected affect only the accessibility of the items they are applied to. If something is not accessible in a particular context and you try to use it, the compiler will give you an error.
upvoted 1 times
...
TonyBezerra
5 years, 3 months ago
No, Yes and Yes. Cause CostumerID is a private property.
upvoted 2 times
...
osaki
5 years, 6 months ago
no yes yes
upvoted 3 times
...
Iryna
5 years, 7 months ago
yes, yes, yes. Explanation: Private members in base classes are inherited but are not accessible from derived https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/members
upvoted 5 times
natsk8freak
5 years, 6 months ago
Even though the property is inherited, it is inaccessible. Therefore, Private members are not accessible properties.
upvoted 2 times
bleasdal3
5 years, 5 months ago
it doesn't say accessible. It says "inherits as a property". New instances of derived classes will have their own private member. So, "Yes, yes yes" is indeed correct.
upvoted 3 times
...
...
...
Khanyie
5 years, 7 months ago
no,yes,yes
upvoted 10 times
...
Mitsoshima
6 years ago
Here the question is about which members are inherited, and not, if they are accessible. Due to the fact, that all members are inherited (inclusive private members, but there are not accessible), the correct answers should be: Yes, Yes, Yes
upvoted 7 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 ...