Exam 2: Fundamental Data Types

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

What is the result of the following code snippet? Double bottles; Double bottleVolume = bottles * 2; System.out.println(bottleVolume);

(Multiple Choice)
5.0/5
(40)

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

(Multiple Choice)
4.8/5
(45)

Which one of the following statements can be used to convert a string str to a double?

(Multiple Choice)
4.8/5
(26)

Which of the methods below are static methods? I. length II. substring III. pow IV. sqrt

(Multiple Choice)
4.8/5
(29)

What will be the value inside the variables x and y after the given set of assignments? Int x = 20; Int y = 10; X = (x - y) * 2; Y = x / 2;

(Multiple Choice)
4.8/5
(36)

What is the output of the following code snippet? Public static void main(String[] args) { Int var1 = 10; Int var2 = 2; Int var3 = 20; Var3 = var3 / (var1 % var2); System.out.println(var3); }

(Multiple Choice)
4.9/5
(45)

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

(Multiple Choice)
5.0/5
(32)

What will be the value stored in the variable x after the execution of the following code snippet? Int a = 10; Int b = 20; Int c = 2; Int x = b / a /*c*/;

(Multiple Choice)
4.9/5
(36)

Which of the following statements places input into the variable value given this line of code? Scanner in = new Scanner(System.in);

(Multiple Choice)
4.8/5
(26)

Which statement is true about variable names in Java?

(Multiple Choice)
4.8/5
(31)

Which one of the following is a correct representation of the given mathematical expression in Java? a+b2\frac{a + b}2

(Multiple Choice)
4.9/5
(30)

Which one of the following operators computes the remainder of an integer division?

(Multiple Choice)
4.8/5
(42)

What will be the value inside the variables a and b after the given set of assignments? Int a = 20; Int b = 10; a = (a + b) / 2; b = a; a++;

(Multiple Choice)
4.7/5
(35)

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

Which of the following guidelines will make code more explanatory for others?

(Multiple Choice)
4.9/5
(30)

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

(Multiple Choice)
4.8/5
(37)

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

(Multiple Choice)
4.8/5
(35)

What does the following statement sequence print if the user input is 123? Public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter a number: "); String str = in.next(); Str += 456; System.out.println(str); }

(Multiple Choice)
4.8/5
(40)

Which one of the following types of statements is an instruction to replace the existing value of a variable with another value?

(Multiple Choice)
4.8/5
(32)

What is wrong with the following code snippet? What is wrong with the following code snippet?

(Multiple Choice)
4.8/5
(37)
Showing 61 - 80 of 103
close modal

Filters

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