CPSI 20023      HW1           Due by Wednesday Sept. 2, 2026

Directions: Answer the questions below.

Hand in by emailing to CPSI20023@gmail.com. Put answers as attachments (for long ones) or in body of email (for short ones, if any). Avoid sharing a google doc because the grader might not be able to see it.

 

1.      Go to w3schools.com, then to its JS Tutorial section, then to the first lesson there, linked from "JS HOME" and titled (once you get there) "JavaScript Tutorial." Find the sandbox on that page and go to it by clicking "Try it Yourself."

(Revised for 2026) Using AI, create a web page that contains a quiz game that exercises the user (that's you in this case!) on the questions below about the JavaScript code in the sandbox. Hand in the page that you generated, and a full-screen screenshot of the result of you playing the quiz game. The file names of both should indicate Q1 to avoid confusion with your answers to other questions.

·       The use of the button HTML command, except for the JavaScript code part.

·       The meaning of onclick, which is an attribute of the button command.

·       The meaning of the JavaScript code assigned to the onclick argument.

·       What does "demo" refer to?

·       What does the function getElementById() do?

·       What does innerHTML refer to?

·       What does the function Date() do?

2.      Consider the "JavaScript Where To" lesson, linked from "JS Where To." JavaScript may be placed within HTML <script>…</script> tags. Let us call these code passages "scripts." Can a script be placed in an HTML head, body, neither, or both?

You may use AI to help, but your answer should be in your own words: you can engage with the AI to get information and to interact with you to help answer questions you have about it and make sure you understand it, but once you understand it, write the answer to this HW question yourself. If you can do that, you understand it, but if you can't, you don't understand it yet - in which case, just interact with the AI to get to an understanding of it!

3.      Consider external JavaScript code.

a.      Why might code be placed in an external file instead of in a web page? You can use AI as explained in the previous question.

b.      Find the external code file myScript.js on the W3schools site. What is the URL of that file?

4.      Consider the "JavaScript Output" lesson linked from "JS Output."

a.      Write an HTML page (you can use a sandbox from "JS HOME" or elsewhere) that has 4 buttons on it. One button demonstrates output to the innerHTML location of an HTML element. Another button demonstrates (when you click it) the document.write() output method. A third button demonstrates output using the alert() function. A final button calls window.print().
    Test the buttons to make sure they work. Explain what happens when you click the document.write() button.

b.      Consider output using console.log(). Explain what you see in the console, or provide a screen shot of the console containing a logged output.

5.      Learn about quote symbols in JavaScript.
Use https://claude.ai/public/artifacts/aa820d6a-7b91-4d07-a04a-53bd77897b58.
(The previous version at https://claude.ai/public/artifacts/830f3187-24ba-45bd-ad97-899d668d6541 is algorithmically the same but has a user experience deficiency.)
Hand in a screen shot showing that you finished it.
Evaluate: what do you think of the quality of this AI-generated app?

6.      (5 pts.) In this course a more mathematically reasonable scoring model is used for scoring HWs, as discussed here. In this course, what is the minimum score on a HW, such as for a HW that is not handed in?