Webdev Exam 2

Ace your homework & exams now with Quizwiz!

41. Which of the following selections is the proper way to apply this CSS rule: .margin {margin-left:0.75in;} a. <p class = "margin"> b. <p style = "margin"> c. <p> d. <p class = ".margin">

a. <p class = "margin">

28. Given the following function which statement would be the correct replacement of a paragraph with id "message" for the comment line (assuming the W3C DOM): a. Document.getElementById("message").style.visibility = "hidden"; b. Document.message.visibility = hidden; c. Document.getElementByTagName.visibility = "hide"; d. Document.setAttribute.style.visibility = "hidden";

a. Document.getElementById("message").style.visibility = "hidden";

12. Which of the following statements is correctly written?

a. If(studentGrade >= 60) Document.write("passed");

10. What would the browser display if the following code were executed in a script? a. Nothing b. 11 c. x and y are > 13 d. x is <=13

a. Nothing

21. Event ____ fires constantly whenever the mouse is in motion. a. Onmousemove b. Onmouseover c. Onmouseout d. All of these

a. Onmousemove

13. Function definitions often contains ______, which are considered to be local variables and correspond with the arguments in the function call. a. Parameters b. Static variables c. Register variables d. Constant variables

a. Parameters

39. Which of the following is not a DOM collection? a. Roots b. Anchors c. Links d. Forms

a. Roots

26. Using the document object model, the simplest way to reference an element is by using ______. a. The element's id attribute b. The innerText property of a p element c. The all collection d. The innerHTML property property of a p element

a. The element's id attribute

4. All variables declared in function definitions are _______. a. Global variables b. Local variables c. Static variables d. Constant variables

b. Local variables

49. Which of the following is NOT a valid function call? Var x = myfunc(); myfunc; x = myfunc(); myfunc(); a. Var x = my func(); b. Myfunc; c. X = myfunc(); d. Myfunc();

b. Myfunc;

19. Which of the following is not an event that can trigger a javascript? a. Mouse actions b. Operating system actions c. Keyboard actions d. Timed actions

b. Operating system actions

2. Interactive Web pages are created with ______ scripting a. Client-side b. Server-side c. None of the above d. Both A and B

b. Server-side

29. Which of the following statement is true? a. The onload event fires whenever an element starts loading b. The onclick event fires when the user clicks the mouse on element c. The onfocus event fires when an element loses focus d. Returning true in an event handler or an a (anchor) element prevents the browser from following the link when the event handler finishes

b. The onclick event fires when the user clicks the mouse on element

30. Which one of the following is a valid variable declaration statement in javascript? a. Var i b. Var submit; c. Var myMessage = "\"Go! Mavericks.\""; d. Var 1student, 2student;

b. Var submit;

11. Which of the following statements is not true? a. Javascript is case sensitive. b. Each Javascript statement ends with a semicolon(;). c. A single slash(/) indicates a single-line comment in JavaScript d. Curly braces ({}) are used to combine multiple Jacascript statements into a statement block

c. A single slash(/) indicates a single-line comment in JavaScript

45. The onfocus event fires when ______. a. The element is loaded from the document b. An image is loaded into the document c. An element is clicked d. An image is downloaded

c. An element is clicked

44. Which of the following is the proper method to access the length of the array arr? a. Arr[].length b. Arr[subscript].length c. Arr.length d. Arr(length)

c. Arr.length

23. The second control statement in a for loop usually a. Sets the terminating condition b. Increments a counter c. Creates a control variable d. None of the above

c. Creates a control variable

16. An object's methods and attributes are accessed by writing the name of the object following _____. a. Method name/attribute name b. Method/attribute index c. Dot d. Property operator

c. Dot

24. Which of the following is NOT done with Javascript a. Form validation b. Browser detection c. Dynamically change the style of a webpage d. RGB colors

c. Dynamically change the style of a webpage

34. If an element's position is declared as absolute then ________. a. Positioning of the element is handled by the browser b. Positioning is handled by the normal flow of elements on the page c. Positioning is set according to the margins of its parent element d. Positioning is handled by relative positioning

