wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Final Exam

Total questions: 21

Worksheet time: 40mins

Name
Class
Date
1.

It helps you to repeatedly execute a block of code. The keywords with this statement are: do, for, foreach, and while.

a)

Jump

b)

Selection

c)

Fixed

d)

Iteration

2.

What does a variable of type int hold?

a)

Value of a decimal

b)

An integer reference

c)

Value of an integer

d)

A pointer to an integer

3.

A keyword used when you want to access members of a class. You do not have to create an object

a)

Static Keyword

b)

Void Keyword

c)

Virtual Keyword

d)

Datatype

4.

Write a program in C# that will draw a square depending on the length entered by the user and if length is equal to 0, the system will end.

(See image beside for your reference)

4 lines
5.

A keyword that tells the compiler that there may be methods in the derived classes that will override the method in the main class.

a)

Static Keyword

b)

Void Keyword

c)

Virtual Keyword

d)

Datatype

6.

What C# keyword allows a method to accept a variable number of method parameters?

a)

var

b)

params

c)

par

d)

varpar

7.

ToString() method is a special method that returns a string that represents the current class.

a)

TRUE

b)

FALSE

8.

A standardized (ECMA) language for creating .NET applications, services, and libraries, with a syntax similar to Java and C++.

a)

C#

b)

Javascript

c)

Python

d)

PHP

9.

It is a user-defined structure that contains variables and methods.

a)

String

b)

Interface

c)

Array

d)

Class

10.

It is a user-defined data structure that contains values of the same data type, such as marks as marks of students.

a)

String

b)

Delegate

c)

Array

d)

Class

11.

It is used to end the current iteration of the loop and transfer the program control returns back to the beginning of the loop.

a)

Break

b)

Continue

c)

Goto

d)

Return

12.

Write a program in C# that will accept 4 numbers randomly in an array and sort them in ascending order.

(See picture beside for reference)

4 lines
13.

In C#, there are six types of literals. Which among them are not type of literals?

a)

Boolean

b)

Integer

c)

Data Type

d)

Null

e)

Declaration

14.

It is used in the selection and loop constructs

a)

Break

b)

Continue

c)

Goto

d)

Return

15.

Inheritance permits parent class to dynamically take behaviour of descendent class

a)

TRUE

b)

FALSE

16.

What is a correct syntax to output "Hello World" in C#?

a)

cout<<"Hello World";

b)

System.out.println("Hello World");

c)

Console.Writeline("Hello World");

d)

print("Hello World");

17.

To declare an array in C#, define the variable type with:

a)

[]

b)

<>

c)

{}

d)

()

18.

How do you insert COMMENTS in C# code?

a)

//This is a comment

b)

/*This is a comment

c)

#This is a comment

d)

\This is a comment\

19.

Which data type is used to create a variable that should store text?

a)

char()

b)

str()

c)

var()

d)

int()

20.

Which operator can be used to compare two values?

a)

=

b)

<>

c)

==

d)

><

21.

The nested for loop consists of multiple for statements.

a)

TRUE

b)

FALSE