ANSWER KEY
cs1114 REVIEW of details test closed laptop period
python details DOES NOT COVER FUNCTIONS!
This is a sample of some of the things that you are responsible for do not believe that if you know
only the things on this test that they will get an A
reec06 review for Test ONE
Print your name legibly:
circle your last name
Sign:
Poly-ID:
JUST LIKE THE REAL TEST BRING ONLY A WRITING UTENSIL,
YOUR ID, AND YOUR BRAIN TO THE TEST.
For the following questions, use these variable definitions.
a = 4444
b=2
c
self-test REVIEW NOT A COMPLETE OR THOROUGH STUDY
1 Ask the user for a float value then show her the value:
_
cosine x3
You do NOT have to convert the number into radians.
Do write the required import(s) that would be needed.
2 What! you didn't write a tw
self-test REVIEW NOT A COMPLETE OR THOROUGH STUDY
1 Ask the user for a float value then show her the value:
_
cosine x3
You do NOT have to convert the number into radians.
Do write the required import(s) that would be needed.
import math
def cosSqrtOfCube
#Question 1a
userWeight = int(input("Please enter your weight in kilograms.")
userHeight = int(input("Please enter your height in meters.")
userBMI = userWeight/(userHeight*2)
print("Your BMI is", str(userBMI) + ".")
#Question 3:
import turtle
#angle and move turtle for first square
turtle.left(20)
turtle.forward(100)
turtle.left(90)
turtle.forward(100)
turtle.left(90)
turtle.forward(100)
turtle.left(90)
turtle.forward(100)
#angle and move for second square
turtle.lef
reec06 review for Test ONE Fall09
Print your name legibly:
circle your last name
Sign:
Poly-ID:
For the following questions, use these variable definitions.
a = 4444
b=2
c = 11.11
d = "hello"
What is the value and type of each of the following expressions
#Question 4:
print("Enter the amount of time that John and Bill have worked.")
#asks for user input
daysJohn = int(input("Please enter the number of days John has worked:")
hoursJohn = int(input("Please enter the number of hours John has worked:")
minutes
print("Exercise 1:")
inputNum = int(input("Please enter a number that is equal or less than 100.")
#converts int to roman numerals
outputNum = "
if (inputNum >= 100):
outputNum = outputNum+"C"
inputNum -= 100
if (inputNum<100) and (inputNum >= 50):
output
print("Exercise 1:")
#asks user to enter an integer in kilograms
kilograms = int(input("Please enter an integer in kilograms.")
#converts kilograms to pounds
pounds = kilograms * 2.2046
#finds the remainder of pounds when divided by 1
rem = pounds%1
#rede
QUESTIONS
cs1114 REVIEW of details test closed laptop period
python basics doe NOT include functions!
This is a sample of some of the things that you are responsible for do not believe that if you know
only the things on this test that they will get an A
\
1. Convert the following numbers to their decimal representation:
a. 100110112 = 15510
b. 11011012 = 10910
c. 3A816 = 93610
d. 22145 = 30910
2. Convert the following numbers to their binary representation:
a. 6910 = 010001012
b. 48510 = 1111001012
c. 6D