CS5001 / CS5003:
Intensive Foundations of Computer Science
You have learned a lot of things this semester! The final exam will be cumulative, meaning that it will cover everything during the semester. There will be a focus on the material since the midterm.
The exam will be a 3-hour exam in class on Tuesday, December 10th, from 6pm-9pm (or 7pm-10pm, if you want -- you can start at either time).
The exam will be on BlueBook again, and you should already have the program on your computer.
We will review tonight, and on Thursday there is an optional lab where we can also review, or you can work on assignment 8.
Here are the topics that we have covered in the course:
Pre-midterm:
int
, float
, str
if
/ elif
/ else
, not
, or
, and
, ==
, !=
, <
, >
, <=
, >=
Post-midterm:
__init__
, __str__
, self
Study Tips
Post-midterm:
__init__
, __str__
, __eq__, self
Be prepared to create a class with an __init__
, __str__
, and __eq__ functions
Be prepared to create an inherited class that calls r
Be prepared to use classes provided for you
Post-midterm:
Understand the first-in-last-out nature of a stack
Understand what the push, pop, top, and empty functions do
Be prepared to create a stack using a list
Be prepared to use a stack to solve problems that can benefit from the use of a stack
Post-midterm:
Understand the first-in-first-out nature of a queue
Be prepared to create a queue from a list
Understand what the enqueue, dequeue, front, and empty functions do
Be prepared to use a queue in a program to solve a problem
Post-midterm:
Understand the difference between a linear search and binary search
Be able to trace a binary search and explain how it works. Make sure you remember that in order to do a binary search, the elements must be sorted
Post-midterm:
Be able to explain all of the above sorts (except Radix sort)
Be able to actually code selection sort and insertion sort
Be able to talk about why merge sort is, on average, much faster than insertion sort
Be able to talk about why selection sort is never fast
Post-midterm:
We won't ask specific questions about AI, nor will we ask about iterators, generators, lambda functions, or sets.
Where to go from here
You are prepared for your next class, CS 5004 - Object-Oriented Design
The class is taught in Java, which means that you will need to learn a new programming language. Java is similar to Python in many ways, but it is also different in many ways. You will find it relatively easy to learn Java, but some things will be tricky to remember. Here is an example of the similarities and differences between Python and Java:
class Main {
public static void main(String[] args) {
for (int i=0; i < 10; i++) {
System.out.println("Java " + Integer.toString(i));
}
}
}
Java
def main():
for i in range(10):
print(f"Python {i}")
if __name__ == "__main__":
main()
Python
Some differences:
for
loops look different (and require parentheses)Another example:
import java.util.ArrayList; // import the ArrayList class
import java.util.Scanner;
class Main {
public static void main(String[] args) {
// create a list
ArrayList<String> myList = new ArrayList<String>();
while (true) {
System.out.print("Please enter a name (blank line to end): ");
Scanner in = new Scanner(System.in);
String s = in.nextLine();
if (s.isEmpty()) {
break;
}
myList.add(s);
}
System.out.println("You entered:");
for (String s : myList) {
System.out.println(s);
}
}
}
Yes, Java does look different! See the next slide for the equivalent Python program.
Another example:
def main():
my_list = []
while True:
s = input("Please enter a name (blank line to end): ")
if s == '':
break
my_list.append(s)
print("You entered:")
for s in my_list:
print(s)
if __name__ == "__main__":
main()
Python programs tend to be shorter than Java programs. But, there are some similarities:
while
loops and for loops in both.The bottom line: you will be able to learn Java relatively quickly, despite the differences.
You have learned programming skills that translate across languages.
You have learned problem solving skills that translate across languages.
You should be proud of how far you've come during the semester, and good luck as you go forward to your future classes in the Align program!