0% found this document useful (0 votes)
55 views3 pages

C#Part2 MCQ Retest

The document contains a 20 question multiple choice test on C# programming concepts. The questions cover topics like namespaces, exceptions, inheritance, properties, delegates, collections, streams, and more. The goal of the test is to assess understanding of important C# programming fundamentals with a time limit of 30 minutes.

Uploaded by

ManuPc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views3 pages

C#Part2 MCQ Retest

The document contains a 20 question multiple choice test on C# programming concepts. The questions cover topics like namespaces, exceptions, inheritance, properties, delegates, collections, streams, and more. The goal of the test is to assess understanding of important C# programming fundamentals with a time limit of 30 minutes.

Uploaded by

ManuPc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

C# Part 2 – Module Test

Marks: 20
Duration: 30mins

1) What is the namespace to add Dictionary<TKey, TValue>?


a. System
b. System.Dictionary
c. System.Collections
d. System.Collections.Generic

2) Which is the correct statement?


a. List<string> listStr=new List<string>();
listStr=”Admin”;
b. List<string> listStr=new List<string>();
listStr.Add=”Admin”;
c. List<string> listStr=new List<string>();
listStr.Add(”Admin”);
d. List<string> listStr=new List<string>();
List.Add(”Admin”);

3) Which is correct statement about Exception Handling?


a. Exception occurs during loading a program
b. Exception occurs at runtime
c. Exception occurs during Just-In-Time Compilation
d. Exception occurs during compile time

4) Which is correct statement when exception not thrown?


a. try->catch->finally
b. try->finally
c. try->catch
d. try->catch->throw->finally

5) Structure can be inherited?


a. True
b. False

6) How to create read-only property in c#?


a. Using Get accessor only
b. Using Set accessor only
c. Using both Get and Set accessor
d. You can’t create read-only property in c#

7) Which is true about try-catch?


a. If there is an Exception in try control goes to catch block
b. can have statements between try and catch blocks
c. In multiple catch blocks , Exception should be called in first catch block
d. All Exceptions in the try will be handled by appropriate catch blocks

8) Which keyword used to declare indexer?


a. base
b. this
c. super
d. indexer
9) Which access specifier used to declare property?
a. public
b. private
c. protected
d. protected internal

10) Find the output


class program
{
public static void Main(string[] args)
{
try {
throw new NullReferenceException("Null Exception");
Console.WriteLine("Null Error");
}
catch (ArgumentNullException e)
{ Console.WriteLine("Argument Null Exception"); }
}
}

a. Null Error
b. ArgumentNullException
c. Compile Time Error
d. Runtime Error

11) Which namespace is used to implement stream classes?


a. System.InputOutput;
b. System.IO;
c. System.In;
d. System.Input.Stream;

12) Which statement is not true about the delegate?


a. delegates are of reference type
b. delegates are object oriented
c. delegates are not type safe.
d. delegates are used to reference methods have same signature.

13) Which .NET collection class that allows an element to be accessed using a
unique key?
a. HashTable
b. ArrayList
c. Stack
d. Queue

14) Which FileMode is used to create a new file with the condition that the file with
same name must not exist?
a. FileMode.Create
b. FileMode.OpenOrCreate
c. FileMode.CreateNew
d. FileMode.Truncate
15) How to iterate HashTable object and print Key and Value.
a. KeyValuePair
b. DictionaryEntry
c. Dictionary
d. Object

16) Which among the following is not an interface declared in System.Collection


namespace?
a. IDictionayComparer
b. IEnumerable
c. IComparer
d. IEnumerator

17) Which is correct statement about delegate declaration?


a. Delegate can be declared only in class
b. Delegate can be declared only in Namespace
c. Delegate can be declared both in class and methods
d. Delegate can be declared both in class and namespace

18) Which among the given classes represents System.Collections.Generic


namespace?
a. SortedDictionay
b. SortedArray
c. HashTable
d. All the above

19) Which is the correct way to declare object to Struct named “Struct1”?
a. Struct1 s=new Struct;
b. Struct1 s=new Struct();
c. Struct1 s;
s=new Struct1;
d. Struct();

20) Which statement is correct about ArrayList.Capacity method?


a. Capacity is the number of elements that are actually exists in arraylist
b. Capacity is the number of elements that the arraylist can store
c. Capacity is explicitly increased.
d. All the above.

You might also like