Midterm Review

You are responsible for all of the material up through HTML.

Java Basics
	Make sure you know how to write a Java program
	Make sure you understand the differences between C++ and Java
	Know how to use pointers to create linked data structures
	Java has no stack-allocated objects, including arrays
	    To create an array of TreeNodes, you must write
		TreeNode forest[] = new TreeNode[10];
		for (i = 0; i < forest.length; i++)
		    forest[i] = new TreeNode();
	Java I/O
	    Scanners
		For reading lines
		For tokenizing lines (remember to close these scanners)
		For file I/O (drop a FileReader object into a BufferReader
		    object which in turn is dropped into a Scanner
		   object)
	    String => Number Conversion using Integer.parseInt and
		Double.parseDouble

	Garbage Collection
	    Reference Counting 
	    Tracing Collectors
		Mark-sweep
		Stop-and-copy
		Generational collectors

How to execute a Java program
	Use the package prefix 
	Use the -classpath or -cp flag to tell the interpreter where to
		find packages
	How to execute a .jar file

Inheritance
	How to draw an inheritance tree
	Interfaces versus classes
	    interfaces are declarations of types (specify an API)
	    classes are concrete implementations of types (provide implementation)
	Types/Subtypes and Classes/Subclasses: Note the relationship
		between types/classes and also that subinterfaces represent
		subtypes
	    i. Abstract type: A set of operations only (Stack)
	    ii. type: A set of values + a set of operations (Stack of ints)
	    
	Virtual methods: Know the difference between virtual, pure virtual,
		and non-virtual methods
	    i. virtual methods provide an implementation that may be
	       overridden by a subclass
	    ii. pure virtual methods: provide no implementation and hence
	    	subclasses must provide an implementation
	    iii. non-virtual method: a method whose implementation must be
	    	 accepted by all subclasses (i.e., it cannot be overridden)

	Know Java and C++ syntax for inheritance (abstract, extends, implements,
		access modifier before each method)

	C++ Inheritance Issues
	    1) Initialization lists for constructors and why they are more
	       efficient than assignments in constructor bodies
	    2) Multiple inheritance
		a) What it is
		b) Shared versus replicated inheritance
	    3) How to inherit implementation but not interface by subclassing
		using the protected keyword

Modules
	Packages (Java)
	Namespaces/Friends (C++)
	void */putting structs in .c rather than .h files to hide
	   implementation (C)

	Disadvantages of Friends
	    one-way: requires O(n^2) declarations to share implementation
		among n classes
	    not inherited: subclasses must also be declared friends

	Java adds package-level access: know the difference between
		package-level and protected access

Generics (Templates)
	Polymorphism-Parametric versus subtype
	    parametric (templates): same piece of code operates on different
	    	 types
	      explicit (C++, Java): explicitly provide the type parameters
	      implicit (scripting and functional languages): the runtime
	      	   environment infers the types of the parameters
	    subtype (inheritance): different piece of code may operate on
	    	 different types but the behavior must be the same
		 
	Know how to write a template class in Java and C++
	Use void * in C to get generic functions/data structures

	    	        Template Properties
			Java	C++	C
	Compilable	 yes	no	yes
	Primitive Types   no 	yes	no

	Java uses type erasure to compile template code: it replaces each
	   type parameter with its upper bound 

Exceptions
	Try/throw/catch in Java/C++
	    use try/catch rather than exit so that stack frames get popped
		and destructors executed in C++. These destructors can
		do the appropriate thing with partially completed resources.
	setjmp/longjmp in C
	    variables stored in registers may be lost
	    volatile variables solve the problem but require a write-through
		to memory which can jam the processor pipeline

	know how to write Java and C++ code with exceptions
	    1) try/catch: try executes error-free code and catch executes
		error handling code
	    2) throw: does not have to appear in a try statement, but if 
		it does not, then the exception is thrown out of the function
	    3) throws declaration: Java requires that exceptions of type
		Exception be declared as not handled using a "throws" 
		statement if they are not caught by a catch statement. This
		is true even if the exception is thrown by a called function
		rather than the function itself
	    4) finally always executes

	know the different Java exception classes and what they do
	    1) Throwable--top-level exception class
	    2) Error--unrecoverable hardware errors
	    3) Exception--for user-defined exceptions--these are checked
		by Java and must either be caught or declared unhandled
	    4) RuntimeException--the one type of Exception object that does
		not have to be caught or declared unhandled

