wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

T_4.2 Identifier, Data Types, Operators & Expressions

Total questions: 10

Worksheet time: 7mins

Name
Class
Date
1.

Identify VALID identifier.

a)

24Century

b)

sum_&_difference

c)

double

d)

MyVariable

2.

Create a variable called myNum of type int and assign it the value 15

(a)  

3.

Declare a constant for PI with value 3.142

(a)  

4.

Tick all the Java reserved words.

a)

enum

b)

const

c)

float

d)

num

5.

Select primitive data types.

a)

int

b)

float/double

c)

boolean

d)

char

e)

String

6.

What is the function for escape sequence \n ?

a)

insert a tab in the text

b)

insert a new line in the text

c)

insert a new space in the text

d)

insert a double line in the text

7.

It is given that

a = 5, b = 2, c = 4 and d = 6

What is the result for this relational expressions?

a * c != d * b

a)

true

b)

false

8.

Check whether the following expression return true or false.

(5 > 3) && (8 < 5)

a)

true

b)

false

9.

Which one is arithmetic expression?

a)

3 == 5

b)

b * c - d

c)

!(a > b)

10.

ax2 + bcx +d\frac{ax^2\ +\ b}{cx\ +d}

Based on algebraic expression above, tick the correct Java expression.

a)

(a * x * x + b) / ((c * x + d)

b)

(a * Math.pow(x,2) + b) / (c * x + d)

c)

((a)(x)(x) + (b)) / ((c)(x) + d)

d)

(b + x *(x * (a))) / (d + x * (c))