CPSC 120, Fall 2014
About the Final Exam


The fourth test in CS 120 will be given during the official scheduled final exam period, on Friday, December 19, at 8:30 AM. It will be in our regular classroom. The test is really more of a fourth test rather than a final exam as such. It will be four or five pages long, compared to four pages for the previous tests.

This final test will concentrate on material that we have covered since the third test, but of course you need to know previous material to the extent that recent topics build on older ones. In addition, the test will include one or two summary essay questions that ask you to write about the course as a whole. For those essays, you should review the basic ideas of web page design, HTML, CSS, and JavaScript. And there might be some questions about basic ideas from the Gimp image processing program.

The main topic for the fourth segment of the course has been data structures: arrays, objects, constructors, classes, and the DOM. Reading from JavaScript & JQuery includes pages 70–73 and 100–130. You might also want to look at Chapter 1b, pages 25–42 for background information on objects, properties, methods, and the document object. You should also review Labs 12 through 14.


Here are some important terms and ideas that you should be familiar with:

data structure

array
elements of an array
index of an element in an array
creating an empty array:   var A = [];
creating an array containing a given list of values:   var A = [2,3,5,7,11,13,17,19];
accessing an array element at a given index:    A[7]
using a variable or expression as an index:   A[i]   A[currentIndex+1]
assigning values to array elements:   A[7] = "foo";    A[i] = 0;
the length of an array:   A.length
using for loops to work with arrays

DOM functions that return arrays:  
     document.getElementsByTagName("..."), document.getElementsByClassName("...")
     using these functions to apply an operations to all HTML elements of a given type

object
properties of an object; property name and property value
creating an empty object:    var pt = {};
adding a property or setting an property value:    pt.x = 17;    pt.y = 42;
creating an object with a given list of values:   var pt = { x: 17, y: 41 };

objects represent "entities" or "things"
constructors
using constructors to create objects
calling a constructor with the "new" operator:    var exam = new Date("Dec 18, 2014);
a constructor defines a "class" of objects that have similar properties
a property of an object can be a function
method:  a function that is a property of an object
designing classes:  what data, constructors, and methods are needed?
arrays of objects
example: using an object to represent a colored circle

the Date class
     new Date()  constructs an object that represents the current time
     new Date{"Jan 1, 2015") constructs a specified date/time
     method date.toString() gives a string representation of the date
     method date.getTime() is milliseconds since midnight, Jan 1, 1970
     
the Card class
     new Card("Ace","Spades")  constructs a specified card
     method card.getSuit() gets the integer representing the suit
     method card.getValue() gets the integer representing the value
     method card.toString() gets a textual representation such as "Ace of Spades"
     
the Deck class
     new Deck()  constructs a shuffled deck
     method deck.shuffle()  puts all cards back and shuffles the deck
     method deck.nextCard()  gets the next card from the deck
     method deck.cardsLeft()  tells how many cards are left in the deck

the DOM, Document Object Model
new method for the document object
    document.createElement("..."), for example:  var element = document.createElement("p");
new methods for HTML element objects:
    method  element.appendChild(child)
    
Gimp image processing concepts
    levels tool
    selection
    drawing tools
    filter