Final Review. 2 Final Details Monday, December 11 th 7:00pm – 10:00pm HCC 1325.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

Chapter 1 Object-Oriented Concepts. A class consists of variables called fields together with functions called methods that act on those fields.
1 Strings and Text I/O. 2 Motivations Often you encounter the problems that involve string processing and file input and output. Suppose you need to write.
1 Various Methods of Populating Arrays Randomly generated integers.
CS324e - Elements of Graphics and Visualization A Little Java A Little Python.
Written by: Dr. JJ Shepherd
1 Lecture 11 Interfaces and Exception Handling from Chapters 9 and 10.
Final Review.
Inheritance Inheritance Reserved word protected Reserved word super
ITEC200 – Week03 Inheritance and Class Hierarchies.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Chapter 41 Defining Classes and Methods Chapter 4.
Lecture 27 Exam outline Boxing of primitive types in Java 1.5 Generic types in Java 1.5.
Wednesday, 12/11/02, Slide #1 CS 106 Intro to Comp. Sci. 1 Wednesday, 12/11/02  QUESTIONS??  Today: CLOSING CEREMONIES!  HW #5 – Back Monday (12/16)
Topic R3 – Review for the Final Exam. CISC 105 – Review for the Final Exam Exam Date & Time and Exam Format The final exam is 120-minutes, closed- book,
Cmp Sci 187: Midterm Review Based on Lecture Notes.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 4 Defining Your Own Classes.
Chapter 10 Classes Continued
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
Abstract Data Types (ADTs) Data Structures The Java Collections API
CSE 331 Software Design & Implementation Hal Perkins Autumn 2012 Java Classes, Interfaces, and Types 1.
Writing Classes (Chapter 4)
1 Review of Java Higher Level Language Concepts –Names and Reserved Words –Expressions and Precedence of Operators –Flow of Control – Selection –Flow of.
Topic 3 The Stack ADT.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Summary and Exam COMP 102.
SAK 3117 Data Structures Chapter 3: STACKS. Objective To introduce: Stack concepts Stack operations Stack applications CONTENT 3.1 Introduction 3.2 Stack.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 12: Pointers continued, C strings.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 8 Objects and Classes.
Data Structures and Java CS 105. L7: Java Slide 2 Data structure Data structure defined: A systematic way of organizing and accessing data Examples Dictionary:
5-Aug-2002cse Arrays © 2002 University of Washington1 Arrays CSE 142, Summer 2002 Computer Programming 1
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2009 Pearson Education, Inc., Upper.
1 Java: AP Curriculum Focus and Java Subset Alyce Brady.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Chapter 6Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 6 l Array Basics l Arrays and Methods l Programming with Arrays.
CS 112 Department of Computer Science George Mason University CS 112 Department of Computer Science George Mason University Final Review Lecture 14.
CSC1401 Classes - 1. Learning Goals Computing concepts Identifying objects and classes Declaring a class Declaring fields Default field values.
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2008 Pearson Education, Inc., Upper.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Types in programming languages1 What are types, and why do we need them?
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
5-Dec-15 Sequential Files and Streams. 2 File Handling. File Concept.
1 Review of Java Basic Concepts –Names and Reserved Words –Expressions and Precedence of Operators –Flow of Control – conditional statements –Flow of Control.
90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 1: Introduction Data.
COP3502 Programming Fundamentals for CIS Majors 1 Instructor: Parisa Rashidi.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 6 Objects and Classes.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
ICS3U_FileIO.ppt File Input/Output (I/O)‏ ICS3U_FileIO.ppt File I/O Declare a file object File myFile = new File("billy.txt"); a file object whose name.
Programmeren 1 6 september 2010 HOORCOLLEGE 2: INTERACTIE EN CONDITIES PROGRAMMEREN 1 6 SEPTEMBER 2009 Software Systems - Programming - Week.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Summary and Exam COMP 102.
Inheritance and Polymorphism. Superclass and Subclass Inheritance defines a relationship between objects that share characteristics. It is a mechanism.
Chapter 4Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapters 4 and 5: Excerpts l Class and Method Definitions l Information.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
© 2006 Pearson Addison-Wesley. All rights reserved 1-1 Chapter 1 Review of Java Fundamentals.
Arrays (part 2) 1 -Based on slides from Deitel & Associates, Inc. - Revised by T. A. Yang.
OOP Basics Classes & Methods (c) IDMS/SQL News
Mid-Year Review. Coding Problems In general, solve the coding problems by doing it piece by piece. Makes it easier to think about Break parts of code.
COMP Inheritance and Polymorphism Yi Hong June 09, 2015.
Lecture 5:Interfaces and Abstract Classes Michael Hsu CSULA.
Georgia Institute of Technology More on Creating Classes Barb Ericson Georgia Institute of Technology June 2006.
Lecture 6:Interfaces and Abstract Classes Michael Hsu CSULA.
Lecture 5:Interfaces and Abstract Classes
CS 215 Final Review Ismail abumuhfouz Fall 2014.
Introduction to Data Structures
Week 4 Lecture-2 Chapter 6 (Methods).
Introduction to Data Structure
Midterm Review CSE116A,B.
Java Basics – Arrays Should be a very familiar idea
Presentation transcript:

