wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C# Skill Review

Total questions: 32

Worksheet time: 16mins

Name
Class
Date
1.

C# class can inherit multiple ________

a)

Interfaces

b)

Classes

c)

Abstract classes

d)

Static classes

2.

Which of the followings are value types in C#?

a)

Int32

b)

Double

c)

Decimal

d)

All of these options

3.

Which of the following is a reference type in C#?

a)

String

b)

Long

c)

Boolean

d)

None

4.

What is Nullable type?

a)

It allows assignment of null to reference type.

b)

It allows assignment of null to value type.

c)

It allows assignment of null to static class.

d)

None

5.

Struct is a _____.

a)

Reference type

b)

Class type

c)

Value type

d)

String type

6.

10 > 9 ? "10 is greater than 9” : "9 is greater than 10” is an example of _______

a)

Inverse operator

b)

Conditional operator

c)

Greater than operator

d)

Ternary operator

7.

Which of the following datatype can be used with enum?

a)

Int

b)

String

c)

Boolean

d)

All of these options

8.

What is indexer?

a)

It allows enumerator with class

b)

It creates index for instances of a class.

c)

It allows an instance of a class to be indexed like an array

d)

None

9.

String data type is ______.

a)

Mutable

b)

Immutable

c)

Static

d)

Value type

10.

An array in C# starts with _____ index.

a)

1

b)

0

c)

-1

d)

null

11.

How to declare an array in C# correctly?

a)

int[] intArray = new int[];

b)

int intArray[] = new int[5];

c)

int[] intArray = new int[5];

d)

int[5] intArray = new int[];

12.

Which of the following is true for ReadOnly variables?

a)

Value will be assigned at runtime.

b)

Value will be assigned at compile time.

c)

Value will be assigned when it accessed first time

d)

None

13.

Which of the following statement is false?

a)

try block must be followed by catch or finally block or both.

b)

finally block cannot include return statement.

c)

try block can include another try block.

d)

none of these options.

14.

Which of the following statement is true?

a)

A finally block may not execute every time

b)

A return or break statement cannot exit a finally block.

c)

A finally block can come before catch block.

d)

Multiple finally block is possible.

15.

Func and Action are the types of ______.

a)

Utility function

b)

Delegate

c)

Event

d)

Generic class

16.

Return type of Predicate <T>() is always a ______.

a)

Integer

b)

String

c)

Void

d)

Boolean

17.

A partial class allows ________

a)

Implementation of single class in multiple .cs files.

b)

Declaration of multiple classes in a single .cs file.

c)

Implementation of multiple interfaces to single class.

d)

Multiple class inheritance.

18.

LINQ stands for ________.

a)

Local Integration Query

b)

Language Integrated Query

c)

Language Included Query

d)

Lazy Integrated Query

19.

Data type of a variable declared using var will be assigned at _______.

a)

Compile time

b)

Runtime

c)

CLR time

d)

Application Initialization time.

20.

Which of the following is true for dynamic type in C#?

a)

It allows multiple time declaration of a variable.

b)

It allows compile time type checking

c)

It escapes compile time type checking

d)

None

21.

The keyword to provides a non-blocking way to start a task, then continue execution when that task completes is

a)

await

b)

sleep

c)

async

d)

volatile

e)

run

22.

Class which represents a single operation that does not return a value and that usually executes asynchronously is____

a)

Async

b)

Thread

c)

Task

d)

Mutex

e)

Job

23.

If you want to wait all certain tasks to be done, before proceeding, you use await keyword combined with _____ function.

a)

Task.WhenAny(...);

b)

Task.WhenAll(...);

c)

Task.WhenAwaitAll(...);

d)

Task.FinishedAll(...);

e)

Task.AllDone(...);

24.

Task.WhenAny() will return ___

a)

The longest task to be completed

b)

Random task

c)

All of the completed tasks given

d)

The completed task in a task list/array

25.

An asynchronous method to force the method to complete asynchronously.

a)

Run()

b)

Yield()

c)

WhenAll()

d)

RunSynchronously()

26.

The class that sends (or raises) the event is called ___

a)

publisher

b)

receiver

c)

sender

d)

transmitter

e)

broadcaster

27.

To attach an event handler to the event we could use ____

a)

+=

b)

-=

c)

.addEvent();

d)

delegate()

28.

A type which represents references to methods with a particular parameter list and return type.

a)

event

b)

lambda expression

c)

delegate

d)

function

29.

to read a text file to string you could use ___

a)

StreamReader

b)

FileStream

c)

FileMode

d)

BufferedStream

30.

The default LogLevel in Logging functionality is

a)

Critical

b)

Error

c)

Information

d)

Debug

31.

Below are the LogLevel, except _____

a)

Information

b)

Trace

c)

None

d)

Critical

e)

Crashing

32.

To store items as key and value pairs we could use _____ collection.

a)

Stack

b)

Queue

c)

List

d)

Dictionary