Sunday 15 February 2015

Odesk DHTML Test Answers

Developer
This test is about 40 multiple choice questions and should take less than 40 minutes to complete

DHTML Test Contents

JavaScript Syntax
CSS
Javascript
DHTML Tricks
Javascript Events
CSS Filters
JavaScript Basic Concepts
DHTML DOM

Today we discuss about Odesk & Elance DHTML Test Answer. This DHTML Test is  combnation of html,css & javascript. Let’s start this odesk test and rich our freelancing marketplace profile.

Odesk & Elance DHTML Test Answers:

Question: 1
You want to disable the selection of text on the webpage. While trying to select some text, the user should see ‘not-allowed’ cursor. Which of the following helps you implement this by using JavaScript and IE 5+ browser?
a. <body onSelectEnd=”this.style.cursor=’not-allowed’; return true;”
onMouseup=”this.style.cursor=’default’”>
b. <body onMouseDown=”this.style.cursor=’default’”
onSelectEnd=”this.cursor=’not-allowed’; return false;”>
c.  <body onSelectStart=”this.style.cursor=’not-allowed’; return false;”
onMouseup=”this.style.cursor=’default’”> (Answer)

d. <body onMouseup=”this.style.cursor=’not-allowed’; return false;”
onSelectStart=”this.style.cursor=’default’”>

Question: 2
A DHTML page contains a table in between some text. You want to shift the table 20 pixels on the right to separate it from text. Which of the following styles would be suitable for the purpose?
a.  position:relative;
left:20PX;   (Answer)  *
b. position:relative;
left:-20PX;
c.  position:relative;
right:-20PX; (Answer)

d. position:relative;
right:20PX;

Question: 3
which of the following properties is used to redirect a visitor to another page?
a.  document.URL (Answer)
b.  window.location.href
c.  document.location.href (Answer)
d.  link.href
e.  window.location

Question: 4
Which of the following statements is true with regard to setTimeout()?
a. The statement(s) it executes run(s) only once
b. It pauses the script in which it is called (Answer)
c.  clearTimeout() does not stop its execution
d. It is required in every JavaScript function

Question: 5
What does the following code snippet do?
<input type=”radio” name=”r1″ value=”radio1″ onclick=”this.checked=false;alert(‘sorry’)”>
a.  The code is incorrect
b.  The code makes it necessary for the user to select the radio button
c.  The code disables the radio button
d.  The code displays an alert when the user selects the button (Answer)

Question: 6
You have two images of buttons, one bright and the other one dull. You want to change the dull image into a bright one. Which of the following attributes would you use with the img tag?
a.  onmousedown=”this.src=’bright.gif’”
onmouseup=”this.src=’dull.gif’”
b. onmousedown=”bright.gif”
onmouseup=”dull.gif”
c.  onmouseup=”this.src=’bright.gif’”
 onmousedown=”this.src=’dull.gif’” (Answer)

Question: 7
This is a JavaScript function for changing the color of the text box named “txtName”:
function SetColor(col)
{ document.forms[0].txtName.style.background=col }
How will you change the color of the text box txtName to green, only for the time that the user is pressing any key?
a.  <input type=”text” onkeydown=”SetColor(‘white’)” onkeyup=”SetColor(‘green’)” name=”txtName”>
b. <input type=”text” onkeydown=”SetColor(‘green’)” onkeyup=”SetColor(‘white’)” name=”txtName”>
c.  <input type=”text” onkeydown=”SetColor(‘green’)” name=”txtName”> (Answer)
 d. <input type=”text” onkeydown=”SetColor(‘white’)” name=”txtName”>

Question: 8
what will the following code snippet do?
<form onreset=”alert(‘Please again fill the form’)”>
a.  It validates the contents of the form
b.  It prompts the user not to leave the fields of the form empty
c.  It prompts the user to fill the form once the form is cleared (Answer)
d.   None of the above

Question: 9
which of the following can you use to accept user input?
a. The prompt method (Answer)
b. The alert method
c.  A form field (Answer)
d. The confirm method (Answer)

Question: 10
You have embedded the document.write() method to write some text within a pair of <TD></TD> table tags. On loading the file, you get some garbled junk on the page that should contain the text. What makes this happen?
a.   The browser does not support JavaScript (Answer)
b.  You are using an outdated version of the browser (Answer)
c.   The browser does not support cookies
d.   None of the above

Question: 11
Which of the following helps you highlight some of the running text on a web page?
a.   <span style=”background-color:yellow”> (Answer)
b.  <span style=”background-highlight:yellow”>
c.   <span style=”background:yellow”> (Answer)
d.   <span style=”highlight-color:yellow”>

Question: 12
A DHTML page contains a table in between some text. You want to shift the table 20 pixels on the right to separate it from text. Which of the following styles would be suitable for the purpose?
a.  position:relative;left:20PX; (Answer)
b.   position:relative;left:-20PX;
c.   position:relative;right:-20PX; (Answer)
d.  position:relative;right:20PX;

Question: 13
Which of the following properties is used to redirect a visitor to another page?
a. document.URL (Answer)
b. window.location.href
c.  document.location.href (Answer)
d.  link.href
e.  window.location

Question: 14
Which of the following statements is true with regard to setTimeout()?
a. The statement(s) it executes run(s) only once
b.  It pauses the script in which it is called (Answer)
c.  clearTimeout() does not stop its execution
d.   It is required in every JavaScript function

Question: 15
What does the following code snippet do?
<input type=”radio” name=”r1″ value=”radio1″ onclick=”this.checked=false;alert(‘sorry’)”>
a. The code is incorrect
b. The code makes it necessary for the user to select the radio button
c.  The code disables the radio button
d. The code displays an alert when the user selects the button (Answer)

Question: 16
You have two images of buttons, one bright and the other one dull. You want to change the dull image into a bright one. Which of the following attributes would you use with the img tag?
a.  onmousedown=”this.src=’bright.gif’”onmouseup=”this.src=’dull.gif’”
b. onmousedown=”bright.gif”onmouseup=”dull.gif”
c.  onmouseup=”this.src=’bright.gif’”
 onmousedown=”this.src=’dull.gif’” (Answer)

Question: 17
What will the following code snippet do?
<form onreset=”alert(‘Please again fill the form’)”>
a.  It validates the contents of the form
b.  It prompts the user not to leave the fields of the form empty
c.  It prompts the user to fill the form once the form is cleared (Answer)
d. None of the above

Question: 18
which of the following can you use to accept user input?
a. The prompt method (Answer)
b.  The alert method
c.  A form field (Answer)
d.  The confirm method (Answer)

Question: 19
You have embedded the document.write() method to write some text within a pair of <TD></TD> table tags. On loading the file, you get some garbled junk on the page that should contain the text. What makes this happen?
a. The browser does not support JavaScript (Answer)
b. You are using an outdated version of the browser (Answer)

c. The browser does not support cookies
d. None of the above

Question: 20
which of the following helps you highlight some of the running text on a web page?
a. <span style=”background-color:yellow”> (Answer)
b. <span style=”background-highlight:yellow”>
c.  <span style=”background:yellow”> (Answer)
 d. <span style=”highlight-color:yellow”>

Question: 21
Which of the following will you use for changing the color of the textbox text with id=txtLocation to blue, on a mouseover event?
a.  txtLocation.color=”blue”
b. document.getElementById(‘txtLocation’).color=”blue”
c.  document.getElementById(‘txtLocation’).style.color=”black”
d.  document.getElementById(‘txtLocation’).style.color=”blue” (Answer)

Question: 22
You want to disable the selection of text on the webpage. While trying to select some text, the user should see ‘not-allowed’ cursor. Which of the following helps you implement this by using JavaScript and IE 5+ browser?
a. <body onSelectEnd=”this.style.cursor=’not-allowed’; return true;”
onMouseup=”this.style.cursor=’default’”>
b. <body onMouseDown=”this.style.cursor=’default’”
onSelectEnd=”this.cursor=’not-allowed’; return false;”>
c. <body onSelectStart=”this.style.cursor=’not-allowed’; return false;”
onMouseup=”this.style.cursor=’default’”> (Answer)

d. <body onMouseup=”this.style.cursor=’not-allowed’; return false;”
onSelectStart=”this.style.cursor=’default’”>

Question: 23
After clicking on a link, your main browser window spawns a small new window and writes some text on it. When both the window page sources are viewed, the small window page source seems identical to that of the large one. Which of the following makes this happen?
a. The function writing to the new window did not close the document stream
b. Windows receive the source code of the window that wrote to them (Answer)
c. Since the new window has no filename, it receives the source code of its parent
d. None of the above

Question: 24
Which of the following is not considered a part of DHTML?
a. JavaScript
b. CSS
c.  HTML
d.  VBScript
e.  All are part of DHTML (Answer)

Question: 25
Which of the following will you use for changing the color of a button with id=btn, to green on a mouseover event?
a. btn.color=”green”
b. document.getElementById(‘btn’).color=”green”
c. document.getElementById(‘btn’).style.color=”black”
d.  document.getElementById(‘btn’).style.color=”green” (Answer)

Question: 26
The following statements show two ways of calling a JavaScript function: i)onclick = “a()”
ii)onclick=”javascript:a()”
a() refers to a function written in JavaScript.
Which of the following statements is correct with regard to the above two statements?
a. There is no difference between the two statements (Answer)
b. The first statement is incorrect and the second one is correct

Question: 27
You want to display an alert that contains a ‘ (single-quote) character. Which of the following characters would you use to escape the ‘ character?
a.  *
b.   \  (Answer)
c.   /
d.   _
e.  #
f.   %
g.   |
h.   ~

Question: 28
You are collecting the user’s details on a webpage form. The id has to be repeated twice on the form, but you want the user to fill it once only. If the name of the first id is id1 and the second (to be auto filled) is id2, which code will you supply to the onkeyup event of id1?
a. document.forms[0].id1.value=document.forms[0].id2.value
b. document.forms[0].id2.value=document.forms[0].id1.value (Answer)
c. document.id1.value=document.id2.value
d.  document.id2.value=document.id1.value

Question: 29
Which of the following statements with regard to CSS is correct?
a. The positioning can be absolute, relative, or dynamic
b. The float property for text/image can be left, right, or center
c. The values for visibility can be true or false
d.  The display property sets how an element is displayed (Answer)

Question: 30
The width of H1 is defined as follows: H1 {width:100px;}
How can you make the heading flip horizontally?
a. <h1 filter(flip)>Heading</h1>
b. <h1 style=”filter::fliph()”>Heading</h1>
c.  <h1 style=”filter:fliph()”>Heading</h1> (Answer)
d.  <h1 style=”FliphFilter()”>Heading</h1>

Question: 31
Which of the following style properties is used to display only a part of an image?
a. snap
b. clip (Answer)
c. Scroll
d. Visible
e. overflow
f.  size

Question: 32
Which of the following properties is used to redirect a visitor to another page?
a. document.URL (Answer)
b. window.location.href
c. document.location.href (Answer)
d. link.href
e. window.location

Question: 33
Which of the following in-built functions is useful when you want to access a form element using its id?
a. getItem(id)
b. getFormElement(id)
c. getElementById(id) (Answer)
d. All of the above
Question: 34
You have embedded the document.write() method to write some text within a pair of <TD></TD> table tags. On loading the file, you get some garbled junk on the page that should contain the text. What makes this happen?
a. The browser does not support JavaScript (Answer)
b. You are using an outdated version of the browser (Answer)

c.  The browser does not support cookies
d.   None of the above

Question: 35
Consider an HTML form with a checkbox and a text field. When data is entered and the Enter key is pressed, the data seems to be lost before the user can click on the button that calls the processing function. How would you correct this programatically?
a. Add a TYPE=HIDDEN INPUT to the form
b. Trap the Enter keypress and return (null)
c.  Add ‘return false’ to onsubmit=”…” in the FORM tag (Answer)
d.  Instruct the user not to press the Enter key
e.  Modify the ENCTYPE property of the form

Question: 36
You are developing an application and there is a possibility of certain users using older browser versions. You want to hide the JavaScript code in the browsers that do not support JavaScript. How would you do this?
a. Precede the JavaScript statements with //
b. Precede the JavaScript statements with –
c. Enclose the statements with /* and */
d. Use the following notation:
        <script language=”javascript”>
        <!–
        //–>
        </script> (Answer)

e. Add a <noscript> tag after the script

Question: 37
Which of the following is an important parameter of the wave filter?
a. WaveSize
b.Wavelength
c. Strength (Answer)
d. All of the above

Question: 38
Which of the following code snippets is more efficient and why? <script language=”javascript”>
for(i=0;i<document.images.length;i++)
document.images[i].src=”blank.gif”;
</script>
<script language=”javascript”>
var theimages = document.images;
for(i=0;i<theimages.length;i++)
theimages[i].src=”blank.gif”
</script>
a. Both are equally efficient
b. The first code is more efficient as it contains less coding
c. The first code is more efficient as it employs object caching (Answer)
d. The second code is more efficient as it employs object caching

Question: 39
The width of h3 is defined as follows: H3 {width:90%;}
How can you make the heading flip vertically?
a. <h3 filter(flip)>Heading</h3>
b. <h3 style=”filter:flipv()”>Heading </h3> (Answer)
c. <h3 style=”filter::flipv()”>Heading </h3>
d.  <h3 style=”FlipvFilter()”>Heading </h3>

Question: 40
You declared an array as follows: var arr;
What value would JavaScript assign to an uninitialized element of this array?
a. NaN
b. null (Answer)
c. undefined
d. false
e. 0

Question: 41
You have created an object. How can you add a property to the object class?
a. With the prototype() method
b. With the prototype property (Answer)
c.  It cannot be done
d. With the this object

Question: 42
How is the following code useful? function validate(field)
{
var valid=”ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz”;
var ok=”yes”;
var temp;

for(var i=0; i < field.value.length; i++)
{
temp=”" + field.value.substring(i,i+1)
if(valid.indexOf(temp)==”-1″)
{
ok=”no”;
break;
}
}
if(ok==”no”)
{
alert(“error”);
field.focus();
}
}
a. It will force a user to enter only numeric values
b. It will force a user to enter only alphanumeric values
c. It will force a user to enter only character values (Answer)
d. None of the above
               
 Question: 43
The width of h3 is defined as follow: H3 {width:100%;}
How can you make the heading glow?
a. <h3 filter(glow)>Heading</h3>
b. <h3 style=”filter:glow()”>Heading </h3> (Answer)
c. <h3 style=”filter::glow()”>Heading </h3>
d. <h3 style=”GlowFilter()”>Heading </h3>

Question: 44
You are formatting your error messages using the following inline style definition: <span style=”color: red”>Error message.</span>
Now you want the error message text to be displayed in blue color. But the problem is that you are not permitted to edit the HTML code, you can only edit the imported style sheet. Which style definition will you use in the imported style sheet to achieve this?
a. span.error{color: blue;}
b. span.error{ color: blue !important;} (Answer)
c. span.error{ color: blue !inherit;}
d.  It is impossible. Inline styles always override imported styles

Question: 45
Which of the following helps you create hyperlinks without an underline?
a. a{text-decoration:none} (Answer)
b. a{text-decoration:noline}
c. a{text-decoration:hide}
d. a{text-decoration:invisible}
e. a{ font-style: normal;}
f. a{font-style: none;}

Question: 46
You are designing a web site and need to set the background image for all the web pages. You want a small background image to repeat and fill up the whole background. Which of the following body styles is ideal for this?
a. body { background: url(/images/bg.gif);
repeat: repeat-x }
b. body { background: url(/images/bg.gif);
repeat: repeat-y }
c. body { background-image: url(/images/bg.gif);
background-repeat: no-repeat }
d. body { background-image: url(/images/bg.gif);}  (Answer)

Question: 47
How would you double the image size of an Image on a mouseover event, if the original width and height are 100px and id is logo?
a. document.getElementById(‘logo’).style.width=”200″
 document.getElementById(‘logo’).style.height=”200″ (Answer)

b. document.getElementById(‘logo’).style.width=”100″
document.getElementById(‘logo’).style.height=”100″
c. document.getElementById(‘logo’).width=”200″
document.getElementById(‘logo’).height=”200″
d. document.getElementById(‘logo’).width=”200px”
document.getElementById(‘logo’).height=”200px”

Question: 48
Consider the following validate function: <script type=”text/javascript”>
function ValidateField()
{
if(document.forms[0].txtId.value ==”")
{return false;}
return true;
}
</script>
This function should be called as soon as the user leaves the field. What will you do?
a. <input name=txtId type=”text” onreset=”return ValidateField()”>
b. <input name=txtId type=”text” onfocus=”return ValidateField()”>
c.  <input name=txtId type=”text” onsubmit=”return ValidateField()”>
d.  <input name=txtId type=”text” onblur=”return ValidateField()”>(Answer)

Question: 49
You do not want the end user to see the JavaScript code embedded in the HTML file when the user views the source of the HTML page. Which of the following helps you achieve this?
a. This is not possible
b. Use externally linked files which hold the JavaScript code (Answer)
c.   Modify the headers of the page
d.  Change the MIME type of the page

Question: 50
Which of the following will you use for changing the color of a button with id=btn, to green on a mouseover event?
a. btn.color=”green”
b. document.getElementById(‘btn’).color=”green”
c. document.getElementById(‘btn’).style.color=”black”
d. document.getElementById(‘btn’).style.color=”green” (Answer)

Question: 51
The width of the h4 is defined as follow: H4 {width:80%;}
How can you make the heading drop shadow?
a. <h4 filter(shadowdrop)>Heading</h4>
b. <h4 style=”filter:shadowdrop()”>Heading </h4>
c. <h4 style=”filter:DropShadow()”>Heading </h4> (Answer)
d. <h4 style=”DropShadow ()”>Heading </h4>
e.  <h4 filter(dropshadow)>Heading</h4>
f. <h4 style=”filter::shadowdrop()”>Heading </h4>     

Question: 52
You want to shake a link on the mouseover event. If the style position is set to relative and the anchor id is lnk1, which of the following code lines will be useful with a timer?
a. document.getElementById(‘lnk1′).left=”0″
document.getElementById(‘lnk1′).left=”2″
b. document.getElementById(‘lnk1′).style.left=”0″
document.getElementById(‘lnk1′).style.left=”2″ (Answer)

c. document.getElementById(‘lnk1′).style.move=”0″
document.getElementById(‘lnk1′).style.move=”2″
d. document.getElementById(‘lnk1′).right=”0″
document.getElementById(‘lnk1′).right=”2″

Question: 53
You have defined an image tag as follows: <img id=”ERImage” width=”100″ height=”100″ onmouseover=”ImageChange()” src=”Image1.jpg”>
How would you implement ImageChange() function, if the new image to be set for mouseover is Image2.jpg?
a. document.getElementById(‘ERImage’).src=”Image1.jpg”
b. document.getElementById(‘ERImage’).src=”Image2.jpg” (Answer)
c. document.getElementById(‘ERImage’).style.src=”Image1.jpg”
d. document.getElementById(‘ERImage’).style.src=”Image2.jpg”

Question: 54
You are required to create a web page in which hyperlinked sub-headings are displayed. On clicking a link, the contents should get displayed dynamically. Which of the following style attributes would you use for this?
a. visibility:hidden;
b. visibility:display;
c. visibility:visible; (Answer)
d. visibility:none;

Question: 55
You are developing a website for children. You want to format the borders of big <td> cells (as mentioned below) for some fun game: Left Border:double
Right Border:dashed
Top Border:dotted
Bottom Border:solid
Which of the following would be the correct style definition?
a. border-style:double dotted dashed solid
b. border-style:dotted dashed solid double (Answer)
c. border-style:dashed double solid dotted
d. border-style:solid double dotted dashed   

Question: 56
You want to delete an element from an options array. How would you do it?
a. Set it to false
b. Set it to null (Answer)
c.  Set it to undefined
d. Set it to -1
e. Set it to 0
f. Set it to 1

Question: 57
How can you change the image position from  relative to absolute if the image id is “ERImage”?
a. document.getElementById(‘ERImage’).position=”absolute”
b. document.getElementById(‘ERImage’).setAttribute(position, “absolute”)
c. document.getElementById(‘ERImage’).style.position=”absolute;”
d. document.getElementById(‘ERImage’).style.position=”absolute” (Answer)

Question: 58
If an image is placed styled with z-index=-1 and a text paragraph is overlapped with it. Which one will come on top?
a. paragraph (Answer)
b. image
c. any of the above

Question: 59
While coding a loop, you come across a condition where you have to ignore the rest of the statements and continue with the beginning of the loop. Which of the following statements would you use?
a. exit
b. return
c. continue
d. while (Answer)
e. break

Question: 60
How would you create a popup window that closes after n seconds?
a. You cannot program a window to close automatically after n seconds. The user will have to manually close it
b. You would use the setTimeout function (Answer)
c. You would use the exit function of the window object
d. You would use the terminate function
e. None of the above

Question: 61
Which of the following styles will be helpful in keeping an image at a fixed position on the webpage, even if someone scrolls the page?
a. background-style:fixed;
b. background-style:static;
c. background-attachment:fixed; (Answer)
d. background-attachment:static;

Question: 62
What is the default value for overflow property?
a. scroll
b. visible (Answer)
c. hidden
d. auto

Question: 63
Which of the following properties of JavaScript is used to store the extra values for DHTML tricks?
a. DHTML
b. HTML
c. innerHTML (Answer)
d. outerHTML

Question: 64
Given below is a window.open function: window.open(url,name,”attributes”)
How will you ensure that different URLs open in the same window?
a. By keeping the second attribute name same (Answer)
b. By nullifying the name attribute
c. By omitting the name attribute
d. None of the above

Question: 65
Which of the following is not a JavaScript event?
a. onabort
b. onchange
c. onupdate (Answer)
d. onkeydown

Question: 66
You are displaying image thumbnails on a page. Upon clicking a thumbnail, the image is being displayed in its actual size. You do not want the user to be able to click the thumbnails unless they are completely downloaded. Which event will you use to prevent the user from clicking on the thumbnails until they are completely downloaded?
a. OnLoad (Answer)
b. OnKeyPress
c. OnKeyUp
d. onClick *

Question: 67
The anchor tag is defined as follows: <a href=”http://expertrating.com”>expertrating</a>
Which of the following styles will make convert this to capital letters on mouseover?
a. a:hover { text:ucase;}
b. a:hover { text-style:uppercase;}
c. a:hover { text-transform:uppercase;} (Answer)
d. a:hover { text-style:upper;}

Question: 68
You have a button definition as given below: <input type=”button” value=”Calculate”>
To load an image “Img2.jpg” as the background of the button on a mouseover event, you can use:
a. event.srcElement.style.backgroundImage=”Img2.jpg”
b. event.srcElement.style.Image=”Img2.jpg”
c. event.srcElement.style.backgroundImage=”url(‘Img2.jpg’)” (Answer)
d. event.srcElement.style.Image=”url(‘Img2.jpg’)”

Question: 69
Which of the following statements is incorrect with regard to a style sheet?
a. Style sheet defines how an HTML element will be displayed
b. Internal and external style sheets cannot be used together
c. Multiple style definitions will cascade into one (Answer)
d. Same style sheets can be used by many HTML pages

Question: 70
How can you use a timer with a function called rearrange()?
a.  tmr=setTimeout(“rearrange()”,1) (Answer)
b. tmr=Timer(1,”rearrange()”)
c.  tmr=Timer(“rearrange()”,1)
d.  tmr=setTimeout(1,”rearrange()”

Question: 71
Which code will be useful for disabling the right click event in Internet Explorer?
a. event.button == 2 (Answer)
b. event.button == 4
c. event.click == 2
d. event.click == 4

Question: 72
The width of the h4 is defined as follow: H4 {width:95%;}
How can you make the heading blur?
a. <h4 filter(blur)>Heading</h42>
b. <h4 style=”filter:blur()”>Heading </h4> (Answer)
c. <h4 style=”filter::blur()”>Heading </h4>
d. <h4 style=”Blur()”>Heading </h4>

Question: 73
Which of the following enables JavaScript Document Object Model to provide access to the HTTP header?
a. document.GetHeader()(Answer)
b. document.getId(‘header’)
c. document.getElementByName(‘header’)
d. document.getElementById(‘header’)
e.  You cannot read the HTTP header information using JavaScript

Question: 74
How would you test whether or not a browser window is open?
a. By using the isOpen method of the window object reference variable
b. By using the closed property of the window object reference variable
c. By using the open method of the document object (Answer)
d. None of the above

Question: 75
You defined two styles as follows: td.right {text-align: right}
td.left {text-align: center}
Which of the following is the right way of calling them in an HTML page?
a. <td >Some Text</td>
b. <td >Some Text</td>
c. <td >Some Text</td>
d. <td>Some Text</td> (Answer)

Question: 76
Consider the following JavaScript alert: <script type=”text/javascript”>
function message()
{
alert(“Welcome to E-Business!!!”)
}
</script>
You want the user to see the above message upon opening the page, how will you implement this?
a. <body onload=”message()”>(Answer)
b. <body onunload=”message()”>
c. <body onsubmit=”message()”>
d. <body onready=”message()”>

Question: 77
You want to move some selected paragraphs 15px towards the left relative to their normal position. The style definition should be like:
a. p.relt{ position:relative; left:15px;}
b. p.relt{ position:relative; left:-15px;} (Answer)
c. p{ position:relative; left:15px;}
d. p{ position:relative; left:-15px;}

Question: 78
When does the load event of the browser occur?
a. When the browser receives the page header information
b. When the browser starts displaying the content
c. When the browser receives all the page information, including framesets
d.  When the browser receives all the page information, including framesets and displays it (Answer)
e. None of the above

Question: 79
You have a function to change the image with id imageID at runtime: function changeimg(givenImg)
{
document.getElementById(‘imageID’).src=givenImg
}
How would you make the webpage display “image2.gif”, only for the time that the user clicks the image?
a. <img id=”imageID” src=”image1.gif” width=”50″ height=”60″ onmousedown=”changeimg(image1.gif)” onmouseup=”changeimg(image2.gif)”> (Answer)
b. <img id=”imageID” src=”image1.gif” width=”50″ height=”60″ onmousedown=”changeimg(image2.gif)” onmouseup=”changeimg(image1.gif)”>
c. <img id=”imageID” src=”image2.gif” width=”50″ height=”60″ onmousedown=”changeimg(image1.gif)” onmouseup=”changeimg(image2.gif)”>
d. <img id=”imageID” src=”image2.gif” width=”50″ height=”60″ onmousedown=”changeimg(image2.gif)” onmouseup=”changeimg(image1.gif)”>

Question: 80
You want to move all the paragraphs 30px towards the right relative to their normal position. The style definition should be:
a. p.relt{ position:relative; left:30px;}
b. p.relt{ position:relative; left:-30px;}
c. p{ position:relative; left:30px;} (Answer)
d. p{ position:relative; left:-30px;}

Question: 81
How will you display text as a superscript?
a. vertical-align: super (Answer)
b. vertical-align: superscript
c. vertical-align: top
d. text-align: super
e. text-align: superscript

Question: 82
What is the error in the statement var charConvert = toCharCode(‘x’)?
a. toCharCode() is a bogus method
b. Nothing. It will work fine
c. toCharCode accepts only numbers (Answer)
d. toCharCode takes no arguments

Question: 83
Which of the following is true?
a. If onKeyDown returns false, the key-press event is cancelled (Answer)
b. If onKeyPress returns false, the key-down event is cancelled
c. If onKeyDown returns false, the key-up event is cancelled
d. If onKeyPress returns false, the key-up event is cancelled

Question: 84
Choose another way to write x ? a = b : a = c
a. if (‘x’) { a = b; } else { a = c; }
b. if (x) { a = c; } else { a = b; }
c. x : a = c ? a = b
d. None of the above (Answer)

Question: 85
Following is a sample CSS style: 1. p
2. (
3. font-family:arial
4. color:black
5. text-align:left
6. );
What are the corrections required in this style?
a. The style definition should be enclosed in curly braces
b. Multiple items within a style should be separated by “;”
c. The style should not close with a semicolon
d. All of the above (Answer)

Question: 86
Which of the following is not a CSS filter?
a. alpha
b. beta (Answer)
c. xray
d. invert

Question: 87
You want to validate the value in a field as soon as the user moves out of the field by pressing the tab key. Which of the following events would you use?
a. onblur (Answer)
b. onfocus
c. lostfocus
d. gotfocus
e. None of the above

Question: 88
Which of the following is not a JavaScript event?
a. onmouseover
b. onmouseout
c. onmousepress (Answer)
d. onmousedown

Question: 89
An HTML form has 10 checkboxes which are all named “chkItems”. Which JavaScript function can be used for checking all the checkboxes together?
a. function CheckAll()
{
for (z = 0; z < document.forms.chkItems.length; z++)
{
document.forms.chkItems[z].checked=true
}
}
b. function CheckAll()
{
        for (z = 0; z < document.forms[0].chkItems.length; z++)
        {
        document.forms[0].chkItems[z].checked=true
        }
} (Answer)

c. function CheckAll()
{
for (z = 0; z < document.forms[0].chkItems.length; z++)
{
document.forms[0].chkItems.list[z].checked=true
}
}
d. function CheckAll()
{
for (z = 0; z < document.forms[0].chkItems.length; z++)
{
document.forms[0].chkItems.list[z].checked=false
}
}

Question: 90
What is the default value for z-index?
a. -1
b. 1
c. 0
d. null
e. auto (Answer)

Question: 91
Which of the following code snippets is more effective? Why is it so? <script language=”javascript”>
for(i=0;i<document.images.length;i++)
document.images[i].src=”blank.gif”;
</script>
<script language=”javascript”>
var theimages = document.images;
for(i=0;i<theimages.length;i++)
theimages[i].src=”blank.gif”
</script>
a. Both are equally effective
b. The first code is more effective as it contains less code
c. The first code is more effective as it employs object caching (Answer)
d. The second code is more effective as it employs object caching

Question: 92
How will you change the color of the paragraph text to blue on placing the mouse over the paragraph, and reset it back when the mouse leaves the paragraph?
a. <p onmouseover=”style.color=’black’” onmouseout=”style.color=’blue’”> The text of the paragraph..</p>
b. <p onmouseover=”style.color=’blue’” onmouseout=”style.color=’black’”> The text of the paragraph..</p> (Answer)
c. <p onmouseout=”style.color=’blue’”> The text of the paragraph..</p>
d. <p onmouseover=”style.color=’blue’”> The text of the paragraph..</p>

Question: 93
You are setting cookies with JavaScript. What happens to cookies.txt data if the file exceeds the maximum size?
a. Your script automatically generates a run-time error
b. Your script automatically generates a load-time error
c. The file is truncated to the maximum length (Answer)
d. None of the above

Question: 94
Which of the following is not a JavaScript event?
a. ondblclick
b. onmousemove
c. onclick
d. onblink (Answer)

Question: 95
Which of the following is used to display an image behind the paragraph text?
a. set negative z-index for the image (Answer)
b. set positive z-index for the image
c. set negative z-index for the paragraph
d. set positive z-index for the paragraph
e. set z-index=0 for the paragraph
f. set z-index=0 for the image

Question: 96
You have this image definition: <img id=”logo” src=”companylogo1.gif” height=”12″ width=”12″ >
Which of the following would be helpful for changing the image to “companylogo2.gif” on page load?
a. logo.source=”companylogo2.gif”
b. logo.source=”companylogo1.gif”
c. document.getElementById(‘logo’).src=”companylogo1.gif”
d. document.getElementById(‘logo’).src=”companylogo2.gif” (Answer)

Question: 97
For making the text transparent, the mask filter can be used like:
a. mask(color=#ff00ff)
b. mask(color=#ffffff) (Answer)
c. mask(#ffffff)
d. mask(#ff00ff)

Question: 98
The following code snippet is used in form validation, the validate function is supposed to return a true if all validations are successful and false if the validation fails. However, the data is always submitted even if the validation fails, what could the cause be? <form name=”frmadd” method=”post” action=”add.asp” onsubmit=”validate()”>
a. There is no error, the code is fine
b. There should be a return statement before the call to the validate function (Answer)
c. onsubmit=”validate()” should be replaced with “javascript:validate()”

Question: 99
You want to position a heading at 15 pixels from the left of the page and 20 pixels from the top of the page. The style definition should be:
a. h2.side{ position:relative;  left:15px; top:20px;}
b. h2.side{ position:absolute; left:15px; top:20px;}
c. h2{ position:relative; left:15px; top:20px;}
d. h2{ position:absolute; left:15px; top:20px;} (Answer)

Question: 100
Which of the options is true for the following style, if h2 and h3 will be positioned on the top of each other? h2{z-index:1;}
h3{z-index:2;}
a. h2 will be on the top of h3
b. h3 will be on the top of h2 (Answer)
c. h3 will be on the right of h2
d. h2 will be on the right of h3

Question: 101
The anchor tag is defined as follows: <a href=”http://expertrating.com”>expertrating</a>
Which of the following styles will increase the spacing between letters on mouseover?
a. a:hover { spacing: 1px;}
b. a:hover { spacing: 2px;}
c. a:hover { letter-spacing: 0;}
d. a:hover { letter-spacing: 2px;}

Question: 102
You developed a web page using HTML and style sheets. You defined H4 style in the head tag, imported style sheet, as well as inline. Which of the following style definitions is used when the page is rendered in a browser?
a. Default browser H4 definition
b. External style sheet definition
c. Inline style definition
d. Style definition in the head tag

Question: 103
How would you change the image position from absolute to relative, if the image id is “ERImage”?
a. document.getElementById(‘ERImage’).position=”relative”
b. document.getElementById(‘ERImage’).setAttribute(“position”, “relative”)
c. document.getElementById(‘ERImage’).style.position=”rel”
d. document.getElementById(‘ERImage’).style.position=”relative”

Question: 104
Which of the following helps you make the text color change to green on moving the mouse over the text?
a. a:hover {color: green;}
b.a:visit {color: green;}
c. a: active {color: green;}
d. a:onmouseover {color: green;}

Question: 105
This is a JavaScript function for changing the color of the text box named “txtName”:
function SetColor(col)
{ document.forms[0].txtName.style.background=col }
How will you change the color of the text box txtName to green, only for the time that the user is pressing any key?
a. <input type=”text” onkeydown=”SetColor(‘white’)” onkeyup=”SetColor(‘green’)” name=”txtName”>
b. <input type=”text” onkeydown=”SetColor(‘green’)” onkeyup=”SetColor(‘white’)” name=”txtName”>
c. <input type=”text” onkeydown=”SetColor(‘green’)” name=”txtName”> (Answer)
d. <input type=”text” onkeydown=”SetColor(‘white’)” name=”txtName”>

Question: 106
How would you randomly choose an element from an array named myStuff if the number of elements changes dynamically?
a. randomElement = myStuff[Math.floor(Math.random() * myStuff.length)]; (Answer)
b. randomElement = myStuff[Math.ceil(Math.random() * myStuff.length)];
c. randomElement = myStuff[Math.random(myStuff.length)];
d. randomElement = myStuff[Math.ceil(Math.random()*myStuff.length - 1)];

Question: 107
Is the following statement correct? The width of an element must be set for making filters work.
a. Yes (Answer)
b. No

Question: 108
Consider the three variables: someText = ‘JavaScript1.2′;
pattern = /(\w+)(\d)\.(\d)/i;
outCome = pattern.exec(someText);
What does pattern.ignoreCase contain?
a. true (Answer)
b. false
c. undefined
d. null
e. 0

Question: 109
Sliding menus can be made using DHTML?
a. True (Answer)
b. False

Question: 110
Sliding menus can be made using DHTML?
a. True (Answer)
b. False

Question: 111
DHTML is a standard defined by the World Wide Web Consortium.
a. True (Answer)
b. False

Question: 112

Your website displays a few articles on java programming. If you want to leave ’1 cm’ space above and below the code blocks, you would use code { margin-top:1cm ; margin-bottom:1cm }.
a. True (Answer)
b. False

No comments: