CPSC 120, Fall 2011
About the Second Test


The second test in CS 120 will be given in class on Wednesday, October 17. It will concentrate on material that we have covered since the first test. Primarily, that means CSS positioning and JavaScript, but we also saw a few new things in HTML (<table>, <pre>) and in CSS (selection in context). However the new material builds on things that we covered earlier, so you still need to know the basics from earlier in the term. You can consult the list of readings from the textbook, on the course web page at http://math.hws.edu/eck/cs120, concentrating on the reading from weeks four through seven. You will also want to review Labs 5, 6, and 7. (There will be nothing on the test about Aptana Studio.)

The format will be similar to the first test: You should expect several types of questions. You will have to write some JavaScript code, and you might be given some JavaScript and asked to figure out what it does. You might also need to write or interpret some CSS. When working with JavaScript or CSS, you might need to write some HTML to go along with it. And of course, there will be some essay-type questions about definitions and concepts.


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

    making HTML tables with <table>, <tr> and <td> tags
    
    CSS selectors p:first-line and p:first-letter
    CSS selection in context,  such as #one h1
    
    background-image: url("...");
    background-size: 100%
    background-attachment: fixed;
    background-repeat: no-repeat;  and  background-repeat: repeat-y;
    
    the CSS float property, with value left or right
    floating images and how text wraps around floated images
    
    using the CSS style float: left for layout, including multicolumn layouts
    the (x,y) coordinate system for CSS elements
    the CSS position property, with values relative, absolute, fixed
    the CSS properties left, top, width, height, right, and bottom
    width and height control the size of an element
    left, right, top, bottom have no effect unless position is set
    using position: absolute and position: fixed to "overlay" elements
    translucent elements, using the CSS opacity property
    translucent colors, using CSS rgba color properties such as  rgba(180,150,0,0.5)
    
    putting JavaScript on a web page with <script>
    
    literals
    variables
    creating a variable with var
    strings
    boolean values
    assignment statements
    operators:  +, -, *, /
    operators for comparing values:  ==, !=, <, >, <=, >=
    functions
    calling a function
    using a function that returns a value, such as Math.sqrt(x) or Math.random()
    making a random integer between 1 and N with  Math.ceil( N * Math.random() )
    using Math.random() to simulate flipping a coin or rolling dice
    the built-in functions alert() and prompt()
    
    defining new functions
    using a function in an onclick attribute
    
    loops and branches
    if statements
    if statements with else
    while (true) loop
    break statements in loops
    counting loops
    
    enabling/disabling a button by setting document.getElementById("btn").disabled to false/true
    making text boxes with <input>, for example:  <input type="text" id="inbox">
    getting the contents an input box with document.getElementById("inbox").value