C Sample Test,Sample questions

Question:
  Which of the following statements is correct?

1.There is one garbage collector per program running in memory.

2.There is one common garbage collector for all programs.

3.. An object is destroyed by the garbage collector when only one reference refers to it.

4.We have to specifically run the garbage collector after executing Visual Studio.NET.


Question:
 A structure in C# provides a unique way of packing together data of ______ types.

1.Different

2.Same

3.Invoking

4.Calling


Question:
 A _____ is any valid C# variable ending with a colon.

1.goto

2.Label

3.Logical

4.Bitwise


Question:
 All C# applications begin execution by calling the _____ method.

1.Class()

2.Main()

3.Submain()

4.Namespace


Question:
 An _______ is a symbol that tells the computer to perform certain mathematical orlogical manipulations.

1.Operator

2.Expression

3.Condition

4.Logic


Question:
 Arrays in C# are ______ objects

1.Reference

2.Logical

3.Value

4.Arithmetic


Question:
 How many types of compilers availbale under CLR?

1.4

2.2

3.1

4.3


Question:
 In C#, a subroutine is called a ________.

1. Function

2.Metadata

3.Method

4.Managed code


Question:
 Multidimensional arrays are sometimes called _______ Arrays.

1.Square

2.Triangular

3.Rectangular

4.Cube


Question:
 The formal-parameter-list is always enclosed in _______.

1.Square

2.Semicolon

3.Parenthesis

4.Colon


Question:
 What will be the output of the following code snippet when it is executed? int x = 1; float y = 1.1f; short z = 1; Console.Write.Line((float) x + y * z - (x += (short) y));

1. 0.1

2.1.0

3.1.1

4.11


Question:
 Which of the following are NOT true about .NET Framework? 1. It provides a consistent object-oriented programming environment whether object code is stored and executed locally, executed locally but Internet-distributed, or executed remotely. 2. It provides a code-execution environment that minimizes software deployment and versioning conflicts. 3. It provides a code-execution environment that promotes safe execution of code, including code created by an unknown or semi-trusted third party. 4. It provides different programming models for Windows-based applications and Web-based applications. 5. It provides an event driven programming model for building Windows Device Drivers.

1.1,2

2. 2,4

3. 4,5

4.1,2,4


Question:
 Which of the following are parts of the .NET Framework? 1. The Common Language Runtime (CLR) 2. The Framework Class Libraries (FCL) 3. Microsoft Published Web Services 4. Applications deployed on IIS 5. Mobile Applications

1.Only 1, 2, 3

2.Only 1, 2

3.Only 1, 2, 4

4.Only 4,5


Question:
 Which of the following are valid .NET CLR JIT performance counters? 1. Total memory used for JIT compilation 2. Average memory used for JIT compilation 3. Number of methods that failed to compile with the standard JIT 4. Percentage of processor time spent performing JIT compilation 5. Percentage of memory currently dedicated for JIT compilation

1.1,5

2. 3,4

3.1,2

4.4,5


Question:
 Which of the following can be used to terminate a while loop and transfer control outside the loop? 1. exit while 2. continue 3. exit statement 4. break 5. goto

1. 1,3

2.2,4

3. 3,5

4.4,5


Question:
 Which of the following constitutes the .NET Framework? 1. ASP.NET Applications 2. CLR 3. Framework Class Library 4. WinForm Applications 5. Windows Services

1.1,2

2.2,3

3.3,4

4.2,5


Question:
 Which of the following statements are correct about arrays used in C#.NET? 1. Arrays can be rectangular or jagged. 2. Rectangular arrays have similar rows stored in adjacent memory locations. 3. Jagged arrays do not have an access to the methods of System.Array Class. 4. Rectangular arrays do not have an access to the methods of System.Array Class. 5. Jagged arrays have dissimilar rows stored in non-adjacent memory locations.

1. 1,2

2. 1,3,5

3.3,4

4.1,2,5


Question:
 Which of the following statements are correct about exception handling in C#.NET? 1 If an exception occurs then the program terminates abruptly without getting any chance to recover from the exception. 2 No matter whether an exception occurs or not, the statements in the finally clause (if present) will get executed. 3 A program can contain multiple finally clauses. 4 A finally clause is written outside the try block. 5 Finally clause is used to perform cleanup operations like closing the network/database connections.

1.1 only

2.2 only

3.2 and 5 only

4.3 and 4 only


Question:
 Which of the following statements are correct? 1. A struct can contain properties. 2. A struct can contain constructors. 3. A struct can contain protected data members. 4. A struct cannot contain methods. 5. A struct cannot contain constants.

1. 1,2

2.3,4

3.1,2,4

4.3,5


Question:
 Which of the following utilities can be used to compile managed assemblies into processor-specific native code?

1.gacutil

2.ngen

3.sn

4.ildasm


Question:
 Which one of the following statements is correct?

1. Array elements can be of integer type only.

2. The rank of an Array is the total number of elements it can contain.

