Student Name: _________________________________________________                                        Recitation Section ____________________

CSE 111 - Homework #2

Instructions:  Print out this page.  Write your answers for the first two parts of the homework on the print out.  Write your answers on a separate sheet for the last section.  Print your name on each page of the homework and staple all your pages together. 

 

Due Date:  Due at the beginning of lecture on Friday, November 15, 2002.

 

Variable names

For each of the names listed, write the word VALID on the line if the identifier is a valid JavaScript identifier.  Write INVALID if it is not a valid JavaScript identifier.

 

_var                      ___________________________

6teenGoingOn17   ___________________________

WrftbsIp                ___________________________

q#rt                      ___________________________

oneTo1                 ___________________________

 

Evaluation of Arithmetic

For each arithmetic expression below, evaluate the expression and give the answer.  Show your work for full credit.

 

((3 * 6) + 9) / 3 * 5

 

 

 

 

9 * (4 + 10) + 14/2 * 3

 

 

 

 

10 * (5 + 5) - (2 * (8 + 9))

 

 

 

 

 

Equivalent Boolean Expressions

Tell whether the two Boolean expressions are equivalent.  Show the truth table to prove the equivalence.

 

(!p || !q) || q         and   (!p && q) && !q

!((!p || r) && !q) && p   and   (r || !q) && (!p && r)