nerdexam
GIAC

GSSP-.NET · Question #302

(Topic 3) John works as a Software Developer for Blue Well Inc. He wants to create a class named Class1 and implements the generic IComparable interface. He writes the following code: public class…

The correct answer is C. public int CompareTo(Class1 obj){}. See the full explanation below for the reasoning.

Question

  • (Topic 3)

John works as a Software Developer for Blue Well Inc. He wants to create a class named Class1 and implements the generic IComparable interface. He writes the following code:

public class Class1 : System.IComparable<Class1> { } However, John needs to compare one object of Class1 with another object. Which of the following code statement will John include in his application?

Options

  • Apublic int CompareTo(object obj){}
  • Bpublic object CompareTo(int obj){}
  • Cpublic int CompareTo(Class1 obj){}
  • Dpublic object CompareTo(Class1 obj){}

How the community answered

(32 responses)
  • A
    6% (2)
  • B
    16% (5)
  • C
    72% (23)
  • D
    6% (2)

Community Discussion

No community discussion yet for this question.

Full GSSP-.NET Practice