Exam 4: Fundamental Data Types

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

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)
5.0/5
(38)

Consider the following Java variable names: I. 1stInstance II. basicInt% III. empName_ IV. addressLine1 V. DISCOUNT Which of the following options is correct?

(Multiple Choice)
4.9/5
(36)

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

(Multiple Choice)
4.8/5
(50)

Which of the following options declares a float variable?

(Multiple Choice)
4.9/5
(28)

The assignment operator

(Multiple Choice)
4.7/5
(40)

What does the following statement sequence print? String str = "Java"; Str += " is powerful"; System.out.println(str);

(Multiple Choice)
4.8/5
(38)

What is the correct way to invoke methods on variables in Java that are strings?

(Multiple Choice)
4.8/5
(39)

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

(Multiple Choice)
4.9/5
(38)

What is the output of the following code snippet? String firstname = "William"; String lastname; System.out.println("First: " + first); System.out.println("Last: " + lastname);

(Multiple Choice)
4.7/5
(29)

What is result of evaluating the following expression? (45 / 6) % 5

(Multiple Choice)
4.7/5
(36)

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 "); Int myInt = in.nextInt(); MyInt += 456; System.out.println(myInt); }

(Multiple Choice)
4.8/5
(31)

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

(Multiple Choice)
4.9/5
(31)

What is wrong with the following code? Int count = 2000 * 3000 * 4000;

(Multiple Choice)
4.9/5
(42)

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.9/5
(37)

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));

(Multiple Choice)
4.9/5
(35)

What is the meaning of x = 0; in Java?

(Multiple Choice)
4.8/5
(30)

What is wrong with the following code snippet? Int size = 42; Cost = 9.99; System.out.println("size = " + size); System.out.println(" cost = " + cost);

(Multiple Choice)
4.7/5
(38)

What will be printed by the statements below? final int BONUS = 20; Int salary = 100; Int netSalary = salary + BONUS; System.out.print (netSalary);

(Multiple Choice)
4.9/5
(39)

Consider the following division statements: I. 22 / 7 II. 22.0 / 7 III. 22 / 7.0 Which of the following is correct?

(Multiple Choice)
4.9/5
(40)

Assume the following variable has been declared and given values as shown: String name = "Mamey, Jean"; Which statement will print the name as "Jean Mamey"?

(Multiple Choice)
4.9/5
(42)
Showing 21 - 40 of 125
close modal

Filters

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