Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Christopher is writing a checkNumas procedure that takes in a list of numbers and checks whether every number on the list is greater than 1

Christopher is writing a checkNumas procedure that takes in a list of numbers and checks whether every number on the list is greater than 100. If it is, the procedure should retum tr procedure should return false.
He wrote the following code:
PROCEDURE checkNums (numList)
1
FOR EACH num IN numList
1
IF (num 100
i
RETURN (false)
ELSE
i
RETURN (true)
}
}
Explain in clear, complete sentences why this code will not work as intended.
What will display when the following code segment is executed?
scores larr[8,7,8,5,6,10,7]
totallarr0
FOR EACH score IN scores
i
1f (num is 3=1)
1
totallarr total + score
DISPLAY (totai)
5
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions