Exam 4: Fundamental Data Types

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

Assume the following variables have been declared and given values as shown: Int i = 2345; Double m = 67.8; Which statement will give the output below? Values are 2345 and 67.80

(Multiple Choice)
4.8/5
(47)

Which one of the following statements defines a constant with the value 123?

(Multiple Choice)
4.7/5
(31)

Assuming that the user inputs a value of 25 for the price and 10 for the discount 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 price: "); Double price = in.nextDouble(); System.out.print("Enter the discount rate: "); Double discount = in.nextDouble(); System.out.println("The new price is " + Price - price * (discount / 100.0)); }

(Multiple Choice)
4.9/5
(39)

Which statement is true about variable names in Java?

(Multiple Choice)
4.9/5
(34)

How do you extract the first 5 characters from the string str?

(Multiple Choice)
5.0/5
(37)

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
(38)

Which one of the following variables is assigned with valid literals?

(Multiple Choice)
4.8/5
(37)

What output is produced by these statements? String name = "Joanne Hunt"; System.out.println(name.length());

(Multiple Choice)
4.9/5
(32)

Which statements about numeric types in Java are true? I. There is more than one integer type II. The data type float uses twice the storage of double III. The numeric range of the Java integer type is related to powers of two

(Multiple Choice)
4.8/5
(51)

Which is the Java equivalent of the following mathematical expression? c = √(a2 + b2)

(Multiple Choice)
4.8/5
(34)

Assuming price contains the value 20.0, which of the following statements displays price = 20.00

(Multiple Choice)
4.8/5
(42)

Which one of the following statements gives the absolute value of the floating-point number x = -25.50?

(Multiple Choice)
4.8/5
(39)

What does the following statement sequence print? String str = "Java Is Good"; Int n = str.length(); String mystery = str.substring(n - 4, n) + Str)charAt(4) + str.substring(0, 4); System.out.println(mystery);

(Multiple Choice)
4.8/5
(32)

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

(Multiple Choice)
4.7/5
(38)

Which option represents the best choice for a variable name to represent the average grade of students on an exam?

(Multiple Choice)
4.8/5
(34)

What is the value of the following expression? 3 * 5 / 2 * 5

(Multiple Choice)
4.9/5
(40)

What is the output of the following code snippet? Int counter = 0; Counter++; System.out.print("The initial value of the counter is "); System.out.println(count);

(Multiple Choice)
4.8/5
(36)

What does the following statement sequence print? String str = "Harry"; Int n = str.length(); String mystery = str.substring(0, 1) + str.substring(n - 2, n); System.out.println(mystery);

(Multiple Choice)
4.9/5
(28)

Which of the following is the Java equivalent of the following mathematical expression? c = 2 π\pi . radius

(Multiple Choice)
4.8/5
(37)

Assuming that the user enters 45 and 62 as inputs for n1 and n2, respectively, what is the output of the following code snippet? public static void main(String[] args) { System.out.print("Enter a number: "); Scanner in = new Scanner(System.in); String n1 = in.next(); System.out.print("Enter another number: "); String n2 = in.next(); String result = n1 + n2; System.out.print(result); }

(Multiple Choice)
4.7/5
(40)
Showing 101 - 120 of 125
close modal

Filters

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