Start learning →

CS Olympiad Booleans and Decisions — practice questions

Explore 30 free Booleans and Decisions questions in CS Olympiad Computer Science. Open each question or exercise to read its content, reference answers and available explanation.

Practise Booleans and Decisions with Quill →

Booleans and Decisions questions and exercises with answers

Showing questions 1–30 of 30.

A quiz app stores whether a player passed. The data type it should use is:Read the answer and worked solution →A login screen checks whether user equals admin. The comparison returns:Read the answer and worked solution →A coder writes is_zero = num = 0 and every value gets wiped. His mistake was using:Read the answer and worked solution →A program must test, not change, a variable. The correct operator is:Read the answer and worked solution →A game checks if a score is even. A number is even when it divides exactly by:Read the answer and worked solution →An expression that evaluates to either true or false is called a:Read the answer and worked solution →In a Python if statement, the body runs only when the condition is:Read the answer and worked solution →A learner writes an if statement with nothing in its body. Python will produce:Read the answer and worked solution →PEP 8 recommends indenting each level of a Python body by how many spaces?Read the answer and worked solution →Instead of writing if is_raining == True, a tidy programmer writes:Read the answer and worked solution →When an if else statement runs, the number of branches actually taken is:Read the answer and worked solution →In Python the else keyword must sit at the same indentation level as the:Read the answer and worked solution →Python provides how many logical operators?Read the answer and worked solution →A club entry rule needs both age and ticket to be valid. The operator to use is:Read the answer and worked solution →A concert lets in anyone in band or choir. The operator to use is:Read the answer and worked solution →A program should act when a computer is switched off. The operator to use is:Read the answer and worked solution →In Python the expression 1 + 2 * 3 evaluates to:Read the answer and worked solution →In Python the expression (1 + 2) * 3 evaluates to:Read the answer and worked solution →The rule deciding order when two operators share a precedence level is:Read the answer and worked solution →Most Python operators are evaluated in which direction?Read the answer and worked solution →A curve program uses two separate if statements and both run by mistake. The fix is to use:Read the answer and worked solution →An elif statement is only legal when it directly follows an if or another:Read the answer and worked solution →Catch the true testsRead the answer and worked solution →Pop the logical operatorsRead the answer and worked solution →Run the decision gatesRead the answer and worked solution →Slice the true resultsRead the answer and worked solution →Assign or compareRead the answer and worked solution →Sort the Python piecesRead the answer and worked solution →Type the answerRead the answer and worked solution →Decisions bingoRead the answer and worked solution →

Worked practice questions

A quiz app stores whether a player passed. The data type it should use is:

  1. bool
  2. list
  3. dict
  4. file
Show answer and solution

Correct answer: A. bool

1. The answer is only yes or no. 2. One data type holds exactly two values. 3. That type is bool. _Source: OpenStax Introduction to Python Programming, Chapter 4._

Open this question →

A login screen checks whether user equals admin. The comparison returns:

  1. Open or Shut
  2. True or False
  3. Text or Digit
  4. Name or Email
Show answer and solution

Correct answer: B. True or False

1. Comparison operators test a relationship. 2. The answer is always one of two values. 3. So it returns True or False. _Source: OpenStax Introduction to Python Programming, Chapter 4._

Open this question →

A coder writes is_zero = num = 0 and every value gets wiped. His mistake was using:

  1. One equals sign
  2. Two equals signs
  3. Three equals signs
  4. Four equals signs
Show answer and solution

Correct answer: A. One equals sign

1. Assignment and comparison look alike but differ. 2. A single equals sign assigns instead of testing. 3. So he used one equals sign. _Source: OpenStax Introduction to Python Programming, Chapter 4._

Open this question →

How to practise

  1. Choose a Booleans and Decisions question and try to work out your answer.
  2. Open the question to check the correct answer and read its worked solution.
  3. Continue in the app for bite-sized lessons, explanations and review with Quill. You can start without creating an account.

More Computer Science topics