3. The length of an Array is the number of dimensions in the Array.

4.The default value of numeric array elements is zero.


Question:
A _______ creates an object by copying variables from another object.

1.Copy constructor

2.Default constructor

3.Invoking constructor

4.Calling constructor


Question:
A _______ is an identifier that denotes a storage location

1.Constant

2.Reference type

3.Variable

4.Object


Question:
An ____ is a group of contiguous or related data items that share a common name.

1.Operator

2.Integer

3.Exponential

4.Array


Question:
Boxing converts a value type on the stack to an ______ on the heap.

1.Bool type

2.Instance type

3.Class type

4.Object type


Question:
C# does not support _____ constructors.

1.parameterized

2.parameter-less

3.Class

4.Method


Question:
C# has _______ operator, useful for making two way decisions.

1.Looping

2.Functional

3.Exponential

4.Conditional


Question:
Code that targets the Common Language Runtime is known as

1.Unmanaged

2.Distributed

3.Managed Code

4.Native Code


Question:
Dot Net Framework consists of :

1.Common language runtime

2.Set of class libraries

3.Common language runtime and set of class libraries

4.None of the above


Question:
https://mcqmate.com/topic/956/c-programming/unit-1-set-1#:~:text=Code%20that%20targets%20the%20Common%20Language%20Runtime%20is%20known%20as

1. Unmanaged

2.Distributed

3.Legacy

4. Managed code


Question:
https://mcqmate.com/topic/956/c-programming/unit-2-set-1#:~:text=Which%20of%20the%20following%20is%20the%20correct%20output%20for%20the%20C%23.NET%20code%20snippet%20given%20below%3FConsole.WriteLine(13%20/%202%20%2B%20%22%20%22%20%2B%2013%20%25%202)%3B

1. 6.5 1

2.5 0

3.6 0

4.6 1


Question:
In C#, all binary operators are ______.

1.Center-associative

2.Right-associative

3.Left-associative

4.Top-associative


Question:
Storage location used by computer memory to store data for usage by an application is ?

1.Pointers

2.Constants

3.Variable

4.None of the mentioned


Question:
Struct’s data members are ____________ by default.

1.Protected

2.Public

3.Private

4.Default


Question:
The C# provides special methods known as _____ methods to provide access to data members.

1.Loop

2.Functions

3.Methods

4.Accessor


Question:
The character pair?: is an________________available in C#.

1.Unary operator

2.Ternary operator

3.Decision operator

4.Functional operator


Question:
The methods that have the same name, but different parameter lists and differentdefinitions is called______.

1.Method Overloading

2.Method Overriding

3.Method Overwriting

4.Method Overreading


Question:
Which of the following .NET components can be used to remove unused references from the managed heap?

1.Common Language Infrastructure

2.CLR

3.Garbage Collector

4.Class Loader


Question:
Which of the following assemblies can be stored in Global Assembly Cache?

1.Private Assemblies

2.Friend Assemblies

3.Shared Assemblies

4.Public Assemblies


Question:
Which of the following benefits do we get on running managed code under CLR? 1. Type safety of the code running under CLR is assured. 2. It is ensured that an application would not access the memory that it is not authorized to access. 3. It launches separate process for every application running under it. 4. The resources are Garbage collected.

1.Only 1 and 2

2.Only 2, 3 and 4

3.Only 1, 3 and 4

4.All of the above


Question:
Which of the following can be facilitated by the Inheritance mechanism? 1. Use the existing functionality of base class. 2. Overrride the existing functionality of base class. 3. Implement new functionality in the derived class. 4. Implement polymorphic behaviour. 5. Implement containership.

1.1,2,3

2.3,4

3.2,4,5

4. 3,5


Question:
Which of the following define the rules for .Net Languages?

1.GAC

2.CLS

3.CTS

4.CLR


Question:
Which of the following is the correct size of a Decimal datatype?

1.8 bytes

2.4 bytes

3.10 bytes

4.None of the above


Question:
Which of the following is the correct way to create an object of the class Sample? 1. Sample s = new Sample(); 2. Sample s; 3. Sample s; s = new Sample(); 4. s = new Sample();

1.1,3

2.2,4

3.1,2,3

4. 4,5


Question:
Which of the following jobs are done by Common Language Runtime? 1. It provides core services such as memory management, thread management, and remoting. 2. It enforces strict type safety. 3. It provides Code Access Security. 4. It provides Garbage Collection Services.

1.Only 1 and 2

2.Only 3 and 4

3.Only 1, 3 and 4

4.All of the above


Question:
Which of the following statements are correct about a .NET Assembly? 1. It is the smallest deployable unit. 2. Each assembly has only one entry point - Main(), WinMain() or DLLMain(). 3. An assembly can be a Shared assembly or a Private assembly. 4. An assembly can contain only code and data. 5. An assembly is always in the form of an EXE file.

1.1,2,3

2.2,4,5

3.1,3,5

4.1,2


