Reference no: EM131097945
1. _____ is interpreted.
Pascal
Java
C++
Ada
C
2. What is the printout of the following code?
double x = 5.5;
int y = (int)x;
System.out.println("x is " + x + " and y is " + y);
x is 5.5 and y is 5.0
x is 5.5 and y is 5
x is 5 and y is 6
x is 6 and y is 6
x is 6.0 and y is 6.0
3. What is the value of (double)(5/2)?
2.0
2
3.0
2.5
3
4. Suppose x=10 and y=10, what is x after evaluating the expression (y >= 10) || (x++ > 10)?
9
11
10
Illegal expression
5. What is y after the following switch statement is executed?
x = 3;
switch (x + 3) {
case 6: y = 0;
case 7: y = 1;
default: y += 1;
}
1
4
2
3
6. Analyze the following statement.
double sum = 0;
for (double d = 0; d<10;) {
d += 0.1;
sum += sum + d;
}
The program compiles and runs fine.
The program runs in an infinite loop because d<10 would always be true.
The program has a compile error because the control variable in the for loop cannot be of the double type.
The program has a compile error because the adjustment is missing in the for
loop.
7. What is the value in count after the following loop is executed?
int count = 0;
do {
System.out.println("Welcome to Java");
} while (count++ < 9);
System.out.println(count);
10
9
0
8
11
8. (char)('a' + Math.random() * ('z' - 'a' + 1)) returns a random character _____
between 'b' and 'z'.
between 'a' and 'y'.
between 'a' and 'z'.
between 'b' and 'y'.
9. What is the output of the following code?
public class Test {
public static void main(String[ ] args) {
int[ ] x = {120, 200, 016};
for (int i = 0; i < x.length; i++)
System.out.print(x[i] + " ");
}
}
120 200 16
120 200 20
120 200 14
016 is a compile error. It should be written as 16.
10. Analyze the following code.
public class Test {
public static void main(String[ ] args) {
int[ ] x = new int[5];
int i;
for (i = 0; i < x.length; i++)
x[i] = i;
System.out.println(x[i]);
}
}
The program displays 4.
The program displays 0 1 2 3 4.
The program has a runtime error because the last statement in the main method causes ArrayIndexOutOfBoundsException.
The program has a compile error because i is not defined in the last statement in the main method.
Consumes no more calories than his calorie limit
: Quincy lives on ding dongs and seafood salads. The price of ding dongs is 1 dollar per bag and the price of seafood salads is 4 dollars each. Quincy allows himself to spend no more than 23 dollars a day on food. He also restricts his consumption to 3..
|
Second city bank account
: If you made a $67,000 deposit in each bank, how much more money would you earn from your Second City Bank account at the end of 9 years? (Do not round intermediate calculations and round your answer to 2 decimal places, e.g., 32.16.)
|
Determine what the equivalent annual benefits
: In 2012, Brazil began construction of the Belo Monte hydroelectric dam on the Xingu River (which feeds the Amazon River). The project is funded by a consortium of investors and is expected to cost $11 billion. It will begin producing electricity in 2..
|
Difintions of moral and natural evil from muslim concept
: 1- what are the difintions of moral and natural evil from Muslim concept? 2- describe how blam and our emotional responses are diffrent when confronted with moral evil and natural evil respective ?
|
What is y after the given switch statement is executed
: What is y after the following switch statement is executed? What is the value in count after the following loop is executed? What is the printout of the following code?
|
When long-run average costs are rising
: When long-run average costs are rising, short-run and long-run marginal costs: (a) Intersect above average costs; (b) Intersect below average costs; (c) Intersect at the level of average costs; (d) Never intersect.
|
Find and present a specific example of impact
: Find and present a specific example of the impact of each type of investment risk. In each case, how did the type of risk affect investment performance?
|
Cigarette consumption and consumer spending on cigarettes
: According to studies undertaken by the US Department of Agriculture, the price elasticity of demand for cigarettes is between – 0.3 and – 0.4 and the income elasticity is about + 0.5. Suppose Congress, influenced by studies linking cigarette smoking ..
|