Here is a general outline of the key concepts and commands (arranged by topic) that you should know for the midterm.
The exam will have the following format:
Definitions: : Briefly define terms using one or two sentences. (5 Points)
Short Answers: Briefly answer questions about:
Hardware (5 Points)
Information Representation (5 Points)
Algorithms (5 Points)
Data Structures (5 Points)
Code Evaluation (5 Points)
Programming: Modify an existing program and extend it. (10 Points)
Parts 1 and 2 is to be done first on paper. However, part 3 can be done with the aid of your laptop and the Internet (but not other people).
This check list is meant to be representative, rather than exhaustive (ie. there may be questions that show up on the exam that are not shown below).
Program
Programming Language
Assembly Language
Interpreter
ASCII
Cache
Pipelining
Multi-core
Exception
Pseudo-code
Complexity
Infinite Loop
Process
File System
What is a computer?
How is a computer logically constructed?
Identify and describe the role of the CPU, RAM, Disk, and I/O.
Draw a diagram that explains the logical construction of a computer (include the CPU, RAM, DISK, and I/O devices). Briefly explain what each component does in a typical computer system.
What is the difference between analog and digital information?
How do you convert a number from decimal to binary? hexadecimal? vice versa?
What is the difference between KB
, MB
, GB
, TB
?
How are colors represented on a computer?
Convert the following binary number into decimal and hexadecimal:
1010
What hardware does a CPU use to execute instructions?
What sort of operations does a CPU support?
What is the execution model of a CPU?
What techniques do CPUs use to improve performance?
Describe how a CPU executes a program and what techniques it uses to improve system performance.
What is an algorithm?
How do we measure and evaluate time complexity?
What is the time complexity of linear search? binary search? sorting?
Discuss whether or not binary search is always better than linear search.
What is a list?
What is a dict?
What are the advantages and disadvantages of either data structure?
Describe a scenario where we would prefer using a list over a dict and vice versa.
What is an operating system?
What is a process? virtual memory? file system?
Describe the abstractions an operating system provides for applications.
How are expressions evaluated?
How do we update a variable?
What are boolean expressions?
How do we perform conditional execution? alternative execution? chained conditionals?
How do we perform repeated execution based on a condition?
How do we perform repeated execution over a sequence?
How do we define a function?
How do we call a function?
What is the difference between return
and print
inside a
function?
How do we construct a list?
How do we access an element in a list?
How do we iterate through a list?
How do we search a list?
How do we slice a list?
How do we add to a list?
How do we sort a list?
How do we construct a string?
How do we access an element in a string?
How do we iterate through a string?
How do we search a string?
How do we slice a string?
How do we convert a string into a list of words?
How do we construct a dict?
How do we access an element in a dict?
How do we iterate through a dict?
How do we search a dict?
How do we read data from a file line-by-line?
How do we write data to a file?
What is the result of the each of the following lines of Python code:
print('1' + 3.0)
print('1' + "3")
print(type(1 + 3))
print(type(1 + 3.0))
What is the result of the following Python code:
x = 1
y = 2
x + y
print(x, y)
What is the result of the following Python code:
x = 1
y = 2
x = x + y
y = x + y
print(x, y)
What is the result of the following Python code:
for i in range(0, 10):
if i < 4:
continue
elif i == 7:
break
else:
print(i)
print(i)
What is the result of the following Python code:
print('go irish'.split()[0])
print('go irish'.split()[1][-1])
print('go irish'.split()[:1])
Write Python code that requests the length and width of a rectangle from the user, computes the area of a rectangle, and then prints the result:
Length? 3
Width? 4
The area of a rectangle with length 3 and width 4 is 12.
Convert the following Python code to use a while loop instead of a for loop:
numbers = [5, 4, 7, 0, 1]
count = 0
for number in numbers:
if number:
break
count += 1
The Python code below is suppose to count all of the even numbers between 1 and 100 (inclusive) that are also a multiple of 5, but it contains some errors. Identify and fix the errors:
while i < 100:
if i % 2 or i % 5:
total + 1
print(total)
Given a list of random integers, numbers, write Python code that
computes the sum of all the numbers between a
and b
(inclusive) and
prints the resulting total.
Write Python code that prints 'Yeah' if a
number n
is between the values
a
and b
(inclusive). Otherwise, print 'Nope'.
Write Python code that computes the list of the even numbers between 0
and 100
that are also a multiple of 7
.
Write a program that simulates flipping a coin 100 times and then prints the number of heads and the number of tails found during the expirement.