Exam 9: Fractals: the Geometry of Nature: Recursion, Grammars and Production Rules
Exam 1: Introduction to Python: Introduction to Numeric Types, Turtle Graphics, Simple for Loops and Functions34 Questions
Exam 2: Pthon: Estimating PI: Math and Random Methods, Selection and Boolean Expressions, the Print Function33 Questions
Exam 3: Codes and Other Secrets: String Operators and Methods, the Len Built-In Function, Keyword Parameters, User Input33 Questions
Exam 4: Introducing the Python Collections: Lists, Dictionaries, Tuples, and Statistics33 Questions
Exam 5: Bigger Data: File Io: the While Loop, String Formatting, Reading Online Data in CSV and Json Formats33 Questions
Exam 6: Image Processing: Nested for Loops, Functions As Parameters, Namespaces, Lists of Lists33 Questions
Exam 7: Data Mining: Cluster Analysis: More on the While Loop; Parrallel Lists31 Questions
Exam 8: Cryptanalysis: Advanced Dictionaries and Lists, Regular Expressions32 Questions
Exam 9: Fractals: the Geometry of Nature: Recursion, Grammars and Production Rules33 Questions
Exam 10: Astronomy: Creating Classes, Writing Constructors, Accessors, Mutators and Special Methods33 Questions
Exam 11: Simulation:computer Simulation Using Objects34 Questions
Exam 12: Father Was a Rectangle: Inheritance and Object-Oriented Design32 Questions
Exam 13: Video Games: Multithreading, Event Handlers, Static Variables33 Questions
Select questions type
In a grammar, the ____ is the starting point.
Free
(Multiple Choice)
4.8/5
(35)
Correct Answer:
C
Describe the two-step process that one should use to design well-formed recursive functions.
Free
(Essay)
4.9/5
(41)
Correct Answer:
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:
B
Match each definition with its phrase.
-The starting point for a grammar.
(Multiple Choice)
4.7/5
(37)
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)
What is the best description of the following function? 1. def hello ():
2) print("Hello World")
3) hello ()
(Multiple Choice)
4.8/5
(32)
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)
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
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)