MCQs > IT & Programming > .NET Framework MCQs > Basic .NET Framework MCQs

Basic .NET Framework MCQ

1. What does JIT do in .Net?

Answer

Correct Answer: JIT translates the IL code to an assembly code and uses the CPU architecture of the target machine to execute a .NET application.

Note: This Question is unanswered, help us to find answer for this one

2. What is the difference between a heap and a stack?

Answer

Correct Answer: The stack contains stored value types; the heap contains stored reference types.

Note: This Question is unanswered, help us to find answer for this one

3. Why would the .NET Framework use Econo-JIT (Just-inTime)?

Answer

Correct Answer: To compile only the methods that are called at run time and remove them from memory after execution

Note: This Question is unanswered, help us to find answer for this one

4. What is the interface segregation principle?

Answer

Correct Answer: Many client-specific interfaces are better than one general-purpose interface.

Note: This Question is unanswered, help us to find answer for this one

5. Which statement about a read-only variable is not true?

Answer

Correct Answer: It can be initialized at declaration only.

Note: This Question is unanswered, help us to find answer for this one

6. What does IL stand for?

Answer

Correct Answer: Intermediate Language

Note: This Question is unanswered, help us to find answer for this one

7. What does CIL stand for?

Answer

Correct Answer: Common Intermediate Language

Note: This Question is unanswered, help us to find answer for this one

8. Which choice best describes the difference between globalization and localization?

Answer

Correct Answer: Globalization involves designing and developing a world-ready app that supports localized interfaces and regional data for users in multiple cultures. Localization is the process of translating an application's resources into versions for each culture that the application will support.

Note: This Question is unanswered, help us to find answer for this one

9. What method do you use to explicitly kill a user's session?

Answer

Correct Answer: Session.Abandon()

Note: This Question is unanswered, help us to find answer for this one

10. What is the Liskov substitution principle?

Answer

Correct Answer: Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.

Note: This Question is unanswered, help us to find answer for this one

11. The ASP.NET Core Module is a native IIS module that plugs into the IIS pipeline to either _.

Answer

Correct Answer: Host an ASP.NET Code app inside of the IIS workes process, called the in-process hosting model, or forward web requests to a backend ASP.NET Core app running the Kestrel server, called the out-of-process hosting model

Note: This Question is unanswered, help us to find answer for this one

12. What is .NET?

Answer

Correct Answer: .NET is a free, cross-platform, open-source developer platform for building many different types of applications with multiple languages, editors, and libraries for web, mobile, desktop, gaming, and IoT.

Note: This Question is unanswered, help us to find answer for this one

13. Why would the .NET Framework use Normal-JIT (Just-in-Time)?

Answer

Correct Answer: To compile only methods called at runtime – which are compiled the first time the methods are called and then stored in a cache to be used for execution when the same methods are called again

Note: This Question is unanswered, help us to find answer for this one

14. When should you use the .NET Core class library project type?

Answer

Correct Answer: When you want to increase the .NET API surface area your library can access, and allow only .NET Core apps to be compatible with your library

Note: This Question is unanswered, help us to find answer for this one

15. Which choice is NOT a component of .NET Framework?

Answer

Correct Answer: .NET framework class library

Note: This Question is unanswered, help us to find answer for this one

16. What is a task?

Answer

Correct Answer: A single operation that does not return a value and that usually executes asynchronously

Note: This Question is unanswered, help us to find answer for this one

17. Why use design patterns?

Answer

Correct Answer: Design patterns help you solve issues related to sofware development using a proven solution, and make communication between developers more efficient

Note: This Question is unanswered, help us to find answer for this one

18. Where should you store connection string information?

Answer

Correct Answer: In configuration files

Note: This Question is unanswered, help us to find answer for this one

19. How can you recieve form data without a model binder in a controller action? Note: The differences are IFormResult/IActionResult and Forms/Form

Answer

