Transcript slides

COMS W1004
Introduction to Computer Science
June 29, 2009
Announcements
• Please fill out the course evaluation in
CourseWorks (check your Columbia email
for more information)
– Describe your experience with the research
project in the Strengths/Weaknesses section
– Evaluate the TA with whom you’re most familiar
• Also check that the grades in CourseWorks
match those on your returned papers!!
Final Grades and Such
• We’re hoping to have everything graded by
this weekend
• You can pick up homework submissions and
see your graded final exam next Tuesday
(July 7) from 12-5pm in 608 CEPSR
• Final grades will be submitted to the registrar
next Tuesday night
Final Exam Logistics
• Wednesday, 5:40-8:40pm (note the start time)
• Big Java chapters 1-7
– Except the brown “testing” and purple “graphics” sections
• Big Java sections 11.1, 11.4, and 11.5
• S&G chapters 1-7
• Anything discussed in class, including example
Java code posted on the website
– Except for student research presentations
Final Exam Rules
•
•
•
•
•
•
No books
No notes
No calculators
No cellphones, etc.
No cheating
No crying
Format of the exam
•
•
•
•
•
10-15 “concept” questions
5-6 problem solving questions
1-2 “Find the bugs” questions
Writing Java code
Understanding Java code
• Last year: 71% Java, 29% theory
Studying for the exam
• Review your class notes and try to anticipate
“problem solving”-type questions
• Make sure you understand the source code that
we looked at in class and in the textbook
• Review the homework solutions!!
• Look at the types of questions at the ends of the
chapters in the assigned readings
Taking the exam
• Note how much each question is worth
• Look through the entire exam and start by
working on problems that you think you
can do quickly and that are worth a lot of
points
• Read the instructions carefully!
More advice
• Concept questions
– Don’t write too much, but try to be detailed
– Each question is looking for 2-3 major points
– Give an example if you can’t explain it
• Problem-solving questions
– ALWAYS show your work to try to get partial
credit
– Check your solution if possible
More advice
• Understanding Java code
– Show the results of intermediate steps
• Writing Java code
– You are graded on accuracy of syntax and
semantics (your code must “compile”)
– Try to use good style (e.g. naming conventions)
More advice
• “Find the bugs” question
– Look for compile-time (syntax, semantic)
errors before trying to find logic errors
– Be sure it’s a bug (look out for tricks)
Basic Concepts (S&G 1)
• What is Computer Science?
• What is an Algorithm?
• Pseudocode
– You will not be asked to write pseudocode but
you should be able to look at an algorithm and
understand it
Examples of Algorithms (S&G 2)
• Searching (Sequential and Binary)
– Worst case number of comparisons
– Average number of comparisons
– Which numbers are compared
• Sorting (Selection and Insertion)
– Which numbers are compared/swapped?
– What does the array look like after each loop?
Comparing Algorithms (S&G 3)
• What does Big-Oh notation mean?
•
•
•
•
•
•
Constant
Logarithmic
Linear
Quadratic
Exponential
Factorial
O(1)
O(log n)
O(n)
O(n2)
O(2n)
O(n!)
Binary Numbers (S&G 4)
• Decimal, binary, and hexadecimal numbers
– Representation
– Conversion
• Negative numbers in binary
• Encoding
– How many things can you represent with N bits?
– How many bits do you need to represent X things?
Boolean Logic (S&G 4)
• Truth tables
• Boolean expressions
• Transistors, gates, and circuits
– Basic gates: OR, AND, NOT
• Some of this was not covered in class but
you should still know this material!
Von Neumann Architecture (S&G 5)
• Memory
–
–
–
–
Volatile vs. Non-volatile storage
Address space (maximum memory size)
Address vs. Data; MAR & MDR
Caching
• I/O Devices
– DASD vs. SASD
• Control Unit
– CPU: fetch, decode, execute
– ALU: circuits for math operations
Assembly Language (S&G 6)
• Fundamental operations
– Data transfer: LOAD, STORE
– Math: ADD, SUBTRACT
– Compare: COMP
– Branch: JUMP, JUMPGT
• Converting Java to assembly language
• Machine language representation
Operating Systems (S&G 6)
• OS History: batch, multiprogrammed, etc.
• OS responsibilities:
– UI management
– System/file access control
– Program scheduling
– Resource allocation
– Deadlock/error detection & avoidance
Networking (S&G 7)
•
Network protocol stack
1.
2.
3.
4.
5.
Physical: how is it sent?
Data Link: how do we know it got there?
Network: where is it going? what route does it take?
Transport: which mailbox does it go to?
Application: what’s inside the envelope?
•
•
Graphs
Dijkstra’s Algorithm
•
Wireless networking
Java Basics (Big Java ch.1 & 4)
• Declaration, instantiation, and assignment
of variables
• Math operators & operator precedence
• Data conversion & casting
• Java compilation process
Java Datatypes (Big Java p.135)
•
•
•
•
•
•
•
•
byte
short
int
long
float
double
char
boolean
8 bits
2 byte integer
4 byte integer
8 byte integer
4 byte floating-point
8 byte floating-point
2 byte character
true or false
Object-oriented Programming
(Big Java ch.2-3)
• Classes vs. Objects
– Attributes
– Methods
– Constructors
• Encapsulation
– public and private
• Calling methods
– arguments and parameters
• Static variables and methods
Java API
• Math: pow, sqrt, etc.
• Random: nextInt, nextDouble, etc.
• Scanner: hasNext, next, nextLine, nextInt, etc.
• String
–
–
–
–
indexOf, charAt, length
endsWith, startsWith, contains, equals
toUpperCase, toLowerCase
replace, substring
Conditionals and Loops
(Big Java ch.5-6)
• Comparing primitives vs. comparing objects
• if, if/else
• for, while, do/while
• Scope of variables
Arrays (Big Java ch.7)
• All elements must be of the same type
• Fixed length
• Arrays are objects
• Declaring, initializing, and using arrays
• Array bounds checking
• Command-line arguments
Exceptions (Big Java ch.11)
• What are exceptions?
• try/catch blocks
• Reading text files
Software Testing
• Unit Testing
– Whitebox: test according to the program
– Blackbox: test according to the specification
• System Testing
Recursion
• Writing recursive methods
• Examples of recursion
– Factorial
– Fibonacci series
Final Exam Logistics
• Wednesday, 5:40-8:40pm (note the start time)
• Big Java chapters 1-7
– Except the brown “testing” and purple “graphics” sections
• Big Java sections 11.1, 11.4, and 11.5
• S&G chapters 1-7
• Anything discussed in class, including example
Java code posted on the website
– Except for student research presentations
Format of the exam
•
•
•
•
•
10-15 “concept” questions
5-6 problem solving questions
1-2 “Find the bugs” questions
Writing Java code
Understanding Java code
Review topics for today
• Clarification of some of the terms
• Substrings
• Boolean circuits (S&G 4)
Terms from the list
• SASD: Sequential Access Storage Device
(S&G page 202)
• JVM: Java Virtual Machine
• Ignore these:
– Polymorphism
– White space