Java Reference
In-Depth Information
c.
The string that represents the name
Julie Nelson
.
d.
(b
2
- 4ac) / 2a
e.
(a + b)/c(ef)-gh
f.
(-b + (b
2
- 4ac)) / 2a
14.
Suppose
x
,
y
,
z
, and
w
are
int
variables. What value is assigned to each
variable after the last statement executes?
x = 5;
z = 3;
y = x - z;
z = 2 * y + 3;
w = x - 2 * y + z;
z = w - x;
w++;
15.
Suppose
x
,
y
, and
z
are
int
variables and
w
and
t
are
double
variables.
What is the value of each variable after the last statement executes?
x = 17;
y = 15;
x = x + y / 4;
z = x % 3 + 4;
w = 17 / 3 + 6.5;
t = x / 4.0 + 15 % 4 - 3.5;
16.
Suppose
x
and
y
are
int
variables and
x
=
25
and
y
=
35
. What is the
output of each of the following statements?
a.
System.out.println(x + ' ' + y);
b.
System.out.println(x + " " + y);
17.
Suppose
x
,
y
, and
z
are
int
variables and
x
=
2
,
y
=
5
, and
z
=
6
. What is
the output of each of the following statements?
a.
System.out.println("x = " + x + ", y = " + y + ", z = " + z);
b.
System.out.println("x + y = " + (x + y));
c.
System.out.println("Sum of " + x + " and " + z + " is " + (x + z));
d.
System.out.println("z / x = " + (z / x));
e.
System.out.println(" 2 times " + x + " = " + (2 * x));
18.
What is the output of the following statements? Suppose
a
and
b
are
int
variables,
c
is a
double
variable, and
a = 13
,
b = 5
, and
c = 17.5.
a.
System.out.println(a + b - c);
System.out.println(15 / 2 + c);
b.
System.out.println(a / (
double
)(b) + 2 * c);
c.
System.out.println(14 % 3 + 6.3 + b / a);
d.
System.out.println((
int
)(c)% 5 + a - b);
e.
System.out.println(13.5 / 2 + 4.0 * 3.5 + 18);
f.
Search WWH ::
Custom Search