NEW
Font size
S
M
L
XL
WorksheetsAG ASP API 04 Security, testing, and optimization
Total questions: 51
Worksheet time: 26mins
Name
Class
Date
1.
Unit tests are designed to validate…
a)
UI components
b)
Entire system
c)
A single class/service
d)
SQL schema
2.
xUnit identifies test methods with…
a)
[Run]
b)
[Fact]
c)
[TestCase]
d)
[Method]
3.
Assertions are used to…
a)
Log output
b)
Verify expected behavior
c)
Compile code
d)
Run migrations
4.
Integration tests validate…
a)
UI rendering
b)
Full pipeline behavior
c)
Azure resources
d)
CSS structure
5.
WebApplicationFactory is used to…
a)
Create Docker images
b)
Create an in-memory API
c)
Make SQL backups
d)
Build HTML
6.
Integration tests ensure endpoints…
a)
Render pages
b)
Return correct HTTP codes
c)
Modify CSS
d)
Stream video
7.
Centralized error handling avoids…
a)
Logging
b)
Error responses
c)
Exposing stack traces
d)
Authentication
8.
UseExceptionHandler maps errors to…
a)
/home
b)
/favicon
c)
/error
d)
/stack
9.
Serilog provides…
a)
Binary logs
b)
Structured, contextual logs
c)
SQL tables
d)
UI components
10.
Serilog supports output to…
a)
Only SQL
b)
Only browser
c)
Console & files
d)
GPU memory
11.
Logging should NOT include…
a)
Usernames
b)
Timestamps
c)
Sensitive data
d)
Routes
12.
Moq is used to…
a)
Test UI
b)
Mock dependencies
c)
Deploy apps
d)
Compile middleware
13.
CI/CD helps…
a)
Increase log size
b)
Automate tests
c)
Disable debugging
d)
Remove controllers
14.
OAuth2 is…
a)
A password manager
b)
An authorization framework
c)
A SQL driver
d)
A UI toolkit
15.
OpenID Connect is…
a)
An email protocol
b)
Identity layer on top of OAuth2
c)
A CSS plugin
d)
A BI tool
16.
OAuth2 tokens include…
a)
HTML
b)
CSS
c)
Access & refresh tokens
d)
Controllers
17.
In OAuth2, the “Resource Owner” is…
a)
The API
b)
The authorization server
c)
The user
d)
The controller
18.
The “Client” in OAuth2 is…
a)
The browser vendor
b)
The application requesting access
c)
IIS server
d)
SQL database
19.
JWT authentication uses…
a)
XML tokens
b)
JSON Web Tokens
c)
Cookies only
d)
XAML
20.
A JWT is sent in…
a)
Authorization header
b)
Query string
c)
Form body
d)
Session file
21.
Role-based authorization uses…
a)
[Inject]
b)
[Authorize(Roles='Admin')]
c)
[Claim]
d)
[Secure]
22.
Least privilege means…
a)
Granting full access
b)
Granting minimum required rights
c)
Removing all roles
d)
Using default admin access
23.
Swagger can be used to…
a)
Run SQL queries
b)
Test secured endpoints with JWT
c)
Compile C#
d)
Set IIS bindings
24.
Unauthorized users accessing admin endpoints receive…
a)
UI banner
b)
Authorization errors
c)
Log warnings only
d)
Cached results
25.
HTTPS is required to…
a)
Enable caching
b)
Provide encrypted transfer
c)
Render Razor pages
d)
Enable DI
26.
JWT keys should be stored in…
a)
GitHub repo
b)
appsettings.json only
c)
Key Vault or User Secrets
d)
Swagger UI
27.
Performance optimization uses…
a)
High CPU load
b)
In-memory caching
c)
Manual SQL reading
d)
Large responses
28.
IMemoryCache is used to…
a)
Store HTML
b)
Temporarily store frequent data
c)
Minify logs
d)
Manage routing
29.
Cache expiration helps…
a)
Break API
b)
Manage data freshness
c)
Disable log rotation
d)
Hide errors
30.
Performance timing middleware uses…
a)
Stopwatch
b)
SQL triggers
c)
CSS counters
d)
IIS filters
31.
Caching patient lists is ideal because…
a)
They change constantly
b)
They rarely change
c)
They are sensitive
d)
They require encryption
32.
Avoid caching…
a)
Static content
b)
Sensitive/user-specific data
c)
Long strings
d)
JSON options
33.
Monitoring performance helps detect…
a)
ASP.NET version
b)
Slow endpoints
c)
Controller names
d)
Folder size
34.
Logging request duration helps…
a)
CSS debugging
b)
Optimization decisions
c)
Color selection
d)
SQL deletion
35.
Integration tests verify…
a)
Startup.cs formatting
b)
Full request execution path
c)
Browser version
d)
Razor markup
36.
Debugging tools in VS allow…
a)
Inspecting runtime behavior
b)
Managing Azure billing
c)
Rendering CSS faster
d)
Forcing JWT refresh
37.
Authentication verifies…
a)
File paths
b)
User identity
c)
Network speed
d)
SQL index
38.
Authorization decides…
a)
Permissions
b)
Route templates
c)
Build order
d)
API names
39.
Caching helps reduce…
a)
Memory usage
b)
Database calls
c)
HTTPS certificates
d)
JWT validation
40.
A stable production API must…
a)
Disable logs
b)
Include error handling, logs & caching
c)
Avoid HTTPS
d)
Disable authentication
41.
Centralized error logging writes…
a)
SQL views
b)
Errors with timestamps
c)
Images
d)
CSS selectors
42.
UseExceptionHandler should be used in…
a)
Production
b)
Swagger
c)
Development
d)
Neither
43.
Serilog rolling logs create…
a)
SQL backups
b)
Razor templates
c)
Daily log files
d)
Static files
44.
Authorization policies simplify…
a)
CSS resets
b)
Controllers
c)
Complex access rules
d)
HTTP pipeline
45.
Logging authentication events helps…
a)
Auditing
b)
Generating HTML
c)
Debugging CSS
d)
Styling
46.
IMemoryCache.TryGetValue helps…
a)
Delete cache
b)
Minify HTML
c)
Validate tokens
d)
Retrieve cached data
47.
IMemoryCache.Set allows…
a)
Storing cached items
b)
CORS
c)
Sending emails
d)
Subscribing roles
48.
Profiling endpoints regularly helps…
a)
Change roles
b)
Maintain optimal response times
c)
Add CSS
d)
Slow deployment
49.
Testing ensures…
a)
Random errors
b)
More CSS
c)
Early bug detection
d)
More logs
50.
Integration tests use…
a)
In-memory server
b)
Browser only
c)
Static files
d)
Real IIS
51.
Debugging tools in Visual Studio allow…
a)
Editing SSL certificates
b)
Styling HTML
c)
Minifying JS
d)
Inspecting runtime behavior
Reset
