Computer Science › Int
Consider the following code:
int i = 55, j = 3;
System.out.println((i / j + 3) / 5);
What is the output for the code above?
Consider the code below:
int val = 205;
for(int i = 0; i < 5; i++) {
val /= 2;
}
At the end of its execution, what is the value of the variable val
in the code above?
Consider the following code:
int i = 100;
double d = 4.55, d2 = 3.75;
int j = (int)(d * 100 + d2);
What is the value of j at the end of the code's execution?
Consider the following code:
int i = 3;
for(int j = 5; j > 0; j--) {
i += i;
}
What will be the value of i at the end of this loop's iteration?
How do we set a method to return an Int in Swift(iOS)?
int x = 10;
int y = 4;
``
int z = x / y;
What is the value of z
?
Which of the following gurantees that your division does not lose its decimal portion?
Which of the following variable assignments is NOT a valid assignment statement?
a. 15 = x - 15;
b. num = x * y;
c. x = y + 15
d. x + y = 15
Suppose you are given the following lines of code:
Integer a = new Integer(10);
Integer b = new Integer(4);
Which of the following lines will not generate an error?
I. if (a.intValue() == b.intValue())
II if ((a.toString()).equals(b.toString()))
III if ((a.intValue()).equals(b.intValue()))
Refer to the following line of code:
double d = -4.73;
Which of the following correctly rounds d to the nearest integer?