- Online Exam Test Papers | - MCQs[multiple choice questions and answers ] | - Mock Test Papers | - Practice Papers | - Sample Test Papers |

Question:
For the code snippet given below, which of the following statements are valid?

public class MyContainer<T> where T: IComparabte
{
    // Insert code here
}
1. Class MyContainer requires that it's type argument must implement IComparabte interface.
2. Type argument of class MyContainer must be IComparabte.
3. Compiler will report an error for this block of code.
4. This requirement on type argument is called as constraint.

1.1 and 2 Only

2.1,2 and 3 Only

3.1 and 4 Only

4.All of the above

Posted Date:-2021-02-25 10:20:32


More MCQS Questions and answers

Search