coms w1004 introduction to computer science june 29, 2009

33
COMS W1004 Introduction to Computer Science June 29, 2009

Post on 22-Dec-2015

218 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: COMS W1004 Introduction to Computer Science June 29, 2009

COMS W1004Introduction to Computer Science

June 29, 2009

Page 2: 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!!

Page 3: COMS W1004 Introduction to Computer Science June 29, 2009

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

Page 4: COMS W1004 Introduction to Computer Science June 29, 2009

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

Page 5: COMS W1004 Introduction to Computer Science June 29, 2009

Final Exam Rules

• No books

• No notes

• No calculators

• No cellphones, etc.

• No cheating

• No crying

Page 6: COMS W1004 Introduction to Computer Science June 29, 2009

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

Page 7: COMS W1004 Introduction to Computer Science June 29, 2009

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

Page 8: COMS W1004 Introduction to Computer Science June 29, 2009

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!

Page 9: COMS W1004 Introduction to Computer Science June 29, 2009

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

Page 10: COMS W1004 Introduction to Computer Science June 29, 2009

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)

Page 11: COMS W1004 Introduction to Computer Science June 29, 2009

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)

Page 12: COMS W1004 Introduction to Computer Science June 29, 2009

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

Page 13: COMS W1004 Introduction to Computer Science June 29, 2009

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?

Page 14: COMS W1004 Introduction to Computer Science June 29, 2009

Comparing Algorithms (S&G 3)

• What does Big-Oh notation mean?

• Constant O(1)• Logarithmic O(log n)• Linear O(n)• Quadratic O(n2)• Exponential O(2n)• Factorial O(n!)

Page 15: COMS W1004 Introduction to Computer Science June 29, 2009

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?

Page 16: COMS W1004 Introduction to Computer Science June 29, 2009

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!

Page 17: COMS W1004 Introduction to Computer Science June 29, 2009

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

Page 18: COMS W1004 Introduction to Computer Science June 29, 2009

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

Page 19: COMS W1004 Introduction to Computer Science June 29, 2009

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

Page 20: COMS W1004 Introduction to Computer Science June 29, 2009

Networking (S&G 7)

• Network protocol stack1. Physical: how is it sent?2. Data Link: how do we know it got there?3. Network: where is it going? what route does it take?4. Transport: which mailbox does it go to?5. Application: what’s inside the envelope?

• Graphs• Dijkstra’s Algorithm

• Wireless networking

Page 21: COMS W1004 Introduction to Computer Science June 29, 2009

Java Basics (Big Java ch.1 & 4)

• Declaration, instantiation, and assignment of variables

• Math operators & operator precedence

• Data conversion & casting

• Java compilation process

Page 22: COMS W1004 Introduction to Computer Science June 29, 2009

Java Datatypes (Big Java p.135)

• byte 8 bits

• short 2 byte integer

• int 4 byte integer

• long 8 byte integer

• float 4 byte floating-point

• double 8 byte floating-point

• char 2 byte character

• boolean true or false

Page 23: COMS W1004 Introduction to Computer Science June 29, 2009

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

Page 24: COMS W1004 Introduction to Computer Science June 29, 2009

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

Page 25: COMS W1004 Introduction to Computer Science June 29, 2009

Conditionals and Loops (Big Java ch.5-6)

• Comparing primitives vs. comparing objects

• if, if/else

• for, while, do/while

• Scope of variables

Page 26: COMS W1004 Introduction to Computer Science June 29, 2009

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

Page 27: COMS W1004 Introduction to Computer Science June 29, 2009

Exceptions (Big Java ch.11)

• What are exceptions?

• try/catch blocks

• Reading text files

Page 28: COMS W1004 Introduction to Computer Science June 29, 2009

Software Testing

• Unit Testing– Whitebox: test according to the program– Blackbox: test according to the specification

• System Testing

Page 29: COMS W1004 Introduction to Computer Science June 29, 2009

Recursion

• Writing recursive methods

• Examples of recursion– Factorial– Fibonacci series

Page 30: COMS W1004 Introduction to Computer Science June 29, 2009

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

Page 31: COMS W1004 Introduction to Computer Science June 29, 2009

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

Page 32: COMS W1004 Introduction to Computer Science June 29, 2009

Review topics for today

• Clarification of some of the terms

• Substrings

• Boolean circuits (S&G 4)

Page 33: COMS W1004 Introduction to Computer Science June 29, 2009

Terms from the list

• SASD: Sequential Access Storage Device (S&G page 202)

• JVM: Java Virtual Machine

• Ignore these:– Polymorphism– White space