wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Unity C# Basics, Variables and Operators

Total questions: 18

Worksheet time: 10mins

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.

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

3.

What does <= mean?

a)

less than

b)

greater than

c)

less than or equal to

d)

greater than or equal to

4.

What punctuation is used to signal the beginning and end of code blocks?

a)

{ }

b)

-> and <-

c)

BEGIN and END

d)

( and )

5.

After running the following code, what will be the value of x?

int y = 3;

x = 5 * y;

a)
3
b)
5
c)
15
d)
0
e)

Compiler Error

6.

___ variables store whole numbers (-4, 3, 51, etc). 

a)

float

b)

logical

c)

char

d)

int

e)

double

7.

___ variables store decimal numbers (3.5, -5,123, 4.0, etc). 

a)

float

b)

int

c)

string

d)

character

e)

double

8.

Which of the following is NOT a logical operator in C# language?

a)

&

b)

&&

c)

||

d)

!

9.

Which of the following is NOT a comparison operator in C# language?

a)

>

b)

<=

c)

=

d)

==

10.

A Unity script is also a ___.

a)

Monobehavior Component

b)

Game Object

c)

Material

d)

Window in Workspace

e)

Function

11.

We use the ___ programming language in Unity.

a)

C++

b)

C#

c)

Java

d)

Objective C

e)

PHP

12.

Access modifier which will allow a property value to be edited via the inspector

a)

public

b)

private

c)

protected

d)

static

e)

const

13.

The information about an objects position, rotation and scale are stored in its (a)   component.

14.

In a Unity game, number values containing decimals are usually stored using a variable of type (a)   .

15.

The (a)   () function of a script will run before the first frame update.

16.

The (a)   () function of a script will run once for each frame of the game.

17.

Replace the (a)   with false.

What will be displayed?

18.

What should replace the blank to display the message when it should.

Use the variable x in your answer and remove any spaces.

(a)