Intro to Coding - Conditional Statements

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Is the following code an Else statement or an Elif statement? https://media.edgenuity.com/EVresources/3701-13-04-30-12-task/mc001-1.jpg Else Elif

2. Elif

Is the following code an Else statement or an Elif statement? https://media.edgenuity.com/EVresources/3701-13-04-30-13-task/mc001-1.jpg Else Elif

1. Else

Is the following code an Else statement or an Elif statement? https://media.edgenuity.com/EVresources/3701-13-04-30-14-task/mc001-1.jpg Else Elif

1. Else

When do programmers use If conditional statements? when they want a certain event to occur when a condition is met when they want to restrict an action from occurring when a condition is met when they want a certain event to occur when a condition is not met when they want to end a program

1. when they want a certain event to occur when a condition is met

You have been asked to write some code for a teacher. The code will print encouraging statements for students who do not have an A in the class. The exact message will depend on whether the student has a B, C, D, or F in the class. You will need an Else statement. Elif statement.

2. Elif statement.

As an intern for a small business, it is your job to write any code that is needed. Today you have been asked to write code that will add all order totals together if the customer is an active customer. If the customer is not an active customer, the code will print "inactive customer." You will need an If statement. Else statement.

2. Else statement.

Which action will be taken for a grade of 95? No action will be taken. Go ice skating with friends. Repeat the quiz. Go ice skating by myself.

2. Go ice skating with friends.

Which statement is a real-life example of an If statement? The sun is shining today because a cold front has moved through. If the sun is shining today, I will go to the beach. The beach is cold today because it is October. The sunny day causes the beach to be warm.

2. If the sun is shining today, I will go to the beach.

Which choices correctly describe Else statements? Check all that apply. They are considered false statements. They include an action to be taken when the If condition is false. They allow decision-making to be a part of the computer program. They execute the Else action when the If condition is false.

2. They include an action to be taken when the If condition is false. 3. They allow decision-making to be a part of the computer program. 4. They execute the Else action when the If condition is false.

Which choice best describes an If statement? a conditional statement that tests whether the condition following it is true or false, then executes the part of the code that corresponds with that result a conditional statement that tells a program to do something only if the answer to the expression is true a conditional statement that executes a piece of code when one statement is false a conditional statement that executes a piece of code whenever an If appears

2. a conditional statement that tells a program to do something only if the answer to the expression is true

Which choices correctly describe an Else statement? Check all that apply. a conditional statement that will show different information if the answer to the If statement is true a conditional statement that will show different information after the If statement answer is false a statement that contains the code to be executed when the If value is false or zero a conditional statement that runs a piece of code when all program statements are true

2. a conditional statement that will show different information after the If statement answer is false 3. a statement that contains the code to be executed when the If value is false or zero

What action would the program execute if fruit_number = 0? It would print "1." It would print "Apples." It would not print a message. It would print "0."

3. It would not print a message

Identify when programmers use an Else statement. to use an If statement in its place to make the test answer true to use an expression instead of a conditional statement to make the answer false to tell the program to take a different action when the If statement answer is false to tell the program to give different information when the test answer is true

3. to tell the program to take a different action when the If statement answer is false

Which type of conditional statement has the following syntax (form)? if expression: statement(s) else statement(s) If statements If-Then statements Elif statements Else statements

4. Else statements

If the grade is 60, which action will be executed? [none] Go skating with friends Go skating alone Study with tutor

4. Study with tutor

If the grade is 60, which action will be executed? [none] Go skating with friends Study with friend Study with tutor

4. Study with tutor

Which sentence describes Elif statements? The program stops after the first false answer. The program can have only one statement. The program runs after a false Elif expression. The program needs one true answer to run after the If statement is false.

4. The program needs one true answer to run after the If statement is false.

You and a friend are writing code for a video game you designed. You want the code to take action based on how many ships you have left in your fleet. You will need an Else statement. Elif statement.

2. Elif statement.

Which sentences describe the value of a conditional statement? Check all that apply. It allows a programmer to designate a portion of the code that will be run only when a condition is met. It creates new program code when a condition is met. It allows a programmer to set a condition that must be met. It incorporates decision-making into a program.

1. It allows a programmer to designate a portion of the code that will be run only when a condition is met. 3. It allows a programmer to set a condition that must be met. 4. It incorporates decision-making into a program.

Which statements describe conditional statements? Check all that apply. They are based on Boolean conditions. They are used by programmers to include decision-making in programs. They are constant variables. They perform actions or computations. They are also known as conditional constructs.

1. They are based on Boolean conditions. 2. They are used by programmers to include decision-making in programs. 4. They perform actions or computations. 5. They are also known as conditional constructs.

Which statements describe an If statement? Check all that apply. A conditional If statement is used when the programmer wants decision-making included in the code. A conditional If statement executes code when the condition returns a value of false. A conditional If statement executes a piece of code when one statement is false and the following statement is true. A conditional If statement tests whether the condition following it is true or false before executing a specified part of the code.

1. A conditional If statement is used when the programmer wants decision-making included in the code. 4. A conditional If statement tests whether the condition following it is true or false before executing a specified part of the code.

Read the following statements and select the conditional statements. Check all that apply. If my car starts, I can drive to work. It is inconvenient when the car does not start. If my car does not start, I will ride the bus to work. I purchased this car used, and it is not reliable.

1. If my car starts, I can drive to work. 3. If my car does not start, I will ride the bus to work.

Which statements are true about conditional statements? Check all that apply. They perform actions or computations. They are based on conditions. They can be executed only when conditions are false. They are also called conditional constructs. They are sometimes called compound statements. They have conditions that must be Boolean (IF, AND, or NOT) in form.

1. They perform actions or computations. 2. They are based on conditions. 4. They are also called conditional constructs. 6. They have conditions that must be Boolean (IF, AND, or NOT) in form.

Why are conditional statements valuable to programmers? Check all that apply. They provide a way for programmers to add decision-making to a computer program. They allow programmers to specify conditions that must be met for an action to occur. They allow a program to evaluate multiple values within a statement. They allow programmers to set actions that will change the conditions.

1. They provide a way for programmers to add decision-making to a computer program. 2. They allow programmers to specify conditions that must be met for an action to occur. 3. They allow a program to evaluate multiple values within a statement.

Read the following statements and use the drop-down menus to identify which statements are conditional statements. I am thinking about going to college. I plan to go to college if my grades are good enough. If my grades are very good, then I will select a college that offers scholarships. I plan to visit several colleges to see what they offer and what the living situations look like. If I do not qualify for any scholarships, then I will apply for student loans. I will also start working a part-time job to help pay for college. If I go to college, then my parents will let me take the extra car with me. If I do not go to college and stay home, then my parents want me to start paying rent.

1. not 2. conditional 3. cond 4. not 5. cond 6. not 7. cond 8. cond


Ensembles d'études connexes

第一課漢字好好玩 廖淑儀Mint

View Set

Atomic Structure and Periodic Trend

View Set

Airfield Managment: Driver Training

View Set

IFRS-Chapter 3-Fair Value Measurement

View Set