Jan 30, 2013

JavaScript multiple choice questions and answers


JavaScript MCQ or multiple choice questions and answers for interview and test

1. Which of the following is not true about document object in JavaScript? 

A. It may contain array of forms object.
B. We can reference the forms object from document using position.
C. We can reference the forms object from document object using name.
D. A document object always keeps single form object.
E. Position of first forms object begins from zero.

Answer: D

2. Which of the following attribute of form tag is not set by using document object in JavaScript?

A. Target
B. Enctype
C. Action
D. Method
E. All of the above can be set.

Answer: E

3. Which of the following is syntactically correct way to access the any element of form object?  

A. document.forms.element
B. document[0].forms.element
C. document.forms[0].element
D. document.forms[0].elements[0]
E. document.forms.elements[0]

Answer:  D

4. Which of the following is not true about JavaScript?

A. It is a scripting language.
B. It was designed to add interactivity to HTML pages.
C. It is a lightweight programming language.
D. It execute with preliminary compilation.
E. It can be embedded directly into HTML pages.

Answer: D

5. Which of the following JavaScript cannot do?

A. JavaScript can react to events.
B. JavaScript can manipulate HTML elements.
C. JavaScript can be use to validate data.
D. JavaScript can create cookies.
E. All of the above are correct.

Answer: E

1. D
2. E
3. D
4. D
5. E

Jan 29, 2013

Html5 objective type questions with answers for interview


Interview questions on html5. It is objective type basic quiz questions and answers for interview as well as assignment.  

1. Which of the following is a not content-specific element in HTML5?

A. <article>
B. <footer>
C. <header>
D. <nav>
E. <narrow>

2. Which of the following is not form controls elements in HTML5?

A. calendar
B. date
C. time
D. email
E. All of the above are form controls elements.

3. Which of the following is not new element of HTML5?

A. <footer>
B. <header>
C. <kbd>
D. <hgroup>
E. <mark>

4. Which of the following is not new element of HTML5?

A. <meter>
B. <nav>
C. <progress>
D. <noscript>
E. <rt>

5. Which of the following is not new form element of HTML5?

A. <datalist>
B. <optgroup>
C. <keygen>
D. <output>
E. Both (c) and (d)

6. Which of the following element has not removed from HTML5?

A. <acronym>
B. <map>
C. <applet>
D. <dir>
E. <tt>

7. Which of the following element has not removed from HTML5?

A. <frame>
B. <frameset>
C. <noframes>
D. <fieldset>
E. <center>

8. Which of the following element is not related video in HTML5?

A. <video>
B. <source>
C. <play>
D. <track>
E. All of the above are related to video.

9.

<video controls="controls" preload="auto">
  <source src="song.mp4" type="video/mp4" />
</video>

Which of the following is true?

A. It should load the entire video when the page loads.
B. It should load only metadata when the page loads.
C. It should load the part of video when the page loads.
D. It should not load the video when the page loads.
E. None of these.

10.

<video controls="controls" preload="metadata">
  <source src="song.mp4" type="video/mp4" />
</video>

Which of the following is true?

A. It should load the entire video when the page loads.
B. It should load only metadata when the page loads.
C. It should load the part of video when the page loads.
D. It should not load the video when the page loads.
E. Error.

11. Which of the following attribute is responsible for subtitle of a video inside <video> element?

A. <caption>
B. <subtitle>
C. <source>
D. <autoplay>
E. <track>

12. Which of the following is incorrect value of kind attribute of <track> element?

A. captions
B. chapters
C. descriptions
D. metadata
E. All of the above are correct value.

13. Which of the following is not true about kind attribute of a <track> element?

A. captions: The track defines translation of dialogue and sound effects
B. chapters: The track defines chapter titles
C. subtitles: The track defines subtitles, used to display subtitles in a video
D. metadata: The track defines content used by scripts.
E. All of the above are correct.

14. Which of the following is not attribute of the <track> element.

A. subtitle
B. default
C. kind
D. src
E. label

15. Which of the following is not event of <video> element?

A. play
B. pause
C. progress
D. error
E. Above all are event of the <video> element.

16. Which of the following is not event of <video> element?

A. timeupdate
B. ended
C. abort
D. error
E. empty

17. Which of the following is not event of <video> element?

A. emptied
B. waiting
C. loadedmetadata
D. seeking
E. abort

18. Which of the following is not property of <video> element?

A. abort
B. currentTime
C. currentSrc
D. videoWidth
E. duration

19. Which of the following is not property of <video> element?

A. height
B. volume
C. abort
D. seeking
E. muted

20. Suppose your browser doesn't support <video> tag
What will be output of following code?

<video width="320" height="240" >
  Exact Help
</video>

A.  Error message
B.  Exact Help
C.  Blank page
D.  Work in audio mode.
E. None of these.

21. The <video> element allows:

A. Single <source> element.
B. Two <source> element.
C. Three <source> element.
D. Multiple <source> elements.
E. None of these.

22.  If there are multiple <source> element inside a <video> element. Browser will display the video of:

