Assume the following has been typed in: Scanner scan = new Scanner(System.in); Which line of code declares a double y and sets it equal to input from the user?
double y = scan.nextDouble();
2
New cards
Which line of code declares a double variable z and sets it equal to 3.5?
double z = 3.5;
3
New cards
Is an int smaller in memory than a double?
True
4
New cards
What is printed by the following code? int y = (13 - 7) / 4; System.out.println(y);
1
5
New cards
What is output when the following code is executed? double num = 2.0 * (26.75 - 20); System.out.println(num);
13.5
6
New cards
What is output when the following code is executed? double num = (0 - 3) * 5; System.out.println(num);
-15.0
7
New cards
What is output when the following code is executed? int x = -7; x++; x++; x--; System.out.println(x);
-6
8
New cards
What is output when the following code is executed? int x = 13; x++; x++; x -= 7; x *= 3; x--; System.out.println(x);
23
9
New cards
Which of the following is a primitive data type? "hello" 5.6 a7878