c. Positioning is set according to the margins of its parent element

27. In creating an image rollover, which should be the first step: a. Create functions to swap the image objects b. Create onmouseover and onmouseout event handlers to call the function to swap the images c. Preload the images being used d. Populate the image arrays

c. Preload the images being used

22. When defining a map on an image, which of the following is not a shape of area you can define as? a. Circle b. Rectangle c. Triangle d. Poly

c. Triangle

3. ______ extend the concept of software reuse to the internet by allowing developers to reuse software components that reside on another machine or platform. a. Web servers b. Web pages c. Web services d. Common Gateway interfaces

c. Web services

32. How do you call a function named "myfunction" in Javascript? a. Call function myFunction b. Call myFunction() c. myFunction()

c. myFunction()

42. What would the function cube return, assuming it is called with the statement cube(3)> function cube (y) {return y*y*y;} a. Javascript runtime error b. 3 c. 9 d. 27

d. 27

50. The same object can have how many properties and methods? a. One or the other b. One of each c. As many as you want of one of the other d. As many of both as you want

d. As many of both as you want

7. In an ASP.NET application written in C#, the ______ file contains the user interface, while the ____ file contains code. a. .cs, .aspx b. .aspx, .cs c. .asax, .cs d. aspx, .cs or ,vb

d. aspx, .cs or ,vb

37. Which of these is the method of the window object that stops repetitive calls to a method? a. clearTimer b. stopTimer c. stopInterval d. clearInterval

d. clearInterval

36. What is the correct Javascript syntax for opening a new window called "w2"? a. w2 = window.new("http://www.w3schools.com"); b. w2 = new("http://www.w3schools.com"); c. w2 = window.open("http://w3schools.com"); d. w2 = open("http://www.w3schools.com");

d. w2 = open("http://www.w3schools.com");

What is the correct JavaScript syntax to insert a comment that has more than one line?

A. /*This comment has more than one line*/

What is the value of num after the following statement is performed? num = 2 * Math.pow( 2, 3 );

A. 16

What would the browser display if the following script were executed? <script type = "text/javascript"> <!-- for ( var i = 0; var i < 5; i++ ) document.write( "X" ); //--> </script>

A. Nothing; the script would generate an error

What would the browser display if the following code were executed in a script? var product = 0; while ( product <= 25 ) product = 2 + product; document.write(product);

A. nothing, the script would result in an inifite-loop error

Which of the following is a legal function call for the function definition provided below? function square( y ) { return y * y; }

A. square(7+2);

. Using the document object model, the simplest way to reference an element is by using........

A. the element's id attribute

Which of the following is the correct abbreviation for the statement a = a * 7; ?

B.a *= 7;

What would the browser display if it executed the following script? <script type = "text/javascript"> <!-- for ( var count = 1; count <= 10; ++count ) { if ( count == 5 ) break; } document.write( count ); //--> </script>

C. 5

Which type of script is recommended for defining scripts that need to be reused by multiple Web pages?

C. External

Which of the following is declared correctly?

C. for ( var i = 0; i < 100; ++i ) { statement; }

When defining a map on an image, which of the following is not a shape of area you can define as?

C. triangle

Which of the following is an illegal array initialization statement? A. var n = [ 10, 20, 30, 40, 50 ];

C. var n[ 10, 20, 30, 40, 50 ];

Which of the following is the correct way to write a JavaScript array with 3 String values?

C. var txt = new Array ("tim","kim","jim");

What will the browser display if the following script is executed and the user enters 5 at both prompts ? <script type = "text/javascript"> <!--- Var firstNumber = window.prompt ("Enter an integer","0"); Var secondNumber=window.prompt("Enter an integer","0"); ThirdNumber = firstNumber + secondNumber; Document.write(thirdNumber); //--→ </script>

D. 55

