wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Primitive Types

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is the resulting value of x?


double x;

x = 2.3

a)

2

b)

2.3

c)

Error

2.

What is the resulting value of x?


int x;

x = 2.3;

a)

Error

b)

2

c)

2.3

3.

What is the resulting value of x?


double x;

x = 7;

a)

Error

b)

7

c)

7.0

4.

What is the resulting value of x?


int x;

x = 3/4;

a)

Error

b)

0

c)

0.75

d)

1

5.

What is the resulting value of x?


double x;

x = 3/4;

a)

Error

b)

0.0

c)

0.75

d)

1.0

6.

What is the resulting value of x?


double x;

x = 3.0 / 4;

a)

Error

b)

0.0

c)

0.75

d)

1.0

7.

What is the resulting value of x?


int x;

x = 3.0 / 4;

a)

Error

b)

0

c)

1

d)

0.75

8.

What is the resulting value of x?


double x;

x = (int) (2 + 3.3);

a)

Error

b)

5

c)

5.3

d)

5.0

9.

What is the resulting value of x?


int x;

x = (double)(2 + 3.3);

a)

Error

b)

5.0

c)

5.3

d)

5

10.

What is the resulting value of x?

double x;

x = (double) (10 / 4)

a)

Error

b)

2.5

c)

2

d)

2.0

11.

What is the resulting value of x?

double x;

x = (double) 10 / 4

a)

Error

b)

2.5

c)

2

d)

2.0

12.

What is the resulting value of x?

int x;

x = (double) (10 / 4)

a)

Error

b)

2.5

c)

2

d)

2.0

13.

What data type for a constant called: PI = 3.14

a)

STRING

b)

INTEGER

c)

FLOAT

d)

BOOLEAN

14.

What data type to store the price of a CD?

a)

STRING

b)

INTEGER

c)

FLOAT

d)

DATE

15.

What data type for a car plate number: plateNumber = "AV01-AFP"?

a)

STRING

b)

INTEGER

c)

FLOAT

d)

DATE

16.

What data type would you use to store a discount rate (e.g. 10%)?

a)

STRING

b)

INTEGER

c)

FLOAT

d)

DATE

17.

What data type would you use to store the number of days till Christmas?

a)

STRING

b)

INTEGER

c)

FLOAT

d)

DATE

18.

What data type for a variable called numberOfLives in a game?

a)

STRING

b)

INTEGER

c)

FLOAT

d)

BOOLEAN

19.

What data type for: age = 15?

a)

STRING

b)

INTEGER

c)

FLOAT

d)

BOOLEAN

20.

What does IDE mean?

a)

Integration Development Environment

b)

Integration Device Environment