oDesk DHTML Test Answers 2015


oDesk DHTML Test Answers is the very important test for both of web designer and web programmer.


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
c. Set it to undefined
d. Set it to -1
e. Set it to 0
f. Set it to 1

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”

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
b.        image
c.         any of the above

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
b.        The first statement is incorrect and the second one is correct

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
e.         break

Consider the three variables: someText = ‘JavaScript1.2′;
pattern = /(\w+)(\d)\.(\d)/i;
outCome = pattern.exec(someText);

What does pattern.ignoreCase contain?

a.         true
b.        false
c.         undefined
d.        null
e.         0

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;
b.        position:relative; left:-20PX;
c.         position:relative; right:-20PX;
d.        position:relative; right:20PX;

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
c.         You would use the exit function of the window object
d.        You would use the terminate function
e.         None of the above

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;
d.        background-attachment:static;

What is the default value for overflow property?
a.         scroll
b.        visible
c.         hidden
d.        auto

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

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()”>

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
b.        By nullifying the name attribute
c.         By omitting the name attribute
d.        None of the above

Which of the following is not a JavaScript event?
a.         onabort
b.        onchange
c.         onupdate
d.        onkeydown

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
b.        OnKeyPress
c.         OnKeyUp
d.        onClick

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;}
d.        a:hover { text-style:upper;}

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’)”
d.        event.srcElement.style.Image=”url(‘Img2.jpg’)”

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
d.        Same style sheets can be used by many HTML pages

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

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

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

Which of the following helps you create hyperlinks without an underline?
a.         a{text-decoration:none}
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;}

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>
c.         <h4 style=”filter::blur()”>Heading </h4>
d.        <h4 style=”Blur()”>Heading </h4>

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”

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

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
c.         Modify the headers of the page
d.        Change the MIME type of the page

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
d.        None of the above

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>

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″
c. document.getElementById(‘lnk1′).style.move=”0″ document.getElementById(‘lnk1′).style.move=”2″
d.  document.getElementById(‘lnk1′).right=”0″
document.getElementById(‘lnk1′).right=”2″

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“

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>
e.         Add a <noscript> tag after the script

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()”>
b.        <body onunload=”message()”>
c.         <body onsubmit=”message()”>
d.        <body onready=”message()”>

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;}
c.         p{ position:relative; left:15px;}
d.        p{ position:relative; left:-15px;}


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>
d.        <h4 style=”DropShadow ()”>Heading </h4>
e.         <h4 filter(dropshadow)>Heading</h4>
f.         <h4 style=”filter::shadowdrop()”>Heading </h4>

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
e.         None of the above

Is the following statement correct? The width of an element must be set for making filters work.
a.         Yes

b.        No

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)”>
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)”>

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;}
d.        p{ position:relative; left:-30px;}

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

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
d.        toCharCode takes no arguments

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

You can find more test answers 
oDesk DHTML Test Answers 2015.