C# Mastery Hub
Home
Challenges
Discussion
Lessons
Core Topics
C# Fundamentals
Console Applications
Classes & OOP
Windows Forms
ASP.NET Core
SQL Server
VS & SQL Connection
RDLC Reports
.NET MAUI
Getting Started
Getting Started
Website Development
SEO Guide
Security
Project Workflow
Extra Topics
Cloud & Deployment
AWS Cloud
Deployment
About
Contact
Test Your Knowledge
Razor Pages - Lesson 5: Validation & Data Annotations Quiz
Answer all questions to test your understanding
1
What are Data Annotations in ASP.NET Core?
Attributes used for validation and metadata
CSS classes for styling
JavaScript functions
Database migrations
2
Which attribute marks a property as required?
[Required]
[Mandatory]
[NotNull]
[Must]
3
How do you specify a custom error message for validation?
Using the ErrorMessage property of the validation attribute
Using a separate error file
Using the ModelState
Using ViewData
4
What does ModelState.IsValid check?
Whether the model passes all validation rules
Whether the model is null
Whether the database is valid
Whether the view is valid
5
Can you create custom validation attributes?
No, only built-in attributes are allowed
Yes, by inheriting from ValidationAttribute
Only for specific data types
Only in MVC applications
Submit Quiz