Which two code segments should you use?

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


You need to implement both Start() methods in a derived class named UseStart that uses the Start() 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
E. Option E
F. Option F

microsoft-exams

8 thoughts on “Which two code segments should you use?

  1. The answers are: C en D

    But D is a bit confusing because it’s missing information that shows that IHome and IOffice is implemented in the class.
    it would have been properly to show the 1st line of the class like the answers B en D: “class UseStart : IHome, IOffice” and the required implemention of the interface methods.

  2. //C and D –> correct answer

    class Program
    {
    static void Main(string[] args)
    {

    var starter = new UseStart();
    ((IHome)starter).Start();
    ((IHome)starter).Start();
    }
    }

    interface IHome {
    void Start();
    }

    interface IOffice {
    void Start();
    }

    class UseStart : IHome, IOffice
    {
    void IHome.Start()
    {

    }

    void IOffice.Start() {

    }

    }

  3. C, D is the correct answer, I tested below code

    class UseStart : IHome, IOffice
    {
    void IOffice.start()
    {
    MessageBox.Show(“IOffice”);
    }

    void IHome.start()
    {
    MessageBox.Show(“IHome”);
    }
    }

    public void test()
    {
    var starter = new UseStart();
    ((IHome)starter).start();
    ((IOffice)starter).start();
    }

  4. Who comes up with these “correct” answers? It kind of defeats the purpose when you can’t trust the answer to be correct.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.