wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C# and .NET Fundamentals Assessment

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What is the default value of an int in C#?

a)

null

b)

1

c)

-1

d)

0

2.

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

a)

bool

b)

float

c)

string

d)

int

3.

What keyword is used to create a loop that executes at least once?

a)

repeat

b)

do

c)

for

d)

while

4.

What is the purpose of the 'break' statement in a loop?

a)

To exit a loop prematurely.

b)

To continue the loop indefinitely.

c)

To skip the current iteration of the loop.

d)

To pause the loop temporarily.

5.

Which of the following is NOT a control structure in C#?

a)

if statement

b)

for loop

c)

while loop

d)

variable

6.

What is encapsulation in Object-Oriented Programming?

a)

Encapsulation is the process of creating multiple instances of a class.

b)

Encapsulation is the method of exposing all data members of a class to the outside world.

c)

Encapsulation is the bundling of data and methods that operate on that data, restricting direct access to some of the object's components.

d)

Encapsulation refers to the inheritance of properties from a parent class.

7.

Which keyword is used to inherit a class in C#?

a)

inherits

b)

subclass

c)

extends

d)

implements

8.

What is the main purpose of the .NET Framework?

a)

The main purpose of the .NET Framework is to provide a platform for building and running applications on Windows.

b)

To create mobile applications exclusively.

c)

To serve as a database management system.

d)

To provide a platform for building web applications only.

9.

What does CLR stand for in the context of .NET?

a)

Common Language Registry

b)

Common Language Runtime

c)

Common Language Resource

d)

Common Logic Runtime

10.

Which of the following is a valid way to declare a string in C#?

a)

string myString = 'Hello, World!';

b)

string myString = "Hello, World!";

c)

string myString = Hello, World!;

d)

string myString = "Hello, World!";

11.

What is the primary function of ASP.NET?

a)

To build dynamic web applications and services.

b)

To design mobile applications.

c)

To create static HTML pages.

d)

To manage database transactions.

12.

Which method is called when an ASP.NET page is loaded?

a)

Page_Load

b)

Page_Unload

c)

Page_Render

d)

Page_Init

13.

What is the difference between a class and an interface in C#?

a)

A class can contain implementation and state, while an interface only defines a contract without implementation.

b)

An interface can contain fields, while a class cannot.

c)

A class cannot have methods, while an interface can.

d)

A class is abstract, while an interface is concrete.

14.

What is the purpose of the 'using' statement in C#?

a)

To manage resource cleanup for IDisposable objects automatically.

b)

To define a variable scope for a block of code.

c)

To create a new thread for parallel execution.

d)

To handle exceptions in a try-catch block.

15.

What is the role of the Global.asax file in an ASP.NET application?

a)

The Global.asax file handles user authentication.

b)

The Global.asax file manages application-level events and settings in an ASP.NET application.

c)

The Global.asax file is used for database connections.

d)

The Global.asax file stores user session data.