Which would be used to have a JavaScript function named hello execute before the user views a web page.. Which method allows you to display text on an HTML page.. Which would you use to
Trang 1Full download Test Bank for Introduction to JavaScript Programming with
XML and PHP by Drake
https://getbooksolutions.com/download/test-bank-for-introduction-to-javascript-programming-with-xml-and-php
You can get solutions of this book at link bellow
https://getbooksolutions.com/download/solution-manual-for-introduction-to-javascript-programming-with-xml-and-php/
Test Bank for Chapter 1
MULTIPLE CHOICE
1 Which is the first step in the program development cycle?
a design a program
b analyze the problem
c code the program and review the results
d test the program
ANS: B
2 Which of the following is not a control structure?
a sequence
b selection
c syntax
d repetition
ANS: C
3 Which of the following is NOT one of the primary JavaScript data types?
a float
b numeric
c Boolean
d string
ANS: A
4 Which type of data type can have only one of two possible values?
a float
b numeric
c Boolean
Trang 2d string
ANS: C
5 Which of the following is not an acceptable variable name?
a one_name
b name_One
c 1_Name
d theFirstName
ANS: C
6 Which of the following is not an acceptable variable name?
a my Friend
b your_Friend
c We_Are_All_Friends
ANS: A
a 10
b 8
c 80
d cannot tell from the information given
ANS: C
8 Which tags are used to provide alternate content for users who have disabled scripts in their
a <noscript></noscript>
b <alt = "no script">
c < /no script>
ANS: A
9 Which would be used to have a JavaScript function named hello() execute before the user views
a web page?
a <script> JavaScript content </script>
b <body> <Javascript = hello()>
c <body onload = "hello()">
d <hello()><body>
Trang 3ANS: C
10 Which of the following describes a JavaScript object?
a anything you can click on
b anything that describes something you can click on
c anything something you can click on can do
d any HTML tag pair
ANS: A
ANS: C
ANS: B
13 Which method allows you to display text on an HTML page?
a onload
b show()
c display()
d write()
ANS: D
14 Which method will retrieve the contents of an HTML element?
a document.get()
b getElementById()
c innerHTML
d document.innerHTML
ANS: B
Trang 415 Which would you use to replace the contents of an HTML page with the value stored in a variable
named student?
a document.write(student);
b document.getElementById(student);
c document.write(student.innerHTML);
d document.write(student.HTML);
ANS: C
16 Which of the following will open a new window named mywindow that is 500 pixels in height and
350 pixels wide?
a mywindow = new window(height = 600, width = 350);
b mywindow = window.open(height = 600, width = 350);
c mywindow = window.open(""; ""; height = "600"; width = "350");
d mywindow = window.open("", "", "height = 600, width = 350");
ANS: D
17 Which of the following will close a window named mywindow ?
a close mywindow;
b mywindow = close();
c mywindow.close();
d mywindow.close;
ANS: C
18 Which of the following will prompt the user to enter his or her name?
a var name = window.open("What is your name?");
b prompt("What is your name?", name);
c var name = document.write("What is your name?");
d var name = prompt("What is your name?");
ANS: D
19 Which is the correct way to define a function named getAge()?
a function getAge()
{ body of function }
b getAge = new function
c getAge()
{ body of function }
d new function getAge()
{ body of function }
ANS: A
Trang 520 Which of the following would retrieve the value displayed in a <div></div> element which has
a sport = document.getElementById("football");
b document.getElementById("football") = sport;
c sport = document.innerHTML(id = "football");
d document.write("football");
ANS: A
TRUE/FALSE
1 True/False: The last step in the program development cycle is to code the program
ANS: F
2 True/False: A prompt is used in a program to tell the user to enter some data
ANS: T
3 True/False: The onload event is used to have JavaScript execute before the user begins to view
the page
ANS: T
4 True/False: The <script></script> tags are used only when you wish to include JavaScript
within the body of a web page
ANS: F
5 True/False: The write() method can only be used to display text within <p></p> tags
ANS: F
6 True/False: In most cases the words function and method mean the same thing
ANS: T
7 True/False: To define a function, you must use the function keyword
ANS: T
8 True/False: The innerHTML property allows you to retrieve information from an element on a
web page
ANS: F
9 True/False: Parameters are values that the user inputs to a program
ANS: F
10 True/False: The prompt() method allows you to prompt the user to input values
ANS: T