Monday, June 16, 2014

oDesk HTML 5 Test Answers-2014

1.       Assuming that some text needs to be written on an HTML5 canvas, select a replacement for the commented line below:
<canvas id=”e” width=”200” height=”200”></canvas>
<script>
     Var canvas = document.getElementById(“e”);
     //insert code here
     context.fillstyle = “blue”;
     context.font = “bold 16px Arial”;
     context.fillText (“Zibri”, 100, 100);
</script>
Ans: c. var context = canvas.getContext(“2d”);

2.       Can we store JavaScript Objects directly into localStorage?

Ans: b. No

3.       For the following items of a <select> list:
<option value="89">Item 1</option>
<option value="90">Item 2</option>
Which of the following values would be passed on by clicking the submit button on selecting Item 2 from the list?

Ans: b. 90

4.       Consider the following javascript code:
var c=document.getElementById(“myCanvas”);
var ctx=c.getcontext(“2d”);
var img=document.getElementById(“img”);

Which method will correctly draw an image in the  x=10, y=10 position?

Ans:a.       Ctx.drawImage(img, 10, 10);

5.       How can an HTML5 canvas size be changed so that it fits the entire window?

Ans: b. <script type=”text/javascript”>
              function resize_canvas() {
                       canvas = document.gatElementById(“”canvas);
                      if (canvas.width < window.innerWidth)
                      {
                           Canvas.width = window.innerWidth;
                      }
                     if (canvas.height < window.innerHeight)
                      {
                           Canvas. height = window.innerHeight;
                      }
             }
</script>


6.       How can audio files be played in HTML5? 
var sound = new Audio("file.wav");
Ans: d. Sound.play();

7.       How does a button created by the <button> tag differ from the one created by an <input> tag?

Ans: d. A button tag can include images as well.

8.       In HTML5, which of the following is not a valid value for the type attribute when used with the <command> tag shown below?  <command type="?">Click Me!</command>

Ans: a.       Button

9.       Once an application is offline, it remains cached until the following happens (select all that apply):

Ans: b.       The manifest file is modified

10.   The following are valid use cases of client file/directory access in HTML5, except:

Ans: c.        Use of HTML5 File API


11.   The following link is placed on an HTML webpage: 
<a href="http://msdn.com/" target="_blank"> MSDN </a> 
What can be inferred from it
b. It will open the site msdn.com in a new window.

12.   True or False:
HTML5 Canvas can be used to create images.

Ans: a. True


13.   What does p2p streaming mean when web applications establish a p2p HTTP connection using HTML?

Ans: a. It means that streaming of a voice/video frame is direct, without using any server between them.

14.   What is the difference between server-sent Events (SSEs) and websockets in HTML?

Ans: a. Websockets can perform bi-directional (client-server and  vice versa) data transfers, while SSEs can only push data to the client/browser.

15.   What is the internal/wire format of input type=”date” in HTML5?

Ans: a. YYYY-MM-DD

16.   What is the limit to the length of HTML attributes?

Ans: a. There is no limit

17.    What is the role of the <dfn> element in HTML5?

Ans: b. It is used to define a definition term

18.    When does the ondragleave mouse event get fired in HTML5?

Ans:b.  It gets fired when an element leaves a valid drop target

19.    Which event is fired when an element loses its focus in an HTML5 document?

Ans:c. Onblur

20.    Which following are valid default values for the <input type="date"> HTML5 element?

Ans: b. 2013-05-30

21.    Which HTML5 doctype declarations are correct?

Ans: c. <!DOCTYPE html>

22.    Which is the standard method for clearing a canvas?

Ans: a. context.clearRect ( x, y, w, h);

23.    Which media event is triggered when there is an error in fetching media data in HTML5?

Ans: a.Onstalled

24.    Which media event will be fired when a media resource element suddenly becomes empty?

Ans: c. Onemptied

25.    Which method of HTMLCanvasElement is used to represent image of Canvas Element?

Ans: a. toDataURL()

26.    Which of the following <link> attributes are not supported in HTML5?

Ans: a. Rev,  d.charset

27.    Which of the following are sample use cases for HTML5 web workers?

Ans: d. All of these

28.   Which of the following are the valid values of the <a> element's target  attribute in HTML5?

Ans: a._blank
           b. _self
           c. _top

29. Which of the following are true about the ARIA role attribute in HTML5?

Ans: a. Every HTML element can have an ARIA role attribute specified.

30. Which of the following are valid ways to associate custom data with an HTML5 element?

Ans: a. <tr class="foo" data-id-type="4">
          c. <tr class="foo" data-id_type="4">


31. Which of the following attributes gets hidden when the user clicks on the element that it modifies? (Eg. hint text inside the fields of web forms)
Ans: c. placeholder


32. Which of the following code is used to prevent Webkit spin buttons from appearing on web pages?
Ans: b. input[type=”number”]::-webkit-inner-spin-button,
              input[type=”number”]::-webkit-outer-spin-button{
             -webkit-appearance:none;
            Margin:0;
          }


33. Which of the following examples contain invalid implementations of the ampersand character in HTML5?
 Ans: c. foo &0; bar


34. Which of the following HTML5 features is capable of taking a screenshot of a web page?
Ans: c. Canvas


35. Which of the following is a possible way to get fullscreen video 
played from the browser using HTML5?
Ans: c. <video height="100%" width="100%">


36. Which of the following is not a valid attribute for the <video> element in HTML5?
Ans: c. disabled


37. Which of the following is not a valid syntax for the <link> element in HTML5?
Ans: b. <link rev="stylesheet" href="abc.css" type="text/css" target="_parent">


38. Which of the following is the best method to detect HTML5 Canvas support in web browsers?
Ans: d. !!window.HTMLCanvasElement


39. Which of the following is the best method to store an array in localStorage?

Ans: b. var names = [];
               names[0] = prompt("New member name?");
               localStorage["names"] = JSON.stringify(names);

           //...
          var storedNames = JSON.parse(localStorage["names"]);


 40. Which of the following is the correct way to check browser support for WebSocket?
Ans: b. console.log(window.WebSocket ? 'supported : 'not supported'');



41. Which of the following is the correct way to display a PDF file in the browser?
Ans: a. <object type="application/pdf" data="filename.pdf" width="100%" height="100%">


42. Which of the following is the correct way to play an audio file in HTML5?
Ans: b. <audio controls>
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
</audio>


43. Which of the following is the correct way to store an object in a localStorage?
Ans: a. localStorage.setitem(‘testobject’, JSON.stringify(testobject))


44. Which of the following is the correct way to store an object in localStorage?
 var obj = { 'one': 1, 'two': 2, 'three': 3 };
Ans: b.       localStorage.setItem('obj', JSON.stringify(obj));


45. Which of the following methods can be used to estimate page load times?
Ans: b. Using the Navigation Timing Javascript API


46. Which of the following shows correct use of client-side data validation in HTML5, on username and password fields in particular?
Ans: a.  <input name="username" required/>
<input name="usernamepass" type="password" required/>


47. Which of the following statements are correct with regard to the <hr> and <br> elements of HTML5?
Ans: b. The <hr> element is used to insert the horizontal line within the document and the <br> element is used to insert a single line break.


48. Which of the following statements regarding WebSockets is true?
Ans: d. All of the above


49. Which of the following video file formats are currently supported by the <video> element of HTML5?
Ans: b. MPEG 4
          c. Ogg


50. Which of the following video tag attributes are invalid in HTML5?
Ans: d. pause

51. Which of the following will detect when an HTML5 video has finished playing?
Ans: a. var video = document.getElementsByName('video')[0];
               video.onended = function(e) {
               }


52. Which of the following will restrict an input element to accept only numerical values in a text field?
Ans: a. <input type="text" pattern="[0-9]*"/>
          b. <input type="number"/>
          c. <input type="text" pattern="/d*"/>

53. You are writing the code for an HTML form and you want the browser to retain the form's input values. That is, if a user submits the form and presses the browser's back button, the fully populated form is displayed instead of a blank form. Which of the following HTML 5 attributes will you use?
Ans: D. formtarget

54. You want to create a link for your website allowing users to email the webmaster. How will you implement this if the webmaster's email address is webmaster@xcompany.com?
Ans: a. <a href="mailto:webmaster@xcompany.com" >webmaster</a>

oDesk Wordpress 3.10 Test Answers 2014

1. You want to schedule a backup of your site database but do not have enough permissions to access your host. Which of the following choices can help you perform this task?
b.  Install “wp database backup” plug-in.


2. Which of the following actions must be performed before upgrading WordPress?
f.   a, b, and c

3. Which of the following files must be deleted after installing WordPress?

d.   None of these files.

4. A possible way to install WordPress in your language is to _________________.

a.   manually install language package or translate as necessary

5. Which of the following actions must you perform to move your site from “/wordpress” to “/blog/wordpress”?
c. Update the database.

6 .On which of the following databases can WordPress be installed by default?
a.  MySQL

7. WordPress’s requirements are modest. At minimum, your server should support:
b. PHP version 4.3 or greater, MySQL version 4.0 or greater

8. Can you Override database values for your site URLs in wp-config.php?
a. Yes
9 .After moving a WordPress site to a new host. If you changed your site’s URL. Do you have to update your posts and pages to correct paths to your uploaded media files?
a.      Yes

10. Is it able to run more than one site/blog from a single installation of WordPress?
a. Yes

11. What is the first action you need to take for enabling WordPress MU feature?
c.  Add this code to wp-config.php file: define( ‘WP_ALLOW_MULTISITE’, true );

12. Which of the following actions must be performed before enabling the Network feature?
b.  Deactivate your plugins

13. Is supper cache a built-in plugin of WordPress?
b.  No

14. After how many times did you enter an invalid password, your IP Address would be locked?
e.  no limit

15 .Super Cache compression can cause problems if your server is _______
b.      already compressing output using mod_deflate (on Apache) or PHP compression (zlib)

16. Can you choose your username during the installation process from which version?
c.    3.0

17. Can you move your wp-config.php file to the parent directory without changing any settings?
b.  Yes, provided that you are installing WordPress in your web root directory (such as public_html). Otherwise, it is impossible.

18 .Can you move your wp-content folder elsewhere or rename it to something else without changing any settings?
c.       No

19. A possible way to collect real-time statistics about traffic to a WordPress site is to:
b.use a plug-in

20 How can the use of html code in comments be disabled?
c.By changing the theme’s source code.

21.  The date/time format of a WordPress site can be changed in __________________.
b.admin settings

22 _________________ is a good way to improve the performance of a WordPress blog.
c.Installing the “wp super cache” plug-in

23. Which of the following blog sites can be imported into WordPress?
d.Opera


24.  Which of the following actions must be performed to import data from WordPress.com?
c.   Login wordpress.com, then export data by export tool, and import a exported xml file to your site.

25 Which of the following data can you import from Blogger site?
c.Posts, comments, and users

26. Can you import content from joomla or mambo site into wordpress?
a.Yes

27 Can you import content from static HTML files into wordpress?
a.Yes

28 Which of the following actions must be fixed after importing data into wordpress?
d.      All of above data

29.  How many built-in user roles does WordPress have?
Note: they are “Administrator”, “Editor”, “Author”, “Contributer” and “Subscriber”

30.  Can users change their avatar on profile setting panel?
b.No

31.  Can you add an extra fields to user’s profiles (as birth day, birth year,..)?
a. Yes

32.  ____________ can do anything in the WordPress administration area: write, edit, and delete posts, pages, links, and comments; upload media files of any type; import content; manage the Dashboard; create, edit, and delete other users; enable and configure plugins and themes; change the site’s theme; and manage all the available options.
Administrator

33 ____________ can publish, edit, and delete posts and pages written by any user. They can upload some kinds of files, and they can write HTML without restrictions. They can manage links and categories, and they can moderate comments. Editors and administrators are also the only users allowed to read private posts and pages.
Editor

34_____________ can publish, edit, and delete their own posts. They cannot write pages. They can upload some kinds of media files, and they are allowed to use only the limited set of HTML tags.
Author

35 ____________ can write their own posts but may not publish or delete them. Their HTML is limited to the set of allowed tags and they cannot upload media files.
Contributor

36 ____________ can manage their own profiles, but can do virtually nothing else in the administration
area.

37. User Level 0 converts to …
Subscriber

38. User Level 1 converts to …
a. Contributor

39.User Level 3 converts to …
Author

40.User Level 7 converts to …
Editor

41. User Level 10 converts to …
Administrator

42. Which of the following role levels has the highest privilege?
b.  Level_10

43 .Does author have the ability to create a category?
b.  No

44 . A possible way to allow the display of several authors’ names on one post is to ______
e.       use a plug-i

45. Which of the following methods can be used to enable posting via e-mail?
b.  Configuring the feature in admin settings.


46.Image size limits can be set _______________.
c.  in the admin settings


47. A taxonomy is a _______
c. group of terms

48. in which version were custom taxonomies introduced?
a. 2.3

49. Which of the below functions is required to create a new taxonomy?
b. register_taxonomy

50.Which of the following methods is required to post html code for others to read?
a. Replacing special characters with corresponding html codes or character codes.

51.Can you set individual password for each post?
a.  Yes

52.Who of the following persons can read a post locked by password?
c.  Anyone who knows a password

53.What is the limitation to the depth of your categories?
c.  No limit levels

54. Can you set the same slug for two categories that have different parents?
b.  No

55. Can a post belong to more than one category?
a. Yes

56. Can you limit the number of revisions WordPress stores by _____
a.  adding the following line to your wp-config.php file: define(‘WP_POST_REVISIONS’, 3);
b. using a plugin

57. Are categories and tags not available for pages?
a.   Yes

58. Which of following action must be performed before using Akismet Plugin?
b. Create an account at wordpress.com.

59. Which of the following tasks should be performed before installing any widget?
c.   Verify that your WordPress theme is widget-ready.

60. In order to display a widget, the user must _________________.
b.  drag the desired widget to the side bar

61. To manually make the sidebar widget-ready, the user must ______________.
a.  modify the sidebar.php file

62. Which of the following methods can be used to eliminate spam?
e.   a and b

63. Which of the following tasks must be performed to add a favicon icon to your site?
e. a and b

64. How can a logo be placed on a WordPress header?
a.  Manually add the logo to the source code.

65. Which of the following theme files can be used to customize the “page not found error” error page?
b.  404.php

66. Is the functions.php file required in each theme?
b.   No

67. Which of the following files are required for completing your theme?
c.   Index.php and style.css


68. What is the name of theme file for a page with slug ‘about’?
b. page-about.php

69 .What is the name of theme file for a page with id ‘3’?
b. page-3.php

70. ‘Slug’ is higher priority in use than ‘id’ in Template Hierarchy?
a.  Yes

71. Can you create a specific theme file for a custom content type?
a. Yes

72. What is the right order (by priority in use) to display page in Template Hierarchy?
a. page-{slug}.php, page-{id}.php, page.php, index.php

73. What is the right order (by priority in use) to display category in Template Hierarchy?
c. category -{slug}.php, category-{id}.php, category.php, archive.php, index.php

74. What is the right order (by priority in use) to display tag in Template Hierarchy?
c. tag -{slug}.php, tag -{id}.php, tag.php, archive.php, index.php

75. What is the right order (by priority in use) to display taxonomies in Template Hierarchy?
b. taxonomy -{taxonomy}-{term}.php, taxonomy-{taxonomy}.php, taxonomy.php, archive.php, index.php

76. Where can Google Adsense be integrated into a WordPress blog?
c. Anywhere.

77. One way to get posts from a specific day is to ____________________.
b.  use the query_posts loop in the source code

78. The “function_exists()” function can be used to check whether a plug-in is activated or not.
a.  True

79. Conditional tags can be used to _______________________.
c.  change the content to be displayed

80. The WordPress loop can be used ____________________.
b.  to display every post

81. Using ____________is a good way to ensure that a WordPress site is indexed by search engines.
a.  a sitemap


82. Which of the following statements regarding permalinks on a WordPress site is true?
b.  Permalinks are optional but highly recommended


83. In which of the following ways can a redirect feature be added to a permalink?
e. a and b

84. One way to make a WordPress page title more SEO friendly is to ____________.
c.  change the title tag in header.php to something like “blog name »» category »» post name”

85. Meta tags can be added to WordPress pages by ________________.
a.   using plug-ins

b.  adding them to the header.php file

86. Which of the following methods can be used to make permalinks SEO friendly?
d  Configuring the feature in the admin settings.


Don't forget to subscribe us please.