The exam will again be pencil-and-paper, closed notes and
internet.
The exam is designed to test you on your understanding of
basic programming concepts and the JavaScript language.
I may ask you to write an expression, an assignment statement,
a conditional statement (if), a loop
(while and for), or a simple
function.
I will not ask you to design a solution to a complex problem,
or a program that consists of multiple functions.
I may ask you to explain a concept, but I will not expect
exact definitions from the notes.
I may ask you to trace the value of a variable in some code.
If I ask you to write code, I will provide you with a list of
objects, properties, and methods you might use.
The best way to prepare is to carefully review the homework
problems and in-class exercises that we did. Review the
readings and the rest of the session notes for basic ideas.
You don't need to reread every page in great detail.
Basic Ideas about Programming and JavaScript
What is a program?
Why do we need programming languages to write programs?
(precise form and meaning)
Where is JavaScript usually executed?
What is the difference between server-side and client-side
programs?
JavaScript: Basic Concepts
What is a statement?
What are variables? Why do we need them?
Explain how an assignment statement works.
Be able to distinguish between the equality and assignment
operators.
Understand the difference between the primitive data types:
numbers, booleans and strings.
Have a basic understanding of an object: an abstraction that
may contain properties and methods.
Be able to write and evaluate basic expressions with numbers
(basic arithmetic) and strings (concatenation).
Be able to create a multi-line string.
The DOM
What is the DOM?
What do we mean when we say HTML is for defining structure
and that CSS is for defining for presentation?
Be able to access HTML elements using
querySelector() and
querySelectorAll(),
and understand the difference between the two.
Be able to access and modify:
HTML element properties, such as innerText
and innerHTML
attributes, using getAttribute() and
setAttribute()
Be able to create an element and add it to a document.
Functions
What is a function? Why do we need them?
Be able to define a function and
call a function.
Be able to write a simple function that takes arguments and
returns a value.
Conditional Statements
Be able to write a conditional statement:
an if statement
an if-else statement
and to describe how one works.
Understand boolean values: true and
false.
Be able to write and evaluate expressions
with comparison operators
(<, ===, >, etc.)
and logical operators
(&&, ||, !).
Repetition Statements
Be able to write a while statement and to
describe how one works.
Be able to write a for statement and to
describe how one works.
When do we use a while statement, and when do
we use a for statement?
Recognize an infinite loop.
Arrays
What is an array?
Be able to use arrays and lists in simple code:
access an item in array
modify the value of an item in array
find the length of an array
Be able to create an array from a string, including a
multi-line string.
Events
What is an event?
Be able to give examples of user-generated events.
Be able to read code that uses the
oneventname property
and describe how it works.
Be able to use the addEventListener() method to
handle events, including:
understanding the eventName parameter
understanding the eventHandler parameter
using the method to connect a function to an event
triggered by some HTML element