CIT 041J Final Exam
The exam consists of two parts: a written (paper) part and a
lab part.
You may download the written part at
http://evc-cit.info/cit041j/final_spring_2010.odt. It is in OpenOffice.org format.
For those of you who don’t want to install OpenOffice.org (although
it’s free),
http://evc-cit.info/cit041j/final_spring_2010.rtf, here it is in Rich Text Format, which
should work with pretty much any word processor.
The written part has ten questions worth 5 points each. You should know
about:
- Creating a
Date object.
- Using
document.writeln( ) to write paragraphs into
a document.
- The difference between
setTimeout( ) and
setInterval( ).
- Using the timer variable returned by those functions.
- Creating cookies with “unusual” characters (like
semicolons, accented characters, etc.) in them.
- Accessing information in a form by
name or
by id.
- Setting an object’s
style properties.
- How to create a new text node.
- How to write CSS attributes (for example, what is the CSS
to make a
<span> element bold with a font-size
125% of normal)
The lab portion of the exam can be downloaded at
http://evc-cit.info/cit041j/final_spring_2010.zip.
It is a game that presents cards to you two at a time. You are to click on
the card with the greater value, and your goal is to be as fast and accurate
as possible.
When you unzip the .ZIP file, you will find these files.
- images
- A set of images depicting playing cards. The file names
tell you what suit and rank the card has. For example, file
02h.png is the image for the
Two of Hearts, and 13d.png is the image for the
King of Diamonds.
- cookieutils.js
- Contains utilities for setting and retrieving cookie values.
- cardutils.js
- Contains utilities for manipulating the deck of cards.
Read the documentation in this file carefully.
- pregame.html
- This is the “entry page” which asks for the
player’s name. You must validate the input so that the
player cannot leave the field blank or just
whitespace.
This page will set a cookie with the player’s name, and
then proceed to the next HTML file (the last part is already done in the
action="" attribute)
- game.html
- This is the main game. When the player clicks the
Start Game button, the program will display the
first two cards in the deck, and the button will become
invisible. The user then clicks on one of the
cards (or the Same Value button if the cards have
the same value). Your program will then figure out if the click
is correct. If so, add one to the score; otherwise, leave it alone.
Then display the next pair of cards.
When the player has gone through all 26 pairs, the Start
Game button becomes visible again, allowing the user
to start a new game.
Comments in each of the HTML files tell you what code to insert.
You do not have to change the cookieutils.js or
cardutils.js files.
Screenshots
Click an image to see it at full size.
 |
This is what you display if the player does
not enter a name in the text field. |
 |
This shows a valid entry. |
 |
This is what you should see before a new game
starts. Notice that the area for the cards shows just
a blank card image. |
 |
This is the first pair of cards. The timer
updates once a second, telling how many seconds
have elapsed for this particular game. |
 |
In this case, the player correctly clicked the
Queen of Diamonds, so the score has been increased and
the program displays the next pair of cards. |
When You Finish
When you finish, send me an email that has as attachments:
- The filled-in test
- A .zip file that contains the code for the entire directory that
holds the game files and the images.