Question: 66The question below uses a robot in a grid of squares. The robot is represented by a triangle, which isinitially at the bottom-left square of the grid facing toward the right of the grid. The robot can move into awhite or gray square, but cannot move into a black region.The goal is to move the robot in a grid to a gray square.Consider the example grid above. Assuming our code segment needs to work when the gray square isanywhere in the top row, which of the following code segments will always get the robot to the graysquare?REPEAT UNTIL (CAN_MOVE (left)){MOVE_FORWARD ()}ROTATE_LEFT ()MOVE_FORWARD ()This is the correct answer because when followed it moves the robot to thegray square. Show
Consider the code segment below. You can assume thatInput_List_From_Userasks the user for severalvalues and returns them as a list.inputList ←Input_List_From_User()resultList ← []FOR EACH itemininputList{APPEND (resultList,Mystery(item))}Based on the code segment, how would you best describe the value ofresultList? Question: 73Assume we have an algorithm used to simulate the results of flipping a coinntimes. Two variables used forthe algorithm areheads_counter, storing the number of heads we’ve had, andflip_counter, storing thenumber of flips we’ve made. We want to add on to the algorithm so that at the end we display whetherthere were an odd or even number of tails.Here are two algorithms that display whether we have an even or odd number of tails:Algorithm A: Set the value ofnum_tailsto(flip_counter - heads_counter). If the value ofnum_tailsMOD 2is equal to 0,DISPLAY ("Even"), otherwiseDISPLAY ("ODD")Algorithm B: Set the value ofeven_flipsto(n MOD 2) = 0and set the value ofeven_heads(heads_counter MOD 2) = 0. Ifeven_flipsis equal toeven_headsthenDISPLAY ("EVEN"), otherwiseDISPLAY ("ODD").Both Algorithm A and Algorithm B always calculate the correct answer isthe right answer because display either even or odd..to Newly uploaded documentsThe following questions make up Set #4 of the Practice Exam Questions. These questions are designed to be similar to those on the AP CSP exam. You should finish these questions within 17 minutes to stay on track with the timing of the actual exam. During the actual exam, you will be provided with the AP CS Reference Sheet, which can be found
here. Click the “Start” button when you are ready to begin the exam. Click the “Pause” button to pause the exam (you will not be able to see the questions when the exam is paused). It will show how much time you have used, but you have unlimited time. Click on the “Finish Exam” button at the end when you are done. The number correct, number wrong, and number skipped will be displayed at the bottom of the page. Feedback for each answer will also be shown as well as your answer. You will not be able to change your answers after you hit the “Finish Exam” button.
24-4-1: The Domain Name System (DNS) is analogous to: 24-4-2: Suppose you are writing a program to accept two integers as input, divide them and return the answer. You decide to use a 64-bit floating-point variable in your program to store the calculated answer and your friend decides to use a 32-bit floating-point variable in his program to store the calculated answer. Assume that the two programs are identical in all other aspects and that the user will never attempt to divide by 0. Then, which of the following statements comparing the answers calculated by the two programs is true? 24-4-3: ASCII is a character-encoding scheme that uses numeric values to represent alphanumeric and special characters. For example, the uppercase letter ‘A’ is represented by the decimal (base 10) value 65. A partial list of characters and their corresponding ASCII values are shown in the table below. ASCII characters can also be represented by octal numbers (base 8). To represent an entire word using octal numbers, we can find the octal value for each letter in the word and then concatenate the values. According to the information provided above, which English word do the following octal numbers represent: 102 117 107 24-4-4: Which of the following is an important part of data analysis?
For which of the following goals would it be more useful to analyze the data instead of the metadata? 24-4-6: A red triangle is pictured below in a grid of squares. It is currently facing upward, and can only move using the MoveTriangle procedure, shown below. The triangle can move onto white and gray squares, but not onto the black squares. PROCEDURE MoveTriangle (numMoves, numTurns) { REPEAT numMoves TIMES { MOVE_FORWARD() } REPEAT numTurns TIMES { TURN_RIGHT() } } Which of the following instructions will get the red triangle to the gray square? (A) MoveTriangle (1, 1) MoveTriangle (1, 1) MoveTriangle (3, 1) MoveTriangle (3, 0) (B) MoveTriangle (4, 1) MoveTriangle (4, 0) (C) MoveTriangle (1, 1) MoveTriangle (1, 3) MoveTriangle (3, 1) MoveTriangle (3, 0) (D) MoveTriangle (1, 1) MoveTriangle (1, 3) MoveTriangle (3, 3) MoveTriangle (3, 0) 24-4-7: A teacher wants to give extra credit to those students in her class who did an extra project and volunteered for community service. She creates a list Look at the incomplete code for the procedure PROCEDURE createExtraCreditList(extraProjectStudents, volunteerServiceStudents) { extraCreditStudents ← [ ] FOR EACH student IN extraProjectStudents { <MISSING CODE> } RETURN extraCreditStudents } Which of the answer choices should replace You may use a procedure (A) IF (contains (volunteerServiceStudents, student)) { APPEND (extraCreditStudents, student) } (B) IF (contains (extraCreditStudents, student)) { APPEND (volunteerServiceStudents, student) } (C) IF (contains (extraProjectStudents, student)) { APPEND (extraCreditStudents, student) } (D) IF (contains (volunteerServiceStudents, student)) { APPEND (extraProjectStudents, student) }
24-4-8: Efficiency of algorithms is most often analyzed based on which of the following characteristics?
24-4-9: A student purchases a single-user license of an online textbook and wants to share the textbook with their classmates. Under what conditions is it acceptable for the student to share this textbook? 24-4-10: The code segment below moves a robot through a maze, with the objective of reaching the gray square. The robot in each grid is represented as a red triangle and is initially facing upwards. The robot can move onto white and gray squares, but not onto the black squares. The procedure REPEAT UNTIL (goalReached ()) { IF (CAN_MOVE (forward)) { MOVE_FORWARD () } IF (CAN_MOVE (left)) { ROTATE_LEFT () } IF (CAN_MOVE (right)) { ROTATE_RIGHT () } } For which of the following grids does the program NOT correctly move the triangle to the gray square? You have attempted of activities on this page Which of the following is a key factor in determining the efficiency of an algorithm?Time and space complexity are the two main measures for calculating algorithm efficiency, determining how many resources are needed on a machine to process it.
Which of the following is a true statement about the student's use of the computer scientist's search procedure?Which of the following is a true statement about the student's use of the computer scientist's search procedure? The student is reusing the computer scientist's procedural abstraction by knowing what the procedure does without knowing how it does it.
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.
What are the values of first and second as a result of executing the code segment?What are the values of first and second as a result of executing the code segment? The value of first is true, and the value of second is true.
|