nerdexam
GIAC

GSSP-NET · Question #315

John works as a Software Developer for Blue Well Inc. He wants to create a class named Class1 GIAC GSSP-.NET Exam and implements the generic IComparable interface. He writes the following code…

The correct answer is C. 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 GIAC GSSP-.NET Exam 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

(26 responses)
  • A
    15% (4)
  • B
    8% (2)
  • C
    73% (19)
  • D
    4% (1)

Community Discussion

No community discussion yet for this question.

Full GSSP-NET Practice