Term
What is the difference between an Algorithm and a Program? |
|
Definition
An algorithm is a conceptual idea, a program is a concrete instantiation of an algorithm. |
|
|
Term
True or False? A computational mode of thinking means that everything can be viewed as a math problem involving numbers and formulas. |
|
Definition
|
|
Term
True or False? Computer Science is the study of how to build efficient machines that run programs. |
|
Definition
|
|
Term
The two things every computer can do are: |
|
Definition
1. Perform calculations & 2. Remember the results |
|
|
Term
Declarative knowledge refers to statements of fact. |
|
Definition
|
|
Term
Imperative knowledge refers to 'how to' methods. |
|
Definition
|
|
Term
A recipe for deducing the square root involves guessing a starting value for y. Without another recipe to be told how to pick a starting number, the computer cannot generate one on its own. |
|
Definition
|
|
Term
True or False? A stored program computer is designed to compute precisely one computation, such as a square root, or the trajectory of a missile. |
|
Definition
|
|
Term
True or False? A fixed program computer is designed to run any computation, by interpreting a sequence of program instructions that are read into it. |
|
Definition
|
|
Term
|
Definition
points the computer to the next instruction to execute in the program. |
|
|
Term
What does it mean when we say that "the computer walks through the sequence executing some computation"? |
|
Definition
The computer executes the instructions mostly in a linear sequence, except sometimes it jumps to a different place in the sequence. |
|
|
Term
True or False? In order to compute everything that is computable, every computer must be able to handle the sixteen most primitive operations. |
|
Definition
|
|
Term
|
Definition
Determines whether a string is legal |
|
|
Term
|
Definition
Determines whether a string has meaning |
|
|
Term
|
Definition
Assigns a meaning to a legal sentence |
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
1. What type is returned for the sequentially evaluated problem below 2. What is the value?
a = 3 a + 2.0 |
|
Definition
|
|
Term
1. What type is returned for the sequentially evaluated problem below 2. What is the value?
a = a + 1.0 a |
|
Definition
|
|
Term
1. What type is returned for the sequentially evaluated problem below 2. What is the value?
a = 3 b |
|
Definition
|
|
Term
Indicate the value returned, or if the evaluation would lead to an error, write the word 'error':
3 > 4 |
|
Definition
|
|
Term
Indicate the value returned, or if the evaluation would lead to an error, write the word 'error': 4.0 > 3.999 |
|
Definition
|
|
Term
Indicate the value returned, or if the evaluation would lead to an error, write the word 'error': 4 > 4 |
|
Definition
|
|
Term
Indicate the value returned, or if the evaluation would lead to an error, write the word 'error': 4 > + 4 |
|
Definition
|
|
Term
Indicate the value returned, or if the evaluation would lead to an error, write the word 'error': 2 + 2 == 4 |
|
Definition
|
|
Term
Indicate the value returned, or if the evaluation would lead to an error, write the word 'error': True or False |
|
Definition
|
|
Term
Indicate the value returned, or if the evaluation would lead to an error, write the word 'error': False or False |
|
Definition
|
|
Term
Indicate the value returned, or if the evaluation would lead to an error, write the word 'error':
not False |
|
Definition
|
|
Term
Indicate the value returned, or if the evaluation would lead to an error, write the word 'error': 3.0 - 1.0 != 5.0 - 3.0 |
|
Definition
|
|
Term
Indicate the value returned, or if the evaluation would lead to an error, write the word 'error': 3 > 4 or (2 < 3 and 9 > 10) |
|
Definition
|
|
Term
Indicate the value returned, or if the evaluation would lead to an error, write the word 'error': 4 > 5 or 3 < 4 and 9 > 8 |
|
Definition
|
|
Term
Indicate the value returned, or if the evaluation would lead to an error, write the word 'error': not(4 > 3 and 100 > 6) |
|
Definition
|
|
Term
Provide the type and the value the expression returns: a = 3 a == 5.0 a |
|
Definition
|
|
Term
Provide the type and the value the expression returns: b = 10 c = b > 9 c |
|
Definition
|
|
Term
Provide the type and the value the expression returns: 3 + 5.0 |
|
Definition
|
|
Term
Provide the type and the value the expression returns: 5/2 |
|
Definition
|
|
Term
Provide the type and the value the expression returns: 5/2 == 5/2.0 |
|
Definition
|
|
Term
Provide the type and the value the expression returns: 5/2.0 |
|
Definition
|
|
Term
Provide the type and the value the expression returns: round(2.6) |
|
Definition
|
|
Term
Provide the type and the value the expression returns: int(2.6) |
|
Definition
|
|
Term
Provide the type and the value the expression returns: 2.0 + 5.0 |
|
Definition
|
|
Term
Provide the type and the value the expression returns: 5*2 == 5.0 * 2.0 |
|
Definition
|
|
Term
Indicate the value returned: "a" + "bc" |
|
Definition
|
|
Term
Indicate the value returned: 3 * "bc" |
|
Definition
|
|
Term
Indicate the value returned: "3" * "bc" |
|
Definition
|
|
Term
Indicate the value returned: "abcd"[2] |
|
Definition
|
|
Term
Indicate the value returned: "abcd"[0:2] |
|
Definition
|
|
Term
Indicate the value returned: "abcd"[:2] |
|
Definition
|
|
Term
Indicate the value returned: "abcd"[2:] |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str1 |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str1[0] |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str[1] |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str1[-1] |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: len(str1) |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str1[len(str1)] |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str1 + str2 + str3 |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str1 + str2 + '' + str3 |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str3 * 3 |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: 'hello' == str1 |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: 'HELLO' == str1 |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: 'a' in str3 |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str4 = str1 + str3 'low' in str4 |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str[1:3] |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str3[:3] |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str3[:-1] |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str1[1:] |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str4[1:9] |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str4[1:9:2] |
|
Definition
|
|
Term
1. Evaluate the expression for type 2. and value: str4[::-1] |
|
Definition
|
|
Term
Indicate value printed when expression is evaluated: if 6 > 7: print("Yep") |
|
Definition
|
|
Term
Indicate value printed when expression is evaluated: if 6 > 7: print("Yep") else: print("Nope") |
|
Definition
|
|
Term
Indicate value printed when expression is evaluated: var = 'Panda' if var == "panda": print("Cute!") elif var == "Panda": print("Regal!") else: print("Ugly...") |
|
Definition
|
|
Term
Indicate value printed when expression is evaluated: temp = 120 if temp > 85: print("Hot") elif temp > 100: print("REALLY HOT!") elif temp > 60: print("Comfortable") else: print("Cold") |
|
Definition
|
|
Term
Indicate value printed when expression is evaluated: temp = 50 if temp > 85: print("Hot") elif temp > 100: print("REALLY HOT!") elif temp > 60: print("Comfortable") else: print("Cold") |
|
Definition
|
|
Term
Write what it prints out, separating what appears on a new line by a comma and a space. If a given loop will not terminate, write the phrase 'infinite loop' (no quotes) in the box.:
num = 0 while num <= 5: print(num) num += 1
print("Outside of loop") print(num) |
|
Definition
0, 1, 2, 3, 4, 5, "Outside of loop", 6 |
|
|
Term
Write what it prints out, separating what appears on a new line by a comma and a space. If a given loop will not terminate, write the phrase 'infinite loop' (no quotes) in the box.:
numberOfLoops = 0 numberOfApples = 2 while numberOfLoops < 10: numberOfApples *= 2 numberOfApples += numberOfLoops numberOfLoops -= 1 print("Number of apples: " + str(numberOfApples)) |
|
Definition
|
|
Term
Write what it prints out, separating what appears on a new line by a comma and a space. If a given loop will not terminate, write the phrase 'infinite loop' (no quotes) in the box.:
num = 10 while num > 3: num -= 1 print(num) |
|
Definition
|
|
Term
Write what it prints out, separating what appears on a new line by a comma and a space. If a given loop will not terminate, write the phrase 'infinite loop' (no quotes) in the box.:
num = 10 while True: if num < 7: print('Breaking out of loop') break print(num) num -= 1 print('Outside of loop') |
|
Definition
10, 9, 8, 7, 'Breaking out of loop', 'Outside of loop' |
|
|
Term
Write what it prints out, separating what appears on a new line by a comma and a space. If a given loop will not terminate, write the phrase 'infinite loop' (no quotes) in the box.:
num = 100 while not False: if num < 0: break print('num is: ' + str(num)) |
|
Definition
|
|
Term
Evaluate what the python program prints: num = 10 for num in range(5): print(num) print(num) |
|
Definition
|
|
Term
Evaluate what the python program prints: divisor = 2 for num in range(0, 10, 2): print(num/divisor) |
|
Definition
|
|
Term
Evaluate what the python program prints: for variable in range(20): if variable % 4 == 0: print(variable) if variable % 16 == 0: print('Foo!') |
|
Definition
0, 'Foo!', 4, 8, 12, 16, 'Foo!' |
|
|
Term
Evaluate what the python program prints: for letter in 'hola': print(letter) |
|
Definition
|
|
Term
Evaluate what the python program prints: count = 0 for letter in 'Snow!': print('Letter # ' + str(count) + ' is ' + str(letter)) count += 1 break print(count) |
|
Definition
|
|
Term
For each program, answer the associated questions. myStr = '6.00x'
for char in myStr: print(char)
print('done')
Questions: 1. How many times does 6 print out? 2. How many times does . print out? 3. How many times does 0 print out? 4. How many times does x print out? 5. How many times does done print out? |
|
Definition
|
|
Term
For each program, answer the associated questions.
greeting = 'Hello!' count = 0
for letter in greeting: count += 1 if count % 2 == 0: print(letter) print(letter)
print('done')
Questions: 1. How many times does H print out? 2. How many times does e print out? Disregard the letters in the word done. 3. How many times does l print out? 4. How many times does o print out? Disregard the letters in the word done. 5. How many times does ! print out? 6. How many times does done print out? |
|
Definition
|
|
Term
For each program, answer the associated questions. school = 'Massachusetts Institute of Technology' numVowels = 0 numCons = 0
for char in school: if char == 'a' or char == 'e' or char == 'i' \ or char == 'o' or char == 'u': numVowels += 1 elif char == 'o' or char == 'M': print(char) else: numCons -= 1
print('numVowels is: ' + str(numVowels)) print('numCons is: ' + str(numCons))
Questions: How many times does o print out? Disregard the o's in last two print statements. How many times does M print out? What will the value of the variable numVowels be? What will the value of the variable numCons be? |
|
Definition
|
|
Term
Example: iteration = 0 count = 0 while iteration < 5: for letter in "hello, world": count += 1 print("Iteration " + str(iteration) + "; count is: " + str(count)) iteration += 1
Does the following give the same output as the example above (Yes/No)?:
for iteration in range(5): count = 0 while True: for letter in "hello, world": count += 1 print("Iteration " + str(iteration) + "; count is: " + str(count)) |
|
Definition
|
|
Term
Example: iteration = 0 count = 0 while iteration < 5: for letter in "hello, world": count += 1 print("Iteration " + str(iteration) + "; count is: " + str(count)) iteration += 1
Does the following give the same output as the example above (Yes/No)?:
for iteration in range(5): count = 0 while True: for letter in "hello, world": count += 1 print("Iteration " + str(iteration) + "; count is: " + str(count)) break |
|
Definition
|
|
Term
Example: iteration = 0 count = 0 while iteration < 5: for letter in "hello, world": count += 1 print("Iteration " + str(iteration) + "; count is: " + str(count)) iteration += 1
Does the following give the same output as the example above (Yes/No)?:
count = 0 phrase = "hello, world" for iteration in range(5): index = 0 while index < len(phrase): count += 1 index += 1 print("Iteration " + str(iteration) + "; count is: " + str(count)) |
|
Definition
|
|
Term
Example: iteration = 0 count = 0 while iteration < 5: for letter in "hello, world": count += 1 print("Iteration " + str(iteration) + "; count is: " + str(count)) iteration += 1
Does the following give the same output as the example above (Yes/No)?:
count = 0 phrase = "hello, world" for iteration in range(5): while True: count += len(phrase) break print("Iteration " + str(iteration) + "; count is: " + str(count)) |
|
Definition
|
|
Term
Example: iteration = 0 count = 0 while iteration < 5: for letter in "hello, world": count += 1 print("Iteration " + str(iteration) + "; count is: " + str(count)) iteration += 1
Does the following give the same output as the example above (Yes/No)?:
count = 0 phrase = "hello, world" for iteration in range(5): count += len(phrase) print("Iteration " + str(iteration) + "; count is: " + str(count)) |
|
Definition
|
|