Exam 2: Data and Expressions

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

In order to generate a random number, you must use Math.random().

(True/False)
4.9/5
(40)

Example Code Ch 02-2 import java.util.Scanner; public class Questions33_34 { public static void main(String[] args) { int x, y, z; double average; Scanner scan = new Scanner(System.in); System.out.println("Enter an integer value"); x = scan.nextInt(); System.out.println("Enter another integer value"); y = scan.nextInt(); System.out.println("Enter a third integer value"); z = scan.nextInt(); average = (x + y + z) / 3; System.out.println("The result of my calculation is " + average); } } -Refer to Example Code Ch 02-2. This code computes

(Multiple Choice)
4.8/5
(44)

Of the following types, which one cannot store a numeric value?

(Multiple Choice)
4.9/5
(36)

Write the paint method for an applet so that it contains 4 concentric circles (each circle is inside the previous circle), where the largest circle is bounded by a 400x400 box and the smallest is bounded by a 100x100 box. Each circle is centered on an applet that is 400x400. Make each circle a different color of your choice.

(Essay)
4.8/5
(37)

Which library package would you import to use the class Random?

(Multiple Choice)
4.8/5
(44)

What is wrong with the following assignment statement? Assume x and y are both String objects. String z = x.equals(y);

(Essay)
4.9/5
(42)

The values of (double)5/2 and (double)(5/2) are identical.

(True/False)
5.0/5
(32)
Showing 61 - 67 of 67
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)