␡
- Get Ready to Program
- What a Computer Program Does
- Common Programming Misconceptions
- Many Programs Already Exist
- Programmers Are in Demand
- The Real Value of Programs
- Users Generally Don't Own Programs
- Giving Computers Programs
- Your First Program
- Clarifying Comments
- Entering Your Own Program
- Summary
- Q&A
- Workshop
< Back
Page 14 of 14
This chapter is from the book
Workshop
The quiz questions are provided for your further understanding.
Quiz
- What is the difference between data and information?
- What is a program?
- What is a programming language?
- True or false: Computers never make mistakes.
- Why should people not fear the computer replacing their jobs?
- What do programmers use editors for?
- True or false: Java and JavaScript are related to each other.
- What filename extension should you use when you create a JavaScript program?
- True or False: There’s no problem writing your programs in your typical word-processing program.
- Tweak the program in Listing 1.2 so the dialog box asks, “Who wrote this program?” and the answer the user gets upon clicking the button is your name.
Answers
- Data consists of raw facts and figures, and information is processed data that has more meaning.
- A program is a set of detailed instructions that tells the computer what to do.
- A programming language is a set of commands and grammar rules with which you write programs that give computers instructions.
- False. A computer might make a mistake, but it’s rare that it does so. In the vast majority of cases where a computer is blamed, a person entered bad data or typed a bad program.
- Computers increase jobs, not replace them. The information industry is one of the reasons for the past two decades of economic growth.
- Programmers use editors to type programs into the computer.
- False. JavaScript and Java only share a name; JavaScript was a scripting language that was developed at the same time Java was hot, so it was named in a way to take advantage of Java’s popularity.
- If your code is going to stay in your HTML document, you can use .html or .htm, but when you create separate JavaScript files, use .js.
- False. The default method of saving files in word processors will add formatting codes that will generate errors when you try to run your program. You can still use a word processor, but you must always remember to save your files as plain text.
Here is one possible solution:
<!DOCTYPE html> <html> <head> <script> /* This is the function that gets called when the user clicks the button on the main page */ function displayProgrammer() { document.write("Dean Miller did!"); } </script> </head> <body> <h1>My First Program</h1> <p id="demo">Who wrote this program?.</p> <button type="button" onclick="displayProgrammer()">And the answer is...</ button> </body> </html>
< Back
Page 14 of 14