Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to mark the class as obsolete.
C Sharp (C#)
[[1]("Use NewClass instead")] public class OldClass { }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Serializable instead of Obsolete.
Trying to use Deprecated which is not a C# attribute.
✗ Incorrect
The Obsolete attribute marks code as outdated and shows a warning when used.
2fill in blank
mediumComplete the code to make the class serializable.
C Sharp (C#)
[[1]] public class Data { public int Id; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Obsolete instead of Serializable.
Confusing NonSerialized which is for fields, not classes.
✗ Incorrect
The Serializable attribute allows the class to be converted to a format for storage or transfer.
3fill in blank
hardFix the error in the code to correctly mark the field as not serializable.
C Sharp (C#)
[Serializable] public class User { public string Name; [[1]] public string Password; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Serializable on a field inside a Serializable class.
Using Obsolete which is unrelated to serialization.
✗ Incorrect
The NonSerialized attribute prevents a field from being serialized.
4fill in blank
hardFill both blanks to mark the class as obsolete and serializable.
C Sharp (C#)
[[1]("This class is outdated")] [[2]] public class OldData { public int Value; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Deprecated which is not a valid C# attribute.
Mixing up NonSerialized which is for fields only.
✗ Incorrect
Use Obsolete to mark the class as outdated and Serializable to allow serialization.
5fill in blank
hardFill all three blanks to mark the class obsolete, make it serializable, and exclude a field from serialization.
C Sharp (C#)
[[1]("Use NewUser instead")] [[2]] public class User { public string Username; [[3]] public string Password; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Deprecated which is not a C# attribute.
Forgetting to exclude sensitive fields from serialization.
✗ Incorrect
Obsolete marks the class as outdated, Serializable allows serialization, and NonSerialized excludes the Password field.