What would the browser display if the following script were executed? <script type = "text/javascript"> var count = 0; var total = 0; while ( count <= 5 ) { total = total + 10; count = count + 1; } document.write( total ); </script>

D. 60

Consider the following script. What is wrong with the following code? 1 <script type = "text/javascript"> 2 var num1, 3 num2; 4 num3; 5 6 num1 = window.prompt("Enter an integer", "0"); 7 num2 = window.prompt("Enter an integer", "0"); 8 num3 = num1 + num2; 9 </script>

D. The word var must be placed before num3 in line 4.

Which of the following statements would correctly print out the sentence "Hello World" in blue?

D. document.write("<p style = \"color: blue\">" ); document.write ("Hello World </p>");

In the following line, the word write is a(n) _________ that performs a task or action in the script. document.write("Hello World");

D. method

If the string passed to parseInt contains a floating-point numeric value, parseInt will ________.

D. truncate the floating-point part to be left with an integer value

What would the browser display if the following code were executed in a script? var x = 11; var y = 14; if ( x > 13 ) if ( y > 13 ) document.writeln( "x and y are > 13" ); else document.writeln( "x is <= 13" );

A Nothing

An alert dialog displaying the text "Welcome!" is created by calling.................

A window.alert("Welcome!");

What does the following expression evaluate to?

B 14

How do you write a conditional statement for executing some statements only if "i" is NOT equal to 5?

B if (i !=5)

What is the result of the statement 17 % 5?

B. 2

What is the value of num after the following statements are performed? num = 2.4589; num = num.toFixed( 2 );

B. 2.46

What is the correct syntax for referring to an external script called "xxx.js"?

B. <script type= "text/javascript" src="xxx.js">

Where is the correct place to insert a JavaScript?

B. Both the <head> section and the <body> section are correct

Which of the following statement is true?

B. The onclick even fires when the user clicks the mouse on an element.

Which of the following is a JavaScript repetition statement?

B. do...while

Which of the following is not a method of the Date object?

B. strike()

Which of the following statements is correct?

C if ( studentGrade >= 60 ) document.write( "Passed" );

Which of the following is not a valid JavaScript variable name?

C. 12footage

What would the browser display if the following code were executed in a script? var grade = 59; if ( grade >= 60 ) document.writeln( "Passed." ); else document.write( "Failed. " ); document.writeln( "You must take this course again." );

D Failed. You must take this course again

18. What is the correct javascript syntax to insert a comment that has more than one line? a. /*this comment has more than one line */ b. //this comment has more than one line // c. <!—this comment has more than one line -->

a. /*this comment has more than one line */

33. Setting the width property to 10 em will create an element that has a width that is _____. a. Size 10pt b. 10 times larger than the font size c. 10 times smaller of the font size d. italicized and 10pt in size

b. 10 times larger than the font size

14. What is the result of the statement 17 % 5? a. 0 b. 2 c. 3 d. 12

b. 2

17. What is the correct syntax for referring to an external script called "xxx.js"

b. <script type = "text/javascript" src = "xxx.js">

38. An ______ is a script that is implicitly executed in response to an occurrence such as completion of loading the document or a use action. a. Event b. Event handler c. Event-driven program d. None of the above

b. Event handler

31. How do you create a function in Javascript? a. Function:myFunction() b. Function myFunction() c. Function=myFunction()

b. Function myFunction()

20. The code to obtain a random integer number between 5 and 9 inclusive is: a. Math.floor(Math.random() * 5) + 4); b. Math.floor(Math.random() * 4) + 4); c. Math.floor(Math.random() * 4) + 5); d. Math.floor(Math.random() * 5) + 5);

d. Math.floor(Math.random() * 5) + 5);

1. Which of the following is not a type of Web control? a. HTML server controls b. Web server controls c. Validation controls d. None of the above

d. None of the above


Related study sets

2.1: Production Possibilities and Opportunity Cost

View Set

PC Pro 4.1.2 Peripheral Device Facts

View Set

TestOut Server Pro 2016 - 11.1.6 - Lab - Create and Share a Printer

View Set