A. First <source> element.
B. Last <source> element.
C. All <source> element from first to last.
D. Will depend upon the browser support of media source.
E. Error message: multiple media source.

23. Which attribute in <video> element is responsible for play/pause button?

A. autoplay
B. poster
C. preload
D. controls
E. It is default of <video> element.

24. Which attribute in <video> element is responsible for start playing as soon as it is ready?

A. preload
B. autoplay
C. loop
D. autorun
E. fastload

25.  Height of the video player by <video> element depends:

A.  Size of media source.
B.  Poster attribute
C.  Height attribute
D.  Size attribute
E.  Width attribute

26.  Which attribute in <video> element is responsible for video will start over again, every time it is finished?

A. autostart
B. autoplay
C. loop
D. replay
E. None of these.

27. Which attribute in <video> element is responsible for audio output of the video should be muted?

A. controls
B. voice=0
C. muted
D. sound
E. None of these.

28. How to display an image when media is downloading by <video> element in HTML5:

A. Using src attribute link to image.
B. Using poster attribute.
C. Using default attributes.
D. Using controls attribute.
E.  Using anyone of the above.

29. How can we specify the source of media in <video> element?

A. By using src attribute
B. By using <source> element.
C. By using <controls> element.
D. Both option (a) and (b)
E. None of these.

30. What is the correct way to set the autoplay attribute in HTML5?

A. <video autoplay>
B. <video autoplay="autoplay">
C. <video autoplay="">
D. Only options (B) and (C)
E. Options (A), (B) and (C) are correct.

31. Which of the following is false about autoplay attribute of <video> element?

A. It is boolean attribute.
B. Video will automatically start playing.
C. It value can be "autoplay" or ""
D. It is correct to write <video autoplay>
E. All of the above are correct.

32. Controls attribute in <video> element doesn't include:
A. Play button
B. Pause button
C. Seeking
D. Volume
E. It includes all of the above.

33. Controls attribute in <video> element doesn't include:

A. Full screen toggle
B. Captions/Subtitles (when available in media)
C. Track (when available in media)
D. Source
E.  It includes all of the above.

34. Which of the following in not true about height and width attribute in <video> element in HTML5.

A.  If height and width are set then space required for the video is reserved when the page is loaded.
B.  If height and width are not set, the browser does not know the size of the video, and cannot reserve the appropriate space to it.
C.  If height and width are not set then page layout may change during loading.
D.  Downsizing a large video with the height and width attributes forces a user to download the original video.
E. All of the above are correct.

35. Which of the following web browser doesn't support the loop attribute of <video> element?

A. Internet Explorer 9
B. Google Chrome 6
C. Firefox 4.0
D. Opera 10.6
E. Apple Safari 5

36. Which of the following is incorrect way to set the loop attribute of <video> element in HTML5?

A. <video loop>
B. <video loop="loop">
C. <video loop="">
D. <video loop="default">
E. All of the above are correct.

37. Which of the following web browser doesn't support the muted attribute of <video> element?

A. Internet Explorer 9
B. Google Chrome 6
C. Firefox 4.0
D. Opera 10.6
E. It is supported by above all browsers.

38. Which of the following is false about poster attribute of <video> element?

A. The poster attribute specifies an image to be shown while the video is downloading.
B. If this is not specified it will display first frame of the video.
C. If this is not specified it will display black screen.
D. It accepts relative URL.
E. It accepts absolute URL.

39. When autoplay attribute has defined in <video> element then:

A. preload attribute is ignored.
B. Web browser assume preload="auto"
C. Web browser assume preload="metadata"
D. Both (A) and (C)
E. None of these.

40. Which of the following element has not removed from HTML5?

A. <font>
B. <basefont>
C. <small>
D. <big>
E. <strike>

Answers:

1. E
2. E
3. C
4. D
5. B
6. B
7. D
8. C
9. A
10. B
11. E
12. E
13. E
14. A
15. A
16. D
17. D
18. A
19. C
20. B
21. D
22. D
23. D
24. B
25. C
26. C
27. C
28. B
29. D
30. E
31. E
32. E
33. D
34. E
35. D
36. D
37. A
38. C
39. A
40. C

Html5 multiple choice questions and answers

Html5 MCQ or multiple choice questions for practical exam, lab test, and viva test etc.

1. Which of the following is not true about HTML5?

A. Better error handling
B. Reduce the need for external plug-in (like Flash)
C. Uses more markups to replace scripting language
D. All of the above are correct.
E. Only options (A) and (C) are correct.

2. Which of the following is not new feature of HTML5?

A. Use <canvas> element for 2D drawing.
B. Use <video> elements for media playback.
C. Use <audio> elements for media playback.
D. Support for local storage
E. All of the above are new features.

3. Which of the following is not form controls elements in HTML5?

A. url
B. search
C. money
D. email
E. time

4. Which of the following is not new element of HTML5?

A. <colgroup>
B. <details>
C. <summary>
D. <figure>
E. <figcaption>

5. Which of the following is not new element of HTML5?

A. <ins>
B. <section>
C. <time>
D. <wbr>
E. <bdi>

6. Which of the following element has not removed from HTML5?

