Question
QUESTION 1 Consider the following line of Java code: float h = Math.E * 123.45; What primitive data type Java will assume 123.45 is? double
QUESTION 1
Consider the following line of Java code:
float h = Math.E * 123.45;
What primitive data type Java will assume 123.45 is?
double | ||
long | ||
int | ||
float |
QUESTION 2
Assume that pies and people are two declared and initialized variables of type int. Also, assume that piesPerPerson is a declared and initialized variable of type float. Consider the following line of Java code (This line has issues, BTW. Think why):
piesPerPerson = (float)(pies/people);
What Java operations are involved here?
variable declaration, implicit casting, integer division | ||
variable declaration, explicit casting, integer division | ||
variable assignment, explicit casting, integer division | ||
variable assignment, implicit casting, integer division |
QUESTION 3
Which identifier is illegal in Java?
broke | ||
break | ||
broken | ||
brake |
QUESTION 4
What is modulo operation doing in Java?
It returns a result of a division operation | ||
It rounds a floating point number to the nearest integer greater than that floating point number | ||
It returns a remainder of a division operation | ||
It returns a fractional/decimal part of a floating point number |
QUESTION 5
Assume that a and b are two declared and initialized variables. Variable a is of type double. Variable b is of type int. Consider the following line of Java code:
a = b;
What kind of type casting, if any, is necessary here?
There is no need for type casting here at all | ||
Explicit casting | ||
Implicit casting | ||
Both implicit and explicit casting |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started