Casting in Java

Quiz
•
Computers
•
9th - 12th Grade
•
Medium
Patrick Bryar
Used 4+ times
FREE Resource
11 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following code segment.
int a = 15;
double b = (double) a / 2.0;
System.out.println(b);
What is printed as a result of executing the code segment?
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following code segment.
int x = 5;
double y = (double) (x * 2);
System.out.print(x + " " + y);
What is printed as a result of executing the code segment?
5 10.0
5 10
10 5.0
10 5
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following code segment.
double num1 = 10.5;
int num2 = (int) num1;
double result = num1 - num2;
System.out.println(result);
What is printed as a result of executing the code segment?
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following code segment.
int m = 8;
double n = (double) (m + 3) / 2;
System.out.print(m + " " + n);
What is printed as a result of executing the code segment?
8 5.5
8 6.0
8 5.0
11 5.5
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following code segment.
double x = 7.0;
int y = (int) x;
double z = x / y;
System.out.println(z);
What is printed as a result of executing the code segment?
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following code segment.
int a = 10;
double b = 3.0;
double c = (double) a / b;
System.out.print(a + " " + b + " " + c);
What is printed as a result of executing the code segment?
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following code segment.
int x = 6;
double y = (double) (x / 2);
System.out.println(x + " " + y);
What is printed as a result of executing the code segment?
6 3.0
6 3
3 3.0
3 3
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Python Data Types

Quiz
•
9th - 12th Grade
12 questions
Project-Stem Unit 1 python coding

Quiz
•
9th - 12th Grade
10 questions
Logic Building in Java Part 1

Quiz
•
6th - 9th Grade
10 questions
C# Data Types

Quiz
•
10th Grade
12 questions
Java - arrays and String methods

Quiz
•
9th - 12th Grade
15 questions
Class X - Java 1

Quiz
•
10th Grade
15 questions
Basics in Java

Quiz
•
9th - 12th Grade
15 questions
Python Fundamentals Quiz

Quiz
•
11th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
1.2 OSI & TCP IP Models Quiz

Quiz
•
10th Grade
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
30 questions
Introduction to Computers

Quiz
•
8th - 9th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
20 questions
Hardware vs. Software Quiz

Quiz
•
7th - 10th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade