Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

19 multiple choice 2 points when would you use a conditional in your co…

Question

19 multiple choice 2 points
when would you use a conditional in your code?
when you want to stop the program from running
when you want to store a value in a variable
when you want to make a decision based on certain conditions, like checking if a key was pressed
when you want the program to repeat an action
20 multiple choice 2 points
what is debugging?
finding and fixing errors in your code
writing new code from scratch
running a program for the first time
storing data in variables
21 multiple choice 2 points
what will the following code output if the variable age is 16?
age = 16
if age >= 18: print(\you can vote.\)
else: print(\you cannot vote yet.\)
\you cannot vote yet.\
no output
an error message
\you can vote.\

Explanation:

Step1: Analyze question 19

Conditional statements are used to make decisions based on certain conditions.

Step2: Analyze question 20

Debugging is the process of finding and fixing errors in code.

Step3: Analyze question 21

Given age = 16, since 16 < 18, the else block will execute.

Answer:

  1. When you want to make a decision based on certain conditions, like checking if a key was pressed
  2. Finding and fixing errors in your code
  3. "You cannot vote yet."