...

/

Practice Challenges for Fun

Practice Challenges for Fun

In this lesson, we will go through some challenges using Java arithmetic expressions.

Quiz

Attempt the following quiz questions and check your understanding of Arithmetic Expressions.

What is the value of each of the following Java expressions?

1

17 + 2 – 5 / 5

A)

18

B)

16

C)

4

D)

3

Question 1 of 70 attempted

Classify each of the following Java assignment statements as either legal or illegal. Let b, s, i, l, f, and d be variables of type byte, short, int, long, float, and double, respectively.

1

d = l

A)

Legal

B)

Illegal

Question 1 of 60 attempted

If i, l, f, and d are variables of type int, long, float, and double, respectively, what is the data type of each of the following expressions?

1

f + d

A)

int

B)

long

C)

float

D)

double

Question 1 of 60 attempted
1

Using Zeller’s congruence, what is the day of the week for March 17, 2020?

f = d + [(26 × (m + 1)) / 10] + y + [y / 4] + 6 × [y / 100] + [y / 400]
A)

Monday

B)

Tuesday

C)

Wednesday

D)

Thursday

Question 1 of 20 attempted

Challenge 1: Find the cube

Write a Java statement that computes the cube of an integer ...