f
38.) In JavaScript every should end with a
;
Identify and correct the error in the following segments of code. var x = 1, total; while (x le tn = 100) { total + = x; ++x; }
Total has no initial value to add to 'x'
How do you find the number with the highest value of x and y? a. Math.max(x, y) b. top(x, y) c. ceil(x, y) d. Math.ceil(x, y)
a. Math.max(x, y)
What will be the value of B? B=5 ; B++; B/=2 a.) 3 b.) 6 c.) 7
a.) 3
12. Increasing the property padding value will: a. Increase the softness of your site b. Increase the distance between cell and content c. Increase the space between cells
b. Increase the distance between cell and content
7. Each JavaScript statement should end with: a. a comma (,) b. a semicolon (;) c. a colon (:) d. an ampersand (&)
b. a semicolon (;)
20. An HTML element may be referred to in JavaScript by its a. class attribute b. style attribute c. id attribute
c. id attribute
18. Which of the following is not a form field? a. Text area b. Radio button c. Reset button d. Tool box
d. Tool box
In JavaScript the ___________ statement is used to make decision
if
How to insert a comment that has more than one line? a. op br !--This comment has more than one line-- cl br b. /*This comment has more than one line*/ c. //This comment has more than one line//
b. /*This comment has more than one line*/
3. What is the correct place to insert a JavaScript? a. The head section b. Both the head section and the body section are correct c. The body section d. Between head and body e.
b. Both the head section and the body section are correct
. JavaScript is the same as Java. a. True b. False
b. False
The default case is required in the switch statement. a. True b. False
b. False
The expression (x gr tn y && a le tn b) is true if x gr tn y is true or a le tn b is true. a. True b. False
b. False
16. Which attribute specifies where to send a form data? a. input b. action c. method
b. action
4. How to write 'Hello World' in an alert box? a. alertBox('Hello World'); b. alert('Hello World'); c. msgBox('Hello World'); d. alertBox = 'Hello World';
b. alert('Hello World');
2. What is the correct JavaScript syntax to write "Hello World"? a. response.write('Hello World'); b. document.write('Hello World'); c. ('Hello World'); d. 'Hello World';
b. document.write('Hello World');
17. There are two primary methods to send the form to the server for processing: a. send and put b. get and post c. get and put d. cgi and html
b. get and post
10. Which set of tags can be used to create an HTML table? a. table, head, foot b. table, tr, td c. table, row, col d. table, colspan, rowspan
b. table, tr, td
15. How can you make a cell span over 3 columns? a. td rowspan = '3' b. td colspan = '3' c. tr rowspan = '3' d. tr colspan = '3'
b. td colspan = '3'
14. Choose the correct HTML code to right-align the content inside a table cell. a. td {align = right;} greater than b. td {text-align:right;} c. td right d. tr {alignment:right}
b. td {text-align:right;}
. In Javascript you must declare a variable before you can use it? a.) True b.) False
b.) False
Javascript can only coded in the head section of the html document a.) True b.) False
b.) False
The prompt method of the document object displays a dialog box where the user can input a value. a.) True b.) False
b.) False
Which code will output the line : Good Morning in the browser window? a.) printf("Good Morning") b.) document.write("Good Morning") c.) print "Good Morning" d.) document write(Good Morning)
b.) document.write("Good Morning")
36.) The keyword which is use to declare a variable a.) new b.) var c.) variable
b.) var
What is the correct HTML for referring to an external style sheet? a. style src="mystyle.css" b. stylesheet mystyle.css /stylesheet c. link rel="stylesheet" type="text/css" href="mystyle.css"
c. link rel="stylesheet" type="text/css" href="mystyle.css"
21. Consider the following code: h1 id ='header1' Using css /h1 Which of the following expressions will you use to change the style of the h1 element dynamically? a. window.document.getElementById ['header1'] (style); b. window.document.style.h1; c. window.document.getElementById ('header1').style; d. window.document.getElementById ('h1').style
c. window.document.getElementById ('header1').style;
Which Javascript function converts string into an integer? a.) parseFloat b.) convert(int) c.) parseInt
c.) parseInt
Which tag should enclose all the JavaScript in your document? a.) forms b.) language c.) javascript d.) none of the above
d.) none of the above
1. Inside which HTML element do we put the JavaScript? a. scripting b. javascript c. script d. js
script
19. Which event is generated when a mouse moves over a text? a. onmouseover b. onrollover c. overmouse
a. onmouseover
23. What is the output of this code? if (a=0) document.write("yes"); else document.write("no"); a. yes b. no
a. yes
27. Will this code cause an error? document.write("body bgcolor="blue" greater than sign "); a. yes b. no
a. yes
Will this code cause an error? document.write("table tr td " "tr td /table"); a. yes b. no
a. yes
We want an alert box saying Welcome will this code work alert("Welcome") a.) Yes b.) No
a.) Yes
8. The exclamation mark (!) in the code means "____". a. true c. not b. find d. loop
c. not
13. Which has higher priority, cell settings or table settings? Answer:
cell
How to write an IF statement for executing some code if "i" is NOT equal to 5? a. if (i nt eq 5) b. if i nt eq 5 c. if i =! 5 then d. if (i != 5)
d. if (i != 5)
The ____________ objects displays alert dialogs and prompt dialogs.
window
Write the JavaScript to display a dialog box asking the user to enter an integer. Show a default value of 0 in the text field.
window.prompt("input an interger", "0");
In JavaScript the _______________ method of the ________ object writes HTML text into an HTML document
write......document
Find the error in this statement for (x=100, x great or =1, x++);
x will always be greater than 1, thus infinite loop. Must be semicolon between for specifications
How does a FOR loop start? a. for (i = 0; i le tn = 5) b. for (i = 0; i le tn = 5; i++) c. for (i le tn = 5; i++) d. for i = 1 to 5
b. for (i = 0; i le tn = 5; i++)
5. How do you create a function? a. function = myFunction() b. function myFunction() c. function: myFunction()
b. function myFunction()
37.) In JavaScript a comment begins with a
//
Which HTML attribute is used to define inline styles? a. styles b. font c. class d. style
d. style
The methods of the _______________ object allow you to perform many common mathematical calculations.
Math
22. The z-index property allows elements to be layered. Elements with higher z-index values are shown in front of elements with lower values. a. True b. False
a. True
11. In most browsers the content of a table header cell is ___________________. a. centered c. right-aligned b. justified d. left-aligned
a. centered
9. How do you write a conditional statement for executing some statements only if 'i' is equal to 5? a. if (i == 5) b. if i == 5 then c. if i = 5 d. if i = 5 then
a. if (i == 5)
24. What is the problem with this code? w=1; sum=0; while (w more than 0) {sum +=w; w++} a. infinite loop b. no problem
a. infinite loop
6. How do you call a function named 'myFunction'? a. myFunction(); b. call myFunction(); c. call function myFunction;
a. myFunction();
25. Which JavaScript event would you use to call a function when a user clicks on a button? a. onclick b. onpush c. onstart
a. onclick