- Read Chapter 2 of
the text. According to the definitions in the book, are all
"procedures" also "commands"? Explain your answer.
- In your own words, describe what a "complete instruction" is and does. (The book provides a definition. The point of this assignment is to understand that definition -- what are complete instructions good for?)
- For each of the following instructions, decide whether the input to the print command is appropriate. If the input is appropriate, describe it (word, list, number, procedure output, variable value, etc.). If not, correct the instruction as best you can.
- print "noodles
- print Hi
- print 7
- print sum 3 4
- print sentence [Hi Joe.] [How are you?]
- print sentence "Worst. "road trip. "ever.
- print x+y
- Withouth using Logo, determine what the following procedure does. (This problem is typical of no-Logo quiz problems you will do.)
repeat 10 [print [**]]
repeat 2 [print [***********]]
- Write a procedure to draw a letter, similar to the example in the previous problem. Use a different character than in the previous question (not *). Make sure you draw a different letter than the previous problem. DO NOT DRAW WITH THE TURTLE FOR THIS PROBLEM. Print characters to the text screen. For full credit, use repeat whenever possible instead of typing the same instruction multiple times.
It might be helpful to know how to print multiple spaces. If so, you'll need to use verical bars; experiment with:
print "| |***
print "*| |*
(Try leaving a large number of spaces between the vertical bars.)
- Following the guidelines at the top of page 21 of Chapter 2, explain how the remainder operation works (p. 16, or "help remainder"). Is your explanation detailed enough to predict the result of entering the instruction
print remainder -8 5?
- Write a single line of Logo code that uses operations such as
quotient, difference, sum and product to evaluate and
(8 * 3) / (6 - 2).
(Do not use *, - and /.)
- The following instruction draws a square:
repeat 4 [forward 100 right 90]
Figure out which of the following instructions draws a triangle and
explain why the other does not draw a triangle. Use the clearscreen
command to clear your screen when you need to.
repeat 3 [forward 100 right 60]
repeat 3 [forward 100 right 120]
- Use what you learned in the previous problem to write an instruction
that draws a hexagon.
- What does the instruction print 3 + 6 * 2 do and why? What Logo instruction would find the sum of 3 and 6 first and then multiply by 2? What value does the instruction give? Explain your answer in complete sentences. Explain why parentheses work as grouping symbols but square brackets do not.
- What does the instruction
print (random 10) + 10
do and why? Answer in complete sentences, and explain your answer fully.
- Give a instruction that uses random to print a random number between 4 and 12. Explain your answer using complete sentences. (Keep in mind that your answer must be in the spirit of Problem 4; we cannot use random with two inputs as incorrectly indicated in the manual entry for random.)
- Consider the following instructions:
- print 5 + 2
- print sum 5 2
- print (sum 5 2 2)
- print sum 5 2 2
- print 5 / 3
- print quotient 5 3
- print sqrt 36
What do the instructions do and why? Answer in complete sentences and explain your answers fully. Include comparisons among the different instructions in the list.
- Write two different Logo instructions to print the product 5
times 3. Which instruction do you prefer to use? Why might someone
else prefer the other instruction?
- Write a procedure to draw a triangle using the turtle. For full credit, use repeat whenever possible instead of typing the same instruction multiple times.
- A classmate wrote the following procedure, which draws a nice
design. If you use the hideturtle (ht) instruction you can see that
the design is an open triangle. (If you want to see the turtle again
use showturtle (st).) Use the Pythagorean theorem to revise the code
to close up the triangle as precisely as possible. Use the sqrt
- Draw a plumbing diagram for the instruction:
setcursor list random 75 random 20
- Use the help command to find out what the command penup does. Describe it completely, following the guidelines presented on page 21.
- Use the help command to find out what the operation pos does. Describe it completely, following the guidelines presented on page 21.