wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

2.2.1 (d) Variables

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

In C#, which data type stores whole numbers from -2,147,483,648 to 2,147,483,647?

a)

int

b)

long

c)

float

d)

double

2.

In C#, which data type stores whole numbers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807?

a)

int

b)

long

c)

float

d)

double

3.

In C#, which data type stores fractional numbers with 6 to 7 decimal digits?

a)

int

b)

long

c)

float

d)

double

4.

In C#, which data type stores fractional numbers with 15 decimal digits?

a)

int

b)

long

c)

float

d)

double

5.

Which data type stores true or false values?

a)

int

b)

long

c)

bool

d)

char

6.

Match the following C# Datatype Declarations

a)

int myNum

1.

5;

b)

double myDoubleNum

2.

5.99

c)

char myLetter

3.

'D'

d)

bool myBool

4.

true

e)

string myText

5.

"Hello"

7.

Organize these options into the right categories

Categorize the following

==

!=

<

<=

>

>=

+

-

/

*

MOD

DIV

^

AND

OR

NOT

Comparison operators
Arithmetic operators
Boolean Operators
8.

The ​ (a)   keyword is useful when you want a variable to always store the same value, so that others (or yourself) won't mess up your code. An example that is often referred to as a constant, is ​ (b)   (3.14159...).

Note: You cannot declare a ​ (c)   variable without assigning the value. If you do, an ​ (d)   will occur: A const field requires a ​ (e)   to be provided.​

Choose from the below words
const
error
value
PI
constant
9.

  • Names are case-sensitive ("myVar" and "myvar" are different variables).

a)

True

b)

False

10.

int x = 5, y = 6, z = 50;

Console.WriteLine(x + y + z);

This code snippet will output what integer value?

(a)