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:
- Chapters 4, 5, 6, 10, and 11
Concepts and terms
- algorithm, program, script
- stored program concept
- how programs are executed in the CPU - roles of the ALU,
Control Unit, registers, program counter, instruction register, bus
- input, output
- variables (identifiers)
- predefined functions or methods: alert, prompt
- text input boxes and buttons
- event-driven programming
- onMouseOver, onMouseOut, onClick
- properties and methods of window and document, such as document.bgColor,
document.write(), window.close(), etc.
- user written functions: where are they defined; usage of the keyword function,
parentheses and braces.
- loops, loops in user written functions
- infeasible problems
- computable and non-computable problems
- paradox, Halting Problem
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.
-
Short answer questions
-
What does a compiler do?
- What is the purpose of a variable?
- What is the difference between the statements below?
a) alert(number); b) alert('number');
- What is the difference between the statements below?
a) alert("number"); b) prompt("number");
- What is the difference between document.bgColor and
document.fgColor ?
- How does an image rollover work?
-
Why is it difficult to design a computer program that will always win at
playing chess?
- What is the Halting Problem?
- What is the difference between an infeasible problem and a non-computable problem?
-
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.
-
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:
Examples:
- 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!"
-
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)
-
(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)
-
Write a page that allows a user to enter a color and will change
the background color accordingly.