Application Development & Programming Flashcards
7 cards from real MCTS practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Application Development & Programming flashcards as text
In C#, what is the difference between 'throw' and 'throw ex' inside a catch block?
Answer: 'throw' preserves the original stack trace; 'throw ex' resets it
Using 'throw' re-throws the caught exception while preserving the original stack trace, while 'throw ex' creates a new stack trace starting at that line.
Which attribute in C# is used to mark a method so it can be called via P/Invoke from unmanaged code?
Answer: [DllImport]
[DllImport] tells the CLR to load a function from an unmanaged DLL and makes it callable from managed C# code.
In ASP.NET MVC, what is the purpose of the 'ActionResult' return type?
Answer: It allows an action to return different response types like views, JSON, or redirects
ActionResult is a base type for all results an MVC action can return, giving flexibility to return ViewResult, JsonResult, RedirectResult, etc.
What is the function of the Global.asax file in an ASP.NET Web Forms application?
Answer: Handles application-level events like Application_Start and Session_Start
Global.asax contains event handlers for application lifecycle events such as Application_Start, Application_End, and Session_Start.
In .NET, which garbage collection generation holds newly created short-lived objects?
Answer: Generation 0
Generation 0 contains the most recently allocated objects and is collected most frequently as part of .NET's generational GC strategy.
Which C# feature allows you to write asynchronous code in a sequential, readable style using async and await?
Answer: Async/Await with Task-based Asynchronous Pattern (TAP)
The async/await keywords combined with TAP allow asynchronous operations to be written as if they were synchronous, improving readability.
In Entity Framework, what does the 'Code First' approach mean?
Answer: Classes are defined in code and the database schema is generated from them
Code First lets developers define domain classes (POCOs) and Entity Framework generates the database schema from those class definitions.