MCQ

C# MCQ – Multiple Choice Questions and Answers – Part 4

Multiple choice questions and answers (MCQs) on C# to prepare for exams, tests, and certifications. These questions are taken from a real written exam and some parts are taken from an interview. So you will find questions on basic techniques such as Variables, Operators, Conditional Statement, Functions, and more. This quiz will easily prepare anyone to pass their online test.
 

 

1. Which of the following is the root of the hierarchy of all .NET types?

A System.Object

B System.Type

C System.Base

D System.Parent

E System.Root

A
System.Object is the root of the hierarchy of all types.

 

 

2. Which of the following statements is correct about the .NET Framework?

A .NET Framework uses DCOM to ensure language interoperability.

B NET Framework is based on DCOM technology.

C NET Framework uses DCOM to make the transition between managed and unmanaged code.

D NET Framework uses DCOM to create unmanaged applications.

E .NET Framework uses COM+ services when creating distributed applications.

C
During transitions between managed and unmanaged code, the COM infrastructure (in particular DCOM) is used for remote communication. In intermediate versions of the CLR, this also applies to the served components (components that use COM+ services).

 

 

3. Which of the following are advantages of managed code under CLR?

A The security type of the code executed under CLR is assured.

B It is guaranteed that an application will not access memory that it is not authorized to access.

C It starts a separate process for each application running under it.

D Resources are recovered.

E All the answers are true

E

 

 

4. Which of the following security features can be used by .NET applications?

A PIN Security

B Code access security

C Role-based security

D Authentication security

E Biorhythm Safety
 

 
B, C
To ensure usability and consistency of code access security, the .NET Framework’s role-based security provides System.Security.Permissions.PrincipalPermission objects that allow the Common Language Runtime(CLR) to perform authorization in a manner similar to code access security controls.

 

 

5. Which of the following jobs are performed by Common Language Runtime?

A It provides basic services such as memory management, thread management and remote communication.

B It uses a strict security type.

C It provides security access to the code.

D It provides Garbage Collection services.

E All the answers are true

E

 

 

6. Which of the following statements is correct about .NET assembly?

A It is the smallest deployable unit.

B Each assembly has only one entry point – Main(), WinMain() or DLLMain().

C An assembly can be a shared assembly or a private assembly.

D An assembly can only contain code and data.

E An assembly is always presented as an EXE file.

A, B, C

 

 

7. What are the types of JIT?

A Pre-JIT

B Econo-JT

C Normal-JIT

D All the answers are true

D
Just-in-time (JIT) is a term used to describe an action such as compiling or activating an object only when it becomes necessary. This term is mainly associated with software compilation. JIT compilation is primarily designed for high-speed code execution and cross-platform support.

JIT compilation was born out of the need for a compiler to take on responsibilities in addition to converting to object code (machine instructions) from a high-level language. JIT compilers facilitate portability to multiple operating systems and hardware platforms. Languages such as Java and C# support JIT compilation.

There are three types of JIT compilers:

  • Pre-JIT: Compiles the entire source code at compile time and is used at deployment time.
  • Econo-JIT: Compiles the methods called at runtime.
  • Normal-JIT: Compiles only the methods called at runtime (at the time of their first call) and stores the compiled code in the cache for use in subsequent calls.

 

 

8. Garbage collector (GC) includes _______ generations.

A One

B Two

C Three

D Five
 

 
C
There are three generations:

  • The 0 generation identifies a newly created object that has never been marked for collection.
  • The 1st generation identifies an object that survived a GC (marked for collection but not deleted because there was enough heap space)
  • The 2nd generation identifies an object that has survived more than one GC scan.

 

 

9. Which of the following statements are correct about JIT?

A The JIT compiler compiles the instructions into machine code at runtime.

B The code compiled by the JIT compiler runs under CLR.

C Instructions compiled by JIT compilers are written in native code.

D Instructions compiled by JIT compilers are written in IL (Intermediate Language) code.

A, B, C

 

 

10. Which of the following belong to the .NET framework ?

A Common Language Runtime (CLR)

B Framework Class Libraries (FCL)

C Microsoft Published Web Services

D Applications deployed on IIS

E Mobile applications

A, B

 

 
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *