Exam 4: Fundamental Data Types

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

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

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

D

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

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

C

What will be printed by the statement below? System.out.print("O\"my\t\\\"no!");

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

D

When you purchase donuts, they come in boxes of 12, so 24 donuts take 2 boxes.All donuts need to be in a box, so if you buy 13 donuts, you'll get 2 boxes with 12 in the first box and 1 in the second.If the integer variable numberOfDonuts contains the positive number of donuts purchased, which of the following will correctly give the number of boxes needed?

(Multiple Choice)
4.8/5
(35)

Which statement is true about variable names in Java?

(Multiple Choice)
4.9/5
(38)

What is the value of Math.abs(-2)?

(Multiple Choice)
4.9/5
(41)

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

Which of the following options declares a float variable?

(Multiple Choice)
4.9/5
(28)

Which is the Java equivalent of the following mathematical expression? Which is the Java equivalent of the following mathematical expression?

(Multiple Choice)
4.7/5
(33)

Assume the following variables have been declared as shown and given values elsewhere: double a, b, c; The discriminant of a quadratic equation is defined to be: Assume the following variables have been declared as shown and given values elsewhere: double a, b, c; The discriminant of a quadratic equation is defined to be:   Which of the following statements will assign the correct value to discriminant? Which of the following statements will assign the correct value to discriminant?

(Multiple Choice)
4.8/5
(41)

Which is the Java equivalent of the following mathematical expression? Which is the Java equivalent of the following mathematical expression?

(Multiple Choice)
4.7/5
(42)

What is the output of the following code snippet? What is the output of the following code snippet?

(Multiple Choice)
4.8/5
(40)

What is the output of the following statement sequence? What is the output of the following statement sequence?

(Multiple Choice)
4.7/5
(29)

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

(Multiple Choice)
4.9/5
(35)

Assume the following variables have been declared and given values as shown: int i = 2345; double m = 67.8; What will be printed by the statement below? System.out.printf("Values are %10d and %7.2f", i, j);

(Multiple Choice)
4.8/5
(35)

How do you compute the length of the string str?

(Multiple Choice)
4.8/5
(32)

At what point in the problem-solving process should one write pseudocode?

(Multiple Choice)
4.9/5
(33)

One way to avoid round-off errors is to use:

(Multiple Choice)
4.7/5
(40)

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

(Multiple Choice)
4.9/5
(35)

Assuming that the user inputs "Joe" at the prompt, what is the output of the following code snippet? Assuming that the user inputs Joe at the prompt, what is the output of the following code snippet?

(Multiple Choice)
4.9/5
(43)
Showing 1 - 20 of 124
close modal

Filters

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