Zebra0.com

alice booleanAlice Programming

Alice Programming

Learn Alice in FREE step-by-step lessons.

Quiz on Boolean Expressions: true or false

After doing all parts of the lesson you should be able to answer these questions.

Write down the answers first. Click the check to check your answer.

1. A Boolean variable can have what values? answer

   true or false

2. How do you ask the user a true false question? answer

   The function getBooleanFromUser gives a choice of true or false.

3. How do you use a Boolean value? answer

   Drag in an if tile and change the comparison

4. When you have an if do you have to put something in the else section? answer

   No, the else is optional.

5. What does && mean? answer

   AND: both parts have to be true

6. What does || mean? answer

   OR: either or both parts must be true

7. How do you count the number of question the user gets right? answer

   Set count to 0 to start, use count=count+1 whenever they get an answer right.

8. What does != mean? answer

   Not Equal

9. Which of these two comparisons would be true if a student got a B:
grade>=80 && grade<90
grade>=80 || grade<90 answer

   The first one, the second one will always be true.

Please review the material for any questions you miss.