Question:
Which of the following statements are correct about data types? 1. If the integer literal exceeds the range of byte, a compilation error will occur. 2. We cannot implicitly convert non-literal numeric types of larger storage size to byte. 3. Byte cannot be implicitly converted to float. 4. A char can be implicitly converted to only int data type. 5. We can cast the integral character codes.

1. 1,3,5

2.2,4

3.3,5

4.1,2,5


Question:
Which of the following statements are correct about JIT? 1. JIT compiler compiles instructions into machine code at run time. 2. The code compiler by the JIT compiler runs under CLR. 3. The instructions compiled by JIT compilers are written in native code. 4. The instructions compiled by JIT compilers are written in Intermediate Language (IL) code.

1.1,2,3

2.2,4

3.3,4

4.1,2


Question:
Which of the following statements are correct about JIT? 1. JIT compiler compiles instructions into machine code at run time. 2. The code compiler by the JIT compiler runs under CLR. 3. The instructions compiled by JIT compilers are written in native code. 4. The instructions compiled by JIT compilers are written in Intermediate Language (IL) code. 5. The method is JIT compiled even if it is not called

1.1, 2, 3

2.2,4

3.3,4,5

4.1,2


Question:
Which of the following statements are correct about the C#.NET code snippet givenbelow? if (age > 18 && no < 11) a = 25; 1. The condition no < 11 will be evaluated only if age > 18 evaluates to True. 2. The statement a = 25 will get executed if any one condition is True. 3. The condition no < 11 will be evaluated only if age > 18 evaluates to False. 4. The statement a = 25 will get executed if both the conditions are True. 5. && is known as a short circuiting logical operator.

1.1,3

2. 2,5

3. 1,4,5,

4.3,4,5


Question:
Which of the following statements are correct? 1. Instance members of a class can be accessed only through an object of that class. 2. A class can contain only instance data and instance member function. 3. All objects created from a class will occupy equal number of bytes in memory. 4. A class can contain Friend functions. 5. A class is a blueprint or a template according to which objects are created.

1.1,3,5

2.2,4

3. 3,5

4.2,4,5


Question:
Which of the following statements are correct? 1. We can assign values of any type to variables of type object. 2. When a variable of a value type is converted to object, it is said to be unboxed. 3. When a variable of type object is converted to a value type, it is said to be boxed. 4. Boolean variable cannot have a value of null. 5. When a value type is boxed, an entirely new object must be allocated and constructed.

1. 2,5

2.1,5

3.3,4

4.2,3


Question:
Which of the following statements are TRUE about the .NET CLR? 1. It provides a language-neutral development & execution environment. 2. It ensures that an application would not be able to access memory that it is not authorized to access. 3. It provides services to run "managed" applications. 4. The resources are garbage collected. 5. It provides services to run "unmanaged" applications.

1.Only 1 and 2

2.Only 1,2 and 4

3.1,2,3,4

4.Only 4 and 5


Question:
Which of the following statements is correct about Managed Code?

1.Managed code is the code that is compiled by the JIT compilers.

2.Managed code is the code where resources are Garbage Collected.

3.Managed code is the code that runs on top of Windows.

4.Managed code is the code that is written to target the services of the CLR.


Question:
Which of the following will be the correct output for the C#.NET code snippet givenbelow? String s1 = "ALL MEN ARE CREATED EQUAL"; String s2; s2 = s1.Substring(12, 3); Console.WriteLine(s2);

1.ARE

2.CRE

3.CR

4.REA


Question:
____ variables are visible only in the block they are declared.

1.System

2.Global

3.Local

4.Console


Question:
_____ namespace is not defined in the .NET class library.

1.System.CodeDom

2.System

3.System.IO

4.System.Text


Question:
_____ parameters are used to pass results back to the calling method.

1.Input

2.Reference

3.Value

4.Output


Question:
_______causes the loop to continue with the next iteration after skipping any statementsin between.

1.Loop

2.Exit

3.Break

4.Continue


Question:
________ are reserved, and cannot be used as identifiers.

1.Keywords

2.literal

3.variables

4.Identifiers


More MCQS

  1. C# MCQS -Programming (.NET Framework)
  2. C# MCQS -Programming(Control Instructions)
  3. C# MCQS - Functions and Subroutines(.NET Framework)
  4. C# Programming-Constructors
  5. C# Programming- Arrays
  6. C# Programming -Structures
  7. C# Programming-Properties
  8. C# Programming -Exception Handling
  9. C# Programming -Interfaces
  10. C# Programming -Delegates
  11. C# Programming -Generics
  12. C# Programming - Datatypes
  13. C# Programming- Operators
  14. C# Programming -Classes and Objects
  15. NET Programming mcqs
  16. Computer Science Engineering (CSE) .NET Programming
  17. C# Programming Mcq Set 1
  18. C# Programming Mcq Set 2
  19. C#.NET Programming Mcq
Learn ,Learn C Objetive choice questions and answers,C Multiple choice questions and answers,C objective, C questions , C answers,C MCQs questions and answer
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!