Which of the following are benefits of procedural abstraction? Select two answers.
Blog
A computer program contains code in several places that asks…
A computer program contains code in several places that asks a user to enter an integer within a specified range of values. The code repeats the input request if the value that the user enters is not within the specified range. A programmer would like to create a procedure that will generalize this functionality and can be used throughout the program. The correct use of the procedure is shown below, where min is the least acceptable value, max is the greatest acceptable value, and promptString is the string that should be printed to prompt the user enter a value. inputVal getRange(min, max, promptString) Which of the following is a correct implementation of the getRange procedure?
Which of the following procedures would be most useful as pa…
Which of the following procedures would be most useful as part of a program to determine whether a word appears in two different text files?
What should you use in your block command(s) to change the l…
What should you use in your block command(s) to change the location of a sprite on the stage in Sprite?
The flowchart symbol for processing (taking action) is:
The flowchart symbol for processing (taking action) is:
The following grid contains a robot represented as a triangl…
The following grid contains a robot represented as a triangle, which is initially in the bottom-left square of the grid and facing the top of the grid. The robot can move into a white or a gray square but cannot move into a black region. The robot is represented by a triangle, which is located in the bottom leftmost square and is initially facing upward. Black squares represent barriers that the robot cannot pass through. The first row contains black shading in the first, second, third, and fourth squares from the left and gray shading in the fifth square from the left. The second row contains black shading in the first, second, third, and fourth squares from the left. The fourth row contains black shading in the second, third, fourth, and fifth squares from the left. The fifth row contains black shading in the second, third, fourth and fifth squares from the left. The following code segment implements an algorithm that moves the robot from its initial position to the gray square and facing the top of the grid. Throughout the first, third, and fifth blocks of code are nested blocks of code. [begin block] Line 1: REPEAT 2 TIMES [begin block] Line 2: [begin block] MOVE_FORWARD [end block] [end block] [end block] Line 3: [begin block] ROTATE_RIGHT [end block] [begin block] Line 4: REPEAT 4 TIMES [begin block] Line 5: [begin block] MOVE_FORWARD [end block] [end block] [end block] Line 6: [begin block] ROTATE_LEFT [end block] [begin block] Line 7: REPEAT 2 TIMES [begin block] Line 8: [begin block] MOVE_FORWARD [end block] [end block] [end block] When the robot reaches the gray square, it turns around and faces the bottom of the grid. Which of the following changes, if any, should be made to the code segment to move the robot back to its original position in the bottom-left square of the grid and facing toward the bottom of the grid?
For each ‘1’ digit in the binary number (bold), add the numb…
For each ‘1’ digit in the binary number (bold), add the number at the top of the column to convert to decimal. What is the equivalent decimal number? Binary to Base 10 Conversion Table Powers of 2 row 128 64 32 16 8 4 2 1 Binary number 0 1 0 1 0 1
In computational thinking, identifying patterns within the p…
In computational thinking, identifying patterns within the parts that can be re-worked within a function is
To display the square of a number in a flowchart, put the st…
To display the square of a number in a flowchart, put the statement “Print square of number” in a/an:
Consider the code segment below. What is the output of the p…
Consider the code segment below. What is the output of the program? x1 ← x2 ← x3 ← NOT (x1 AND x2)x4 ← NOT (x1) OR NOT (x2)DISPLAY (x3)DISPLAY (x4)