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
Web Application Security (Full Section) Quiz
Answer all questions to test your understanding
1
Why is HTTPS important for websites?
It encrypts data between client and server
It prevents man-in-the-middle attacks
It builds user trust
All of the above
2
What does HSTS stand for?
HTTP Strict Transport Security
HTTP Secure Transfer System
Hypertext Secure Transport Service
HTTP Standard Transfer Security
3
Which service provides free SSL certificates?
Let's Encrypt
SSL.com
Verisign
Symantec
4
What does app.UseHttpsRedirection() do?
Redirects HTTP to HTTPS
Redirects HTTPS to HTTP
Disables HTTPS
Creates a certificate
5
Which Azure feature provides free SSL certificates?
App Service Managed Certificate
Azure Key Vault
Azure Active Directory
Azure Functions
6
What is ASP.NET Core Identity?
A membership system for authentication and authorization
A database system
A web framework
A cloud service
7
What is the purpose of UserManager in ASP.NET Core Identity?
To manage user creation and password operations
To manage database connections
To manage HTTP requests
To manage file uploads
8
What does the SignInManager do?
Handles user sign-in and sign-out
Manages database queries
Handles HTTP responses
Manages file storage
9
Which attribute is used to restrict access based on roles?
[Authorize]
[Authenticate]
[AllowAnonymous]
[Role]
10
What is the purpose of password hashing in Identity?
To securely store passwords
To make passwords shorter
To display passwords in plain text
To delete passwords
11
What is SQL Injection?
A type of database backup
A security vulnerability where malicious SQL code is injected
A database optimization technique
A SQL query optimization
12
How can you prevent SQL Injection in C#?
By using parameterized queries
By using string concatenation
By using dynamic SQL
By using hard-coded values
13
Which method in ADO.NET prevents SQL injection?
Using SqlCommand with parameters
Using string concatenation
Using dynamic SQL
Using inline queries
14
Does Entity Framework Core prevent SQL Injection?
Yes, it automatically parameterizes queries
No, it is vulnerable
Only with stored procedures
Only in development
15
What is a best practice for validating user input?
Validate and sanitize all user input
Accept all input without validation
Only validate numbers
Only validate emails
16
What is Cross-Site Scripting (XSS)?
Malicious scripts injected into trusted websites
A type of database backup
A network protocol
A CSS framework
17
How does Razor Pages prevent XSS?
By automatically encoding output
By deleting scripts
By blocking JavaScript
By disabling HTML
18
What is Cross-Site Request Forgery (CSRF)?
Tricking a user into performing unwanted actions
A type of virus
A network attack
A database attack
19
How does ASP.NET Core prevent CSRF?
Using anti-forgery tokens
Using passwords
Using email verification
Using cookies
20
What does the [ValidateAntiForgeryToken] attribute do?
Validates the anti-forgery token in POST requests
Validates user login
Validates email addresses
Validates passwords
21
What are security headers?
HTTP response headers that instruct browsers on secure behavior
Database headers
CSS headers
JavaScript headers
22
What does the Content-Security-Policy (CSP) header do?
Specifies allowed content sources
Blocks all content
Allows all content
Disables CSS
23
What does X-Frame-Options: DENY do?
Prevents the page from being displayed in frames
Allows the page in all frames
Redirects to HTTPS
Enables JavaScript
24
What is the purpose of X-Content-Type-Options: nosniff?
Prevents MIME type sniffing
Allows MIME type sniffing
Disables CSS
Enables JavaScript
25
What does the Strict-Transport-Security header do?
Forces browsers to use HTTPS
Allows HTTP only
Redirects to HTTP
Disables SSL
26
What are secrets in application development?
Sensitive data like passwords and API keys
Public data
Log files
Cache data
27
What is User Secrets in ASP.NET Core?
A development-only secret storage
A production secret storage
A database storage
A file storage
28
What is Azure Key Vault?
A cloud service for storing secrets securely
A web framework
A database system
A file storage system
29
Which command sets a User Secret in .NET?
dotnet user-secrets set 'key' 'value'
dotnet secret set 'key' 'value'
dotnet add secret 'key' 'value'
dotnet config secret 'key' 'value'
30
What is a best practice for managing secrets?
Never store secrets in code or configuration files
Store secrets in appsettings.json
Store secrets in comments
Store secrets in logs
Submit Quiz