Saturday, September 7, 2013

oDesk DHTML Test Answers

You want to delete an element from an options array. How would you do it?
 b.        Set it to null


How can you change the image position from  relative to absolute if the image id is “ERImage”?
 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


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


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


Consider the three variables:
someText = ‘JavaScript1.2′;
pattern = /(\w+)(\d)\.(\d)/i;
outCome = pattern.exec(someText); 
What does pattern.ignoreCase contain? 
a.         true


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;


How would you create a popup window that closes after n seconds?
 b.        You would use the setTimeout function


Which of the following styles will be helpful in keeping an image at a fixed positionon the webpage, even if someone scrolls the page?
 
c.         background-attachment:fixed;


What is the default value for overflow property?
 
b.        visible


Which of the following properties of JavaScript is used to store the extra values for DHTML tricks?
 c.         innerHTML


Consider the following validate function:
 
This function should be called as soon as the user leaves the field. What will you do? 
d.        


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
Which of the following is not a JavaScript event?
 
c.         onupdate


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
The anchor tag is defined as follows:


Which of the following styles will make convert this to capital letters on mouseover? 
c.         a:hover { text-transform:uppercase;}


You have a button definition as given below:
To load an image “Img2.jpg” as the background of the button on a mouseover event, you can use: 
c.         event.srcElement.style.backgroundImage=”url(‘Img2.jpg’)”


Which of the following statements is incorrect with regard to a style sheet?
 
c.         Multiple style definitions will cascade into one


Which of the following statements with regard to CSS is correct?
 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)


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


Which of the following helps you create hyperlinks without an underline?
 a.         a{text-decoration:none}


The width of the h4 is defined as follow:
H4 {width:95%;}
How can you make the heading blur? 
b.        

Heading



Which of the following will you use for changing the color of the textbox text with id=txtLocation to blue, on a mouseover event?
 
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()


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?
 b.        Use externally linked files which hold the JavaScript code


How would you test whether or not a browser window is open?
 c.         By using the open method of the document object


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? 
d.        Some Text


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?
 
b.        document.getElementById(‘lnk1′).style.left=”0″
document.getElementById(‘lnk1′).style.left=”2″


Which of the following will you use for changing the color of a button with id=btn, to green on a mouseover event?
 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?
 d.        Use the following notation:
       


Consider the following JavaScript alert:
You want the user to see the above message upon opening the page, how will you implement this? 
a.        


You want to move some selected paragraphs 15px towards the left relative to their normal position. The style definition should be like:
 
b.        p.relt{ position:relative; left:-15px;}


The width of the h4 is defined as follow:
H4 {width:80%;}
How can you make the heading drop shadow? 
c.        

Heading



When does the load event of the browser occur?
 d.        When the browser receives all the page information, including framesets and displays it
Is the following statement correct?


The width of an element must be set for making filters work. 
a.         Yes


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.        


You want to move all the paragraphs 30px towards the right relative to their normal position. The style definition should be:
c.         p{ position:relative; left:30px;}


How will you display text as a superscript?
 
a.         vertical-align: super


What is the error in the statement var charConvert = toCharCode(‘x’)?
 
c.         toCharCode accepts only numbers


Which of the following enables JavaScript Document Object Model to provide access to the HTTP header?
 
a.         document.GetHeader()


The width of the h4 is defined as follow:
H4 {width:80%;}
How can you make the heading drop shadow?
 c.        

Heading



Which of the following properties of JavaScript is used to store the extra values for DHTML tricks?
c.         innerHTML


The width of h3 is defined as follows:
H3 {width:90%;}


How can you make the heading flip vertically?
 b.        

Heading



Which of the following is true?
 
a.         If onKeyDown returns false, the key-press event is cancelled


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


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?
 b.        document.getElementById(‘lnk1′).style.left=”0″
document.getElementById(‘lnk1′).style.left=”2″


Which of the following is not a JavaScript event?
 d.        onblink


You are developing a website for children. You want to format the borders of big 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?
 b.        border-style:dotted dashed solid double


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

No comments:

Post a Comment