exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 2 question 79 discussion

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

You are developing an application that includes the following code segment:

You need to implement the Open() method of each interface in a derived class named UseResources and call the Open() method of each interface.
Which two code segments should you use? (Each correct answer presents part of the solution. Choose two.)

  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
Show Suggested Answer Hide Answer
Suggested Answer: AC 🗳️
An interface contains only the signatures of methods, properties, events or indexers. A class or struct that implements the interface must implement the members of the interface that are specified in the interface definition.
Example:
interface ISampleInterface
{
void SampleMethod();
}
class ImplementationClass : ISampleInterface
{
// Explicit interface member implementation:
void ISampleInterface.SampleMethod()
{
// Method implementation.
}
static void Main()
{
// Declare an interface instance.
ISampleInterface obj = new ImplementationClass();
// Call the member.
obj.SampleMethod();
}
}

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
supersunny
Highly Voted 5 years, 9 months ago
A,C are ok.
upvoted 15 times
...
banshee
Highly Voted 5 years, 5 months ago
A and C are correct (verified in the code). The reason why A and not D is correct is because when we call method explicitly from interface, it's public by default.
upvoted 9 times
...
Epit2021
Most Recent 4 years, 5 months ago
just why would you do this, this code is horrible
upvoted 3 times
...
rdasan
4 years, 10 months ago
A, C is the answer Check : https://dotnetfiddle.net/cKHiG1
upvoted 5 times
...
XardasLord
4 years, 11 months ago
A and C
upvoted 1 times
...
majco333
5 years, 5 months ago
A, C: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/interfaces/explicit-interface-implementation
upvoted 7 times
...
Aerologic
5 years, 5 months ago
I think the answers should be C and D since in A they don't specify the modifiers for the class methods, which means they default to private and the derived class wouldn't be able to access them.
upvoted 3 times
sscooter1010
5 years, 3 months ago
It just means that you'll have to call those methods via the interface, not the class
upvoted 6 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