Exam 2: Fundamental Data Types

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

Assuming that the user inputs a value of 30 for the price and 10 for the discount rate in the following code snippet, what is the output? Scanner in = new Scanner(System.in); System.out.print("Enter the price: "); Double price = in.nextDouble(); System.out.print("Enter the discount rate: "); Double discount = in.nextDouble(); System.out.print("The new price is "); System.out.println(price - price * (discount / 100.0));

Free
(Multiple Choice)
4.8/5
(33)
Correct Answer:
Verified

C

What is the output of the following statement sequence? Public static void main(String[] args) { Int x = 100.0 % 6.0; System.out.println(x); }

Free
(Multiple Choice)
4.8/5
(38)
Correct Answer:
Verified

B

Which one of the following statements can be used to extract the last 10 characters from the string variable str?

Free
(Multiple Choice)
4.9/5
(32)
Correct Answer:
Verified

A

Which of the following options declares a float variable?

(Multiple Choice)
4.8/5
(40)

What is the value inside the value variable at the end of the given code snippet? Public static void main(String[] args) { Int value = 3; Value = value - 2 * value; Value++; }

(Multiple Choice)
4.9/5
(37)

Which of the following is the Java equivalent of the following mathematical expression? P = 2 . π\pi .(radius)3

(Multiple Choice)
4.8/5
(32)

Which one of the following is a correct method for defining and initializing an integer variable with name value?

(Multiple Choice)
4.9/5
(38)

In an airline reservation system, the cost of an airline ticket is required. Which data type should be used to store this value?

(Multiple Choice)
4.7/5
(40)

What is the output of the following code snippet? Public static void main(String[] args) { Double a; A = Math.sqrt(9.0) + Math.sqrt(16.0); System.out.println(a); }

(Multiple Choice)
4.7/5
(33)

What is the output of the following code snippet? Public static void main(String[] args) { Int value = 3; Value++; System.out.println(value); }

(Multiple Choice)
4.8/5
(43)

Assuming that the user inputs "Joe" at the prompt, what is the output of the following code snippet? Public static void main(String[] args) { System.out.print("Enter your name "); String name; Scanner in = new Scanner(System.in); Name = in.next(); Name += ", Good morning"; System.out.print(name); }

(Multiple Choice)
4.8/5
(26)

What is the result of the following code snippet? Public static void main(String[] args) { Double circleRadius; Double circleVolume = 22 / 7 * circleRadius * circleRadius; System.out.println(circleVolume); }

(Multiple Choice)
4.9/5
(36)

Which one of the following statements can be used to extract the last five characters from any string variable str?

(Multiple Choice)
5.0/5
(44)

What is the output of this code snippet? Int sum = 22; Sum = sum + 2; System.out.print(sum); // sum = sum + 4; System.out.print(sum);

(Multiple Choice)
4.9/5
(44)

Which statement is true?

(Multiple Choice)
4.8/5
(39)

Assuming that the user inputs a value of 25000 for the pay and 10 for the bonus rate in the following code snippet, what is the output? Public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter the pay: "); Double pay = in.nextDouble(); System.out.print("Enter the bonus rate: "); Double bonus = in.nextDouble(); System.out.println("The new pay is " + (pay + pay * (bonus / 100.0))); }

(Multiple Choice)
4.9/5
(32)

The problem solving process emphasizes a "first, do-it-by-hand" approach because

(Multiple Choice)
5.0/5
(42)

What is the result of the following statement? String s = "You" + "had" + "me" + "at" + "hello";

(Multiple Choice)
4.7/5
(37)

Which one of the following statements can be used to get the fifth character from a string str?

(Multiple Choice)
4.8/5
(45)

Which of the following statements is correct about constants?

(Multiple Choice)
4.8/5
(32)
Showing 1 - 20 of 103
close modal

Filters

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