exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 2 question 122 discussion

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

HOTSPOT -
A developer designs an interface that contains 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:

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
slargollo
Highly Voted 5 years, 5 months ago
It should be No,No,No. No - you can't access Method1 from an instance of Class2, therefore no exception is thrown. No - Class1 inherits from Class2, so the cast of an instance of Class1 into INewInterface doesn't throw an exception. No - Class2 uses an explicit implementation of INewInterface
upvoted 14 times
DiegoB
4 years, 11 months ago
There is a new ThrowException() in Method1
upvoted 2 times
...
...
pgarq19
Highly Voted 5 years, 5 months ago
Yes, No, No -> does work for me. I have tested this example.
upvoted 12 times
sscooter1010
5 years, 4 months ago
How is it possible to call Method1() from an instance of Class1?
upvoted 1 times
VladWork
5 years, 2 months ago
The second question is not about calling method1. It is about casting. So answer is yes no no
upvoted 5 times
...
abelbm
5 years, 2 months ago
In this way ((INewInterface)ee).Method1();
upvoted 1 times
abelbm
5 years, 2 months ago
Sorry... var ee = new Class2(); ((INewInterface)ee).Method1();
upvoted 3 times
...
...
...
sscooter1010
5 years, 4 months ago
Sorry, meant Class2...
upvoted 1 times
...
...
Mogens
Most Recent 4 years, 5 months ago
No, No, No. Exactly as slargollo have described. Try noussa's code and assign the last statement to a random variable and you will see that the casting of INewInterface on class1 is a-okay.
upvoted 2 times
...
TomasRafaj
4 years, 5 months ago
No, No, No - slargollo's answer tested and proved to be right
upvoted 2 times
...
noussa
4 years, 5 months ago
NO, YES,NO here is the proof: https://dotnetfiddle.net/vqQplG
upvoted 1 times
Mogens
4 years, 5 months ago
Nice that you checked this with code, but if you assign the casting of Class1 to a random variable you will not have any compile time errors. So it is actually no no no.
upvoted 1 times
...
...
kobegao
4 years, 8 months ago
zookharb is right:first question is to check if we understand the concept of:hiding method from users of the class through the implementation of explicit interface
upvoted 2 times
noussa
4 years, 5 months ago
I do agree: NO, YES,NO here is the proof: https://dotnetfiddle.net/vqQplG
upvoted 1 times
Dunmer
4 years, 5 months ago
Aaaand... you're incorrect. It should probably be: 1. NO - We cannot call the method from Class2 instance (as said above) 2. NO - because you can cast a class to its interface, e.g.: INewInterface newInterface = (INewInterface) class1; and it won't throw anything as the question only asks if we can cast the instance to the interface :) 3. NO - explicit implementation - also mentioned earlier.
upvoted 1 times
Dunmer
4 years, 5 months ago
My mistake. Class1 doesn't implement INewInterface...
upvoted 1 times
Dunmer
4 years, 5 months ago
And again... a mistake. Actually Class1 implements the interface (INewInterface) as it inherits from Class2.
upvoted 1 times
...
...
...
...
...
zookhrab
4 years, 8 months ago
The answer is No, Yes, No 1)We cannot call the method from Class2 instance - NO 2) We can cast the class1 instance to interface then we can call method - YES 3) This is explicit implementation - NO
upvoted 4 times
...
eliasalg
4 years, 9 months ago
1) It depends: If the instance is created as a Class2 it is not possible to call the method Method1 (as it is an explicit implementation) It is possible to call this method only when we pass through the interface (ex: INewInterface c2 = new Class2();) 2) No: it is possible to cast Class1 into INewInterface (Class2 implements INewInterface et Class1 extends Class2) 3) No: it is an explicit implementation
upvoted 1 times
...
Panos_
4 years, 10 months ago
Y,Y,N is correct answers because the first two throws NoImplementedException.
upvoted 4 times
...
whtvr
5 years, 3 months ago
The question is not clear, if I go like this: INewInterface class2 = new Class2(); class2.Method1(); Then the first one will be yes, but if you go like this: Class2 class2 = new Class2(); class2.Method1(); Then it won't compile because you can't access the Method1 that way, so the question is - whether INewInterface class2 = new Class2(); means class2 is an instance of Class2 in their understanding, if not then it should be No, No, No
upvoted 6 times
...
pvtpeter
5 years, 5 months ago
Yes,, No, No
upvoted 7 times
...
jose1024
5 years, 6 months ago
Should be yes,yes,no. A class1 object casted as INewInterface does throw an exception
upvoted 6 times
pvtpeter
5 years, 5 months ago
Why? The right answer should be: Yes, No, No
upvoted 5 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 ...