MCQ

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

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. The metadata of the .Net assembly is stored in which file?

A .dll

B .exe

C manifest

D core

C
The manifest contains this assembly metadata. A manifest contains all the metadata necessary to specify the assembly requirements and security identity, as well as all the metadata necessary to define the scope of the assembly and resolve references to resources and classes. The manifest can be stored in a PE file (an .exe or .dll file) with MSIL (Microsoft Intermediate Language) code or in a standalone PE file containing only the manifest information.

 

 

2. CTS (Common Type System) manages _________?

A Communication between different languages

B Types of values

C Types of reference

D All data types in .net

A
In .NET, Common Type System (CTS) is a standard that specifies how specific definitions and values of a type are represented in the computer memory. It is intended to allow programs written in different programming languages to easily share information.

 

 

3. Which of the following types can hold a value of any size?

A Int32

B Double

C Long

D BigInteger

D
There is no theoretical limit. The BigInteger class allocates as much memory as necessary for all the data bits it is asked to keep.

 

 

4. What is Code Access Security (CAS)?

A It avoids unauthorized access to the source code.

B Avoids unauthorized access to resources and operations and restricts code to perform specific tasks.

C It prevents unauthorized access to dll and exe.

D None of the above
 

 
B
CAS is the solution to block unapproved code from performing privileged actions. When the CLR loads an assembly, it gets proof of the assembly and uses it to identify the code group to which the assembly belongs. A code group contains a set of permissions (one or more permissions).

 

 

5. Which of the following methods tells the garbage-collector not to call finalize?

A GC.Collect(int)

B GC.Dispose()

C GC.Cancel()

D GC.SuppressFinalize()

D
“SuppressFinalize” should only be called by a class that has a “finalizer”. It tells the Garbage Collector (GC) that this object has been completely cleaned up.

 

 

6. What is the namespace which is the parent for all types in the .Net framework?

A System.Object

B System.Web

C System.IO

D System.File

A
C# has a unified type system, which means that all types inherit, directly or indirectly, from Object (System.Object). This includes reference and value types. It also includes all primitive types, such as int and bool, as well as all types provided in the .NET Framework and any custom types you define.

 

 

7. What are the following features introduced in .Net 3.5?

A WCF

B WWF

C WPF

D All the answers are true

A
The .Net 3.5 version includes the following main components:

  • Microsoft Windows Communication Foundation(WCF)
  • Microsoft Windows Presentation Foundation(WPF)
  • Microsoft Windows Workflow Foundation(WWF)

Windows Communication Foundation (WCF) is an infrastructure for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another.

Microsoft Windows Workflow Foundation (WWF) provides a platform based on the .Net Framework for creating workflows.

Windows Presentation Foundation (WPF) in Visual Studio provides developers with a unified programming model for building business applications on Windows.

 

 

8. What are the features of .Net 4.5?

A Portable class library

B Parallel processing

C .Net for Windows Store apps

D All the answers are true
 

 
D
.Net Framework 4.5 Features

  • .NET Applications for Windows Store
  • Portable class libraries
  • Key features and improvements
  • Parallel processing
  • Web
  • Tools
  • Windows Presentation Foundation (WPF)
  • Windows Communication Foundation (WCF)
  • Windows Workflow Foundation (WF)

 

 

9. The code that runs under CLR is called _______?

A Managed code

B Unmanaged code

C COM Code

D PIN code

A
The Common Language Runtime (CLR) is an environment that manages code execution and provides application development services. Compilers such as VB.NET expose CLR features to allow developers to create applications. Code created in this environment is called managed code. Note that COM components are not managed code, although they (and other unmanaged code) can be used in applications built under the CLR.

 

 

10. Which of the following is not a valid data type in .Net?

A Double

B Int32

C Int16

D MIME
 

 
D
The types that are available in the .Net framework are:

  • Signed integer: sbyte, short, int, long.
  • Unsigned integer: byte, ushort, uint, ulong.
  • Unicode characters: char.
  • IEEE floating point: float, double.
  • High precision decimal: decimal.
  • Boolean: bool.

 

 
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 *