Casting in Java

Casting in Java

9th - 12th Grade

11 Qs

quiz-placeholder

Similar activities

Unit 6 Computer Science Arrays

Unit 6 Computer Science Arrays

10th - 12th Grade

14 Qs

APCSA Unit 7

APCSA Unit 7

9th - 12th Grade

12 Qs

Python Intro 1

Python Intro 1

7th - 12th Grade

11 Qs

ASK Tingkatan 2 - Bab 003 (3.1.1-3.1.2)

ASK Tingkatan 2 - Bab 003 (3.1.1-3.1.2)

7th - 9th Grade

15 Qs

Java Math

Java Math

9th - 12th Grade

15 Qs

C++ Arrays

C++ Arrays

8th - 12th Grade

12 Qs

CS A U1 Review

CS A U1 Review

12th Grade

8 Qs

Unit 8 - Searching and Sorting

Unit 8 - Searching and Sorting

9th - 12th Grade

15 Qs

Casting in Java

Casting in Java

Assessment

Quiz

Computers

9th - 12th Grade

Medium

Created by

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?

7.0
7.5
8.0
15.0

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?

0.5
10.5
10
0

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?

1.0
7.0
0.0
None of the above

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?

10 3.0 3.3333333333333335
10 3.0 3.0
10 3.0 3.33
10 3.0 3.3

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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?