Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
12 views3 pages

Untitled Document

The document contains a series of questions and answers related to ASP.NET Web Forms, LINQ, C#, ASP.NET Core, and Entity Framework Core. Key concepts include ViewState, the FirstOrDefault LINQ method, the var keyword, the ConfigureServices method, dependency injection, Razor templating engine, null-coalescing operator, and EF Core as an ORM framework. Each question is followed by the correct answer and a brief explanation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Untitled Document

The document contains a series of questions and answers related to ASP.NET Web Forms, LINQ, C#, ASP.NET Core, and Entity Framework Core. Key concepts include ViewState, the FirstOrDefault LINQ method, the var keyword, the ConfigureServices method, dependency injection, Razor templating engine, null-coalescing operator, and EF Core as an ORM framework. Each question is followed by the correct answer and a brief explanation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

10. Which of the following is true about ViewState in ASP.NET Web Forms?

A) ViewState is stored on the server​


B) ViewState stores session data​
C) ViewState persists data across postbacks​
D) ViewState works only with cookies

Answer: C) ViewState persists data across postbacks

Explanation: ViewState allows the values of controls to persist across HTTP postbacks.

11. Which LINQ method returns the first element that matches a condition?

A) Where​
B) Select​
C) FirstOrDefault​
D) All

Answer: C) FirstOrDefault

Explanation: FirstOrDefault returns the first matching element or default value if no match
is found.

12. What does the var keyword signify in C#?

A) Variable can be null​


B) Variable is constant​
C) Variable type is inferred at compile time​
D) Variable type is object

Answer: C) Variable type is inferred at compile time

Explanation: var allows the compiler to infer the type based on the assigned value.

13. In which file is the ConfigureServices method found in ASP.NET


Core?
A) Program.cs​
B) Startup.cs​
C) App.config​
D) Web.config

Answer: B) Startup.cs

Explanation: The Startup.cs file in ASP.NET Core contains ConfigureServices for


registering services.

14. Which of the following is used for dependency injection in .NET Core?

A) IServiceCollection​
B) SqlDependency​
C) HttpContext​
D) WebClient

Answer: A) IServiceCollection

Explanation: Services are added to the DI container using the IServiceCollection


interface in ConfigureServices.

15. What is Razor in ASP.NET?

A) A database​
B) A server​
C) A templating engine​
D) A logging tool

Answer: C) A templating engine

Explanation: Razor is a markup syntax that allows embedding C# into HTML in ASP.NET MVC.

16. Which operator is used to handle null-coalescing in C#?

A) ?​
B) ??​
C) ::​
D) ?:
Answer: B) ??

Explanation: The ?? operator returns the left operand if not null, otherwise the right operand.

17. What is Entity Framework Core?

A) A file system​
B) A front-end library​
C) An ORM framework​
D) A network protocol

Answer: C) An ORM framework

Explanation: EF Core is an open-source object-relational mapper for .NET.

18. Which command is used to create a new migration in EF Core?

A) ef add migration​
B) dotnet ef migrations add​
C) efcore create migration​
D) add-migration

Answer: B) dotnet ef migrations add

Explanation: dotnet ef migrations add <name> creates a new migration in EF Core.

You might also like