2020 Beaver Computing Challenge
(Grade 5 & 6)
Questions, Answers, Explanations, and Connections
Ren is allowed to bring one of his four teddy bears to school.
Ren brings the bear that has a star on one of its feet, and is wearing a scarf or a bow, but not glasses.
Which bear did Ren bring to school?
(D)
Ren did not choose the bear in Option A or the bear in Option C because those bears have glasses.
Ren did not choose the bear in Option B because that bear does not have a star on one of its feet.
Ren chose the bear in Option D. The bear in Option D has a star on one of its feet, is wearing a scarf, and does not have glasses.
Ren decides that the bear he will take along to school must meet a specific set of requirements.
This set of requirements is:
the bear has a star on one of its feet
the bear is wearing a scarf or a bow
the bear does not have glasses
This task requires the use of boolean logic. Each of Ren’s requirements is expressed as a boolean statement. A boolean statement is either true or false. The three individual statements are then combined together using the boolean operators AND, OR, and NOT. AND is true if all statements it connects are true. OR is true if at least one of the statements it connects is true. NOT is true if the statement it is referring to is false. We can think of Ren’s set of requirements as the following boolean expression which combines the three statements above:
(star on one of its feet) AND (wearing a scarf OR wearing a bow) AND (NOT has glasses)
Boolean logic is used extensively in programing languages, in extracting information from databases or spreadsheets, and in the CPU itself.
Canada
Whenever a customer orders soup, a bowl is taken from the top of the stack shown.
What is the fewest number of soup orders that need to be filled so that three identical bowls are used?
(A) 13
Starting at the top of the stack and moving down, the first time three identical bowls will be used is when we take the third orange bowl. This bowl is the 13th bowl from the top of the stack, so that means at least 13 soup orders must be filled so that three identical bowls are used.
In this problem, you are asked to keep track of which bowls are removed until the required number of identical bowls are removed. The key property is that the top bowl must be the first one that is removed. We say that this follows the last-in first-out or LIFO principle.
In computer science, a collection of items that follows this principle is called a stack. Stacks have two main operations: push places an element at the top of the stack, and pop removes the top element from the stack. In this problem, we are only using the pop operation.
A stack is one fundamental way in which a collection can be stored. In particular, a computer program will often be broken into smaller pieces called subroutines. The order in which these subroutines are executed is often determined using a stack. An example of an application of stacks that you might be more familiar with is an “undo button" in an editor or word processor. Can you see how this follows the LIFO principle?
Ireland