CSC 121: Computers and Scientific Thinking
Fall 2009

Test 2 Review


A: Tue, Nov 17
B: Mon, Nov 16
  • As with Test 1, the test will contains extra points (e.g., 53 out of 50).
  • As with Test 1, the test will include a variety of questions (e.g., TRUE/FALSE, short answer, trace/modify code).
Study advice
  • review chapters & online lecture notes
  • look over chapter exercises, review questions, labs
  • reference other sources for examples, different perspectives
Course Material
TEST 1 MATERIAL

User Interaction and Computation
    text boxes
        INPUT tag, attributes: TYPE="text", ID, SIZE, VALUE
        access contents via document.getElementById('BOX_ID').value
    variables
        naming conventions
        variables & memory cells 
        variables for reusing values (e.g., fill-in-blank story) 
        variables for temporary values (e.g., swapping images)
    pages that compute
        numbers & expressions, mathematical operators (+, -, *, /)
        number representation
        parseFloat function
    programming errors & debugging
        syntax error, run-time error, logic error
Functions and Randomness
    predefined functions
        units of computational abstraction
        function call, inputs & output (return value)
        Math functions
            Math.sqrt, Math.abs, Math.floor, Math.ceil, Math.round
            Math.min, Math.max, Math.pow
            Math.random
    simple user-defined functions
        function keyword, function name, comments, {}
        enclosed in SCRIPT tags in HEAD
        functions to simplify buttons
            code goes into function; ONCLICK attribute calls the function
    randomness in a page
        application: dice simulation
            function changes dice images at random, called on button click
            requires consistent naming scheme (die1.gif, die2.gif, ...)
        application: random slide show
            similar to dice, pick among images (slide1.jpg, side2.jpg, ...)
            ONLOAD attribute of BODY to perform initial selection
        application: banner ads
            similar to slide show, pick among banners (ad0.gif, ad1.gif, ...)
            setInterval function to schedule regular changes   
            variable and % operator to rotate banners in order
            
Computer Science as a Discipline
    study of computation, artificial vs. natural science
    CS themes: hardware, software, theory
    subfields of CS
        Algorithms & Data Structures: public-key encryption
        Architecture: parallel processing
        Operating Systems & Networks: Ethernet
        Software Engineering: software life cycle
        Artificial Intelligence: Turing Test
        Bioinformatics: genetic databases
    ethics of computing