5.6.2: Iterating through arrays in code.
Lab Notes: Good practice to show you how to loop. Up and down max down to up changing numbers in an array from negative to possitive and more at the beginning...
5.6.2: Iterating through arrays in code.
Lab Notes: Good practice to show you how to loop. Up and down max down to up changing numbers in an array from negative to possitive and more at the beginning...
5) Would numerous changes to the program be needed to sum 5000 numbers rather than 5? Type yes or no.
Quiz I got this wrong.
Assign tempVal with the myVals array element at the index one after the value held in variable i
Quiz- IMPORTNAT Keep note of how they word the problem because it makes a difference..
Which is a valid assignment? Assume x is an integer variable. itemCounts = x x = itemCounts + 1 x = itemCounts[2] + 1
Lab Notes Keep note of this just incase you need it on the Labs..
5.2.7: Arrays and loops
LAB NOTES : Might be useful in a lab..
Which item should be changed to allow the user to enter 100 values? integer array(5) userVals i = i + 1
Lab Notes: I believe this is how you declare an array at the beginning..
Goal: Loop numYears times (numYears is an integer variable)
Because i starts at 0, then < must be used, not <=.
4.8.1: While loops.
I got all of these wrong because I was not carful to follow the numbers and especially what happens when the loop exits or does not enter the body.
e first iteration
Tricky confusion: The probably is referring to the while loop iteration. I do not like how it didn't make it clearer within the problem.
How many loop iterations will the algorithm execute?
I got this wrong because I did not follow the numbers correctly. Draw out everything.
4.7.1: Nested loops.
This last part was annoying. It was difficult to follow the numbers.
4.4.2: Looping N times.
I got all of these wrong.. study before taking quiz
Suppose the first input was 0. Would (1.0 * valuesSum / numValues) be 0? Yes No
answer == no Why? valuesSum and numValues would both be 0. valueSum is multiplied by 1.0, converting from integer to float. numValues is then implicitly converted to float. 0.0 / 0.0 results in a "not a number", as 0.0 / 0.0 is mathematically undefined.
Suppose the first input was 0. Would (1.0 * valuesSum / numValues) be 0? Yes No
end value = "not a number" undefined.. 0.00/0.00
4.3.2: GCD program.
This section was a bit tricky...
Iterate until cVal equals 15 (tricky; think carefully).
I got this wrong..
cVal != 15
At the end of the loop body, the _____. next input is gotten loop is exited average is computed
I do not like this explination.
When the input is -3 0, which branch executes? If Else
This assumes y= 0....Keep tricky note
ny value of userAge, do the two output statements always execute?
This is worded weird, but I can follow their train of thought. Review.
Complete the comparison for floating-point numbers.
I did not understand any of these..
Determine if float variable x is 98.6.
I do not understand their logic.
AbsoluteValue (x - y)
I got this wrong..
Given: float x x == 32 is OK. True False
I go tthis incorrect
Which operator is evaluated first?
I got this wrong
<= 10 11..20 21..5
I got this wrong. Look at 11..20. This means 11-20
500-599 are pay channels. Does this expression correctly detect the pay channel range? (userChannel >= 500) or (userChannel <= 599) Yes No
I got this incorrect because of the and and or
wage is greater than 10 or age is less than 18. Use or. Use >, < (rather than >=, <=).
I got this wrong
ich detects if x is in the range -4 to +4? (x < -5) and (x < 5) (x > -5) or (x < 5) (x > -5) and (x < 5) Correct The first expression checks that x is above -5 (so -4, -3, ...). The second checks that x is below 5 (so 4, 3, ...). and'ing yields -4, -3, ..., 3, 4. 3) Which de
Not here that there is a difference between and and or
3.4.1: Decision sequence to detect increasing ranges.
I do not get this, redo
Range for x = 4
I got this wrong
3.4.4: Using if-elseif for ranges: Insurance prices. fullscreen
I understand this
Range for x = 4
I got this wrong.
3.4.3: More ranges with a decision sequence.
I DO NOT UNDERSTAND THIS SECTION
centsLost is a negative number
I got this wrong
: Implicit conversions among float and integer
Remember this
2.10.1: Integer division.
Remember to check if the variable starts as an integer or a float. It makes a difference.
2.10.1: Integer division does not generate any fraction.
Do these before the quiz.
2.9.8: Seeding a pseudo-random number generator.
DO ALL OF THESE BEFORE THE QUIZ TO KEEP IT FRESH.
2.8.1: Math functions.
IMPORTANT! to note that x starts as a float. Therefore, the final answer will end as: 0.0 format
0.0 / 5.0 0.0 Positive infinity Negative infinity
This was tricky. Take note that it was a 0 number/ a whole number