A. <font>
B. <basefont>
C. <small>
D. <big>
E. <strike>

7. Which of the following is true about video in HTML5?

A. HTML5 doesn't support video.
B. To play video we must have to use some plug-in.
C. It defines a new element which specifies a standard way to embed a video.
D. Both the options (a) and (b)
E. None of the above.

8.

<video controls="controls" preload="none">
  <source src="song.mp4" type="video/mp4" />
</video>

Which of the following is true?

A. It should load the entire video when the page loads.
B. It should load only metadata when the page loads.
C. It should load the part of video when the page loads.
D. It should not load the video when the page loads.
E. Error.

9. Which of the following attribute is used to specify the title of the text track in a <track> element?

A. caption
B. subtitle
C. kind
D. label
E. srclang

10. Which of the following is not true about srclang attribute of a <track> element?

A. This specifies the language of the track text data.
B. This attribute is required if kind="subtitles"
C. Its value can be two-letter language code.
D. Only option (A) and (C) are correct.
E. Options (A), (B) and (C) are correct.

11. Which of the following is true about <!doctype> declaration in HTML5?

A. <!doctype> declaration is optional.
B. There must be only one <!doctype> declaration.
C. There must be only two <!doctype> declaration.
D. There can be any number of <!doctype> declaration.
E. None of the above.

12. Which of the following is not new element of HTML5?

A. <article>
B. <aside>
C. <bdi>
D. <command>
E. <big>

13. Which of the following is not new media element of HTML5?

A. <audio>
B. <video>
C. <object>
D. <source>
E. <track>

14. Which of the following browser doesn't support <video> tag?

A. Internet Explorer 9
B. Firefox
C. Opera
D. Chrome
E. All supports <video> tag.

15. Type attribute of <source> element for a video is:
A. Media source type
B. Media compression type
C. MIME type
D. Media extension
E. Its value can be image, audio or video

16. Which of the following attribute is used to specify the URL of the track file in a <track> element?

A. origin
B. source
C. subtile
D. src
E. url

17. Which of the following is not method of <video> element?

A. play()
B. pause()
C. load()
D. canPlayType
E. Above all are methods of the <video> element.

18. Which of the following is not property of <video> element?

A. abort
B. currentTime
C. currentSrc
D. videoWidth
E. duration

19. Which of the following attribute is used to specify the language of the track text data in a <track> element?

A. type
B. kind
C. lang
D. srclang
E. language

20. When autoplay attribute has defined in <video> element then:

A. preload attribute is ignored.
B. Web browser assume preload="auto"
C. Web browser assume preload="metadata"
D. Both (A) and (C)
E. None of these.


21. What is correct behavior of preventDefault() function:

A. Prevent the drag event
B. Prevent the drop event
C. Prevent the browser default handling of the data
D. Prevent the load data in browser.
E. All of the above.

22. Which of the following is correct way to set the dragged data?

A. e.dataTransfer.setData("Data",e.target.id);
B. e.dataTransfer.setData(e.target.id,"Data");
C. e.dataTransfer.setData(e.target.id,e.source.id,"Data");
D. e.dataTransfer.setData("Data",e.target.id,e.source.id);
E. e.dataTransfer.setData(e.target.id,e.source.id);

Note: Here e is ondrop event

23. How to make an element draggable:

A. <div drag="true" />
B. <div draggable="true" />
C. <div type="drag" />
D. <div type="draggable"/>
E. All of the above are correct.

24. Which event will fire when an element is dragged?

A. ondragoccure
B. ondragstart
C. ondragbegin
D. ondrag
E. ondragging

25. Which of the following is not a valid event of drag and drop?

A. ondragstart
B. ondragover
C. ondragend
D. ondrop
E. All of the above are correct.

26. What is default behavior of browser when any element is dropped?

A. Drop on the element.
B. Open as link on drop.
C. Display a warning message.
D. Hide the dropping element.
E. None of the above is correct.

27. Which method will use to get the dragged data?

A. dataTransfer.getdragdata
B. dataTransfer.getdragelement
C. dataTransfer.sedata
D. dataTransfer.gedata
E. dataTransfer.getdrop

28. Correct way to declaring character encoding in html5 is:

A. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
B. <meta http-equiv="Content-Type" charset=UTF-8" />
C. <meta http-equiv="Content-Type" content="text/html;/>
D. <meta content="text/html; charset=UTF-8" />
E. <meta charset="UTF-8" />

29. How can we create DOCTYPE in html5?

A. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
B. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
C. <!DOCTYPE html PUBLIC "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
D. <!DOCTYPE html PUBLIC>
E. <!DOCTYPE html>

30. Which of the following is most appropriate tag in html5 to divide the document into logical document sections?

A. <div></div>
B. <span></span>
C. <frame></frame>
D. <section></section>
E. <group></group>

Answers:

1. D
2. E
3. C
4. A
5. A
6. C
7. C
8. D
9. E
10. E
11. B
12. E
13. C
14. E
15. C
16. D
17. E
18. A
19. D
20. A

21. C
22. A
23. B
24. B
25. C
26. B
27. D
28. E
29. E
30. D