QUESTION IMAGE
Question
ps unit 2: programming reinforcement activity (you can do
names: dangelo wilson
part 1: sequencing showdown
the steps for calculating the average of test scores are scrambled below.
- divide the total by the number of scores.
- add all the scores together.
- display the average.
- ask the user how many test scores they want to enter.
- input each score one at a time.
task a: rewrite the steps in the correct sequence:
ask the user how many test scores
input each score at one time
add all the scores together
divide the total by number of scor
display the average
task b: which step might be a distractor or unnecessary in some contexts? why?
part 2: selection sprint
pseudocode for a program that grants access is below. fill in the missing condition.
if userage > 13 ____ parentalapproval = true
display \access granted\
else
display \access denied\
task a: fill in the missing boolean operator (and, or, or not).
answer: ______
task b (ap-style mcq):
which of these input values will grant access?
a. userage = 10, parentalapproval = true
b. userage = 14, parentalapproval = false
c. userage = 14, parentalapproval = true
d. userage = 12, parentalapproval = false
Part 1: Sequencing Showdown
Task A
To calculate the average of test scores, the correct sequence of steps is:
- Ask the user how many test scores they want to enter. (This is the first step to know the number of scores to input.)
- Input each score one at a time. (After knowing the number, we input each score.)
- Add all the scores together. (To get the total sum of the scores.)
- Divide the total by the number of scores. (To find the average from the total and the count of scores.)
- Display the average. (To show the calculated average.)
Task B
Step 4 (Ask the user how many test scores they want to enter) might be a distractor or unnecessary in some contexts. For example, if the number of test scores is fixed (like in a predefined set of scores, say 5 scores for a specific test always), we don't need to ask the user for the number of scores. We can directly input the fixed number of scores.
Part 2: Selection Sprint
Task A
The missing Boolean operator is "AND". The logic here is that access is granted if the user's age is greater than 13 and parental approval is true. So the condition should be userAge > 13 AND parentalApproval = TRUE. If we used "OR", then either condition being true would grant access, which is not the intended logic here (a child under 13 with parental approval or a child over 13 without parental approval might not be the intended access rule). "NOT" would not make sense here as it would invert the condition in an ill - fitting way.
Task B
Let's analyze each option:
- Option A:
userAge = 10(which is not greater than 13) andparentalApproval = TRUE. Since the condition isuserAge > 13 AND parentalApproval = TRUE, both parts of the "AND" condition are not met (age is not >13), so access is denied. - Option B:
userAge = 14(which is >13) butparentalApproval = FALSE. For the "AND" conditionuserAge > 13 AND parentalApproval = TRUE, both conditions must be true. Since parental approval is false, the condition is not met, and access is denied. - Option C:
userAge = 14(which is >13) andparentalApproval = TRUE. Both parts of the "AND" conditionuserAge > 13 AND parentalApproval = TRUEare met, so access is granted. - Option D:
userAge = 12(not >13) andparentalApproval = FALSE. The "AND" condition is not met, so access is denied.
Final Answers
Part 1
- Task A: 4, 5, 2, 1, 3 (in order: Ask the user how many test scores they want to enter; Input each score one at a time; Add all the scores together; Divide the total by the number of scores; Display the average)
- Task B: Step 4 (Ask the user how many test scores they want to enter) might be unnecessary if the number of scores is fixed.
Part 2
- Task A: AND
- Task B: C. userAge = 14, parentalApproval = TRUE
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
Part 1: Sequencing Showdown
Task A
To calculate the average of test scores, the correct sequence of steps is:
- Ask the user how many test scores they want to enter. (This is the first step to know the number of scores to input.)
- Input each score one at a time. (After knowing the number, we input each score.)
- Add all the scores together. (To get the total sum of the scores.)
- Divide the total by the number of scores. (To find the average from the total and the count of scores.)
- Display the average. (To show the calculated average.)
Task B
Step 4 (Ask the user how many test scores they want to enter) might be a distractor or unnecessary in some contexts. For example, if the number of test scores is fixed (like in a predefined set of scores, say 5 scores for a specific test always), we don't need to ask the user for the number of scores. We can directly input the fixed number of scores.
Part 2: Selection Sprint
Task A
The missing Boolean operator is "AND". The logic here is that access is granted if the user's age is greater than 13 and parental approval is true. So the condition should be userAge > 13 AND parentalApproval = TRUE. If we used "OR", then either condition being true would grant access, which is not the intended logic here (a child under 13 with parental approval or a child over 13 without parental approval might not be the intended access rule). "NOT" would not make sense here as it would invert the condition in an ill - fitting way.
Task B
Let's analyze each option:
- Option A:
userAge = 10(which is not greater than 13) andparentalApproval = TRUE. Since the condition isuserAge > 13 AND parentalApproval = TRUE, both parts of the "AND" condition are not met (age is not >13), so access is denied. - Option B:
userAge = 14(which is >13) butparentalApproval = FALSE. For the "AND" conditionuserAge > 13 AND parentalApproval = TRUE, both conditions must be true. Since parental approval is false, the condition is not met, and access is denied. - Option C:
userAge = 14(which is >13) andparentalApproval = TRUE. Both parts of the "AND" conditionuserAge > 13 AND parentalApproval = TRUEare met, so access is granted. - Option D:
userAge = 12(not >13) andparentalApproval = FALSE. The "AND" condition is not met, so access is denied.
Final Answers
Part 1
- Task A: 4, 5, 2, 1, 3 (in order: Ask the user how many test scores they want to enter; Input each score one at a time; Add all the scores together; Divide the total by the number of scores; Display the average)
- Task B: Step 4 (Ask the user how many test scores they want to enter) might be unnecessary if the number of scores is fixed.
Part 2
- Task A: AND
- Task B: C. userAge = 14, parentalApproval = TRUE