-
[1 mark]
What is the console output of the following lines of Java code?
boolean b1 = false;
boolean b2 = false;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
b2 = true;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
b1 = true;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
b2 = false;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
-
===
false false
===
false true
===
true true
===
false true
-
===
false false
===
true false
===
true true
===
false true
-
===
false false
===
false true
===
true true
===
true false
-
===
false false
===
true false
===
true true
===
true false
-
[1 mark]
What is the console output of the following lines of Java code?
boolean b1 = false;
boolean b2 = true;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
b2 = false;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
b1 = true;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
b2 = true;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
-
===
false true
===
false false
===
false true
===
true true
-
===
false true
===
false false
===
true false
===
true true
-
===
true false
===
false false
===
false true
===
true true
-
===
true false
===
false false
===
true false
===
true true
-
[1 mark]
What is the console output of the following lines of Java code?
boolean b1 = true;
boolean b2 = false;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
b2 = true;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
b1 = false;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
b2 = false;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
-
===
false true
===
true true
===
false true
===
false false
-
===
false true
===
true true
===
true false
===
false false
-
===
true false
===
true true
===
false true
===
false false
-
===
true false
===
true true
===
true false
===
false false
-
[1 mark]
What is the console output of the following lines of Java code?
boolean b1 = true;
boolean b2 = true;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
b2 = false;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
b1 = false;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
b2 = true;
System.out.println("===");
System.out.println((b1 && b2) + " " + (b1 || b2));
-
===
true true
===
false true
===
false false
===
false true
-
===
true true
===
false true
===
false false
===
true false
-
===
true true
===
true false
===
false false
===
false true
-
===
true true
===
true false
===
false false
===
true false
-
[1 mark]
What is the console output of the following lines of Java code?
boolean p = false;
boolean q = false;
boolean conjunction = p && q;
boolean disjunction = p || q;
System.out.println("===");
System.out.println(!conjunction);
System.out.println(!disjunction);
p = true;
System.out.println("===");
System.out.println(!conjunction);
System.out.println(!disjunction);
-
===
true
true
===
true
true
-
===
true
true
===
true
false
-
===
false
false
===
false
false
-
===
false
false
===
false
true
-
[1 mark]
What is the console output of the following lines of Java code?
boolean p = false;
boolean q = true;
boolean conjunction = p && q;
boolean disjunction = p || q;
System.out.println("===");
System.out.println(!conjunction);
System.out.println(!disjunction);
p = true;
System.out.println("===");
System.out.println(!conjunction);
System.out.println(!disjunction);
-
===
true
false
===
true
false
-
===
true
false
===
false
false
-
===
false
true
===
false
true
-
===
false
true
===
true
true
-
[1 mark]
What is the console output of the following lines of Java code?
boolean p = true;
boolean q = false;
boolean conjunction = p && q;
boolean disjunction = p || q;
System.out.println("===");
System.out.println(!disjunction);
System.out.println(!conjunction);
q = true;
System.out.println("===");
System.out.println(!disjunction);
System.out.println(!conjunction);
-
===
false
true
===
false
true
-
===
false
true
===
false
false
-
===
true
false
===
true
false
-
===
true
false
===
true
true
-
[1 mark]
What is the console output of the following lines of Java code?
boolean p = true;
boolean q = true;
boolean conjunction = p && q;
boolean disjunction = p || q;
System.out.println("===");
System.out.println(!conjunction);
System.out.println(!disjunction);
p = false;
System.out.println("===");
System.out.println(!conjunction);
System.out.println(!disjunction);
-
===
false
false
===
false
false
-
===
false
false
===
true
false
-
===
true
true
===
true
true
-
===
true
true
===
false
true
-
[1 mark]
Assume that we already declare an int variable called i. Which of the following boolean expressions always evaluates to true (despite the value of i)?
-
i >= 5 && 10 >= i
-
i >= 5 || 10 >= i
-
i < 5 && 10 < i
-
i < 5 || 10 < i
-
[1 mark]
Assume that we already declare an int variable called i. Which of the following boolean expressions always evaluates to true (despite the value of i)?
-
17 >= i && i >= 4
-
17 >= i || i >= 4
-
17 < i && i < 4
-
17 < i || i < 4
-
[1 mark]
Assume that we already declare an int variable called i. Which of the following boolean expressions always evaluates to false (despite the value of i)?
-
i >= 5 && 10 >= i
-
i >= 5 || 10 >= i
-
i < 5 && 10 < i
-
i < 5 || 10 < i
-
[1 mark]
Assume that we already declare an int variable called i. Which of the following boolean expressions always evaluates to false (despite the value of i)?
-
17 >= i && i >= 4
-
17 >= i || i >= 4
-
17 < i && i < 4
-
17 < i || i < 4
-
[1 mark]
What is the console output of the following lines of Java code?
int i = 5;
int j = 7;
int k = 9;
String s = "Hello ";
System.out.println(s + i + j + k);
System.out.println((s + i) + j + k);
System.out.println(s + (i + j) + k);
-
Hello 579
Hello 579
Hello 129
-
Hello 579
Hello 516
Hello 129
-
Hello 21
Hello 516
Hello 129
-
Hello 579
Hello 579
Hello 579
-
There is a compile-time error in the above code, so it simply cannot be run to produce console output.
-
[1 mark]
What is the console output of the following lines of Java code?
int i = 11;
int j = 12;
int k = 13;
String s = "Hello ";
System.out.println(s + i + j + k);
System.out.println((s + i) + j + k);
System.out.println(s + (i + j) + k);
-
Hello 111213
Hello 111213
Hello 2313
-
Hello 111213
Hello 1125
Hello 2313
-
Hello 36
Hello 1125
Hello 2313
-
Hello 111213
Hello 111213
Hello 111213
-
There is a compile-time error in the above code, so it simply cannot be run to produce console output.
-
[1 mark]
What is the console output of the following lines of Java code?
int i = 25;
int j = 11;
int k = 3;
System.out.println(((i % j) * (j / k)) % 4);
-
0
-
1
-
2
-
3
-
4
-
There is a compile-time error in the above code, so it simply cannot be run to produce console output.
-
[1 mark]
What is the console output of the following lines of Java code?
int i = 37;
int j = 11;
int k = 3;
System.out.println(((i % j) * (j / k)) % 4);
-
0
-
1
-
2
-
3
-
4
-
There is a compile-time error in the above code, so it simply cannot be run to produce console output.
-
[1 mark]
What is the console output of the following lines of Java code?
int i = 13;
int j = 2;
System.out.println(i / j);
System.out.println( (double) (i / j));
System.out.println(((double) i) / j );
System.out.println( (double) i / j );
-
6
6.0
6.5
6.5
-
6.5
6.5
6.5
6.5
-
6
6.0
6.0
6.0
-
6
6.0
6.5
6.0
-
There is a compile-time error in the above code, so it simply cannot be run to produce console output.
-
[1 mark]
What is the console output of the following lines of Java code?
int i = 14;
int j = 4;
System.out.println(i / j);
System.out.println( (double) (i / j));
System.out.println(((double) i) / j );
System.out.println( (double) i / j );
-
3
3.0
3.5
3.5
-
3.5
3.5
3.5
3.5
-
3
3.0
3.0
3.0
-
3
3.0
3.5
3.0
-
There is a compile-time error in the above code, so it simply cannot be run to produce console output.
-
[1 mark]
What is the console output of the following lines of Java code?
double a = 3.1415926;
double b = (int) a;
System.out.println(b);
int c = (int) a;
System.out.println(c);
double d = (c * 5) / 2;
System.out.println(d);
d = (b * 5) / 2;
System.out.println(d);
-
3.0
3
7.0
7.5
-
3.0
3.0
7.0
7.5
-
3.0
3.0
7.5
7.5
-
3
3
7.0
7.0
-
[1 mark]
What is the console output of the following lines of Java code?
double a = 3.1415926;
double b = (int) a;
System.out.println(b);
int c = (int) a;
System.out.println(c);
double d = (c * 9) / 2;
System.out.println(d);
d = (b * 9) / 2;
System.out.println(d);
-
3.0
3
13.0
13.5
-
3.0
3.0
13.0
13.5
-
3.0
3.0
13.5
13.5
-
3
3
13.0
13.0
-
[1 mark]
What is the console output of the following lines of Java code?
double a = 3.4;
double b = ((int) a) * 3;
System.out.println(b);
double c = ((int) a) + 2.7;
System.out.println(c);
double d = (( (int) c ) * 3) / 2;
System.out.println(d);
d = (b * 3) / 2;
System.out.println(d);
-
9.0
5.7
7.0
13.5
-
10.0
6.0
9.0
15.0
-
10.2
6.1
9.15
15.3
-
9
5
7
13
-
[1 mark]
What does the equal sign (=) mean in Java?
-
The assignment operator.
-
The relational comparison operator.
-
The arithmetic quotient operator.
-
The arithmetic remainder operator.
-
[1 mark]
What does the equal-equal sign (==) mean in Java?
-
The assignment operator.
-
The relational comparison operator.
-
The arithmetic quotient operator.
-
The arithmetic remainder operator.
-
[1 mark]
What does the percentage sign (%) mean in Java?
-
The assignment operator.
-
The relational comparison operator.
-
The arithmetic quotient operator.
-
The arithmetic remainder operator.
-
[1 mark]
What does the operator && mean in Java?
-
The logical conjunction operator.
-
The logical disjunction operator.
-
The logical negation operator.
-
The concatenation operator.
-
[1 mark]
What does the operator || mean in Java?
-
The logical conjunction operator.
-
The logical disjunction operator.
-
The logical negation operator.
-
The concatenation operator.
-
[1 mark]
What does the operator || mean in Java?
-
The logical conjunction operator.
-
The logical disjunction operator.
-
The logical negation operator.
-
The concatenation operator.
-
[1 mark]
Which one of the following expressions contains type error(s) so that it does not compile?
-
"I " + "Love " + 1021
-
((double) 11 / 3) + " is what?"
-
((13 % 3) + "234") + 56 + ("(13 % 3) * 234")
-
((13 % 3) + "234") / 56 + ((13 % 3) * 234)
-
All of the above expressions contain some type error(s).
-
None of the above expressions contain some type error(s).