AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Operations with Primitive Data Types

APCSA-4EIYMX

Assume the following declaration:

 int num1 = 5;
 int num2 = 9;
 double answer;
 double count = 2.5;
 count = count/num1;
 num1 = (int)(count + num2/count);
 answer = num1 + num2 + count;

What is the value of answer?

A

27.5

B

17.5

C

27

D

31.4

E

type mismatch, can not cast a double to an int