Log in
Sign up for FREE
arrow_back
Library

Unit 7 Pretest - Selection and Logical Expressions

star
star
star
star
star
Last updated about 2 months ago
25 questions
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Question 1
1.

Question 2
2.

What will this program output?

Question 3
3.

What will this program output?

Question 4
4.

Consider this code: age = 16 if age >= 18: print("Adult") else: print("Minor") Why does the program print "Minor" instead of "Adult"?

Question 5
5.

In a flowchart, which shape represents a decision point where the program must choose between different paths?

Question 6
6.

Question 7
7.

Which flowchart structure best represents this logic: "If the temperature is above 75, display 'Hot.' Otherwise, display 'Cool.'"?

Question 8
8.

What is the result of evaluating the condition: 5 >= 5?

Question 9
9.

Why must the condition inside an if statement evaluate to either True or False?

Question 10
10.

What is the primary purpose of an else statement in a program?

Question 11
11.

Question 12
12.

You need to write a program that assigns letter grades based on test scores: A for 90+, B for 80-89, C for 70-79, D for 60-69, and F for below 60. Which control structure is best suited for this task?

Question 13
13.

In an if/elif/else structure, how many code blocks can actually execute when the program runs?

Question 14
14.

Consider this scenario: A program needs to check if a number is positive, negative, or zero. Why would if/elif/else be better than using three separate if statements?

Question 15
15.

Question 16
16.

If you want to check whether a student's grade is between 80 and 90 (inclusive), which condition would work?

Question 17
17.

What is the key difference between how an if/else structure and an if/elif/else structure handle multiple conditions?

Question 18
18.

Question 19
19.

Consider this code: password = "secret123" if password == "secret123": print("Access Granted") else: print("Access Denied") Why is the == operator used instead of = in the condition?

Question 20
20.

Question 21
21.

Question 22
22.

Question 23
23.

Question 24
24.

Question 25
25.