AP CSP - UNIT 7
In the following procedure, the parameter str is a string and the parameter num is a number. PROCEDURE printArgs(str, num) { DISPLAY(num) DISPLAY(str) DISPLAY(num) } Consider the following code segment. printArgs("**", 1) printArgs("*", 2) What is displayed as a result of executing the code segment? A 1 * 1 2 ** 2 B 1 ** 1 2 * 2 C * 1 * ** 2 ** D ** 1 ** * 2 *
1 ** 1 2 * 2
Consider the following procedure. PROCEDURE doSomething(num1, num2) { DISPLAY(num1) RETURN(num1) DISPLAY(num2) } Consider the following statement. DISPLAY(doSomething(10, 20)) What is displayed as a result of executing the statement above? A 10 10 B 10 20 C 10 10 20 D 10 20 10
10 10
A student is writing a program that is intended to replace each negative value in a particular column of a spreadsheet with the value 0. Which of the following procedures is most likely to be useful in the student's program? A A procedure containsNegatives, which returns true if any negative values appear in the column and returns false otherwise. B A procedure countNegatives, which returns the number of negative values that appear in the column. C A procedure findNegative, which returns the row number of the first negative value that appears in the column or -1 if there are no negative values. D A procedure minimum, which returns the minimum value that appears in the column.
A procedure findNegative, which returns the row number of the first negative value that appears in the column or -1 if there are no negative values.
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? A A procedure getWords, which takes a positive integer n and a text file as input and returns the first n words in the text file. B A procedure isFound, which takes a word and a text file as input and returns true if the word appears in the text file C A procedure textMatch, which takes two text files as input and returns true if the two text files are identical. D A procedure sameSize, which takes two text files as input and returns true if the two text files contain the same number of words.
A procedure isFound, which takes a word and a text file as input and returns true if the word appears in the text file
A student has a data file containing 10,000 numerical values. The student is writing a program to compute the average of the numbers contained in the file. Which of the following procedures is most likely to be useful in the student's program? A A procedure that returns the quotient when dividing one value by another B A procedure that returns the sum when adding one value to another C A procedure that returns the sum of the values in the file D A procedure that returns true if the file contains any duplicate values and returns false otherwise
A procedure that returns the sum of the values in the file
Which of the following code segments will move the robot to the gray square along the path indicated by the arrows? A BotMover 1 BotMover 1 BotMover 0 B BotMover 1 BotMover 2 BotMover 3 C BotMover 1 BotMover 3 BotMover 0 D BotMover 3 BotMover 1 BotMover 0
BotMover 1 BotMover 3 BotMover 0
A program contains the following procedures for string manipulation. Which of the following expressions can be used to generate the string "Happy" ? A Concat (Substring ("Harp", 1, 1), Substring ("Puppy", 2 , 4)) B Concat (Substring ("Harp", 1, 2), Substring ("Puppy", 3 , 3)) C Concat (Substring ("Harp", 1, 2), Substring ("Puppy", 4 , 2)) D Concat (Substring ("Harp", 2, 2), Substring ("Puppy", 4 , 2))
Concat (Substring ("Harp", 1, 2), Substring ("Puppy", 3 , 3))
The following code segment is intended to draw the figure. startX ←← 2 startY ←← 6 endX ←← 8 endY ←← 8 REPEAT 4 TIMES { <MISSING CODE> } Which of the following can be used to replace <MISSING CODE> so that the figure is drawn correctly? A DrawLine (startX, startY, endX, endY) endY ←← endY - 2 B DrawLine (startX, startY, endX, endY) endX ←← endX - 2 endY ←← endY - 2 C endY ←← endY - 2 DrawLine (startX, startY, endX, endY) D endX ←← endX - 2 endY ←← endY - 2 DrawLine (startX, startY, endX, endY)
DrawLine (startX, startY, endX, endY) endY ←← endY - 2
A student wrote the following procedure to calculate the sum of the integers from 1 to 5. The student later decides to modify the procedure to calculate the sum of the integers from 1 to max, which represents any positive integer greater than 1. Which of the following changes should be made to the procedure to meet the student's goal? The procedure should take max as an input parameter. The condition in the REPEAT UNTIL block should be changed to count > max. The condition in the REPEAT UNTIL block should be changed to max < 5. A I only B II only C I and II D I and III
I and II
Let an original file name be stored in the string variable original. Which of the following statements will correctly extract the description and store it in the string variable descr ? descr ←← TrimLeft (TrimRight (original, 4), 11) descr ←← TrimLeft (TrimRight (original, 11), 4) descr ←← TrimRight (TrimLeft (original, 11), 4) A I only B II only C I and III D II and III
I and III
In the following procedure, the parameter age represents a person's age. The procedure is intended to return the name of the age group associated with age. People who are under 18 are considered minors, people who are 65 and older are considered senior citizens, and all other people are considered adults. The procedure does not work as intended. Line 1: PROCEDURE ageGroup(age) Line 2: { Line 3: result ←← "adult" Line 4: IF(age ≥ 65) Line 5: { Line 6: result ←← "senior citizen" Line 7: } Line 8: RETURN(result) Line 9: Line 10: result ←← "adult" Line 11: IF(age < 18) Line 12: { Line 13: result ←← "minor" Line 14: } Line 15: RETURN(result) Line 16: } Removing which two lines of code will cause the procedure to work as intended? Select two answers. A Line 3 B Line 8 C Line 10 D Line 15
Line 8 Line 10
A list of numbers is considered increasing if each value after the first is greater than or equal to the preceding value. The following procedure is intended to return true if numberList is increasing and return false otherwise. Assume that numberList contains at least two elements. Line 1: PROCEDURE isIncreasing(numberList) Line 2: { Line 3: count ←← 2 Line 4: REPEAT UNTIL(count > LENGTH(numberList)) Line 5: { Line 6: IF(numberList[count] < numberList[count - 1]) Line 7: { Line 8: RETURN(true) Line 9: } Line 10: count ←← count + 1 Line 11: } Line 12: RETURN(false) Line 13: } Which of the following changes is needed for the program to work as intended? A In line 3, 2 should be changed to 1. B In line 6, < should be changed to ≥. C Lines 8 and 12 should be interchanged. D Lines 10 and 11 should be interchanged.
Lines 8 and 12 should be interchanged.
A computer science student completes a program and asks a classmate for feedback. The classmate suggests rewriting some of the code to include more procedural abstraction. Which of the following is NOT a benefit of procedural abstraction? A Making the code more readable B Making the code run faster C Providing more opportunities for code reuse D Reducing the amount of duplicated code
Making the code run faster
An application program interface (API) provides a procedure Max, which returns the greater of its two integer arguments. A programmer would like to find the greatest of three integer values , , and . Which of the following expressions will produce the desired result in every case? A Max(Max (a, b), c) B Max (a, b) - Max (b, c) C Max (a, b) + Mx (b, c) - Max (a, c) D (Max (a, b) + Max (b, c) / 2
Max(Max (a, b), c)
Which of the following code segments will move the robot to the gray square? A MoveAndTurn 1, 2 MoveAndTurn 3, 4 MoveAndTurn 0, 2 B MoveAndTurn 2, 1 MoveAndTurn 4, 1 MoveAndTurn 2, 0 C MoveAndTurn 2, 1 MoveAndTurn 4, 3 MoveAndTurn 2, 0 D MoveAndTurn 3, 1 MoveAndTurn 5, 3 MoveAndTurn 3, 0
MoveAndTurn 2, 1 MoveAndTurn 4, 3 MoveAndTurn 2, 0
Which of the following code segments will move the robot to the gray square? A MoveXTimes 2 RightXTimes 1 MoveXTimes 3 B MoveXTimes 2 RightXTimes 3 MoveXTimes 3 C MoveXTimes 3 RightXTimes 1 MoveXTimes 3 D MoveXTimes 3 RightXTimes 3 MoveXTimes 3
MoveXTimes 2 RightXTimes 3 MoveXTimes 3
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? A PROCEDURE getRange(min, max, promptString) { DISPLAY(promptString) RETURN(INPUT()) } B PROCEDURE getRange(min, max, promptString) { DISPLAY(promptString) x ←← INPUT() RETURN(x) } C PROCEDURE getRange(min, max, promptString) { DISPLAY(promptString) x ←← INPUT() REPEAT UNTIL(x ≥ min AND x ≤ max) { DISPLAY(promptString) x ←← INPUT() } } D PROCEDURE getRange(min, max, promptString) { DISPLAY(promptString) x ←← INPUT() REPEAT UNTIL(x ≥ min AND x ≤ max) { DISPLAY(promptString) x ←← INPUT() } RETURN(x) }
PROCEDURE getRange(min, max, promptString) { DISPLAY(promptString) x ←← INPUT() REPEAT UNTIL(x ≥ min AND x ≤ max) { DISPLAY(promptString) x ←← INPUT() } RETURN(x) }
A game program contains the following code to update three score variables, health, food, and knowledge. The maximum values for the three variables are 100, 80, and 25, respectively. health ←← health + 10 IF(health > 100) { health ←← 100 } food ←← food + 1 IF(food > 80) { food ←← 80 } knowledge ←← knowledge + 5 IF(knowledge > 25) { knowledge ←← 25 } The game program's author would like to write a procedure that could be used to update any variable in the game (myScore) that has a maximum value (myLimit) by a given amount (myAmount). A correct call of the procedure is shown below. myScore ←← updateScore(myScore, myAmount, myLimit) Which of the following is a correct implementation of updateScore ? A PROCEDURE updateScore(score, amount, limit) { score ←← score + amount IF (score > limit) { score ←← limit } } B PROCEDURE updateScore(score, amount, limit) { score ←← score + amount IF(score > amount) { score ←← limit } RETURN(limit) } C PROCEDURE updateScore(score, amount, limit) { score ←← score + amount IF(score > limit) { score ←← limit } RETURN(score) } D PROCEDURE updateScore(score, amount, limit) { IF(score = health) { score ←← score + 10 } IF(score = food) { score ←← score + 1 } IF(score = knowledge) { score ←← score + 5 } IF(score > limit) { score ←← limit } }
PROCEDURE updateScore(score, amount, limit) { score ←← score + amount IF(score > limit) { score ←← limit } RETURN(score) }
Which of the following are benefits of procedural abstraction? Select two answers. A Procedural abstraction prevents programmers from accidentally using the intellectual property of other programmers. B Procedural abstraction eliminates the need for programmers to document their code. C Procedural abstraction makes it easier for people to read computer programs. D Procedural abstraction provides an opportunity to give a name to a block of code that describes the purpose of the code block.
Procedural abstraction makes it easier for people to read computer programs. Procedural abstraction provides an opportunity to give a name to a block of code that describes the purpose of the code block.
A programmer notices the following two procedures in a library. The procedures do similar, but not identical, things. Procedure returns the value . Procedure returns the value . Which of the following procedures is a generalization of the procedures described above? A Procedure , which returns the value n + m B Procedure , which returns the value n^4 C Procedure , which returns the value n^3 + n^2 D Procedure , which returns the value n^m
Procedure , which returns the value n^m
A programmer notices the following two procedures in a library. The procedures do similar, but not identical, things. Procedure MaxTwo (x, y) returns the greater of its two integer parameters. Procedure MaxThree (x, y, z) returns the greatest of its three integer parameters. Which of the following procedures is a generalization of the MaxTwo and MaxThree procedures? A Procedure Min (x, y), which returns the lesser of its two integer parameters B Procedure Max (numList), which returns the maximum value in the list of integers numList C Procedure MaxFour (w, x, y, z), which returns the greatest of its four integer parameters D Procedure OverMax (numList, max), which returns the number of integers in numList that exceed the integer value max
Procedure Max (numList), which returns the maximum value in the list of integers numList
Directions: For the question or incomplete statement below, two of the suggested answers are correct. For this question, you must select both correct choices to earn credit. No partial credit will be earned if only one correct choice is selected. Select the two that are best in each case. Which of the following are ways in which a programmer can use abstraction to manage the complexity of a program? Select two answers. A Replacing each instance of repeated code with a call to a procedure B Replacing longer variable names with shorter variable names to reduce typing errors C Replacing several lines of documentation with a single line of documentation D Replacing several lines of documentation with a single line of documentation name1, name2, name 3, and with a list of strings called names
Replacing each instance of repeated code with a call to a procedure Replacing several lines of documentation with a single line of documentation name1, name2, name 3, and with a list of strings called names
A student wrote the procedure below, which is intended to ask whether a user wants to keep playing a game. The procedure does not work as intended. Which of the following best describes the result of running the procedure? A The procedure returns TRUE when the user inputs the value and returns FALSE otherwise. B The procedure returns TRUE when the user inputs the value "n" and returns FALSE otherwise. C The procedure returns TRUE no matter what the input value is. D The procedure returns FALSE no matter what the input value is.
The procedure returns FALSE no matter what the input value is.
In the procedure Mystery below, the parameter number is a positive integer. Which of the following best describes the result of running the procedure Mystery? A The procedure returns true when the initial value of number is 2, and it otherwise returns false. B The procedure returns true when the initial value of number is greater than 2, and it otherwise returns false. C The procedure returns true when the initial value of number is even, and it otherwise returns false. D The procedure returns true when the initial value of number is odd, and it otherwise returns false.
The procedure returns true when the initial value of number is even, and it otherwise returns false.
A student is developing a program that allows users to look up the definitions of words that appear in a book. The student plans to perform a large number of searches through a dictionary containing words and their definitions. The student will use a procedure written by a computer scientist to quickly search the dictionary (and knows that the procedure will return a definition if one is available). The student cannot modify the search procedure written by the computer scientist but can call the procedure by supplying a word. Which of the following is a true statement about the student's use of the computer scientist's search procedure? A The student is changing the search procedure's internal abstractions. B The student is modifying the search procedure to take a definition as an argument and return the corresponding word. C The student is reusing the computer scientist's procedural abstraction by knowing what the procedure does without knowing how it does it. D The student is reusing the computer scientist's procedural abstraction by using duplicate code each time a search needs to occur.
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 code segments will move the robot to the gray square along the path indicated by the arrows? A botStepper 2 botStepper 3 B botStepper 3 botStepper 4 C botStepper 2 Move_Forward botStepper 3 D botStepper 3 Move_Forward botStepper 4
botStepper 2 Move_Forward botStepper 3
Let the value of the variable x be 2, the value of the variable y be 2, and the value of the variable r be 1. Which of the following code segments can be used to draw the figure? A drawCircle(x, y, r) drawCircle(x, y + 2, r) drawCircle(x + 2, y, r) drawCircle(x + 2, y + 2, r) B drawCircle(x, y, r) drawCircle(x, y + 3, r) drawCircle(x + 3, y, r) drawCircle(x + 3, y + 3, r) C drawCircle(x, y, r + 2) drawCircle(x, y + 2, r + 2) drawCircle(x + 2, y, r + 2) drawCircle(x + 2, y + 2, r + 2) D drawCircle(x, y, r + 3) drawCircle(x, y + 3, r + 3) drawCircle(x + 3, y, r + 3) drawCircle(x + 3, y + 3, r + 3)
drawCircle(x, y, r) drawCircle(x, y + 3, r) drawCircle(x + 3, y, r) drawCircle(x + 3, y + 3, r)
Let the value of the variable xVal be 6 and the value of the variable yVal be 5. Which of the following code segments can be used to draw the figure? A drawLine(1, 5, xVal, yVal) drawline(1, 5, xVal, yVal + 2) drawline(1, 5, xVal, yVal + 2) B drawLine(1, 5, xVal, yVal) drawline(1, 5, xVal, yVal + 2) drawline(1, 5, xVal, yVal - 2) C drawLine(1, 5, xVal, yVal) drawline(1, 5, xVal + 2, yVal + 2) drawline(1, 5, xVal + 2, yVal - 2) D drawLine(1, 5, xVal, yVal) drawline(1, 5, xVal + 2, yVal + 2) drawline(1, 5, xVal - 2, yVal - 2)
drawLine(1, 5, xVal, yVal) drawline(1, 5, xVal, yVal + 2) drawline(1, 5, xVal, yVal - 2)
A student's overall course grade in a certain class is based on the student's scores on individual assignments. The course grade is calculated by dropping the student's lowest individual assignment score and averaging the remaining scores. For example, if a particular student has individual assignment scores of 85, 75, 90, and 95, the lowest score (75) is dropped. The calculated course grade is (85+90+95)/3=90(85+90+95)/3=90. A programmer is writing a program to calculate a student's course grade using the process described. The programmer has the following procedures available. The student's individual assignment scores are stored in the list scores. Which of the following can be used to calculate a student's course grade and store the result in the variable finalGrade? A finalGrade ←← Sum (scores) / LENGTH (scores) finalGrade ←← finalGrade - Min (scores) B finalGrade ←← Sum (scores) / (LENGTH (scores) - 1) finalGrade ←← finalGrade - Min (scores) C finalGrade ←← Sum (scores) - Min (scores) finalGrade ←← finalGrade / LENGTH (scores) D finalGrade ←← Sum (scores) - Min (scores) finalGrade ←← finalGrade / (LENGTH (scores) - 1)
finalGrade ←← Sum (scores) - Min (scores) finalGrade ←← finalGrade / (LENGTH (scores) - 1)
A programmer wants to create a new string by removing the character in position n of the string oldStr. For example, if oldStr is "best" and n is 3, then the new string should be "bet". Assume that 1 < n < len(oldStr). Which of the following code segments can be used to create the desired new string and store it in newStr ? Select two answers. A left ←← substring(oldStr, 1, n - 1) right ←← substring(oldStr, n + 1, len(oldStr)) newStr ←← concat(left, right) B left ←← substring(oldStr, 1, n + 1) right ←← substring(oldStr, n - 1, len(oldStr)) newStr ←← concat(left, right) C newStr ←← substring(oldStr, 1, n - 1) newStr ←← concat(newStr, substring(oldStr, n + 1, len(oldStr))) D newStr ←← substring(oldStr, n + 1, len(oldStr)) newStr ←← concat(newStr, substring(oldStr, 1, n - 1))
left ←← substring(oldStr, 1, n - 1) right ←← substring(oldStr, n + 1, len(oldStr)) newStr ←← concat(left, right) newStr ←← substring(oldStr, 1, n - 1) newStr ←← concat(newStr, substring(oldStr, n + 1, len(oldStr)))
Consider two lists of numbers called list1 and list2. A programmer wants to determine how many different values appear in both lists. For example, if list1 contains [10, 10, 20, 30, 40, 50, 60] and list2 contains [20, 20, 40, 60, 80], then there are three different values that appear in both lists (20, 40, and 60). The programmer has the following procedures available. Which of the following can be used to assign the intended value to count ? A bothList ←← Combine (list1, list2) uniqueList ←← RemoveAllDups (bothList) count ←← LENGTH (bothList) - LENGTH (uniqueList) B newList1 ←← RemoveAllDups (list1) newList2 ←← RemoveAllDups (list2) bothList ←← Combine (newList1, newList2) count ←← LENGTH (list1) + LENGTH (list2) - LENGTH (bothList) C newList1 ←← RemoveAllDups (list1) newList2 ←← RemoveAllDups (list2) bothList ←← Combine (newList1, newList2) count ←← LENGTH (newList1) + LENGTH (newList2) - LENGTH (bothList) D newList1 ←← RemoveAllDups (list1) newList2 ←← RemoveAllDups (list2) bothList ←← Combine (newList1, newList2) uniqueList ←← RemoveAllDups (bothList) count ←← LENGTH (bothList) - LENGTH (uniqueList)
newList1 ←← RemoveAllDups (list1) newList2 ←← RemoveAllDups (list2) bothList ←← Combine (newList1, newList2) uniqueList ←← RemoveAllDups (bothList) count ←← LENGTH (bothList) - LENGTH (uniqueList)
The device is positioned at the upper-left corner of a sheet of paper and is facing right. Which of the following code segments will produce the drawing shown? A penDown() goForward(10) turnRight(90) goForward(10) turnRight(90) goForward(10) B penDown() goForward(10) penUp() turnRight(90) turnRight(90) penDown() goForward(10) C penDown() goForward(10) turnRight(90) penUp() goForward(10) turnRight(90) penDown() D penDown() goForward(10) penUp() turnRight(90) goForward(10) turnRight(90) penDown() goForward(10)
penDown() goForward(10) penUp() turnRight(90) goForward(10) turnRight(90) penDown() goForward(10)
The procedure Draw (length, direction) is used to draw a line segment length units long in a given direction (left, right, up, or down), starting at the current cursor position. The cursor is then repositioned at the end of the line segment that was drawn. Consider the following program, where the cursor starts in the upper left corner of a grid of dots. The dots are spaced one unit apart. Draw (1, right) Draw (2, down) Draw (1, left) Draw (1, right) Draw (1, up) Draw (1, left) Which of the following represents the figure that is drawn by the program? A shaped like E B shaped like backwards E C bro idk the answer isnt this one D backwards S
shaped like backwards E
Consider the following procedures. PROCEDURE proc1(str) { DISPLAY(str) DISPLAY("happy") } PROCEDURE proc2(str1, str2) { proc1(str2) DISPLAY(str1) } What is displayed as a result of the procedure call proc2("birthday", "to you") ? A birthday happy to you B birthday happy birthday C to you birthday happy D to you happy birthday
to you happy birthday
Which of the following code segments can be used to draw the figure? Select two answers. A x ←← 4 y ←← 1 r ←← 0 REPEAT 3 TIMES { drawCircle(x, y, r) r ←← r + 1 y ←← y + 1 } B x ←← 4 y ←← 1 r ←← 0 REPEAT 3 TIMES { r ←← r + 1 y ←← y + 1 drawCircle(x, y, r) } C x ←← 4 y ←← 4 r ←← 3 REPEAT 3 TIMES { drawCircle(x, y, r) y ←← y - 1 r ←← r - 1 } D x ←← 4 y ←← 4 r ←← 3 REPEAT 3 TIMES { y ←← y - 1 r ←← r - 1 drawCircle(x, y, r) }
x ←← 4 y ←← 1 r ←← 0 REPEAT 3 TIMES { r ←← r + 1 y ←← y + 1 drawCircle(x, y, r) } x ←← 4 y ←← 4 r ←← 3 REPEAT 3 TIMES { drawCircle(x, y, r) y ←← y - 1 r ←← r - 1 }
The procedure can be used to draw a circle on a coordinate grid. The circle is centered at the coordinate and has a radius of units. The procedure will be used to draw the following figure on a coordinate grid. Which of the following code segments can be used to draw the figure? A xPos <-- 3 yPos <-- 6 REPEAT 3 TIMES { DrawCircle (xPos, yPos, 2) xPos <-- xPos + 2 yPos <-- yPos + 2 B xPos <-- 3 yPos <-- 6 REPEAT 3 TIMES { DrawCircle (xPos, yPos, 2) xPos <-- xPos + 2 yPos <-- yPos - 2 C xPos <-- 7 yPos <-- 2 REPEAT 3 TIMES { DrawCircle (xPos, yPos, 2) xPos <-- xPos + 2 yPos <-- yPos + 2 D xPos <-- 3 yPos <-- 6 REPEAT 3 TIMES { DrawCircle (xPos, yPos, 2) xPos <-- xPos + 2 yPos <-- yPos - 2
xPos <-- 3 yPos <-- 6 REPEAT 3 TIMES { DrawCircle (xPos, yPos, 2) xPos <-- xPos + 2 yPos <-- yPos - 2
Which of the following code segments can be used to draw the figure? A xVal ←← 1 yVal ←← 0 len ←← 1 REPEAT 5 TIMES { drawLine(xVal, yVal, xVal, yVal + len) xVal ←← xVal + 1 len ←← len + 1 } B xVal ←← 1 yVal ←← 0 len ←← 1 REPEAT 5 TIMES { drawLine(xVal, yVal, xVal + len, yVal) yVal ←← yVal + 1 len ←← len + 1 } C xVal ←← 5 yVal ←← 0 len ←← 5 REPEAT 5 TIMES { drawLine(xVal, yVal, xVal, yVal + len) xVal ←← xVal - 1 } D xVal ←← 5 yVal ←← 0 len ←← 5 REPEAT 5 TIMES { drawLine(xVal, yVal, xVal + len, yVal) yVal ←← yVal - 1 len ←← len - 1 }
xVal ←← 1 yVal ←← 0 len ←← 1 REPEAT 5 TIMES { drawLine(xVal, yVal, xVal, yVal + len) xVal ←← xVal + 1 len ←← len + 1 }