wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C#

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

To inherit a class, the _______ notation is used in C#

a)

:

b)

;

c)

=>

d)

As

2.

In a class the virtual function ____________

a)

Can have a default implementation in the class

b)

Must only be declared but not implemented

c)

Cannot exist

3.

An abstract class must have __________

a)

Atleast one abstract method

b)

Only virtual methods

c)

Only static methods

4.

_________ is an access modifier

a)

Private

b)

Params

c)

Override

d)

Out

5.

An ____________ is an object that encapsulates information about an unusual program occurrence

a)

Exception

b)

try

c)

catch

d)

finally

6.

Objects cannot be created for _________ class.

a)

normal

b)

student

c)

abstract

d)

struct

7.

Static class can have _________ members.

a)

static

b)

abstract

c)

static and non static

d)

Void

8.

What is lamda expression? (Any 2)

a)

Anonymous function

b)

Can be used to create delegates

c)

Named function

d)

None

9.

Which of the following will be the correct output for the C#.NET code snippet given below?


String s1 = "Nagpur";

String s2;

s2 = s1.Insert(6, "Mumbai");

Console.WriteLine(s2);

a)

NagpuMumbair

b)

Nagpur Mumbai

c)

Mumbai

d)

NagpurMumbai

10.

Usecase: A system needs to be implemented to create a mobile shop, consisting of Apple IPhone, OnePlus, Google Nexus. At run time, the end-user will provide the phone required and the system should be able to create an instance of the correct mobile phone object from his existing factory / godown / repository. Which design pattern fits this usecase?

a)

Singleton

b)

Abstract Factory

c)

Adaptor

d)

None