Information Management
    There are 4 aspects to information management
    	  1) Content capture
	  2) Content management/storage
	  3) Content navigation/analysis
	  4) Content presentation
    Content capture: The important concepts are
    	  1) Sampling
	  2) Compression: Lossy versus lossless
    Content Storage: The important concepts are
	  1) Color models: Bitmap, grey scale, full color, color models
	  2) Know the trade-offs between different storage formats and
	     when they are mostly used (e.g., photos for JPEG, graphics for
	     GIFS, documents for PDF).
	  3) Know the difference between Ascii and Unicode and the difference
	     between Unicode and its different encodings.

    Content Management: Know the different ways to store content and when
    	    they are typically used
	  1) Relational databases: For well-structured, dense data.
	     a) They provide a DDL, DML, and various important access
	     	controls
	  2) Document collections: For semi-structured, sparse data. 
	  3) Digital libraries: For human-curated collections of data, often
	     with multi-media components. Often include meta-data, such as
	     catalogs.
	  4) Software repositories: a collection of information published by a
	     single organization. Typically not currated and typically lacks 
	     meta-data so it is more "raw" than a digital library.
	  5) Hypertext: Uses markup language and links for navigation. Good
	     for personal web-pages and "front-facing" content for organizations.
	  6) Spreadsheets: Good for non-programmers needing to store information.
     Secondary Storage
     	  The four main types are:
	      1) Hard disks
	      2) Solid state devices (SSD)
	      3) USB devices
	      4) Tapes
	  Hard disks are slow because of seek time and rotational latency
	  SSDs have almost no seek time and no rotational latency. The
	      transfer rates for cheap SSDs is comparable to transfer rates
	      for enterprise hard disks whereas enterprise-level SSDs used
	      in cloud storage have 10 times higher transfer rates than
	      enterprise hard disks.
	  SSDs are roughly 4 times more expensive than hard disks per gigabyte.

     Indices: Uses to speed up the performance of queries
     	  Know the difference between
	  1) Primary index
	  2) Cluster index
	  3) Secondary index

	  Know the difference between a range and point query

     Content Presentation
     	  1) The human eye is the primary way we gather sensory information
	     so most computer output is visual
	  2) Human visual properties
	     a) 20-30 frames per second is required to gain the illusion of
	     	smooth, continuous motion.
	     b) Review the facts on human color sensitivity
	     c) Animation: The human eye is strongly attracted to animation
	     	so generally include only one animation at a time and stop
		the animation after a brief time if it was only meant to
		attract the user's attention. Continous animation interferes
		with a person's ability to concentrate
	  3) Color models
	     a) RGB: Used by computers to generate colors and used by
	     	image formats to represent colors
	     b) HSV: Color model most familiar to humans and how humans generally
	     	express color.
	     c) CMY: Reflective color model used by printers and artists.
	  4) Text Presentation
	     a) Serif fonts: Use for printed material where the curls help
	     	the reader's eye move through the page.
	     b) Sans-serif fonts: Use for computer displays where the lack
	     	of curls helps improve readability on lower-resolution displays.
	     c) Typewriter fonts: Hardly ever used except for code in computer
                programs

    HTML and CSS
    1) HTML is used to specify the content and structure of a document.
       CSS is used to specify the presentation and appearance of a document.
    2) Basic HTML tags
       a) p, div, blockquote, pre: create blocks of content
       b) span, q: creates inline content that can be styled using CSS
       c) tt, strong (b), em (i), ul, sub, sup: ways to emphasize text
       d) table, th, tr, td: used for creating tables
       e) img: used to include an image
       f) {ol, ul}, li: created ordered and unordered lists
       g) a: creates links to other content
       h) h1-h6: creates headers/sections
       i) hr: creates a horizontal line
       j) br: creates a line break without creating a new paragraph
       k) head: specifies the meta-data for the document and goes before
	  the body
       l) body: specifies the viewable content of the document
       m) html: specifies the beginning of the document--goes before head.
    3) HTML attributes: Used to provide meta-data about an element's content.
       Important attributes are:
       a) id: uniquely identifies an element
       b) class: used by CSS for styling similar elements, such as the first
       	  paragraph in a section
       c) name: used by HTML widgets when they transmit key/value pairs to
       	  a server
       d) src: used by the img tag to indicate the file to be included
       e) colspan: used by the td tag to indicate the number of columns
          spanned by this cell.
       f) style: used to specify a CSS style for that specific tag. It is
	  generally considered poor form to use this attribute. You should
	  put rules for the tag in a stylesheet instead. The one exception
	  is using the style attribute to specify the pixel width/height of
	  an image. You do this per image to prevent the page from flickering
	  as it is loaded.
    4) HTML comments: Start with <!-- and end with -->. For example:
         <!-- This is a comment -->
    5) HTML entity codes: Used to represent reserved HTML characters such 
	as <, >, and & or to represent characters that do not
	appear on a keyboard, such as π or ⊂.