Final Review

2 Final Details Monday, December 11 th 7:00pm – 10:00pm HCC 1325

3 Sections Covered - Detailed View , , [covered 3.4, 3.5 in class] [covered 4.5 in class] , [(basically) covered 5.6 in class] , 6.7, 6.8[covered 6.9 in class] , [covered 7.4 in class] some parts of 12 covered in class notes

4 Sections Covered - Broadly Chapters 1-11  (except for Graphics track)  … with minor exceptions…

5 Other Topics (from before midterm) Running time / Big O notation Working with references handout  including null / this Merge sort Command line arguments printf

6 Other Topics (after midterm) More detailed treatment of some topics  polymorphism (e.g. covered Collections)  file output (e.g. covered buffers and generic Writers)  File input Call Stack Scanning tokens Regular Expressions

7 Chapter 1 Computer processing The Java Programming Language Program Development Object-Oriented Programming  (very basic)

8 Chapter 2 Character Strings Variables and Assignment Primitive Data Types Expressions Data Conversion Interactive Programs

9 Chapter 3 Creating Objects The String Class Packages Formatting Output  (plus more detailed coverage of printf) Enumerated Types Wrapper Classes

10 Chapter 4 Anatomy of a Class Encapsulation Anatomy of a Method

11 Chapter 5 The if Statement and Conditions Other Conditional Statements Comparing Data The while Statement Other Repetition Statements

12 Chapter 6 Software Development Activities Identifying Classes and Objects Static Variables and Methods Class Relationships Interfaces Method Design Testing  (covered the same material in class)

13 Chapter 7 Declaring and Using Arrays Two-Dimensional Arrays The ArrayList Class

14 Chapter 8 Creating subclasses Overriding methods Class hierarchies Inheritance and visibility Designing for inheritance

15 Chapter 9 Polymorphism  polymorphic references  through inheritance  through interfaces Searching  linear search  binary search Sorting  insertion sort  selection sort  merge sort

16 Chapter 10 Exception Handling The try-catch Statement Exception Classes I/O Exceptions

17 Chapter 11 Recursive Thinking Recursive Programming Using Recursion

18 Running Time – Big-O For a parameter n…  e.g. the length of a string or size of an array … count the number of steps performed…  loop through n elements = n steps  loop inside a loop = n 2 steps Ignore constants… coefficients…  3n + 2 steps = O(n)  n 2 /2 steps = O(n 2 )  “cutting problem in half at each step” = O(log n)

19 Working with References null reference  Object variable not assigned anything  When does this cause an exception? this reference  When does this simplify code?

20 File I/O Where do the exceptions happen?  How do we handle them? Why do we want to buffer? How do we buffer? Using Scanner  with default tokens  with defined tokens

