The assignment operator
A) denotes mathematical equality
B) places a new value into a variable
C) means the same as the equal sign used in algebra
D) makes it illegal to write a statement like "sum = sum + 4"
Give this one a try later!
, B) places a new value into a variable
static variable belong to ________________
Give this one a try later!
Classes
Given the following switch statement where x is an integer
switch (x) {
case 3: x += 1;
case 4: x += 2;
case 5: x += 3;
case 6: x++
case 7: x += 2
case 8: x--
case 9: x++
If x is currently equal to 5, what will the value of x be after the switch statement
executes?
A) 8
B) 11
C) 5
D) 6
E) 10
Give this one a try later!
, B) 11
How many x's will be output? Assume row and col are integers.
for (row = 0; row < 2; ++row) {
System.out.print ("x");
for (col = 0; col < 3; ++col) {
// do something
}
}
A) 1
B) 2
C) 3
D) 6
Give this one a try later!
B) 2
What is the output, if the input is 3 2 1 0 ?
x = scnr.nextInt();
while (x > 0) {
System.out.print(2 * x + " ");
}
A) 6
B) 6 4 2
C) 6 4 2 0
D) 6 6 6 6 6 ..... (infinite loop)
A) denotes mathematical equality
B) places a new value into a variable
C) means the same as the equal sign used in algebra
D) makes it illegal to write a statement like "sum = sum + 4"
Give this one a try later!
, B) places a new value into a variable
static variable belong to ________________
Give this one a try later!
Classes
Given the following switch statement where x is an integer
switch (x) {
case 3: x += 1;
case 4: x += 2;
case 5: x += 3;
case 6: x++
case 7: x += 2
case 8: x--
case 9: x++
If x is currently equal to 5, what will the value of x be after the switch statement
executes?
A) 8
B) 11
C) 5
D) 6
E) 10
Give this one a try later!
, B) 11
How many x's will be output? Assume row and col are integers.
for (row = 0; row < 2; ++row) {
System.out.print ("x");
for (col = 0; col < 3; ++col) {
// do something
}
}
A) 1
B) 2
C) 3
D) 6
Give this one a try later!
B) 2
What is the output, if the input is 3 2 1 0 ?
x = scnr.nextInt();
while (x > 0) {
System.out.print(2 * x + " ");
}
A) 6
B) 6 4 2
C) 6 4 2 0
D) 6 6 6 6 6 ..... (infinite loop)