Exam 2: Pthon: Estimating PI: Math and Random Methods, Selection and Boolean Expressions, the Print Function
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
When calculating pi using the Wallis formula, the accumulator variable:
(Multiple Choice)
4.9/5
(43)
Case Study 1:
>>> import math
>>> numSides = 8
>>> innerAngleB = 360.0 / numSides
>>> halfAngleA = innerAngleB / 2
>>> oneHalfSideS = math.sin(math.radians(halfAngleA))
>>> sideS = oneHalfSideS * 2
>>> polygonCircumference = numSides * sideS
>>> pi = polygonCircumference / 2
>>> pi
3.0614674589207183
-Refer to the session in the accompanying case study 1. Which line uses the math module?
(Multiple Choice)
4.8/5
(38)
To create a drawing window, use the Screen constructor contained in the turtle module.
(True/False)
4.9/5
(43)
How many times will the following print statement be executed?
>>> for sides in range(8, 100, 8):
Print(sides, archimedes(sides))
(Multiple Choice)
4.9/5
(32)
The parameters passed to the print function are, by default, separated by a space when printed.
(True/False)
4.8/5
(35)
Case Study 1:
>>> import math
>>> numSides = 8
>>> innerAngleB = 360.0 / numSides
>>> halfAngleA = innerAngleB / 2
>>> oneHalfSideS = math.sin(math.radians(halfAngleA))
>>> sideS = oneHalfSideS * 2
>>> polygonCircumference = numSides * sideS
>>> pi = polygonCircumference / 2
>>> pi
3.0614674589207183
-Refer to the session in the accompanying Case Study 1. Explain, in general terms, how to modify this series of statements in such a way that you would be able to change the number of sides and try the calculation again without needing to retype all of the statements.
(Essay)
4.8/5
(31)
When using the Wallis function, the larger the value of the parameter passed into the function, the less accurate the result. Therefore, wallis(100) will be more accurate than wallis(10000).
(True/False)
4.8/5
(45)
What is the name of the formula that calculates pi using the following equation?
π/4 = 1/1 - 1/3 + 1/5 - 1/7 + 1/9 …
(Multiple Choice)
4.9/5
(38)
Case Study 2:
>>> acc = 0
>>> for x in range(1, 6):
acc = acc + x
>>> acc
15
-Refer to the session in the accompanying case study 2. Which of the following is the initialization statement?
(Multiple Choice)
4.9/5
(33)
The ____ uses probability and random behavior to calculate pi.
(Multiple Choice)
4.8/5
(34)
Explain the term short-circuit evaluation of Boolean expressions. Use an example to illustrate what this means.
(Essay)
4.8/5
(35)
Showing 21 - 33 of 33
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)