wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C# Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the output of this code?

int x = 8;

// x = 3;

Console.WriteLine(x);

a)

3

b)

8

c)

error

d)

24

2.

Fill the gaps.

___Declaring an integer

and printing it___

int x = 42;

Console.WriteLine(x);

a)

//.........//

b)

/*............*/

c)

<----...................----->

d)

?-------------?

3.

What is the type of the temp variable?

var temp = 14.55;

a)

Double

b)

Boolean

c)

Integer

d)

String

4.

What is the output of this code?

var n1;

n1 = true;

Console.WriteLine(n1);

a)

1

b)

true

c)

error

d)

0

5.

Fill in the blank to make the variable num a constant.


_______int num=2;

a)

con

b)

constant

c)

const

d)

constans

6.

Fill in the blanks to display the result of the multiplication of x and y.

int x = 42;

int y = 7;

int z = x __ y;

Console.WriteLine( __ );

a)

*.....z

b)

mul........z

c)

*......y

d)

-.......x

7.

What is the output of this code?

int x = 16;

int y = 5;

Console.WriteLine(x/y);

a)

3.2

b)

3

c)

error

d)

4

8.

Which operator is used to determine the remainder?

a)

*

b)

%

c)

+

d)

-

9.

Fill in the missing parentheses to have x equal 15.

int x =__2 + 3__* 3;

Console.WriteLine(x);

a)

(....)

b)

{.....}

c)

<....>

d)

|.....|

10.

What is the alternative for x = x + 5?

a)

x += 5;

b)

x -= 4;

c)

x = y + 5;

d)

x=+5