What will be output as a result of executing the following code segment?
Line 1: int a = 10;
Line 2: double b = 10.7;
Line 3: double c = a + b;
Line 4: int d = a + c;
Line 5: System.out.println(c + " " + d);
Java Basics #2

Flashcard
•
Computers
•
10th - 12th Grade
•
Hard
Quizizz Content
FREE Resource
Student preview

7 questions
Show all answers
1.
FLASHCARD QUESTION
Front
Back
Nothing will be printed because of a compile-time error.
2.
FLASHCARD QUESTION
Front
Consider the following code segment:
Line 1: int a = 10;
Line 2: double b = 10.7;
Line 3: int d = a + b;
Line 3 will not compile in the code segment above. With which of the following statements could we replace this line so that it compiles?
I. int d = (int) a + b;
II. int d = (int) (a + b);
III. int d = a + (int) b;
Back
II and III
3.
FLASHCARD QUESTION
Front
What is printed as a result of executing the following code segment?
Line 1: int a = 11;
Line 2: int b = 4;
Line 3: double x = 11;
Line 4: double y = 4;
Line 5: System.out.print(a / b);
Line 6: System.out.print(", ");
Line 7: System.out.print(x / y);
Line 8: System.out.print(", ");
Line 9: System.out.print(a / y);
Back
2, 2,75, 2.75
4.
FLASHCARD QUESTION
Front
What is printed as a result of executing the following code segment?
int var = 12;
var = var % 7;
var = var - 1;
System.out.println(var);
Back
4
5.
FLASHCARD QUESTION
Front
What is printed as a result of executing the following code segment?
int count = 5;
double multiplier = 2.5;
int answer = (int)(count * multiplier);
answer = (answer * count) % 10;
System.out.println(answer);
Back
0
6.
FLASHCARD QUESTION
Front
!(a > b || b <= c) is equivalent to which of the following? a > b && b <= c, a <= b || b > c, a <= b && b > c, a < b || b >= c, a < b && b >= c
Back
a <= b && b > c
7.
FLASHCARD QUESTION
Front
Which of the following expressions evaluates to true?
x && y && z,
x && y || z && y,
!(x && y) || z,
!(x || y) && z,
x && y || !z
Back
!(x && y) || z
Similar Resources on Quizizz
9 questions
HW 1: Distance and Midpoint Formulas

Flashcard
•
11th Grade
9 questions
Revolving 2D shapes to create 3D solids

Flashcard
•
9th - 12th Grade
8 questions
AP CS A Flashcard 4 Practice

Flashcard
•
9th - 12th Grade
8 questions
AP CSP 12-2 U4L1 Variable

Flashcard
•
9th - 12th Grade
8 questions
Heating Curve

Flashcard
•
10th - 12th Grade
8 questions
Unit #4- Loops and Nested Loops

Flashcard
•
9th - 12th Grade
9 questions
B-Man - Graphing Linear Equations

Flashcard
•
9th - 12th Grade
10 questions
Linear Functions

Flashcard
•
10th - 12th 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
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
20 questions
Distance, Midpoint, and Slope

Quiz
•
10th Grade
20 questions
Figurative Language Review

Quiz
•
10th Grade
20 questions
Understanding Linear Equations and Slopes

Quiz
•
9th - 12th Grade