Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare a generic class named Box.
C Sharp (C#)
public class Box[1] { }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets or parentheses instead of angle brackets.
Forgetting to include the generic type parameter.
✗ Incorrect
Generic classes in C# use angle brackets <> to specify type parameters.
2fill in blank
mediumComplete the code to declare a generic class named Pair with two type parameters.
C Sharp (C#)
public class Pair[1] { }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses or square brackets instead of angle brackets.
Declaring only one type parameter when two are needed.
✗ Incorrect
Multiple generic type parameters are declared inside angle brackets separated by commas.
3fill in blank
hardFix the error in the generic class declaration syntax.
C Sharp (C#)
public class Container[1] { }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets or parentheses instead of angle brackets.
Omitting the generic type parameter brackets.
✗ Incorrect
Generic classes must use angle brackets <> to declare type parameters.
4fill in blank
hardFill both blanks to declare a generic class named Result with one type parameter and a property of that type.
C Sharp (C#)
public class Result[1] { public [2] Value { get; set; } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a concrete type like int or string instead of the generic type parameter.
Forgetting to declare the generic type parameter in the class.
✗ Incorrect
The class declares a generic type parameter and uses T as the property type.
5fill in blank
hardFill all three blanks to declare a generic class named Pair with two type parameters and two properties of those types.
C Sharp (C#)
public class Pair[1] { public [2] First { get; set; } public [3] Second { get; set; } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using concrete types instead of generic type parameters for properties.
Forgetting to declare both generic type parameters.
✗ Incorrect
The class declares two generic type parameters and uses them as property types.