Test 1: Decision Making and Loops

MCQs

30 questions · 25 min · 30 marks

Want to try first? Take the free Computer Science test: 94hbp-7gz9m-ufent-tsj4r

Sample questions

The first 5 of 30. Try each one, then tap to see the answer.

  1. Question 1

    What is the purpose of control structures in programming?

    • AOnly to make code longer
    • BTo manage decision-making and repetition of tasks
    • CTo create variables
    • DTo import libraries
    Show answer

    Answer: B

    Control structures help manage the decision-making process and the repetition of tasks in programs.

  2. Question 2

    Which of the following are the two main types of control structures?

    • ADecision making and Looping
    • BTesting and Debugging
    • CImporting and Exporting
    • DCreating and Sorting
    Show answer

    Answer: A

    The two main types of control structures are Decision making and Looping.

  3. Question 3

    What does decision making in programming allow the program to do?

    • ARepeat a block of code forever
    • BChoose different actions based on conditions
    • CStore a collection of items
    • DFind and fix bugs
    Show answer

    Answer: B

    Decision making allows the program to choose different actions based on conditions.

  4. Question 4

    Which statement runs a block of code only if a condition is true?

    • Aif
    • Bfor
    • Crange()
    • Dimport
    Show answer

    Answer: A

    The if statement lets us make decisions based on conditions. If the condition is true, it runs a block of code.

  5. Question 5

    What defines the structure, block or scope of code in Python?

    • ACurly braces
    • BSemicolons
    • CIndentation
    • DParentheses
    Show answer

    Answer: C

    In Python indentation defines the block or scope of your code and is mandatory.

More tests in Control Structures in Python

Practise with a free account

Save your scores, see which chapters need work, and keep a notebook of every question you got wrong.

Create free account