What is the output of the following code?
double x = 15.7;
int y = (int) x;
System.out.println(y);

Java Programming Quiz 10.14

Quiz
•
Computers
•
9th - 12th Grade
•
Medium

Arasaka Teacher
Used 1+ times
FREE Resource
33 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
15
16
15.7
15.0
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following code:
int a = 7;
int b = 2;
double result = (double) a / b;
System.out.println(result);
What is the output?
3
3.0
3.5
3.50
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the value of `z` after this code executes?
double x = 12.9;
int y = 5;
int z = (int) (x / y);
2
2.0
2.58
3
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following will correctly cast the result of the division to an integer?
double num1 = 17.8;
double num2 = 5.2;
int result = (int) (num1 / num2);
int result = (int) num1 / num2;
int result = num1 / (int) num2;
int result = num1 / num2;
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of this code?
int m = 10;
int n = 3;
double o = (double) m / n;
System.out.println(o);
3
3.0
3.33
3.3333333333333335
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be printed if this code is executed?
int score = 75;
if (score >= 70)
{System.out.println("Pass"); }
System.out.println("End of program");
Pass
End of program
Pass End of program
Nothing will be printed
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of this code?
int x = 10;
if (x % 2 == 0) {
x = x / 2;
}
System.out.println(x);
10
5
0
2
Create a free account and access millions of resources
Similar Resources on Quizizz
30 questions
GDSC DEU & PYTHON

Quiz
•
9th - 12th Grade
30 questions
Python Programming End of Unit Assessment

Quiz
•
7th - 9th Grade
28 questions
Python / Hangman project

Quiz
•
9th Grade
30 questions
SUMATIF BAB 1 XII RPL

Quiz
•
12th Grade
28 questions
AP CSA |U2L5 User Input by Mr. B

Quiz
•
12th Grade
30 questions
Christianson

Quiz
•
11th Grade
29 questions
Parcial 1 Programación en Java

Quiz
•
12th Grade
30 questions
Java Servlets & JSPs Test

Quiz
•
10th Grade
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
20 questions
Math Review - Grade 6

Quiz
•
6th Grade
20 questions
math review

Quiz
•
4th Grade
5 questions
capitalization in sentences

Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance

Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions

Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines

Quiz
•
Professional Development
12 questions
Dividing Fractions

Quiz
•
6th Grade
Discover more resources for Computers
25 questions
Spanish preterite verbs (irregular/changed)

Quiz
•
9th - 10th Grade
10 questions
Identify Slope and y-intercept (from equation)

Quiz
•
8th - 9th Grade
10 questions
Juneteenth: History and Significance

Interactive video
•
7th - 12th Grade
8 questions
"Keeping the City of Venice Afloat" - STAAR Bootcamp, Day 1

Quiz
•
9th - 12th Grade
26 questions
June 19th

Quiz
•
4th - 9th Grade
20 questions
Distance, Midpoint, and Slope

Quiz
•
10th Grade
20 questions
Figurative Language Review

Quiz
•
10th Grade
27 questions
STAAR English 1 Review

Quiz
•
9th Grade