Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 5 MCQs ASP.NET Core MVC, Entity Framework Core and Security

CSE253 — .Net Programming 60 questions. Pick an option to check it.

Read the notes Subjective questions

0 of 60 answered 0 right 0 wrong , 60 left

  1. Question 1 of 60 Middleware Request Pipeline Easy

    What is the main purpose of the middleware request pipeline in ASP.NET Core?

  2. Question 2 of 60 Middleware Request Pipeline Easy

    In an ASP.NET Core application, middleware components are generally executed in what order?

  3. Question 3 of 60 Built-In Middleware and Custom Middleware Easy

    Which middleware is commonly used to serve static files in ASP.NET Core?

  4. Question 4 of 60 Built-In Middleware and Custom Middleware Easy

    What is custom middleware?

  5. Question 5 of 60 Dependency Injection in ASP.NET Core Easy

    What is the main purpose of dependency injection in ASP.NET Core?

  6. Question 6 of 60 Dependency Injection in ASP.NET Core Easy

    Where are application services commonly registered for dependency injection?

  7. Question 7 of 60 Introduction to Entity Framework Core Easy

    What is Entity Framework Core primarily used for?

  8. Question 8 of 60 Introduction to Entity Framework Core Easy

    What does ORM stand for?

  9. Question 9 of 60 DbContext and Entity Configuration Easy

    What is the role of the DbContext class in Entity Framework Core?

  10. Question 10 of 60 DbContext and Entity Configuration Easy

    Which property type in a DbContext usually represents a database table?

  11. Question 11 of 60 Code First Approach Easy

    What is created first in the Entity Framework Core Code First approach?

  12. Question 12 of 60 Code First Approach Easy

    Which feature is commonly used to apply Code First model changes to a database?

  13. Question 13 of 60 Database First Approach Easy

    What is the starting point in the Database First approach?

  14. Question 14 of 60 Database First Approach Easy

    What is commonly generated from an existing database in the Database First approach?

  15. Question 15 of 60 Database Migrations Easy

    What is the purpose of a database migration in Entity Framework Core?

  16. Question 16 of 60 Database Migrations Easy

    Which command is commonly used to create a new Entity Framework Core migration?

  17. Question 17 of 60 CRUD Operations using Entity Framework Core Easy

    What does the letter C represent in CRUD?

  18. Question 18 of 60 CRUD Operations using Entity Framework Core Easy

    Which method marks a new entity for insertion into the database?

  19. Question 19 of 60 Authentication and Authorization in Web Applications Easy

    What does authentication verify?

  20. Question 20 of 60 Authentication and Authorization in Web Applications Easy

    What does authorization determine?

  21. Question 21 of 60 Middleware Request Pipeline Medium

    An ASP.NET Core application must log both the incoming request and the outgoing response status. Where should the logging middleware call await next(context)?

  22. Question 22 of 60 Middleware Request Pipeline Medium

    A middleware component returns a response without invoking the next middleware. What is the effect on the request pipeline?

  23. Question 23 of 60 Built-In Middleware and Custom Middleware Medium

    An application should serve files from wwwroot without routing those requests through MVC controllers. Which built-in middleware should be added?

  24. Question 24 of 60 Built-In Middleware and Custom Middleware Medium

    A conventional custom middleware class receives a RequestDelegate through its constructor. Which method signature allows ASP.NET Core to execute it?

  25. Question 25 of 60 Dependency Injection in ASP.NET Core Medium

    A service stores information that must be shared within one HTTP request but isolated from other requests. Which lifetime should be used?

  26. Question 26 of 60 Dependency Injection in ASP.NET Core Medium

    A controller constructor requires IEmailSender, but no implementation has been registered. What normally happens when ASP.NET Core tries to create the controller?

  27. Question 27 of 60 Introduction to Entity Framework Core Medium

    A queried entity is modified in memory and SaveChangesAsync() is called without explicitly calling Update. Why can Entity Framework Core persist the modification?

  28. Question 28 of 60 Introduction to Entity Framework Core Medium

    The same EF Core model must run against SQL Server in production and SQLite during local testing. Which EF Core feature primarily enables this?

  29. Question 29 of 60 DbContext and Entity Configuration Medium

    A Blog has many Post entities, and every Post has one required Blog. Which Fluent API configuration best represents this relationship?

  30. Question 30 of 60 DbContext and Entity Configuration Medium

    An entity property must map to a database column named product_code and have a maximum length of 20. Where can both rules be configured centrally?

  31. Question 31 of 60 Code First Approach Medium

    In a Code First project, a developer adds a required Email property to the Customer entity. What should normally be done to apply this model change to the database?

  32. Question 32 of 60 Code First Approach Medium

    A Code First model uses a property named CustomerId in the Customer class without explicit key configuration. How does EF Core usually treat this property?

  33. Question 33 of 60 Database First Approach Medium

    A team has an existing SQL Server database and needs to generate EF Core entity classes and a DbContext. Which command is appropriate?

  34. Question 34 of 60 Database First Approach Medium

    A developer needs to add custom behavior to a scaffolded entity while allowing the entity to be regenerated later. Which approach best protects the custom code?

  35. Question 35 of 60 Database Migrations Medium

    A migration has been created locally but has not been applied or shared. The developer discovers that it is incorrect. Which command is most appropriate for removing it?

  36. Question 36 of 60 Database Migrations Medium

    A production administrator needs a reviewable SQL script containing database changes between two migrations. Which command should the developer use?

  37. Question 37 of 60 CRUD Operations using Entity Framework Core Medium

    A read-only product listing loads thousands of rows and does not modify them. Which query is generally more efficient?

  38. Question 38 of 60 CRUD Operations using Entity Framework Core Medium

    A controller must delete an order only when it exists. Which sequence correctly performs the operation?

  39. Question 39 of 60 Authentication and Authorization in Web Applications Medium

    An ASP.NET Core application uses cookie authentication and protected endpoints. Which middleware order is required after routing and before endpoint execution?

  40. Question 40 of 60 Authentication and Authorization in Web Applications Medium

    An action should be accessible only to authenticated users who satisfy a policy named CanApproveOrders. Which attribute is appropriate?

  41. Question 41 of 60 Middleware Request Pipeline Hard

    In an ASP.NET Core application, middleware is registered in this order: UseExceptionHandler, UseStaticFiles, UseRouting, UseAuthentication, UseAuthorization, and MapControllers. A controller throws an exception while executing an authorized action. Which component can reliably handle the exception?

  42. Question 42 of 60 Middleware Request Pipeline Hard

    A middleware executes code before and after await _next(context). A later middleware short-circuits the request and never calls its own next delegate. Which behavior is expected?

  43. Question 43 of 60 Built-In Middleware and Custom Middleware Hard

    A custom middleware needs to redirect unauthenticated requests to /login, but must allow static assets and the login endpoint through. Which placement is most appropriate?

  44. Question 44 of 60 Built-In Middleware and Custom Middleware Hard

    A custom middleware stores a request-specific correlation identifier in an instance field of the middleware class. Under concurrent requests, what is the primary defect?

  45. Question 45 of 60 Dependency Injection in ASP.NET Core Hard

    A singleton service directly depends on a scoped DbContext. What is the correct assessment of this dependency graph?

  46. Question 46 of 60 Dependency Injection in ASP.NET Core Hard

    A controller constructor requests IEnumerable<INotificationHandler>. Three handlers are registered, and one registration is repeated for the same implementation type. What does the default container normally inject?

  47. Question 47 of 60 Introduction to Entity Framework Core Hard

    An EF Core query projects entities into DTOs and uses AsNoTracking(). Later, the application modifies one projected DTO and calls SaveChanges(). What happens?

  48. Question 48 of 60 Introduction to Entity Framework Core Hard

    A LINQ query contains a custom C# method inside its Where predicate. EF Core cannot translate that method to SQL. In a modern EF Core version, what is the usual result when the query executes?

  49. Question 49 of 60 DbContext and Entity Configuration Hard

    An entity has a property Code configured with IsRequired().HasMaxLength(20), while its database column is manually changed to allow NULL. During migration generation, what does EF Core compare?

  50. Question 50 of 60 DbContext and Entity Configuration Hard

    A required one-to-many relationship is configured with a non-nullable foreign key, but the navigation property is not marked virtual and lazy-loading proxies are enabled. What should be expected?

  51. Question 51 of 60 Code First Approach Hard

    A Code First model changes a property from string to int while existing rows contain nonnumeric values. A migration is generated successfully. When is the likely failure observed?

  52. Question 52 of 60 Code First Approach Hard

    A Code First application uses a non-nullable DateTime property with no explicit database default. A new entity is inserted without setting that property. Which value is generally sent by EF Core?

  53. Question 53 of 60 Database First Approach Hard

    A database-first model is scaffolded, then the generated entity class is edited to add validation attributes. The database is scaffolded again. What is the main risk?

  54. Question 54 of 60 Database First Approach Hard

    A database-first scaffold sees a nullable database column and generates a nullable CLR property. Application code later treats the value as non-nullable without checking it. Which issue is most likely?

  55. Question 55 of 60 Database Migrations Hard

    Two application instances start simultaneously after a new migration has been deployed but not applied. Both call Database.Migrate(). What is the principal operational concern?

  56. Question 56 of 60 Database Migrations Hard

    A migration adds a non-nullable column to a populated table without a default value. What must usually be handled for the migration to succeed?

  57. Question 57 of 60 CRUD Operations using Entity Framework Core Hard

    Two requests load the same row with a rowversion concurrency token. Both modify it, and the first request saves successfully. What normally happens when the second request calls SaveChanges()?

  58. Question 58 of 60 CRUD Operations using Entity Framework Core Hard

    A controller receives an entity graph from a client and calls Update(graph) directly. The graph omits a sensitive property that should remain unchanged. What is the major risk?

  59. Question 59 of 60 Authentication and Authorization in Web Applications Hard

    An ASP.NET Core application calls UseAuthorization() before UseAuthentication(). An endpoint requires an authenticated user. What is the likely consequence?

  60. Question 60 of 60 Authentication and Authorization in Web Applications Hard

    A policy requires claim scope=orders.read. A bearer token contains scope as the single string orders.read orders.write. A simple claim-value equality requirement is used. What is the likely result?

That's unit 5

Answer a few questions and your score shows up here.