Question
1.What is the result of the following boolean equation true &&false ||false Group of answer choices True False 2.What is the result of the following
1.What is the result of the following boolean equation
true &&false ||false
Group of answer choices
True
False
2.What is the result of the following boolean equation?
false && true || true && true
Group of answer choices
True
False
3.
What is the result of the following boolean equation?
false && true || true && true
Group of answer choices
True
False
4.
What is the result of the following comparative statement?
int x = 9;
int y = 5;
int z = 12;
x
Group of answer choices
True
False
5.
What is wrong with the following code
if (x<9);
{
x=x+2;
}
Group of answer choices
the code in the braces executes not matter the value of x
x cannot be set equal to itself
the braces need to be removed
x<9 is not a valid boolean expression
6.
What is wrong with the following code?
if true
{
x = 12;
}
Group of answer choices
The if statement needs parenthesis
you cannot enter a single boolean as the expression
the braces need to be removed
missing the semicolon after true
7.
What is the output of the following code?
double x = 8.5;
if(x>8)
{
System.out.println("large");
}
else
{
System.out.println("small");
}
Group of answer choices
large
small
no output
both
8.
What is the output of the following code?
int x = 11;
int y =6;
if (x>9)
if(y>10)
System.out.print("both large ");
else
System.out.println("not large");
Group of answer choices
not large
both large
no output
both large not large
9.
What is wrong with the following code?
switch (ch)
{
case 'A'
System.out.println("Apple");
break;
case 'B'
System.out.println("Banana");
}
Group of answer choices
missing the colon after each case
missing parenthesis around the characters
the "break" is not needed
missing a semicolon after (ch)
10.
Which of the following is true about switch statements?
Group of answer choices
they can only be used with int and char
they can be used with any data type
they cannot have multiple choices selected
there is no way to give an "else" for if none of the options where selected
11.
What is the output of the following code?
char ch = 'A'; switch(ch) { case 'A': System.out.print("Apple "); case 'B': System.out.print("Banana "); }
Group of answer choices
Apple Banana
Apple
Banana
No output
12.
Select all uses of a boolean variable
Group of answer choices
use as a flag variable
track whether something has a particular trait
used in if statements to control flow of program
used to hold a true or false value
13.
Which of the following is NOT true of if statements
Group of answer choices
if statements cannot accept multiple conditions
they can work with just a boolean variable in the parenthesis
the braces are optional when there is only one line inside
else statements do not have a boolean expression
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started