Review for Second Exam

Check with your instructor whether all of this material will be on your exam, and whether there is additional material that you are responsible for that is not listed here.

The exam will cover the lecture material from Weeks numbered 7-12 in the syllabus, as well as the labs from Weeks 7-12 (all the lectures on programming, including algorithms, javascript, how programs are processed in the CPU, limits of computation - infeasible and non-computable problems).

The parts of the textbook covered are:

Concepts and terms

Sample Questions

NOTE: These questions are only samples. The questions on the exam may be different, and may cover other topics from the list above.

  1. Short answer questions

    1. What does a compiler do?

    2. What is the purpose of a variable?

    3. What is the difference between the statements below?
      a) alert(number); b) alert('number');

    4. What is the difference between the statements below?
      a) alert("number"); b) prompt("number");

    5. What is the difference between document.bgColor and document.fgColor ?

    6. How does an image rollover work?

    7. Why is it difficult to design a computer program that will always win at playing chess?

    8. What is the Halting Problem?

    9. What is the difference between an infeasible problem and a non-computable problem?

  2. Explain a web page containing Javascript

    Be prepared to look at the html for a web page and draw a picture of what gets displayed on the page, and explain what happens when buttons are pushed.

  3. Write the code in Javascript

    Be prepared to write a complete Web page containing textboxes and buttons that use Javascript to accomplish a simple task:


    1. Write the code to display one button on the web page. The button should say "Push me". When the button is pushed, a message should appear saying "Ouch!"

    2. Write a simple script that asks for a person's name and then produces a message that says "Hello Jane" (or whatever the name is)

    3. (Similar to problem above, but uses onclick().) Write the code for a Web page that contains uses a textbox that allows the user to type in his name. The webpage also contains a button that says "Press Here". When the button is pressed, a message appears that says "Hello Jane" (or whatever the user's name is)

    4. Write a page that allows a user to enter a color and will change the background color accordingly.