21 Regular Expressions Given regular expression  yes/no matching questions  give informal description Given informal description  write regular expression  pass appropriately to Scanner

22 What Kind of Questions? Look at the exercises in the text  finding errors in code  finding differences in code  explaining/defining concepts  predicting output of code  writing methods or classes  specifying/justifying design from requirements

23 What Kind of Questions? Similar format for lecture material  e.g. specify running time  e.g. find null reference problem Using regular expressions Predicting tokens parsed Describe call stack  including exceptions  explain stack trace

24 It May Be on the Test if… It is in the text It is in the lecture notes It is something I said in class or wrote on the blackboard It was part of a lab/assignment

25 What Code Do You Need to Know? Officially: everything as per previous slide Unofficially:  I try to only assume you know “important” methods and classes  … but I decide what is “important”  in general… little used methods that occur rarely in the notes will be given implicitly  but you should know enough code to solve problems without help/look-up

26 Examples There will be definitions (again)  abstract class  checked exception  final method  overridden method

27 Examples There may be explanations required…  Explain why a static method cannot refer to an instance variable.  Give two differences between an abstract class and an interface.

28 Examples Draw a UML diagram for a single class hierarchy representing these animals, with abstract classes grouping animal types  parrot  gorilla  horse  bat  penguin Add an interface for flyers

29 Examples Correct the problems Flyer polly = new Parrot(); Animal koko = new Gorilla(); Gorilla junior = koko.makeOffspring(); polly.layEgg();

30 Examples Define appropriate classes and public methods for the given requirements.  Every salesperson will be assigned a unique ID number, and a numbered office with a phone. Salespeople will sell vacuum cleaners at a fixed price. When inventory runs out, the top salesperson will be designated employee of the month.

31 Examples Find the exception in this code, and handle it. public static void main(String[] args) { FileWriter fileout = new FileWriter(“names.txt”); if(fileout!=null) fileout.write(“John Smith”); else System.out.println(“No name written to file”); }

32 Examples Find the exception in this code, and handle it. public static void main(String[] args) { Student s = new Student( ,”tsmith”); String fname = s.getFirstName(); System.out.println(fname); }

33 Examples Given this information in file.txt: 7 | 5 | 5p,| 4 Write the code that will print these tokens to the screen using a Scanner/delimiter:  “7 | 5 | 5” and “, | 4”  “7 | “ and “ | “ and “p,| 4”

34 Solution Scanner filein = new Scanner( new File(“file.txt”) ).useDelimiter(“p”); while(filein.hasNext()) { System.out.println(filein.next()); } “5”

35 Examples Yes or no expression matching  [1-7]*a? 43  (17)+(17a)?17a  [abc][def](di)?bed  [123]+(45)?a* aaaa  [ab][bc][cde]*abcde  [A-C]DEF?ABCDE  [truck].[stop]+trstopstop yes no yes no

36 Examples Describe the strings matching the expressions  (cat)+  [cat][cat]  cat?  [ca]?t*  (c?a+)t?  [c-t]a?[c-t]*

37 Examples What is the value in variable temp after: int temp = 30; String stemp = temp + “12”; temp = temp + Integer.parseInt(stemp); Again: Collection l = new ArrayList ; int temp = 40; l.add(40); temp = l.size();

38 Examples Write a method that picks a random character in the string “string”.

39 Examples What is wrong with this? How can it be corrected? int count=1,max=0; while(count=max) { System.out.println(count); count-=2; }

40 Examples A LinkedList implements Collection Write a method that adds every word in the sentence “This is a sentence” to a LinkedList, then prints the size.

41 Examples Given double[] input, write a method that returns the highest value

42 Examples Write a class NamedArrayList that extends ArrayList by adding a name for the array list in the first position.

43 Examples What is wrong with these declarations:  char[] chars = {“d”, “a”, “b”};  String[] = new String[5];  Scanner[] sc = new Scanner(5);

44 Examples Write a recursive function that returns true if the input is a power of 3. Write a recursive function that returns true if a string contains only the letter ‘s’.