Tải bản đầy đủ (.pdf) (6 trang)

Test bank for introduction to javascript programming with XML and PHP by drake download

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (321.51 KB, 6 trang )

Introduction to JavaScript Programming
with XML and PHP

Test Bank Chapter 1

Test Bank for Introduction to JavaScript Programming with
XML and PHP by Drake
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.


a.
b.
c.

Which type of data type can have only one of two possible values?
float
numeric
Boolean

© 2014 Pearson Education

1


Introduction to JavaScript Programming
with XML and PHP

Test Bank Chapter 1

d. 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.

a.
b.
c.
d.

Which of the following is not an acceptable variable name?

my Friend
your_Friend
We_Are_All_Friends
all of the above are acceptable variable names

ANS: A

7. If the variable hours = 10, what is the value of the variable salary after the following instruction
has been executed: salary = hours * 8
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
browsers?
a. <noscript></noscript>
b. <alt = "no script">
c. < /no script>
d. there are no such tags
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>

© 2014 Pearson Education

2


Introduction to JavaScript Programming
with XML and PHP

Test Bank Chapter 1

ANS: 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

11.Which of the following describes a JavaScript method?
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: C

12.Which of the following describes a JavaScript property?
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: 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

© 2014 Pearson Education

3


Introduction to JavaScript Programming

with XML and PHP

Test Bank Chapter 1

15. 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

© 2014 Pearson Education

4


Introduction to JavaScript Programming
with XML and PHP

Test Bank Chapter 1


20. Which of the following would retrieve the value displayed in a <div></div> element which has
id = "football" and store that information in a variable named sport?
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

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

© 2014 Pearson Education

5


Introduction to JavaScript Programming
with XML and PHP

© 2014 Pearson Education

Test Bank Chapter 1

6



×