University of Waterloo Logo and CEMC Banner

2020 Beaver Computing Challenge
(Grade 5 & 6)

Questions, Answers, Explanations, and Connections


Part A

Bear Selection

Story

Ren is allowed to bring one of his four teddy bears to school.

The first bear wears glasses, a scarf and has a star. The second bear wears a bow. The third bear wears glasses, a bow, a scarf and has a star. The fourth bear wears a scarf and has a star.

Ren brings the bear that has a star on one of its feet, and is wearing a scarf or a bow, but not glasses.

Question

Which bear did Ren bring to school?

  1. The first bear wears glasses, a scarf and has a star.
  2. The second bear wears a bow.
  3. The third bear wears glasses, a bow, a scarf and has a star.
  4. The fourth bear wears a scarf and has a star.

Answer

(D) The fourth bear wears a scarf and has a star.

Explanation of Answer

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.

Connections to Computer Science

Ren decides that the bear he will take along to school must meet a specific set of requirements.

This set of requirements is:

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.

Country of Original Author

Canada

Bowls

Story

Whenever a customer orders soup, a bowl is taken from the top of the stack shown.

A description of stack follows.

Question

What is the fewest number of soup orders that need to be filled so that three identical bowls are used?

  1. 13
  2. 14
  3. 15
  4. 16

Answer

(A) 13

Explanation of Answer

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.

Connections to Computer Science

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?

Country of Original Author

Ireland