Test 4: Short Questions – Part 1

Short questions

25 questions · 50 min · 62 marks

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

Sample questions with answers

The first 5 of 25, each with a model answer. Try writing yours first.

  1. Question 1 · 2 marks

    What are control structures?

    Show model answer

    Control structures are used to control the flow of a program based on different conditions or to repeat certain actions multiple times. They help manage decision-making and the repetition of tasks.

  2. Question 2 · 2 marks

    Name the two main types of control structures.

    Show model answer

    The two main types are Decision making and Looping.

  3. Question 3 · 2 marks

    What is decision making in programming? Give a real-life example.

    Show model answer

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

    Example: deciding whether to take an umbrella based on the weather situation.

  4. Question 4 · 3 marks

    What is the use of the if statement? Write its syntax.

    Show model answer

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

  5. Question 5 · 2 marks

    Why is indentation mandatory in Python?

    Show model answer

    In Python, indentation defines the structure, block or scope of the code. Incorrect indentation may cause an IndentationError.

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