IFSC 30003 HW3 Due by Wednesday Sept. 17, 2025
Directions: Answer the questions below, then hand in by emailing to IFSC30003HW@gmail.com. You may use JavaScript, reasoning, or both. In some of them, the best way is to try to reason them out, then try them in JavaScript to check your reasoning. You can use a sandbox to test JavaScript statement. You can hand it in an email with as few attachments as is feasible.
(1) Give four examples of the logical OR (written in JavaScript as ||) from daily life illustrating the four cases of true or false, false or true, true or true, and false or false. (Avoid using examples of if-then statement from daily life, as these are not the same.
(2) Using JavaScript, write code that will print 5 lines: one for each row of the truth table for OR, plus a line containing the column labels.
To assist in this, here is the truth table for OR:Truth table A B (A OR B) ----------------------- T T T T F T F T T F F F
Hint: You need to print out your truth table somehow. So, \n denotes the newline character (i.e. a line break) in JavaScript. On the other hand, <br> denotes a line break in HTML. Thus, if you put a \n in a string and write the string to the innerHTML of an HTML element like a <p>, it will display in HTML as white space (in other words, it will print as a space or a line wrap, as decided by HTML). Instead, put the substring "<br>" in the string and HTML will render the "<br>" as the desired line break. On the other hand if you print using pure JavaScript, for example using alert(), which creates a popup that contains text, not HTML, then \n in a string that you print using alert() will line break the string at that point. On the other hand, if you use alert() to print in its popup, if the string you print there contains the substring <br>, it will print out simply as the 4 characters "<br>". Confused yet?? It will become clearer when you try it, just like so many things in programming.
(3) Using JavaScript, write code that will print 5 lines: one for each row of the truth table for AND, plus a line containing the column labels.
(4) (Optional in 2025, not required) What is the integer value of an 8-bit byte containing the following bit sequences? (Hint)
a. 00000001
b. 00000010
c. 00000011
d. 00000100
e. 00001000
f. 00001111
(5) (Optional in 2025, not required)
a. What is 7^7 in JavaScript? Explain. See https://www.w3schools.com/js/js_bitwise.asp for more information.
b. What is 7 & 7? Explain.
c. What is 7 | 7? Explain.
(6) What is the minimum score on a HW assigment in this course?
(7) Use the learning app at https://claude.ai/public/artifacts/af242f43-0243-4187-9d17-4b34b9295435. Provide a screen shot when you finish. Also give your assessment of the learning value of this app.
(8) Use the learning app at https://claude.ai/public/artifacts/a42c5fe1-e8c0-4db4-aa99-3e618ea45a93. Provide a screen shot when you finish. Also give your assessment of the learning value of this app.
(9) Significantly improve the program you wrote for HW 1 or HW 2. You can use AI. Explain what you tried and what issues arose.