What is the possible output from System.out.println((int)(Math.random() * 4))?

a. 0
b. 1
c. 2
d. 3
e. 4


a. 0
b. 1
c. 2
d. 3
Math.random() returns a real value between 0.0 and 1.0, excluding 1.0. Math.random() * 4 yields a real value between 0.0 and 4.0, excluding 4.0. After casting, the resulting integer may be 0, 1, 2, or 3.

Computer Science & Information Technology

You might also like to view...

Audio file types including .mp3 and .mp4 are supported in PowerPoint

Indicate whether the statement is true or false

Computer Science & Information Technology

What type of attack is being attempted when an attacker uses a password-cracking program to guess passwords by attempting every possible combination of letters?

A. brute force B. replay C. ciphertext-only D. dictionary

Computer Science & Information Technology

Identify the mode of message transmission usedin smishing.

a. Multimedia Messaging Service b. Short Message Service c. Email d. Voice mail

Computer Science & Information Technology

You assign bullets when creating an unordered list. 

Answer the following statement true (T) or false (F)

Computer Science & Information Technology