Q1. Which two code fragments represent ways to use HTML5 to save values to session storage? (Choose two.)
A. Option A
B. Option B
C. Option C
D. Option D
Answer: A,C
Explanation: Example: sessionStorage.setItem("key", "value");
Example:
if (sessionStorage.clickcount)
{
sessionStorage.clickcount=Number(sessionStorage.clickcount)+1;
}
else
{
sessionStorage.clickcount=1;
}
document.getElementById("result").innerHTML="You have clicked the button " +
sessionStorage.clickcount + " time(s) in this session.";
Q2. Which CSS position value is used to position an element relative to the browser window?
A. position: relative;
B. position: absolute;
C. position: static;
D. position: fixed;
Answer: D
Q3. Which CSS3 code fragment styles an H2 element only if it is a direct child of a DIV element?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: B
Q4. When content from a flow is loaded into a region, overflowed content:
A. attempts to fit into the region by auto-adjusting the styles.
B. continues into the next region.
C. is truncated and an error flag is set.
D. is buffered for download.
Answer: B
Q5. Which three are valid JavaScript variables? (Choose three.)
A. xyz1
B. .Int
C. int1
D. _int
E. 1xyz
Answer: A,C,D
Explanation: Variable names must begin with a letter or special variable with either $ or _ Variable names are case sensitive (y and Y are different variables)
Q6. You create an interface for a touch-enabled application.
During testing you discover that some touches trigger multiple input areas.
Which situation will cause this problem?
A. The touch screen is not calibrated.
B. The input areas are too close together.
C. The defined input areas are too small.
D. The input areas are semi-transparent.
Answer: B
Q7. You write the following JavaScript code. (Line numbers are included for reference only.)
You need to write a function that will initialize and encapsulate the member variable full name.
Which are two possible code fragments you could insert at line 02 to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
A. Option A
B. Option B
C. Option C
D. Option D
Answer: B,D
Explanation:
Note:
* In JavaScript this always refers to the “owner” of the function we're executing, or rather, to the object that a function is a method of.
* If you assign a value to variable that has not yet been declared, the variable will automatically be declared as a GLOBAL variable.
This statement:
carname="Volvo";
Will declare the variable carname as a global variable , even if it is executed inside a
function.
Q8. You need to use JavaScript to access the "section1" element in the following code fragment:
<div id='section1'>
Which method should you use?
A. getElementsByTagName
B. getElementById
C. getElementsByName
D. getElementsByClassName
Answer: B
Q9. You add script tags to an HTML page. You need to update the text value within a specific HTML element. You access the HTML element by id. What should you do next?
A. Use the createTextNode method.
B. Use the appendChild method.
C. Set the new text value with the setAttribute method.
D. Use the firstChild property and set the new text value with the nodeValue property.
Answer: D
Q10. The variable named "ctx" is the context of an HTML5 canvas object. What does the following code fragment draw? ctx.arc(x, y, r, 0, Math.PI, true);
A. a circle at the given point
B. a square at the given point
C. a semi-circle at the given point
D. a line from one point to another
Answer: C
Q11. Which attribute prefills a default value for an input element in HTML5?
A. name
B. placeholder
C. autocomplete
D. required
Answer: B
Q12. Which code fragment will display an image file while the video is downloading?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: B
Q13. DRAG DROP
Match the JavaScript code fragments with the HTML5 local storage functions. (To answer, drag the appropriate code fragment from the column on the left to its local storage function on the right. Each code fragment may be used once, more than once, or not at all. Each correct match is worth one point.)
Answer:
Q14. Which two code segments declare JavaScript functions? (Choose two.)
A. varfunct= (a);
B. function Foo(a){
…
}
C. var a=new Foo();
D. Foo=function(a){
...}
Answer: C,D
Explanation: Example:
function add(x, y) {
return x + y;
}
var t = add(1, 2);
alert(t); //3
Example:
//x,y is the argument. 'returnx+y' is the function body, which is the last in the argument list.
var add = new Function('x', 'y', 'return x+y');
var t = add(1, 2);
alert(t); //3
Incorrect:
Not A: funct keyword not used in JavaScript
Q15. An HTML5 application can run without an Internet connection if:
A. the application is converted to an executable.
B. the .NET Framework is installed on the client computer.
C. the application specifies the use of a client-side SQL database.
D. the application specifies the use of an ApplicationCache interface.
Answer: D
Q16. You create an instance named "location" of a geolocation object.
Which code fragment will initiate periodic updates of a device's geographic location?
A. location = navigator.geolocation;
B. location.watchPosition(showLocation) ;
C. location.getCurrentPosition(showLocation);
D. location.clearNatch(watchid);
Answer: B
Q17. DRAG DROP
Match the HTML5 elements to the corresponding functions. (To answer, drag the appropriate HTML5 element from the column on the left to its function on the right. Each HTML5 element may be used once, more than once, or not at all. Each correct match is worth one point.)
Answer: