nerdexam
GIAC

GSSP-NET · Question #61

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…

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

Question

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 object CompareTo(Class1 obj){}
  • Dpublic int CompareTo(Class1 obj){}

How the community answered

(15 responses)
  • A
    13% (2)
  • B
    7% (1)
  • C
    7% (1)
  • D
    73% (11)

Community Discussion

No community discussion yet for this question.

Full GSSP-NET Practice