Correct Answer: Public IActionResult ReceivedDataByRequest() { string theName = Request.Form[

Note: This Question is unanswered, help us to find answer for this one

20. Which choice creates an 8-tuple containing prime numbers that are less than 20?

Answer

Correct Answer: Var primes = Tuple.Create(2, 3, 5, 7, 11, 13, 17, 19);

Note: This Question is unanswered, help us to find answer for this one

21. You want to add responsibilities to object dynamically. Which design pattern best fit this objective?

Answer

Correct Answer: Decorator

Note: This Question is unanswered, help us to find answer for this one

22. What is a thread?

Answer

Correct Answer: A single operation that does not return a value and that usually executes asynchronously

Note: This Question is unanswered, help us to find answer for this one

23. Which statement describes a Dispose method?

Answer

Correct Answer: It belongs to the IDisposable interface and is used to free resources, such as network connection and files.

Note: This Question is unanswered, help us to find answer for this one

24. Why would you use ahead-of-time (AOT) compilation?

Answer

Correct Answer: You can deliver a faster startup time, especially in big applications where much code executes on startup.

Note: This Question is unanswered, help us to find answer for this one

25. _ pattern works as a bridge between two incompatible interfaces? // wording in question is maybe changed?

Answer

Correct Answer: Adapter

Note: This Question is unanswered, help us to find answer for this one

26. What is CIL?

Answer

Correct Answer: Formerly known as MSIL, CIL is a programming language that NET developers use. It represents the lowest possible level for a language that humans can still read.

Note: This Question is unanswered, help us to find answer for this one

27. What is the purpose of CLR?

Answer

Correct Answer: CLR performs various operations such as memory management, security checks, assembly loading, and thread management. It also provides a secure execution environment for applications.

Note: This Question is unanswered, help us to find answer for this one

28. Which is NOT true about a constant variable?

Answer

Correct Answer: At runtime, its value is evaluated.

Note: This Question is unanswered, help us to find answer for this one

29. Which of the following selects an anonymous type?

Answer

Correct Answer: Select new { a.Country, a.Region }

Note: This Question is unanswered, help us to find answer for this one

30. What is a namespace?

Answer

Correct Answer: A group of classes, structures, interfaces, enumerations, and delegates—organized in a logical hierarchy by function that enable you to access the core functionality you need in your applications

Note: This Question is unanswered, help us to find answer for this one

31. What is the dependency inversion principle?

Answer

Correct Answer: Entities must depend on abstractions, not on concrete implementations.

Note: This Question is unanswered, help us to find answer for this one

32. You want to create a class of which only a single instance can exist. Which design pattern best fits this objective?

Answer

Correct Answer: Singleton

Note: This Question is unanswered, help us to find answer for this one

33. You must connect an app to an online identity provider using OAuth. For authentication, the app uses WebAuthenticationBroker object. You need to make sure the app registers with the provider. Which action do you take?

Answer

Correct Answer: Invoke the AuthenticateAsync method and construct an HTTPS request URI.

Note: This Question is unanswered, help us to find answer for this one

34. What do code contracts do?

Answer

Correct Answer: Code contracts provide a way to specify preconditions, postconditions, and object invariants in your code.

Note: This Question is unanswered, help us to find answer for this one

35. Why would Pre-JIT be used by the .NET Framework?

Answer

Correct Answer: To compile complete source code into native code in a single compilation cycle during deployment of the application

Note: This Question is unanswered, help us to find answer for this one

36. You want to encapsulate a command request as an object. Which design pattern best fits this objective?

Answer

Correct Answer: Command

Note: This Question is unanswered, help us to find answer for this one

37. You want to separate object construction from its representation. Which design pattern best fits this objective?

Answer

Correct Answer: Builder

Note: This Question is unanswered, help us to find answer for this one

38. When break is used inside two nested for loops, does control come out of the inner for loop or the outer for loop?

Answer

Correct Answer: It breaks from only the inner loop.

Note: This Question is unanswered, help us to find answer for this one

39. What is the difference between System.String and string?

Answer

Correct Answer: There is none—string is an alias for System. String.

Note: This Question is unanswered, help us to find answer for this one

40. Which is NOT true about a read-only variable?

Answer

Correct Answer: It can be initialized at declaration only.

Note: This Question is unanswered, help us to find answer for this one

41. Which is NOT true about lambda statements?

Answer

Correct Answer: A statement lambda cannot return a value.

Note: This Question is unanswered, help us to find answer for this one

42. What does CAS stand for and what does it do?

Answer

Correct Answer: CAS stands for Code Access Security and it enables users to restrict, on a very granular level, what managed code can do according to a level of trust.

Note: This Question is unanswered, help us to find answer for this one

43. What is an interface in .NET?

Answer

Correct Answer: An interface declares a contract or behavior that implementing classes require. It may declare only properties, methods, and events with no access modifiers. All the declared members must be implemented.

Note: This Question is unanswered, help us to find answer for this one

44. What is the namespace for caching information in .NET?

Answer

Correct Answer: System.Runtime.Caching;

Note: This Question is unanswered, help us to find answer for this one

45. What is an abstract class in .NET?

Answer

Correct Answer: An abstract class provides a partial implementation for functionality and some abstract or virtual members that must be implemented by the inheriting entities. It can declare fields too.

Note: This Question is unanswered, help us to find answer for this one

46. Assuming y is a value type, which is an example of boxing?

Answer

Correct Answer: Object thisObject = y;

Note: This Question is unanswered, help us to find answer for this one

47. What is the Common Type System (CTS)?

Answer

Correct Answer: The component of CLI in which .NET Framework provides support for several languages since it contains a type system that is common with all the languages

Note: This Question is unanswered, help us to find answer for this one

48. What is the difference between a SDK (software development kit) and runtime in .NET Core?

Answer

Correct Answer: The runtime is the virtual machine that hosts and runs the application and abstracts all the interaction with the operating system; the SDK usually includes documentation and other help files.

Note: This Question is unanswered, help us to find answer for this one

49. When should a developer use the .NET Standard class library project type?

Answer

Correct Answer: When you want to increase the number of apps that are compatible with your library, and decrease the .NET API surface area your library can access

Note: This Question is unanswered, help us to find answer for this one

50. What is the single responsibility principle?

Answer

Correct Answer: A class should have only a single responsibility - that is, only changes to one part of the software's specification should be able to affect the specification of the class.

Note: This Question is unanswered, help us to find answer for this one

51. Which is a set of features that extends the query capabilities of the .NET language syntax by adding sets of new standard query operators that allow data manipulation, regardless of the data source?

Answer

Correct Answer: LINQ

Note: This Question is unanswered, help us to find answer for this one

52. What is a delegate?

Answer

Correct Answer: A delegate in .NET is similar to a function pointer in C or C++. Using a delegate allows the programmer to encapsulate a reference to a method inside a delegate object.

Note: This Question is unanswered, help us to find answer for this one

53. What happens when you concatenate two strings?

Answer

Correct Answer: A third string object is created containing the concatenated strings.

Note: This Question is unanswered, help us to find answer for this one

54. What makes a strong-named assembly?

Answer

Correct Answer: A signed assembly

Note: This Question is unanswered, help us to find answer for this one

55. Which code do you use if you want to trigger a garbage collection in .NET?

Answer

Correct Answer: System.GC.Collect();

Note: This Question is unanswered, help us to find answer for this one

56. When you define an abstract method, how do you use it in a derived class?

Answer

Correct Answer: In your derived class, override the method.

Note: This Question is unanswered, help us to find answer for this one

57. What is CoreCLR?

Answer

Correct Answer: CoreCLR is the .NET execution engine in .NET Core that performs functions like garbage collection and compilation to machine code.

Note: This Question is unanswered, help us to find answer for this one

58. When would you use asynchronous actions?

Answer

Correct Answer: To avoid blocking the request thread while waits for an I/O operation

Note: This Question is unanswered, help us to find answer for this one

59. What is Kestrel?

Answer

Correct Answer: A cross-platform web server ASP.NET Core that is included by default in ASP.NET Core project templates**

Note: This Question is unanswered, help us to find answer for this one

60. Which group contains all official types of JIT compilations?

Answer

Correct Answer: Pre-JIT, Econo-JIT, Normal-JIT

Note: This Question is unanswered, help us to find answer for this one

61. What is the difference between a stack and queue?

Answer

Correct Answer: Stacks process value types by a top-down hierarchy - last in, first-out (LIFO). Queues follow this principle and insert items from the lower end while deleting ones from the top - first in, first-out (FIFO)

Note: This Question is unanswered, help us to find answer for this one