What is the name for this kind of code structure? if color == "red": print("Sounds good! We'll make the car red!") elif color == "blue": print("Sounds good! We'll make the car blue!")
TS Unit 2 Review for Test

Flashcard
•
Computers
•
12th Grade
•
Hard
Quizizz Content
FREE Resource
Student preview

20 questions
Show all answers
1.
FLASHCARD QUESTION
Front
Back
conditional
Answer explanation
Explanation: An if statement, or conditional, is a code structure that makes a decision. It is composed of a line that asks a question, and then one or more indented lines that run or are skipped based on the answer to that question.
2.
FLASHCARD QUESTION
Front
What value is in the variable `x` after this code runs?
x = 0
y = 10
if x == y:
x = 100
Back
0
Answer explanation
Explanation: In this case the answer to 'are x and y equal?' is False, and so the line inside the if-statement will not run, meaning x will stay the same.
3.
FLASHCARD QUESTION
Front
What value is in the variable `x` after this code runs?
x = 0
y = 10
if x < y:
x = y
Back
10
Answer explanation
Explanation: In this case the answer to 'is the value of x less than y?' is True, and so the line inside the if-statement will run, setting a new x value.
4.
FLASHCARD QUESTION
Front
Which of the following is NOT a valid conditional clause format? (circle one) A. else: B. if condition: C. elif condition: D. else condition:
Back
else condition:
Answer explanation
Every clause contains a keyword and a colon. Most clauses also contain a condition, except for `else`, which does not have its own condition.
5.
FLASHCARD QUESTION
Front
Which of the following is NOT true about conditions?
They are boolean expressions,
They always produce the value True or False,
You can only have one condition per conditional,
They come between the keyword and colon in a conditional clause
Back
You can only have one condition per conditional
Answer explanation
Explanation: The condition is the part of the if-statement or other conditional clause that asks a yes-or-no question. For a conditional with multiple clauses, each clause will have its own condition, except for `else`.
6.
FLASHCARD QUESTION
Front
What value is in the variable `y` after this code runs?
Back
100
Answer explanation
Explanation: A nested conditional is only tested if the outer conditional is True. In this case, x is less than y, so the first condition is True. Then we check the inner conditional. x is NOT less than 0, so we skip the block of the inner conditional, and the final value of y is 100.
7.
FLASHCARD QUESTION
Front
What symbol is used in Python to divide with no remainder? (floor division operator)
Back
//
Answer explanation
Explanation: The Python floor division operator, //, divides two numbers and gets rid of the remainder, leaving an integer.
Create a free account and access millions of resources
Similar Resources on Quizizz
15 questions
Python modules, operators and random

Flashcard
•
University
16 questions
Python Basics Unit 3.1

Flashcard
•
12th Grade
16 questions
AP CSA Primitive Types Practice

Flashcard
•
11th Grade
10 questions
Ôn tập chủ đề F

Flashcard
•
KG
14 questions
AP CS ArrayLists

Flashcard
•
12th Grade
13 questions
Fall Semester Exam Review (Units 1, 2)

Flashcard
•
12th Grade
17 questions
Java Basics

Flashcard
•
12th Grade
15 questions
Python Programming Flashcard

Flashcard
•
University
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
Discover more resources for Computers
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
20 questions
Taxes

Quiz
•
9th - 12th Grade
17 questions
Parts of Speech

Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression

Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing

Quiz
•
9th - 12th Grade
10 questions
Identifying equations

Quiz
•
KG - University