Final Exam Study Guide

The exam will be in class, and you will have the full time to complete it. A well prepared student will have no problems being done in 120 minutes. It will be closed book, closed notes, closed laptops, closed cell phones, closed bricks, closed everything and no discussions allowed with class mates during the exam.

Here is a list of topics that you should be able to explain or use in a program. Understanding these topics well will help you do well on the exams.

This is a guide, not a guarantee. I intend for it to help you, but questions on the exam can come from any material we have studied in this class.

basic data (number, string, boolean)
  operations on each type

all of the "big 6" topics

  1) data storage to memory: variables, assignment

  2) data retrieval: expressions, evaluation

  3) decision making: conditional statements
       comparisons, boolean conditions

  4) repetition: loops 
       definite loops (for)
       indefinite loops (while)
       break statement to end a loop
       return to end a loop (and end execution of a function)

  5) procedure abstrations: 
       writing functions
         functions are first class objects
         a function can be assigned to a variable
       calling functions
         understand how parameters are passed 
           from the calling function to the called function
         understand how return values are sent back 
           from the called function to the calling function

  6) data abstraction: aggregation (arrays)
       creating arrays
       using arrays (indexing, using for loop to access all items)
       getting length of array

  what they are: 
    sort of an abstraction of an entire program 
    data and functions combined, wrapped up
  data field (variable in an object)
  method (function in an object)

  how we create one
  how to initialize one
  how to use one, how to access the data fields and call the methods
  return data as a group with an object (that has no methods)
  constructors: functions that "manufacture" and return new objects
  arrays of objects
  object that contains an array as a data field

what you learned in your assignments:
  sorting (bubble sort)
    linear search through an array
    binary search (number guessing game)
  finding prime numbers (sieve of eratosthenes)

scope: visibility of names
  local scope
    variables declared inside a function
    parameters inside a function
  global scope
    functions at the top level
    variables declared outside of all functions (we dont use these)
  object scope
    using "this" to access a data field from inside a method

input mechanisms
  prompt statement
  getting text from input fields on the HTML page
  "parsing" text using string.split

output mechanisms
  alert statement (useful when debugging)
  sending text back to fields on an HTML page
  canvas drawing
converting text to numbers
  what is it, 
  why we use it,
  what is the basic coding pattern for a recursive function
  simple example (factorial)

simulated execution
  show memory map for local variables 
  show how variable values are assigned and change
  show how memory maps are created for a function call
  show how parameters are passed when function is called
  show how return values are sent back to calling memory map

good coding practices
  using named constants instead of explicit numbers in code
    named constant is a variable that is initialized 
      and then not re-assigned, so its value does not change
  write a few lines of code, compile, and test
    dont write a large block of code and hope it all works
  grow a program a little piece at a time
    add capabilities one thing at a time 
  input data validation
  comment the code at places that could be hard to understand
  dont use global variables (unless you are testing and are using
    them temporarily) 
  write functions to prevent replicating blocks of code throughout
    your source code
  write functions to make code more compact and easier to read
    abstract away some details into the function body