Quiz 5
Quiz 5
True
True
Bob is 43
The equal sign (=) is used to make an assignment, whereas the == sign merely makes a comparison
and returns a boolean.
Znak jednakosti (=) koristi se za dodjelu, dok znak == samo čini usporedbu i vraća booleovu vrijednost.
True
Which operator is used to test if both sides of a boolean expression are equal?
Koji se operator koristi za testiranje jesu li obje strane booleovog izraza jednake?
==
if/else statement
if statement
switch statement
Which are used in a boolean expression?
Operators
Vatiables
A customer is eligible for a discount based on certain criteria. Under what conditions does “You qualify
for a discount” print? (Hint: There may be more than one correct answer)
Kupac ima pravo na popust na temelju određenih kriterija. Pod kojim uvjetima se ispisuje "Kvalificirate
se za popust"? (Savjet: Može biti više od jednog točnog odgovora)
int purchase;
int rewardPoints;
if (purchase >= 2000 || rewardPoints >= 4000) {
System.out.println("You qualify for discount");
}
I scored 10 points
True
In the AND (&&) test, if the first expression on the left hand side is false, then there is no need to
evaluate the second statement.
U AND (&&) testu, ako je prvi izraz s lijeve strane netočan, onda nema potrebe za procjenom druge izjave.
True
What is the output?
Što je izlaz?
public static void main(String args[]) {
char grade ='E';
if (grade == 'A') {
System.out.println("Excellent performer");
}else if (grade == 'B') {
System.out.println("Good Performer");
}else if (grade == 'C') {
System.out.println("Average Performer");
}else {
System.out.println("Below Average Performer");
}
}
When the input does not match any of the cases, the default statement is executed.
A break statement causes control to transfer to the end of the switch statement.
True
True/false
An if/else statement is used when you need to choose between two alternatives.
True
The switch statement is a more efficient way to write code when dealing with a large range of
unknown values
Naredba switch je učinkovitiji način za pisanje koda kada se radi s velikim rasponom nepoznatih vrijednosti
False
In the OR (||) test, if the first expression on the left hand side is true then there is no need to evaluate the second
statement.
U testu ILI (||), ako je prvi izraz s lijeve strane istinit, nema potrebe za procjenom druge izjave.
True
In a boolean expression which uses the && operator, what would make this expression evaluate to
true?
U booleovskom izrazu koji koristi && operator, što bi učinilo da ovaj izraz procijeni na istinito?
Consonants
Which two of the following data types can be used in a switch statement?
String
int