debugging Show
Idea’algorith- m’write code’execute code’debug’main- tain
Find out from the businesses and potential visitors what information and format they think should be used for the app
Language B is am- biguous because the process of "av- erage" is not ex- plained well
If the last digit of the value found in step 6 is 5, then the sum is odd Step 1: Using a random number generator, get a value between 1 - 6 inclusively Step 2: Remember that num- ber Step 3: Repeat steps 1 and 2 Step 4: Add the two remembered numbers together Step 5: Multiply that sum by 10 Step 6: Divide the result of that multiplica- tion by 2 What conclusions can be made with regard to what we are trying to determine? Select two answers: If the value found in step 6 is 10, 20, 30, 40, 50 or 60 then the sum is even
1,
The syntax of arti- ficial languages is explicit and unam- biguous
They are not very ambiguous
RANDOM(a,b) * 2
RAMof error may be oc- curring. Add statements to display the state of the program at var- ious points to try and identify where the error might have occurred.
Variables assist in making code more readable, Variables allow you to store values calculated by the program and ac- cess them at a lat- er point in the pro- gram, Variables al- low you to change a value used in multiple places in a program easily.
The program will be easier for oth- ers to debug, The program will be easier to read.
The answer dis- played by the al- gorithm for any known value of n can always be pre- dicted Which of the following statements best describes the predictability of the results when this algorithm is run on a computer?
A programmer will find it easier to read and under- stand the code since they will know what the variables repre- sent.
Use concise names to avoid ty- pos and keep code tidier, Use names which describe what each vari- able represents to make code easier to understand
none of these
boolean (true/false)
Pseudocode displays a fruit that begins with Z. Use 26 IF blocks formatted similarly to the one above (changing the let- ters of the alpha- bet and fruits).
Which 2 lines of code in the segment above must be switched in order for the program to correctly move a robot from the starting position to the ending posi- tion? Select two answers. line 5 and line 7
Line 1: IF (b ` 0) Line 2: { Line 3: a • a/b Line 4: } Line 5: ELSE Line 6: { Line 7: a • a*b Line 8: } Changing line 7 to a • 0 Which of the following changes will NOT affect the results when the code segment is executed?
(value MOD 5) = 0
What outputs would be the best choice to substitute in for "missing output 1" and "missing output 2", based on the condition? missing output 1: value does not equal 4 missing output 2: value is equal to 4
facing left
march
odd_counter> [move_forward] For which of the following grids will the code correctly navigate the robot to a final destination of the grey square and then terminate?
REPEAT UNTIL (x mod 2 = 1) { x • x + 3 } Assume that x is initially 6. How many times will the loop iterate? 1
6
The word HI could be displayed 1, 2, 3, 4, 5, 6, 7, 8, 9, or 10 times
a • 0 REPEAT UNTIL (<missing statement>) { a • a + 1 } a > 10
-} x • x * (-1) } DISPLAY x When the code above is run, what will be the final value of the variable x, displayed at the end of the program?
Level 8 Level 9 Cannot go up. Lev- el 9
Choose meaning- ful names for all variables and pro- cedures. Include comments detailing the pur- pose and behav- ior of variables and procedures
PROCEDURE MYSTERY (number) IS_POS_INTflavors alphabetically while Olaf suggests that they organize the flavors in order from his favorite to his least favorite. Which of the following solutions would allow these ice cream peddlers to find the customers' chosen flavors the most efficiently?
When the prob- lem cannot be ac- curately solved in a reasonable time and an approxi- mate solution is acceptable.
The condition of the loop never be- comes false
execution time memory usage size of program
The output will be true if input D is true, and false oth- erwise.
The direction of travel for an eleva- tor
Which is the best song new song from last year?
All real numbers within a finite interval can be expressed by a 32-bit integer rep- resentation.
1001110
50, 20
2^
4
The output will be 4
i • 1 REPEAT n TIMES { i • i + 1 } The teacher has the following procedures available. min (a, b): Returns the lesser of the two values a and b max (a, b): Returns the greater of the two values a and b Which of the following code segments can replace so that the program works as intended? Select two answers. gradeList [i] • gradeList[i] + 5 IF (gradeList [i] > 100) { gradeList [i] • 100 } gradeList [i] • min (gradeList[i] + 5, 100)
selection
Temp • LN LN • FN FN • Temp
You have an even amount of items in your list! 68. GROCER <---MILK EGGS CHEESEanswer<--- yes Repeat Until (awnser=/ yes) DISPLAY [ ADD AN ITEM] item <--- input insert [grocery,2,item] DISPLAY [add an item?' answer <---- input While running this code segment, the user enters the following values when prompted: pizza yes bread no. What is stored in the list called grocery after the block of code is executed? milk, bread, pizza, eggs, cheese
FOR EACH item IN oldList { IF (NOT IsPartOf (newList, item)) { APPEND (newList, item) } } Which of the following best describes the contents of newList after the code segment is executed? All unique ele- ments in oldList NOT including any repeats of ele- ments.
finalList, will con- tain all the words found in list1 and list2 in alphabet- ical order, but it may contain re- peated words. What are two advantages of using well named variables?Which of the following are benefits of well-named variables? -The program will be easier to read. -The program will be easier for others to debug.
Which of the following is a reason for the importance of variables in programming quizlet?Variables assist in making code more readable, Variables allow you to store values calculated by the program and access them at a later point in the program, Variables allow you to change a value used in multiple places in a program easily.
Which of the following describes good practice when naming variables in code select two answers?Use concise names to avoid typos and keep code tidier. Use names which describe what each variable represents to make code easier to understand.
Which of the following statements best describes the predictability of the results when this algorithm is run on a computer group of answer choices?Which of the following statements best describes the predictability of the results when this algorithm is run on a computer? The answer displayed by the algorithm for any known value of n can always be predicted.
|