Exam 9: Fractals: the Geometry of Nature: Recursion, Grammars and Production Rules

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

In a grammar, the ____ is the starting point.

Free
(Multiple Choice)
4.8/5
(35)
Correct Answer:
Verified

C

Describe the two-step process that one should use to design well-formed recursive functions.

Free
(Essay)
4.9/5
(41)
Correct Answer:
Verified

1. Are we done yet? Have we found a problem that is small enough to solve trivially? If so, solve it without any further work and return the answer.
2. If not, simplify the problem and solve the simpler problem. Combine the result of solving the simplified problem with what you know to solve the original. Return the combined result.

Match each definition with its phrase. -A construct that explains how to replace a symbol in a grammar with another symbol.

Free
(Multiple Choice)
4.8/5
(33)
Correct Answer:
Verified

B

Match each definition with its phrase. -The starting point for a grammar.

(Multiple Choice)
4.7/5
(37)

In computer science terms, what is a grammar?

(Essay)
5.0/5
(32)

Describe the Sierpinski triangle.

(Essay)
4.8/5
(40)

Describe how you could implement a recursive function to draw a Sierpinski triangle.

(Essay)
4.8/5
(46)

Case Study 4: 1. Draw a trunk that is n units long. 2. Turn to the right 30 degrees and draw another tree with a trunk that is n − 15 units long. 3. Turn to the left 60 degrees and draw another tree with a trunk that is n − 15 units long. -Refer to the instructions in the accompanying Case Study 4. How would you identify the base case?

(Essay)
4.8/5
(41)

When drawing a tree with a recursive function, what is the base case?

(Multiple Choice)
5.0/5
(26)

What do the characters "[" and "]" represent in the L-systems grammar?

(Multiple Choice)
4.8/5
(41)

Writing a program to draw the Sierpinski triangle is more complex than the fractal tree, although it is still surprisingly simple.

(True/False)
4.9/5
(46)

When drawing a Koch snowflake, what is the simplest possible curve?

(Multiple Choice)
4.8/5
(40)

Recursion can be used to express mathematical functions in an elegant way.

(True/False)
4.9/5
(39)

In computer science, a grammar consists of:

(Multiple Choice)
5.0/5
(36)

What is the best description of the following function? 1. def hello (): 2) print("Hello World") 3) hello ()

(Multiple Choice)
4.8/5
(32)

In a recursive function, the ____ identifies when to stop.

(Multiple Choice)
4.8/5
(40)

Case Study 1: 1. def drawSquare(aTurtle, side): 2. for i in range(4): 3. aTurtle.forward(side) 4. aTurtle.right(90) 5. 6. def nestedBox(aTurtle, side): 7. if side >= 1: 8. drawSquare(aTurtle, side) 9. nestedBox(aTurtle, side - 5) -Refer to the session in the accompanying Case Study 1. Line ____ represents the recursive step.

(Multiple Choice)
4.8/5
(36)

How is the Sierpinski triangle drawn?

(Multiple Choice)
4.7/5
(37)

A fractal tree requires only one recursive call.

(True/False)
4.9/5
(43)

Every recursive program must have a base case in order to know when to stop.

(True/False)
4.8/5
(40)
Showing 1 - 20 of 33
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)