Category Archives: Top 10 popular test answers

Top 10 popular test answers

CSS Test

Published by:

1. Consider the following code snippet:

<div id=”sectors”>
<div id=”A” class=”A”></div>
<div id=”B” class=”B”></div>
<div id=”C” class=”C”></div>
<div id=”D” class=”D”></div>
<div id=”E” class=”E”></div>
</div>
With these style rules:
<style>
#sectors > div {
float: left;
position: relative;
width: 80px;
height: 80px;
margin: 16px;
background-color:red; color: white;
text-align: center;
}
#sectors > div::after {
content: attr(id) ‘-Block’;
}
#sectors > div.changecolor {
background-color: blue;
}
</style>

Which of the following code snippets when inserted into CSS will change the A and B div’s color from red to blue?

Answers:

  1. In style rule add this code “#sectors > div:not(.C):not(.D):not(.E) {background-color: blue;}”
  2. In style rule add this code “#sectors > div:not(.C, .D, .E) {background-color: blue;}”
  3. Both A and B
  4. None of the above

2. Which of the following will create a triangle effect using pure CSS3 on a white background, without making use of background images?

Answers:

  1. It is not possible to do so.
  2. border-color: #a0c7ff #ffffff #ffffff #ffffff; border-style: solid; border-width: 20px; width: 0px; height: 0px;
  3. background-color: #a0c7ff #ffffff #ffffff #ffffff; border-style: solid; border-width: 20px; width: 0px; height: 0px;
  4. background-color: #a0c7ff #ffffff #ffffff #ffffff; border-style: solid; border-width: 1px; width: 10px; height: 10px;

3. Can a percentage value be given in a ruby-align property?

Answers:

  1. Yes
  2. No

4. Consider the following font definition:

font-weight:normal

What is the other way of getting the same result?

Answers:

  1. font-weight:100
  2. font-weight:900
  3. font-weight:400
  4. font-weight:700

5. Consider the following code:

div[class^=”stronger”] { }
{em

}

Which of the following statements is true?

Answers:

  1. It applies the rule only on divs who belong to a class that begins with “stronger”.
  2. It applies the rule only on divs of class “stronger”.
  3. It applies the rule only on divs who belong to a class which end with “stronger”.
  4. It applies the rule only on divs who belong to a class which does not contain “stronger” in its name.

6. For the clear property, which of the following values is not valid?

Answers:

  1. none
  2. left
  3. right
  4. top

7. What will be the output of the following code?
<style>
.foo {
width:100px;
height:50px;
border-width:3px;
-webkit-border-image:
-webkit-gradient(linear, 0 0, 0 100%, from(black), to(red)) 1 100%;
-webkit-border-image:
-webkit-linear-gradient(black, red) 1 100%;
-o-border-image:
-o-linear-gradient(black, red)) 1 100%;
-moz-border-image:
-moz-linear-gradient(black, red) 1 100%;

}
</style>

<div class=”foo”>Lorem</div>

Answers:

  1. The text “Lorem” will be colored black-red.
  2. The div element will be colored black-red.
  3. The border of div element will be colored black-red.
  4. None of these.

8. Which of the following is not a valid value for the font-smooth property?

Answers:

  1. auto
  2. never
  3. always
  4. normal
  5. length

9. Which of the following option does not exist in media groups available in CSS3?

Answers:

  1. continuous or paged
  2. visual or tactile
  3. grid or bitmap
  4. braille or screen

10. Which of the following is not a valid page break?

Answers:

  1. page-break-inside
  2. page-break-outside
  3. page-break-before
  4. page-break-after
  5. None of these

11. Which statement is correct given the following?
box-shadow:30px 20px 10px 5px black;

Answers:

  1. The shadow will be spread out to 30px top, 20px right, 10px bottom, 5px left.
  2. The position of the horizontal black shadow is 30px and the position of the vertical black shadow is 20px and blur distance is 10px and size of shadow is 5px.
  3. The position of the vertical black shadow is 30px and the position of the horizontal black shadow is 20px and size of shadow is 10px and blur distance is 5px.
  4. The shadow will be spread out to 30px top and bottom, 20px left and right with 10px blur distance, 5px shadow size.

12. The min-width property cannot be applied to the following element:

Answers:

  1. button
  2. span
  3. table row

13. Given the following problem:

A drop shadow needs to appear only at the bottom, and no images should be used.
Consider the following code:

-moz-box-shadow: 0px 4px 4px #000;
-webkit-box-shadow: 0px 4px 4px #000;
box-shadow-bottom: 5px #000;

However, this produces shadows on the rest of the element.

Which of the following code snippets will correct the issue?

Answers:

  1. border-bottom:5px solid #ffffff; -webkit-box-shadow: 0px 5px #000000; -moz-box-shadow: 0px 5px #000000; box-shadow: 0px 5px #000000;
  2. -webkit-box-shadow: 0 4px 4px -2px #000000; -moz-box-shadow: 0 4px 4px -2px #000000; box-shadow: 0 4px 4px -2px #000000;
  3. -webkit-box-shadow: 0 4px 4px -2px inside #000000; -moz-box-shadow: 0 4px 4px -2px inside #000000; box-shadow: 0 4px 4px -2px inside #000000;
  4. None of these.

14. Consider the following code:

body { text-replace: “a” “b” “b” “c” }

What will be the output of the following string if the text-replace style is implemented?

andy lives behind cafe

Answers:

  1. ndy lives behind cbfe
  2. cndy lives cehind ccfe
  3. andy lives behind cafe
  4. andy lives cehind bafe

15. What is the default value of the transform-style property?

Answers:

  1. preserve-3d
  2. flat
  3. none
  4. preserve

16. What will be the output of the following code?…
<style>
.foo {
width:100px;
height:50px;
border-width:3px;
-webkit-border-image:
-webkit-gradient(linear, 0 0, 0 100%, from(black), to(red)) 1 100%;
-webkit-border-image:
-webkit-linear-gradient(black, red) 1 100%;
-o-border-image:
-o-linear-gradient(black, red)) 1 100%;
-moz-border-image:
-moz-linear-gradient(black, red) 1 100%;

}
</style>

<div class=”foo”>Lorem</div>

Answers:

  1. The text “Lorem” will be colored black-red.
  2. The div element will be colored black-red.
  3. The border of div element will be colored black-red.
  4. None of these.

17. Which of the following styles is not valid for an image?

Answers:

  1. img { float= left }
  2. img { float: left here }
  3. img { background: “black” }
  4. img { border-width: 10 }
  5. All of the above

18. Suppose that a <tr> tag has 10 <td> tags. In this case which statement is correct given the following?
td:nth-child(3n+0){
background-color: orange;
}

Answers:

  1. It returns a syntax error.
  2. The background color of the fourth td will be orange.
  3. The background color of the third td will be orange.
  4. The background color of every third td will be orange.

19. What is the best method to select all elements except for the last one in an unordered list?

Answers:

  1. Adding a class to each <li> element but last
  2. Using li:not(:last-child) css selector
  3. Using li:last-child selector
  4. None of the above

20. Which of the following will apply a black inner glow with 25% opacity to a page element?

Answers:

  1. box-shadow: 0 0 8px rgba(255,255,255, 0.25);
  2. box-shadow: inset 0 0 8px rgba(0,0,0, 0.25);
  3. box-shadow: 0 0 8px rgba(255,255,255, 25%);
  4. box-shadow: inset 0 0 8px rgba(0,0,0, 25%);

21. Which of the following is the initial value for the column-fill property?

Answers:

  1. auto
  2. balance
  3. none

22. Which of the following can be used to add a shadow around the div element below?
<div>Lorem ipsum</div>

Answers:

  1. box-shadow: 0 0 8px 2px #888;
  2. border-shadow: 0 0 8px 2px #888;
  3. div-shadow: 8px 2px 0 0 #888;
  4. None of these

23. Which of the following will decrease 50px from a DIV element whose width is 100%?

Answers:

  1. width: calc(100% – 50px);
  2. width: reduce(100% – 50px);
  3. width: decrease(100% – 50px);
  4. width: 100% – 50px;

24. Which of the following properties specifies the minimum number of lines of a paragraph that must be left at the bottom of a page?

Answers:

  1. orphans
  2. widows
  3. bottom
  4. overflow
  5. None of these

25. What is the maximum value that can be given to the voice-volume property?

Answers:

  1. 10
  2. 100
  3. 500
  4. None of the above

26. What is the initial value of the font-size property?

Answers:

  1. small
  2. medium
  3. large
  4. default

27. Is there a way to create a pure CSS3 text color gradient?

Answers:

  1. Yes, using the text-gradient property.
  2. Yes, but only for headings.
  3. There is no way to do a text color gradient with CSS3.
  4. None of the above.

28. Consider the following code:

border-opacity:0.7;

Given a div element that needs to have a transparent red border, which of the following code samples will work in conjunction with the code above to accomplish the requirement?

Answers:

  1. border: 1px solid rgba(255, 0, 0, 0.7);
  2. border: 1px solid rgb(255, 0, 0, 0.7);
  3. border: 1px solid rgba(255, 255, 0, 0.7);
  4. border: 1px solid red; opacity: 0.7;

29. What is the initial value of the animation-iteration-count property?

Answers:

  1. 1
  2. 5
  3. None

30. What is the default value of the animation-direction property?

Answers:

  1. none
  2. normal
  3. alternate
  4. inherited

31. Is it possible to combine a background image and CSS3 gradients?

Answers:

  1. It is possible only when two separate styles are used, “background-image” and “gradient”, on an HTML tag.
  2. It is possible only when “background-image” is used.
  3. It is possible only when layered HTML tags are used, “background-image” and “gradient”.
  4. It is not possible to combine a background image and CSS3 gradients.

32. What will happen if the cursor property value is set to none?
Answers:

  1. The default cursor will be displayed.
  2. No cursor will be displayed.
  3. A pointer cursor will be displayed.
  4. A text cursor will be displayed.

33. What will be the outcome of given code?
div[class^=”stronger”] { }
{

}
Answers:

  1. It applies the rule only on divs who belong to a class that begins with “stronger”.
  2. It applies the rule only on divs of class “stronger”.
  3. It applies the rule only on divs who belong to a class which end with “stronger”.
  4. It applies the rule only on divs who belong to a class which does not contain “stronger” in its name.

34. To apply style on every input element except text, which of the following selectors should be used?

Answers:

  1. input:([!type=’text’])
  2. input:not([type=”text”])
  3. input:not([type!=”text”])
  4. input:([type!=’text’])

35. For the clear property, which of the following value is not valid?

Answers:

  1. none
  2. left
  3. right
  4. top

36. Read the following:

@page rotated {size: landscape}
TABLE {page: rotated; page-break-before: right}

What will this code do?

Answers:

  1. It will put all tables on a right-hand side landscape page.
  2. It will rotate the page if the table is positioned at the right side.
  3. It will keep the table in the landscape position and rotate the page.
  4. None of the above

37. What is the initial value of the opacity property?

Answers:

  1. 1
  2. normal
  3. none

38. State whether the following statement is true or false.

If a parent element display property is set to none, its children too will not be rendered.

Answers:

  1. True
  2. False

39. Which of the following filters does SVG support?

Answers:

  1. SVG supports only CSS filters.
  2. SVG supports CSS filters as well as ‘filter’ property of SVG
  3. SVG supports only ‘filter’ property of SVG
  4. SVG does not supports any filters

40. What will happen if the pause property is used as follows?

h2 { pause: 40s 60s }

Answers:

  1. pause-before will be set to 40 seconds and pause-after will be set to 60 seconds.
  2. pause-after will be set to 40 seconds and pause-before will be set to 60 seconds.
  3. pause-after and pause-before will be set to 40 seconds.
  4. pause-after and pause-before will be set to 60 seconds.

41. Which of the following properties allow percentages in their value fields?

Answers:

  1. font-size
  2. font-variant
  3. font-weight
  4. line-height

42. Which of the following is not a valid value for the font-stretch property?

Answers:

  1. condense
  2. normal
  3. semi-narrower
  4. expanded
  5. semi-expanded

43. Which of the following styles is valid?

Answers:

  1. order: “none”;
  2. order= “none”;
  3. order: none;
  4. order= none;
  5. None of these.

44. Which one of the following is appropriate to mirror/flip text by using CSS3?

Answers:

  1. .mirror_text{ -moz-transform: scaleX(-1); -o-transform: scaleX(-1); -webkit-transform: scaleX(-1); transform: scaleX(-1); filter: FlipH; -ms-filter: “FlipH”; }
  2. .mirror_text{ Box-reflect; 20px right; }
  3. .mirror_text{ Box-reflect; 20px left; }
  4. .mirror_text{ -moz-transform: rotate(-180deg); -webkit-transform: rotate(-180deg); transform: rotate(-180deg); }

45. What is the initial value of the marquee-speed property?

Answers:

  1. slow
  2. normal
  3. fast
  4. none

46. Which of the following will apply a gradient transition to #DemoGradient using CSS3?

Answers:

  1. @-webkit-keyframes pulse #DemoGradient { 0% { background: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgb(196,222,242)), color-stop(0.5, rgb(242,242,242)), color-stop(1, rgb(240,240,240))); } 50% { background: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgb(222,252,255)), color-stop(0.5, rgb(242,242,242)), color-stop(1, rgb(240,240,240))); } 100% { background: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgb(196,222,242)), color-stop(0.5, rgb(242,242,242)), color-stop(1, rgb(240,240,240))); } }
  2. #DemoGradient{ background: -webkit-linear-gradient(#C7D3DC,#5B798E); background: -moz-linear-gradient(#C7D3DC,#5B798E); background: -o-linear-gradient(#C7D3DC,#5B798E); background: linear-gradient(#C7D3DC,#5B798E); -webkit-transition: background 1s ease-out; -moz-transition: background 1s ease-out; -o-transition: background 1s ease-out; transition: background 1s ease-out; background-size:1px 200px; border-radius: 10px; border: 1px solid #839DB0; cursor:pointer; width: 150px; height: 100px; } #DemoGradient:Hover{ background-position:100px; }
  3. It is not possible to apply a gradient transition using only CSS3.

47. Using height on transitions is not possible with:

Answers:

  1. height:auto
  2. height:100%
  3. height:0
  4. max-height:100%

48. Consider the following problem:
When trying to apply a CSS3 style to a label of a checked radio button like this:
….
<style>
label:checked { font-weight: bold; }
</style>
….
<input type=”radio” id=”rad” name=”radio”/>
<label for=”rad”>A Label</label>

This does not produce the desired effect.
Which of the following snippets will correct issue?

Answers:

  1. It is not possible to style.
  2. <input id=”rad” type=”radio” name=”rad”><label “rad”>A Label</label>
  3. input[type=”radio”]:checked+label{ font-weight: bold; }
  4. input[type=”radio”]:checked@label{ font-weight: bold; }

49. There are various types of input fields in a HTML page. Choose the appropriate CSS3 code which will have an effect on all inputs, except checkbox and radio.

Answers:

  1. form input:not([type=”radio”], [type=”checkbox”]) { }
  2. input:not([type=”radio”]):not([type=”checkbox”]) { }
  3. input:not([type=”radio & checkbox”]) { }
  4. input:!([type=”radio”]) , input:!([type=”checkbox”]) { }

50. Is it possible to use transition animations with a gradient background?

Answers:

  1. Yes
  2. No

51. What is the difference between float:left; vs display:inline-block; ?

Answers:

  1. There is no difference, both of them have the same results.
  2. display:inline-block; adds whitespace between the elements.
  3. float:left; collapses the parent element on itself.
  4. None of these.

52. What is the range of values (in decimal notation) that can be specified in the RGB color model?

Answers:

  1. 0 to 256
  2. 0 to 255
  3. -250 to 250
  4. -255 to 255

53. Which of the following are not valid values for the target-new property?

Answers:

  1. window
  2. tab
  3. none
  4. parent
  5. current

54. What will be the output of the following rule?

em { color: rgba(0,0,255,1) }

Answers:

  1. Opacity 1 with solid red color
  2. Opacity 0 with solid blue color
  3. Opacity 0 with solid red color
  4. Opacity 1 with solid blue color
  5. None of these

55. While rendering the following code, what is the role of “src” propery?

@font-face {
font-family: “calibriforh1”;
src: local(“calibri”), url(calibri.woff);
}
h1 { font-family: “calibriforh1”, arial, sans-serif; }

Answers:

  1. It’s for searching the user’s system for a “calibri” font, and if it does not exist, it will load the font from the server instead.
  2. It’s for searching the user’s system for a “calibri” font, and if it does not exist, it will load user’s system’s default font instead.
  3. It’s for loading the user’s system’s default font.
  4. None of these.

56. Which of the following statements is true with regard to CSS3 transitions?

Answers:

  1. Using CSS transitions will slow down page upload and produce lag.
  2. The completion of a CSS transition generates a corresponding DOM event. An event is fired for each property that
  3. undergoes a transition. This allows a content developer to perform actions that synchronize with the completion of a transition.
  4. CSS transitions allow DOM events in CSS values to occur smoothly over a specified duration.
  5. None of these.

57. Given that one div element needs to be hidden and on active state needs to be displayed, what will be the output of the following code?

div {
display: none;
-webkit-transition: opacity 1s ease-out;
opacity: 0;
}

div.active {
opacity: 1;
display: block;
}

Answers:

  1. On active state the element is displayed.
  2. On active state the element’s opacity is changed to 1.
  3. On active state the element’s opacity is changed to 0.
  4. Nothing will be shown.

58. Which of the given options is/are equivalent to the following rule?

DIV { line-height: 1.2; font-size: 10pt }

Answers:

  1. DIV { line-height: 1.2em; font-size: 10pt }
  2. DIV { line-height: 12em; font-size: 10pt }
  3. DIV { line-height: 120%; font-size: 10pt }
  4. DIV { line-height: 20%; font-size: 10pt }
  5. DIV { line-height: 80%; font-size: 10pt }

59. What will happen if the following style declaration is applied to an element?

p { margin: 3em 2em }

Answers:

  1. The top and the bottom margins will be 3em and the left and the right margins will be 2em.
  2. The top and the bottom margins will be 2em and the left and the right margins will be 3em.
  3. The top and the left margins will be 3em and the bottom and the right margins will be 2em.
  4. The top and the right margins will be 2em and the bottom and the left margins will be 3em.

60.Problem to solve:
Need to use attribute selector in css to change link on different color and image.
The following code is not working correctly:

<style>
a {
display: block;
height: 25px;
padding-left: 25px;
color:#333;
font: bold 15px Tahoma;
text-decoration: none;
}
a[href=’.pdf’] { background: red; }
</style>
…..
<a href=»/manual.pdf»>A PDF File</a>
Which of the following code snippets will correct issue?

Answers:

  1. a[href$=’.pdf’] { /*css*/ }
  2. a[href#=’.pdf’] { /*css*/ }
  3. a[href@=’.pdf’] { /*css*/ }
  4. a{href$=’.pdf’} [/*css*/ ]

61.Suppose there are 16 elements and a style needs to applied only on every 4th element. Which of the following is correct?

Answers:

  1. div:nth-child(4), div:nth-child(8), div:nth-child(12), div:nth-child(16) { }
  2. div:nth-child(4n) { }
  3. div:nth-child(4n+4) { }
  4. div:nth-child(3n+4)

62.To make childdiv vertically center of given code, what should the “display” property of parentdiv and childdiv be?
#parentdiv
{
width: 200px;
height: 400px;
vertical-align: middle;
}

#childdiv
{
width: 100px;
height: 50px;
}

Vertical Center

Answers:

  1. display:table-cell; for parentdiv and display:inline-block; for childdiv
  2. display:block; for parentdiv and display:inline-block; for childdiv
  3. display:inline-block; for parentdiv and display:table-cell; for childdiv
  4. display:inline-block; for parentdiv and display:inline-block; for childdiv

63.Which of the following can be used to add a shadow around the div element below?

Lorem ipsum

Answers:

  1. . box-shadow: 0 0 8px 2px #888;
  2. border-shadow: 0 0 8px 2px #888;
  3. div-shadow: 8px 2px 0 0 #888;
  4. None of these

64.Is it possible to format numbers with CSS?

Answers:

  1. .No, CSS cannot be used for that purpose.
  2. Yes, it can be done using the number-format property.
  3. Yes, it can be done using the decimal property.
  4. None of these

65.What is true about the background-clip property?
<style>
.foo {
width:100px;
height:50px;
border-width:3px;
-webkit-border-image:
-webkit-gradient(linear, 0 0, 0 100%, from(black), to(red)) 1 100%;
-webkit-border-image:
-webkit-linear-gradient(black, red) 1 100%;
-o-border-image:
-o-linear-gradient(black, red)) 1 100%;
-moz-border-image:
-moz-linear-gradient(black, red) 1 100%;
}
</style>
<div class=»foo»>Lorem</div>
Answers:

  1. The text «Lorem» will be colored black-red.
  2. The div element will be colored black-red.
  3. The border of div element will be colored black-red.
  4. None of these

66.What is true about the background-clip property?

Answers:

  1. The background-clip property specifies the painting area of the background.
  2. The background-clip property is not supported in Internet Explorer 8 and earlier versions.
  3. The background-clip property is supported in Internet Explorer 9+, Firefox, Opera, Chrome, and Safari.
  4. All are correct.

23,170 total views, 60 views today

Top 10 popular test answers

Javascript Test 2016

Published by:

1. Which of the following Array methods in JavaScript runs a function on every item in the Array and collects the result from previous calls, but in reverse?

Answers:

  1. reduce()
  2. reduceRight()
  3. everse()
  4. pop()

2. Which of the following is true about setTimeOut()?

Answers:

  1. The statement(s) it executes run(s) only once.
  2. It pauses the script in which it is called.
  3. clearTimeOut() won’t stop its execution.
  4. The delay is measured in hundredths of a second.
  5. It is required in every JavaScript function.

3. How can the operating system of the client machine be detected?

Answers:

  1. It is not possible using JavaScript.
  2. Using the navigator object
  3. Using the window object
  4. Using the document object
  5. None of these.

4. Which of the following prints “AbBc”?

Answers:

  1. var b = ‘a’; var result = b.toUpperCase() + ‘b’ + ‘b’.toUpperCase() +’C'[‘toLowerCase’](); alert(result);
  2. var b = ‘a’; var result = b.toUpperCase() + ‘b’ + ‘b’.toUpperCase() +’c'[‘toUpperCase’](); alert(result);
  3. var b = ‘a’; var result = b.toUpperCase() + b + ‘b’.toUpperCase() +’C'[‘toLowerCase’](); alert(result);
  4. var b = ‘a’; var result = b.toUpperCase() + ‘b’ + ‘b’.toUpperCase() +C; alert(result);

5. Which of the following descriptions is true for the code below?

var object0 = {};
Object.defineProperty(object0, “prop0”, { value : 1, enumerable:false, configurable : true });
Object.defineProperty(object0, “prop1”, { value : 2, enumerable:true, configurable : false });
Object.defineProperty(object0, “prop2”, { value : 3 });
object0.prop3 = 4;

Answers:

  1. Object ‘object0’ contains 4 properties. Property ‘prop2’ and property ‘prop3’ are available in the for…in loop. Property ‘prop0’ and property ‘prop1’ are available to delete.
  2. Object ‘object0’ contains 4 properties. Property ‘prop1’ and property ‘prop2’ are available in the for…in loop. Property ‘prop2’ and property ‘prop3’ are available to delete.
  3. Object ‘object0’ contains 4 properties. Property ‘prop0’ and property ‘prop2’ are available in the for…in loop. Property ‘prop0’ and property ‘prop2’ are available to delete.
  4. Object ‘object0’ contains 4 properties. Property ‘prop1’ and property ‘prop3’ are available in the for…in loop. Property ‘prop0’ and property ‘prop3’ are available to delete.

6. Performance-wise, which is the fastest way of repeating a string in JavaScript?

Answers:

  1. String.prototype.repeat = function( num ) { return new Array( num + 1 ).join( this ); }
  2. function repeat(pattern, count) { if (count < 1) return ”; var result = ”; while (count > 0) { if (count & 1) result += pattern; count >>= 1, pattern += pattern; } return result; }
  3. String.prototype.repeat = function(count) { if (count < 1) return ”; var result = ”, pattern = this.valueOf(); while (count > 0) { if (count & 1) result += pattern; count >>= 1, pattern += pattern; } return result; };
  4. String.prototype.repeat = function (n, d) { return –n ? this + (d || ”) + this.repeat(n, d) : ” + this };

7. Consider the following variable declarations:

var a=”adam”
var b=”eve”

Which of the following would return the sentence “adam and eve”?

Answers:

  1. a.concatinate(“and”, b)
  2. a.concat(“and”, b)
  3. a.concatinate(” and “, b)
  4. a.concat(” and “, b)

8. Which of the following code snippets will correctly split “str”?

Answers:

  1. <script> var str = ‘something — something_else’; var substrn = str.split(‘ — ‘); </script>
  2. <script> var str = ‘something — something_else’; var substrn = split.str(‘ — ‘); </script>
  3. <script> var str = ‘something — something_else’; var substrn = str.split(‘ – ‘,’ – ‘); </script>
  4. <script> var str = ‘something — something_else’; var substrn = split.str(‘ – ‘,’ – ‘); </script>

9. Which object can be used to ascertain the protocol of the current URL?

Answers:

  1. document
  2. window
  3. history
  4. browser
  5. form
  6. location

10. Which of the following best describes a “for” loop?

Answers:

  1. “for” loop consists of six optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
  2. “for” loop consists of five optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
  3. “for” loop consists of four optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
  4. “for” loop consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.

11. Which of the following descriptions best describes the code below?

<script>
var variable1 = { fastFood: “spaghetti”, length: 10 };
Object.freeze(variable1);
variable1.price = 50;
delete variable1.length;
</script>

Answers:

  1. Object is frozen, a property named “price” is added in the variable1 object, a property named “length” is deleted from this object. At the end of the code, the object “variable1” contains 2 properties.
  2. Object is frozen, a property named “price” is not added in the variable1 object, a property named “length” is deleted from this object. At the end of the code, object “variable1” contains 1 properties.
  3. Object is frozen, a property named “price” is added in the variable1 object, a property named “length” is not deleted from this object. At the end of the code, object “variable1” contains 1 properties.
  4. Object is frozen, a property named “price” is not added in the variable1 object, a property named “length” is not deleted from this object. At the end of the code, object “variable1” contains 2 properties.

12. Which of the following is not a valid HTML event?

Answers:

  1. ondblclick
  2. onmousemove
  3. onclick
  4. onblink

13. Analyze the following code snippet which uses a Javascript Regular Expression character set. What will be the output of this code?

<html>
<body>

<script type=”text/javascript”>
var str = “Is this enough?”;
var patt1 = new RegExp(“[^A-J]”);
var result = str.match(patt1);
document.write(result);
</script>

</body>
</html

Answers:

  1. I
  2. Is
  3. s
  4. I,s,

14. Consider the following image definition:
<img id=”logo” src=”companylogo1.gif” height=”12″ width=”12″ >
Which of the following will change the image to companylogo2.gif when the page loads?

Answers:

  1. logo.source=”companylogo2.gif”
  2. logo.source=”companylogo1.gif”
  3. document.getElementById(‘logo’).src=”companylogo1.gif”
  4. document.getElementById(‘logo’).src=”companylogo2.gif”

15. What is the final value of the variable bar in the following code?

var foo = 9;
bar = 5;
(function() {
var foo = 2;
bar= 1;
}())
bar = bar + foo;

Answers:

  1. 10
  2. 14
  3. 3
  4. 7

16. Which of the following are JavaScript unit testing tools?

Answers:

  1. Buster.js, jQuery, YUI Yeti
  2. QUnit, Modernizr, JsTestDriver
  3. Node.js, Modernizr, Jasmine
  4. Buster.js, YUI Yeti, Jasmine

17. Which of the following can be used for disabling the right click event in Internet Explorer?

Answers:

  1. event.button == 2
  2. event.button == 4
  3. event.click == 2
  4. event.click == 4

18. An image tag is defined as follows:
<img id=”ERImage” width=”100″ height=”100″ onmouseover=”ImageChange()” src=”Image1.jpg”>
The purpose of the ImageChange() function is to change the image source to Image2.jpg. Which of the following should the ImageChange() function look like?

Answers:

  1. document.getElementById(‘ERImage’).src=”Image1.jpg”
  2. document.getElementById(‘ERImage’).src=”Image2.jpg”
  3. document.getElementById(‘ERImage’).style.src=”Image1.jpg”
  4. document.getElementById(‘ERImage’).style.src=”Image2.jpg”

19. Consider the following JavaScript alert:
<script type=”text/JavaScript”>
function message() {
alert(“Welcome to ExpertRating!!!”)
}
</script>
Which of the following will run the function when a user opens the page?

Answers:

  1. body onload=”message()”
  2. body onunload=”message()”
  3. body onsubmit=”message()”
  4. body onreset=”message()”

20. Which of the following code snippets will correctly get the length of an object?

Answers:

  1. <script> var newObj = new Object(); newObj[“firstname”] = “FirstName”; newObj[“lastname”] = “LastName”; newObj[“age”] = 21; Object.size = function(obj) { var size = 0, key; for (key in obj) { if (obj.hasOwnProperty(index)) size++; } return size; }; var size = Object.size(newObj); </script>
  2. <script> var newObj = new Object(); newObj[“firstname”] = “FirstName”; newObj[“lastname”] = “LastName”; newObj[“age”] = 21; Object.size = function(obj) { var size = 0, key; for (key in obj) { if (obj.hasOwnProperty(value)) size++; } return size; }; var size = Object.size(newObj); </script>
  3. <script> var newObj = new Object(); newObj[“firstname”] = “FirstName”; newObj[“lastname”] = “LastName”; newObj[“age”] = 21; Object.size = function(obj) { var size = 0, key; for (key in obj) { if (obj.hasOwnProperty(length)) size++; } return size; }; var size = Object.size(newObj); </script>
  4. <script> var newObj = new Object(); newObj[“firstname”] = “FirstName”; newObj[“lastname”] = “LastName”; newObj[“age”] = 21; Object.size = function(obj) { var size = 0, key; for (key in obj) { if (obj.hasOwnProperty(key)) size++; } return size; }; var size = Object.size(newObj); </script>

21. In an HTML page, the form tag is defined as follows:
<form onsubmit=”return Validate()” action=”http://www.mysite.com/”>
The validate() function is intended to prevent the form from being submitted if the name field in the form is empty. What should the validate() function look like?

Answers:

  1. <script type=”text/javascript”> function Validate() { if(document.forms[0].name.value == “”) return true; else return false; } </script>
  2. <script type=”text/javascript”> function Validate() { if(document.forms[0].name.value == “”) return false; else return true; } </script>
  3. script type=”text/javascript”> function Validate() { if(document.forms[0].name== “”) return false; else return true; } </script>
  4. <script type=”text/javascript”> function Validate() { if(document.forms[0].name == “”) return true; else return false; } </script>

22. Which of the following code snippets changes an image on the page?

Answers:

  1. var img = document.getElementById(“imageId”); img.src = “newImage.gif”;
  2. var img = document.getElementById(“imageId”); img.style.src = “newImage.gif”;
  3. var img = document.getElementById(“imageId”); img.src.value = “newImage.gif”;
  4. var img = document.getElementById(“imageId”); img = “newImage.gif”;

23. Which of the following results is returned by the JavaScript operator “typeof” for the keyword “null”?

Answers:

  1. function
  2. object
  3. string
  4. number

24. What will be the final value of the variable “apt”?

var apt=2;
apt=apt<<2;

Answers:

  1. 2
  2. 4
  3. 6
  4. 8
  5. 16

25. How can a JavaScript object be printed?

Answers:

  1. console.log(obj)
  2. console.print(obj)
  3. console.echo(obj);
  4. None of these

26. Which of the following is the correct syntax for using the JavaScript exec() object method?

Answers:

  1. RegExpObject.exec()
  2. RegExpObject.exec(string)
  3. RegExpObject.exec(parameter1,parameter2)
  4. None of these

27. Having an array object var arr = new Array(), what is the best way to add a new item to the end of an array?

Answers:

  1. arr.push(“New Item”)
  2. arr[arr.length] = “New Item”
  3. arr.unshift(“New Item”)
  4. arr.append(“New Item”)

28. Consider the following JavaScript validation function:

function ValidateField()
{
if(document.forms[0].txtId.value ==””)
{return false;}

return true;
}
Which of the following options will call the function as soon as the user leaves the field?

Answers:

  1. input name=txtId type=”text” onreset=”return ValidateField()”
  2. input name=txtId type=”text” onfocus=”return ValidateField()”
  3. input name=txtId type=”text” onsubmit=”return ValidateField()”
  4. input name=txtId type=”text” onblur=”return ValidateField()”

29. Which of following uses the “with” statement in JavaScript correctly?

Answers:

  1. with (document.getElementById(“blah”).style) { background = “black”; color = “blue”; border = “1px solid green”; }
  2. with document.getElementById(“blah”).style background = “black”; color = “blue”; border = “1px solid green”; End With
  3. With document.getElementByName(“blah”).style background = “black”; color = “blue”; border = “1px solid green”; End With
  4. with (document.getElementById(“blah”).style) { .background = “black”; .color = “blue”; .border = “1px solid green”; }

30. Consider the following JavaScript validation function:

<script type=”text/JavaScript”>
function ValidateField()
{
if(document.forms[0].txtId.value ==””)
{return false;}

return true;
}
</script>

Which of the following options will call the function as soon as the user leaves the field?

Answers:

  1. input name=txtId type=”text” onreset=”return ValidateField()”
  2. input name=txtId type=”text” onfocus=”return ValidateField()”
  3. input name=txtId type=”text” onsubmit=”return ValidateField()”
  4. input name=txtId type=”text” onblur=”return ValidateField()”

31. Which of the following modifiers must be set if the JavaScript lastIndex object property was used during pattern matching?

Answers:

  1. i
  2. m
  3. g
  4. s

32. Consider the following image definition:

<img id=”logo” src=”companylogo1.gif” height=”12″ width=”12″ >

Which of the following will change the image to “companylogo2.gif” when the page loads?

Answers:

  1. logo.source=”companylogo2.gif”
  2. logo.source=”companylogo1.gif”
  3. document.getElementById(‘logo’).src=”companylogo1.gif”
  4. document.getElementById(‘logo’).src=”companylogo2.gif”

33. Which of the following will check whether the variable vRast exists or not?

Answers:

  1. if (typeof vRast=”undefined”) {}
  2. if (typeof vRast ==”undefined”) {}
  3. if (vRast.defined =true) {}
  4. if (vRast.defined ==true) {}

34. What would be the use of the following code?

function validate(field) {
var valid=”ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz”;
var ok=”yes”;
var temp;

for(var i=0;i<field.value.length;i++) {
temp=”” + field.value.substring(i,i+1)

if(valid.indexOf(temp)==”-1”) {
ok=”no”;
}
}

if(ok==”no”) {
alert(”error”);
field.focus();
}
}

Answers:

  1. It will force a user to enter only numeric values.
  2. It will force a user to enter only alphanumeric values.
  3. It will force a user to enter only English alphabet character values.
  4. None of these.

35. An image tag is defined as follows:

<img id=”ERImage” width=”100″ height=”100″ onmouseover=”ImageChange()” src=”Image1.jpg”>

The purpose of the ImageChange() function is to change the image source to “Image2.jpg”. Which of the following should the ImageChange() function look like?

Answers:

  1. document.getElementById(‘ERImage’).src=”Image1.jpg”
  2. document.getElementById(‘ERImage’).src=”Image2.jpg”
  3. document.getElementById(‘ERImage’).style.src=”Image1.jpg”
  4. document.getElementById(‘ERImage’).style.src=”Image2.jpg”

36. Which of the following choices will detect if “variableName” declares a function?

<script>
var variableName= function(){};
</script>

Answers:

  1. return variableName;
  2. nameof variableName;
  3. isFunction variableName;
  4. typeof variableName;

37. Which of the following choices will change the source of the image to “image2.gif” when a user clicks on the image?

Answers:

  1. img id=”imageID” src=”image1.gif” width=”50″ height=”60″ onmousedown=”changeimg(image1.gif)” onmouseup=”changeimg(image2.gif)”
  2. img id=”imageID” src=”image1.gif” width=”50″ height=”60″ onmouseclick=”changeimg(image2.gif)” onmouseup=”changeimg(image1.gif)”
  3. img id=”imageID” src=”image2.gif” width=”50″ height=”60″ onmousedown=”changeimg(image1.gif)” onmouseup=”changeimg(image2.gif)”
  4. img id=”imageID” src=”image2.gif” width=”50″ height=”60″ onmousedown=”changeimg(image2.gif)” onmouseup=”changeimg(image1.gif)”
  5. img id=”imageID” src=”image1.gif” width=”50″ height=”60″ onmousedown=”changeimg(‘image2.gif’)” onmouseup=”changeimg(‘image1.gif’)”

38. How can created cookies be deleted using JavaScript?

Answers:

  1. They can’t be deleted. They are valid until they expire.
  2. Overwrite with an expiry date in the past
  3. Use escape() on the value of the path attribute
  4. Use unescape() on the value of the path attribute
  5. The cookie file will have to be removed from the client machine.
  6. Wait till the expiry date is reached

39. What would be the value of ‘ind’ after execution of the following code?

var msg=”Welcome to ExpertRating”
var ind= msg.substr(3, 3)

Answers:

  1. lco
  2. com
  3. ome
  4. Welcome

40. Are the two statements below interchangeable?

object.property
object[”property”]

Answers:

  1. Yes
  2. No

41. Which of the following is not a valid method in generator-iterator objects in JavaScript?

Answers:

  1. send()
  2. throw()
  3. next()
  4. stop()

42. Which of the following code snippets will return all HTTP headers?

Answers:

  1. var req = new XMLHttpRequest(); req.open(‘GET’, document.location, false); req.send(null); var headers = req.getAllResponseHeaders().toLowerCase(); alert(headers);
  2. var req = new XMLHttpAccess(); req.open(‘GET’, document.location, false); req.send(null); var headers = req.getAllResponseHeaders().toLowerCase(); alert(headers);
  3. var req = new XMLHttpRequest(); req.open(‘GET’, document.location, false); req.send(null); var headers = req.getResponseHeader().toLowerCase(); alert(headers);
  4. var req = new XMLHttpRequestHeader(); req.open(‘GET’, document.location, false); req.send(null); var headers = req.retrieveAllResponseHeaders().toLowerCase(); alert(headers);

43. Consider the following JavaScript alert:

<script type=”text/JavaScript”>
function message() {
alert(“Welcome to ExpertRating!!!”)
}
</script>

Which of the following will run the function when a user opens the page?

Answers:

  1. body onload=”message()”
  2. body onunload=”message()”
  3. body onsubmit=”message()”
  4. body onreset=”message()”

44. Which of the following is the most secure and efficient way of declaring an array?

Answers:

  1. var a = []
  2. var a = new Array()
  3. var a = new Array(n)
  4. var a

45. Which of the following Regular Expression pattern flags is not valid?

Answers:

  1. gi
  2. p
  3. i
  4. g

46. Which of the following built-in functions is used to access form elements using their IDs?

Answers:

  1. getItem(id)
  2. getFormElement(id)
  3. getElementById(id)
  4. All of these

47. Which of the following statements is correct?

Answers:

  1. There is no undefined property in JavaScript.
  2. Undefined object properties can be checked using the following code: if (typeof something == null) alert(“something is undefined”);
  3. It is not possible to check for undefined object properties in JavaScript.
  4. Undefined object properties can be checked using the following code: if (typeof something === “undefined”) alert(“something is undefined”);

48. Which of the following correctly uses a timer with a function named rearrange()?

Answers:

  1. tmr=setTimeout(“rearrange ()”,1)
  2. tmr=Timer(1,”rearrange ()”)
  3. tmr=Timer(“rearrange ()”,1)
  4. tmr=setTimeout(1,”rearrange ()”)

49. Which of the following can be used to escape the ‘ character?

Answers:

  1. *
  2. \
  3. @
  4. #
  5. %
  6. |
  7. ~

50. Which event can be used to validate the value in a field as soon as the user moves out of the field by pressing the tab key?

Answers:

  1. onblur
  2. onfocus
  3. lostfocus
  4. gotfocus
  5. None of these

51. When setting cookies with JavaScript, what will happen to the cookies.txt data if the file exceeds the maximum size?

Answers:

  1. The script automatically generates a run-time error.
  2. The script automatically generates a load-time error.
  3. All processes using document.cookie are ignored.
  4. The file is truncated to the maximum length.

52. Which of the following are not global methods and properties in E4X?

Answers:

  1. ignoreComments
  2. ignoreWhiteSpace
  3. setName()
  4. setNamespace()
  5. ignoreComments and ignoreWhiteSpace
  6. setName() and setNamespace()

53. Which of the following will change the color of a paragraph’s text to blue when a user hovers over it, and reset it back to black when the user hovers out?

Answers:

  1. <p onmouseover=”style.color=’black'” onmouseout=”style.color=’blue'”> The text of the paragraph..</p>
  2. <p onmouseover=”style.color=’blue'” onmouseout=”style.color=’black'”> The text of the paragraph..</p>
  3. <p onmouseout=”style.color=’blue'”> The text of the paragraph..</p>
  4. <p onmouseover=”style.color=’blue'”> The text of the paragraph..</p>
  5. <p onmousein=”style.color=’blue'” onmouseout=”style.color=’black'”> The text of the paragraph..</p>

54. What is the purpose of while(1) in the following JSON response?

while(1);[[‘u’,[[‘smsSentFlag’,’false’],[‘hideInvitations’,’false’],[‘remindOnRespondedEventsOnly’,’true’],[‘hideInvitations_remindOnRespondedEventsOnly’,’false_true’],[‘Calendar ID stripped for privacy’,’false’],[‘smsVerifiedFlag’,’true’]]]]

Answers:

  1. It’s invalid JSON code.
  2. It makes it difficult for a third-party to insert the JSON response into an HTML document with a <script> tag.
  3. It iterates the JSON response.
  4. It prevents the JSON response from getting executed.

55. Consider the three variables:

someText = ‘JavaScript1.2’;
pattern = /(w+)(d).(d)/i;
outCome = pattern.exec(someText);

What does outCome[0] contain?

Answers:

  1. true
  2. false
  3. JavaScript1.2
  4. null
  5. 0

56. Which of the following choices will turn a string into a JavaScript function call (case with objects) of the following code snippet?

<script>
window.foo = {
bar: {
baz: function() {
alert(‘Hello!’);
}
}
};
</script>

Answers:

  1. bar[‘baz’]();
  2. object[‘foo’][‘bar’][‘baz’]();
  3. document[‘foo’][‘bar’][‘baz’]();
  4. window[‘foo’][‘bar’][‘baz’]();

57. Which of the following determines whether cookies are enabled in a browser or not?

Answers:

  1. (navigator.Cookie)? true : false
  2. (application.cookieEnabled)? true : false
  3. (navigator.cookieEnabled)? true : false
  4. (application.cookie)? true : false

58. Which of the following options can be used for adding direct support for XML to JavaScript?

Answers:

  1. E4X
  2. egex
  3. Generators and Iterators
  4. let

59. Which of the following will detect which DOM element has the focus?

Answers:

  1. document.activeElement
  2. document.ready
  3. document.referrer
  4. document.getelementbyid

60. Which of the following will randomly choose an element from an array named myStuff, given that the number of elements changes dynamically?

Answers:

  1. randomElement = myStuff[Math.floor(Math.random() * myStuff.length)];
  2. randomElement = myStuff[Math.ceil(Math.random() * myStuff.length)];
  3. randomElement = myStuff[Math.random(myStuff.length)];
  4. randomElement = Math.random(myStuff.length);

61. How can global variables be declared in JavaScript?

Answers:

  1. All variables are local in JavaScript.
  2. Declare the variable between the ‘script’ tags, and outside a function to make the variable global
  3. Precede the variable name with the constant global
  4. Declare the variable in an external file

62. Which of the following objects in JavaScript contains the collection called “plugins”?

Answers:

  1. Location
  2. Window
  3. Screen
  4. Navigator

63. What will be output of the following code?

function testGenerator() {
yield “first”;
document.write(“step1”);

yield “second”;
document.write(“step2”);

yield “third”;
document.write(“step3”);
}

var g = testGenerator();
document.write(g.next());
document.write(g.next());

Answers:

  1. firststep1second
  2. step1step2
  3. step1
  4. step1step2step3

64. Which of the following methods will copy data to the Clipboard?

Answers:

  1. execClipboard(‘Copy’)
  2. copyCommand(‘Clipboard’)
  3. execCommand(‘Copy’)
  4. execClipboard(‘Copy’)

65. Which of the following code snippets trims whitespace from the beginning and end of the given string str?

Answers:

  1. str.replace(/^s+|s+$/g, ”);
  2. str.replace(/^s+/,”);
  3. str.replace(/s+$/,”);
  4. str.replace(/s+/g,’ ‘);

66. What is the difference between call() and apply()?

Answers:

  1. The call() function accepts an argument list of a function, while the apply() function accepts a single array of arguments.
  2. The apply() function accepts an argument list of a function, while the call() function accepts a single array of arguments.
  3. The call() function accepts an object list of a function, while the apply() function accepts a single array of an object.
  4. The call() function accepts an object list of a function, while the apply() function accepts a single array of an object.

67. Which of the following code snippets is more efficient, and why?

<script language=”JavaScript”>
for(i=0;i<document.images.length;i++)
document.images[i].src=”blank.gif”;
</script>

<script language=”JavaScript”>
var theimages = document.images;
for(i=0;i<theimages.length;i++)
theimages[i].src=”blank.gif”
</script>

Answers:

  1. Both are equally efficient.
  2. The first code is more efficient as it contains less code.
  3. The first code is more efficient as it employs object caching.
  4. The second code is more efficient as it employs object caching.

68. What is the meaning of obfuscation in JavaScript?

Answers:

  1. Obfuscation is a keyword in JavaScript.
  2. Making code unreadable using advanced algorithms.
  3. Decrypting encrypted source code using advanced algorithms.
  4. None of these.

69. Which of the following JavaScript Regular Expression modifiers finds one or more occurrences of a specific character in a string?

Answers:

  1. ?
  2. *
  3. +
  4. #

70. Which of the following is not a valid JavaScript operator?

Answers:

  1. |
  2. ===
  3. %=
  4. ^

71. Which of the following code snippets returns “[object object]”?

Answers:

  1. <script> var o = new Object(); o.toSource(); </script>
  2. <script> var o = new Object(); o.valueOf(); </script>
  3. <script> var o = new Object(); o.toString(); </script>
  4. <script> var o = new Object(); o.getName(); </script>

72. Which of the following can be used to invoke an iframe from a parent page?

Answers:

  1. window.frames
  2. document.getElementById
  3. document.getelementsbyname
  4. document.getelementsbyclassname

73. Select the following function that shuffles an array?

Answers:

  1. function shuffle(array) { var tmp, current, top = array.length; if(top) while(–top) { current = Math.floor(Math.random() * (top + 1)); tmp = array[current]; array[current] = array[top]; array[top] = tmp; } return array; }
  2. function shuffle(array) { return array.sort(function(a,b) { return (a-b); }); }
  3. function shuffle(array) { var results = new Array(); var sorted_arr = array.sort(); for (var i = 0; i < array.length – 1; i++) { if (sorted_arr[i + 1] == sorted_arr[i]) { results.push(sorted_arr[i]); } } return results; }
  4. function shuffle(array) { for (var tmp, cur, top=array.length; top–;){ cur = (Math.random() * (top + 1)) << 0; tmp = array[cur]; array[cur] = array[top]; array[top] = tmp; } return array.sort(); }

74. Which of the following code snippets removes objects from an associative array?

Answers:

  1. delete array[“propertyName”];
  2. array.propertyName.remove();
  3. array.splice(index, 1);
  4. array[“propertyName”].remove();

75. What is the error in the statement: var charConvert = toCharCode(‘x’);?

Answers:

  1. toCharCode() is a non-existent method.
  2. Nothing. The code will work fine.
  3. toCharCode only accepts numbers.
  4. toCharCode takes no arguments.

76. What value would JavaScript assign to an uninitialized variable?

Answers:

  1. NaN
  2. null
  3. undefined
  4. false

77. What does the following JavaScript code do?

contains(a, obj) {
for (var i = 0; i < a.length; i++) {
if (a[i] === obj) {
return true;
}
}
return false;
}

Answers:

  1. It calculates an array’s length.
  2. It compares ‘a’ and ‘obj’ in an array.
  3. The code will cause an error.
  4. It checks if an array contains ‘obj’.

78. If an image is placed styled with z-index=-1 and a text paragraph is overlapped with it, which one will be displayed on top?

Answers:

  1. The paragraph.
  2. The image.
  3. It depends on other rules.

79. Which of the following code snippets gets an image’s dimensions (height & width) correctly?

Answers:

  1. var img = document.getElementById(‘imageid’); var width = img.clientWidth; var height = img.clientHeight;
  2. var img = document.getElementById(‘imageid’); var width = img.width; var height = img.height;
  3. var img = document.getElementById(‘imageid’); var width = img.getAttribute(‘width’); var height = img.getAttribute(‘height’);
  4. var img=document.getElementById(“imageid”); var width=img.offsetWidth; var height=img.offsetHeight;

80. Which of the following are correct values of variableC, and why?

<script>
variableA = [6,8];
variableB =[7,9];
variableC = variableA + variableB;
</script>

Answers:

  1. 6, 7, 8 and 9. The + operator is defined for arrays, and it concatenates strings, so it converts the arrays to strings.
  2. 6, 15 and 9. The + operator is defined for arrays, and it concatenates numbers, so it converts the arrays to numbers.
  3. 6, 8, 7 and 9. The + operator is defined for arrays, and it concatenates strings, so it converts the arrays to strings.
  4. 6, 87 and 9. The + operator is not defined for arrays, and it concatenates strings, so it converts the arrays to strings.

81. The following are the samples for getting a selected value in the from a dropdown list:

<select id=”ddlViewBy”>
<option value=”1″>test1</option>
<option value=”2″ selected=”selected”>test2</option>
<option value=”3″>test3</option>
</select>

Which code block is correct?

Answers:

  1. var e = document.getElementById(“ddlViewBy”); var strUser = e.options[e.selectedIndex].text;
  2. var e = document.getElementById(“ddlViewBy”); var strUser = e.options[e.selectedIndex].value;
  3. var e = document.getElementByName(“ddlViewBy”); var strUser = e.options[e.selectedIndex].text;
  4. var e = document.getElementByName(“ddlViewBy”); var strUser = e.options[e.selectedIndex].value;

82. var profits=2489.8237

Which of the following code(s) produces the following output?

output : 2489.824

Answers:

  1. profits.toFixed(4)
  2. profits.toFixed(3)
  3. profits.formatDollar(3)
  4. profits.nuberFormat(3)

83. A form contains two fields named id1 and id2. How can you copy the value of the id2 field to id1?

Answers:

  1. document.forms[0].id1.value=document.forms[0].id2.value
  2. document.forms[0].id2.value=document.forms[0].id1.value
  3. document.id1.value=document.id2.value
  4. document.id2.value=document.id1.value

84. Which of the following code snippets will toggle a div element’s background color?

<button id=”toggle”>Toggle</button>
<div id=”terd”>Change Background Color.</div>

Answers:

  1. <script> var button = document.getElementById(‘toggle’); button.click = function() { terd.style.backgroundColor = terd.style.backgroundColor == ‘blue’ ? ‘red’ : ‘blue’; }; </script>
  2. <script> var button = document.getElementById(‘toggle’); button.ready = function() { terd.style.backgroundColor = terd.style.backgroundColor == ‘blue’ ? ‘red’ : ‘blue’; }; </script>
  3. <script> var button = document.getElementById(‘toggle’); button.focus = function() { terd.style.backgroundColor = terd.style.backgroundColor == ‘blue’ ? ‘red’ : ‘blue’; }; </script>
  4. <script> var button = document.getElementById(‘toggle’); button.onclick = function() { terd.style.backgroundColor = terd.style.backgroundColor == ‘blue’ ? ‘red’ : ‘blue’; }; </script>

85. How can the user’s previously navigated page be determined using JavaScript?

Answers:

  1. It is not possible in JavaScript. This can be done only through server-side scripting.
  2. Using the document.referrer property
  3. Using the window object
  4. None of these

86. Which of the following is not a valid method for looping an array?

Answers:

  1. var a= [1,2]; for (var i = 0; i < a.length; i++) { alert(a[i]); }
  2. var a= [1,2]; a.forEach( function(item) { alert(item); })
  3. var a= [1,2]; a.map( function(item) { alert(item); })
  4. var a= [1,2]; a.loop( function(item) { alert(item); })

87. Which of the following correctly sets a class for an element?

Answers:

  1. document.getElementById(elementId).className = “Someclass”;
  2. document.getElementById(elementId).setAttribute(“className”, “Someclass”);
  3. document.getElementById(elementId).class = “Someclass”;
  4. document.getElementById(elementId).style = “Someclass”;

88. An HTML form contains 10 checkboxes all named “chkItems”. Which JavaScript function can be used for checking all the checkboxes together?

Answers:

  1. function CheckAll() { for (z = 0; z < document.forms.chkItems.length; z++) { document.forms.chkItems[z].checked=true } }
  2. function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems[z].checked=true } }
  3. function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems.list[z].checked=true } }
  4. function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems.list[z].checked=false } }

89.Which of the following is not a valid Date Object method in JavaScript?

Answers:

  1. parse()
  2. setDay()
  3. setTime()
  4. valueOf()

90.Which event can detect when the user highlights text within a text or textarea object?

Answers:

  1. onSelect()
  2. onBlur
  3. onChange()
  4. onMove
  5. None of these

91.Consider the following code snippet:
var myJSONObject =
{«ircEvent»: «PRIVMSG», «method»: «newURI», «regex»: «^http://.*»};

What is the best way to remove the property ‘regex’, so the result would be this code snippet?

myJSONObject ==
{«ircEvent»: «PRIVMSG», «method»: «newURI»};

Answers:

  1. myJSONObject.regex.delete;
  2. myJSONObject.regex.remove;
  3. delete myJSONObject.regex;
  4. remove myJSONObject.regex;

92.Which of the following is the best way to show both single and double quotes in the same sentence

Answers:

  1. alert(«It’s «+’»game»‘+» time.»);
  2. alert(‘It\’s \»game\» time.’);
  3. alert(‘It\’\s «game» time.’);
  4. alert(‘It\’s «game» time.’);

93.Which of the following statements is true regarding importing JavaScript files inside of other JavaScript files?

Answers:

  1. There is no import/include/require keyword in JavaScript, but there ways to import JS files inside of other JS files.
  2. There is an import keyword in JavaScript, which allows importing JS files inside of other JS files.
  3. There is no option to do so in JavaScript.

94. Which of the following shortcuts can be used for writing multiple document.write statements?

Answers:

  1. for(document){}
  2. with(document) {}
  3. withThis(document){}
  4. None of these

95.In JavaScript, the encodeURI() function is used to encode special characters. Which of the following special characters is/are an exception to that rule?
A. £
B. €
C. @
D. $
Answers:

  1. A
  2. B
  3. C
  4. D
  5. A and B
  6. C and D

96.Consider the following code:

<form>
<textarea id=»foo» name=»foo»></textarea>
</form>

Which of the following is the best method to get the line number of the form’s text area?
Answer:

  1. A<script> foo.value.split(/\r\n\|\r\|\n/g); </script>
  2. <script> foo.value.split(/\r\/n\|\r\|\n/g); </script>
  3. <script> foo.value.split(/\rn\|\r\|\n/g); </script>
  4. <script> foo.value.split(/\r\n|\r|\n/g); </script>

97.Consider the following code:
var setter=new Object()
setter.color=»blue»
How would you delete the color property of the variable seter?

Answer:

  1. setter.color delete;
  2. delete setter.color
  3. delete(setter.color)
  4. setter.color.delete

98. Is the following statement regarding expression closures in JavaScript true or false?
The syntax function(x) {return x*x;} can be written as function(x) x*x.

Answer:

  1. Yes
  2. No

99.Which of the following statements regarding this String prototype is correct?
String.prototype.doSomething = function(suffix) {
return this.indexOf(suffix, this.length — suffix.length) !== -1;
};
Answer:

  1. This method determines whether or not a string ends with another string.
  2. This method determines whether or not a string begins with another string.
  3. This method returns the position of the last occurrence of a specified value in a string.
  4. This method returns the position of the first occurrence of a specified value in a string.

100.What will be the result of the following code?
document.getElementById(“banana”).className = document.getElementById(“banana”).className.replace(/(?:^|\s)apple(?!\S)/g ,’e’ );
Answer:

  1. Replace class ‘apple’ with ‘g’ in the HTML element which contains ID ‘banana’
  2. Replace current class with ‘apple’ in the HTML element which contains ID ‘banana’
  3. Replace class ‘apple’ with ‘e’ in the HTML element which contains ID ‘banana’
  4. Replace ID ‘apple’ with ‘banana’ in the HTML element which contains ID ‘banana’ and class ‘g’

101.Which of the following will determine if the user’s browser is named “Netscape”?

Answer:

  1. if(appName==”Netscape”){}
  2. if(document.appName==”Netscape”){}
  3. if(navigator==”Netscape”){}
  4. if(browser==”Netscape”){}
  5. None of these

102. Given a p element with some text content, which of the following code snippets sets the background color of the text to yellow, its color to red, and its font size to 20px?

Answer:

  1. var p = document.getElementById(elementId);
    p.setAttribute(«style», «background-color:yellow;color:red;font-size:20px;»);
  2. var p = document.getElementById(elementId);
    p.style.background = ‘yellow’;
    p.style.color= ‘red’;
    p.style.size= ’20px’;
  3. var p = document.getElementById(elementId);
    p.style.background = ‘yellow’;
    p.style.color= ‘red’;
    p.style.font.size= ’20px’;
  4. var p = document.getElementById(elementId);
    p.setAttribute(«style», «background-color:red;color:yellow;font-size:20;»);

103.Which of the following are not valid HTML events?

Answer:

  1. onmouseover
  2. onmouseout
  3. onmouseabove
  4. onmousedown
  5. onmousein

104.Which of the following options is used to access the attributes in E4X?

Answer:

  1. @
  2. ::
  3. #
  4. *

105.Which of the following can be used to write a JavaScript function that will accept user input?

Answer:

  1. The prompt method
  2. The alert method
  3. A form field
  4. All of these

106.Which of the following prints «AbBc»?

Answer:

  1. var b = ‘a’; var result = b.toUpperCase() + ‘b’ + ‘b’.toUpperCase() +’C'[‘toLowerCase’](); alert(result);
  2. var b = ‘a’; var result = b.toUpperCase() + ‘b’ + ‘b’.toUpperCase() +’C'[‘toLowerCase’](); alert(result);
  3. var b = ‘a’; var result = b.toUpperCase() + b + ‘b’.toUpperCase() +’C'[‘toLowerCase’](); alert(result);
  4. var b = ‘a’; var result = b.toUpperCase() + ‘b’ + ‘b’.toUpperCase() +C; alert(result);

107.Which of these options is the most maintainable way to attach JavaScript functionality to an HTML element?

Answer:

  1. <p onclick=»alert(‘You clicked me!’)»> some text </p>
  2. <script> function fun(){alert(‘You clicked me!’)} </script>
    <a onclick=fun()>…</a>
  3. <script>
    function fun(){ alert(‘You clicked me!’); };
    var el = document.getElementById(«click-target»);
    el.onClick = fun;
    </script>
    <a id=»click-target»>…</a>
  4. <a href=»javascript:alert(‘You clicked me!’)»>…</a>

108.Which of these options is the most maintainable way to attach JavaScript functionality to an HTML element?
<html>
<body>
<script type=»text/javascript»>
function validate() {
var chk=»ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz»;
var ok=»yes»;
var temp;
var field1=document.getElementById(«t1»);
var field=field1.value.substring(field1.value.length-1,field1.value.length);
if(chk.indexOf(field)==»-1″) {
alert(«error»);
field1.value=(field1.value).slice(0,field1.value.length-1);
}
}
</script>
<input type=»text» id=»t1″ onkeyup=»validate()» onkeypress =»validate()»/>
</body>
</html>
Answer:

  1. The code will cause an error alert to be displayed if a numeric character is entered, and the numeric character is removed.
  2. The code will cause an error alert to be displayed if a non-numeric character is entered, and the non-numeric character is removed.
  3. The code will cause an error alert to be displayed if a numeric character is entered, and the value of textbox is reset.
  4. The code will cause an error alert to be displayed if a non-numeric character is entered, and the value of textbox is reset.

109. What would be the default setting for the expires attribute of the document.cookie property?

Answers:

  1. The duration of the browser session
  2. The duration the current document stays loaded
  3. Twenty-four hours from the time the cookie is set
  4. There is no default setting
  5. The duration for which the machine is on

110.Which of the following choices will remove a selection option from the code below?
<button id”newbtn” onclick=”g();”>Remove</button>
<select name=”selectBox” id=”selectBox”>
<option value=”option1″>option1</option>
<option value=”option2″>option2</option>
<option value=”option3″>option3</option>
<option value=”option4″>option4</option>
</select>
Answers:

  1. <script>
    function g(){
    var index = 1;
    var d = document.getElementById(“selectBox”);
    var d_nested = d.childNodes[index];
    var throwawayNode = d.deleteChild(d_nested);
    }
    </script>
  2. ><script>
    function g(){
    var index = 1;
    var d = document.getElementById(“selectBox”);
    var d_nested = d.childNodes[index];
    var throwawayNode = d.clearChild(d_nested);
    }
    </script>
  3. <script>
    function g(){
    var index = 1;
    var d = document.getElementById(“selectBox”);
    var d_nested = d.childNodes[index];
    var throwawayNode = d.emptyChild(d_nested);
    }
    </script>
  4. <script>
    function g(){
    var index = 1;
    var d = document.getElementById(“selectBox”);
    var d_nested = d.childNodes[index];
    var throwawayNode = d.removeChild(d_nested);
    }
    </script>

111.Which of the following is incorrect regarding Strict mode in JavaScript?

Answer:

  1. It catches some common coding errors, throwing exceptions.
  2. It enables features that are confusing or poorly thought out.
  3. It prevents, or throws errors, when relatively «unsafe» actions are taken (such as gaining access to the global object).

112. Which of the following is incorrect regarding Strict mode in JavaScript?
var a = ‘A’.charCodeAt(0) + 5;
var b = ‘c’.charCodeAt(0) + 1;
var c = 0;
for (var i = 0; i < 10; i++) {
c = c + (a+b % 2);
}
alert(c);

Answer:

  1. 700
  2. 60
  3. 0
  4. 760

113. Which of the following is/are true regarding JavaScript and multi-threading/concurrency?

Answer:

  1. JavaScript is single-threaded, forcing asynchronous events to a queue to wait for execution.
  2. JavaScript is multi-threaded, and behaves in a synchronous manner.
  3. JavaScript can be single or multi-threaded, depending on the browser’s capabilities.
  4. None of these.

114. Which of the following will change the color of the text box to green, as long as the user is pressing a key?

Answer:

  1. input type=»text» onkeydown=»color(‘white’)» onkeyup=»color(‘green’)» name=»txtName»
  2. input type=»text» onkeydown=»color(‘green’)» onkeyup=»color(‘white’)» name=»txtName»
  3. input type=»text» onkeydown=»color(‘green’)» name=»txtName»
  4. input type=»text» onkeydown=»color(‘white’)» name=»txtName»
  5. input type=»text» onkeypress=»color(‘green’)» onkeyup=»color(‘white’)» name=»txtName»

115. In an HTML page, the form tag is defined as follows:
<form onsubmit=»return Validate()»

action=»http://www.mysite.com/»>
The validate() function is intended to prevent the form from being submitted if the name field in the form is empty. What should the validate() function look like?

Answer:

  1. <script type=»text/javascript»> function Validate() { if(document.forms[0].name.value == «») return true; else return false; } </script>
  2. <script type=»text/javascript»> function Validate() { if(document.forms[0].name.value == «») return false; else return true; } </script>
  3. script type=»text/javascript»> function Validate() { if(document.forms[0].name== «») return false; else return true; } </script>
  4.  <script type=»text/javascript»> function Validate() { if(document.forms[0].name == «») return true; else return false; } </script>

116. Which of the following statements are true regarding the code below?
<script>
alert(«foo» === new String(«foo»)); // output false
</script>

Answer:

  1. The «===» operator always returns false.
  2. The «===» operator returns true only if they refer to the same object (comparing by reference) and if both the primitive and the object have the same value.
  3. The «===» operator returns true only if the object (comparing by reference) and the primitive have the same value.
  4. The «===» operator does not work for objects.

117.Which of the following statements are true regarding the «this» keyword in JavaScript?

Answer:

  1. The value of «this» can be set by assignment during execution, and it will be the same each time the function is called.
  2. Inside a function, the value of «this» depends on how many times the function is called.
  3. Inside a function, the value of «this» depends on how the function is called (as a simple call, an object method, a constructor, etc.).
  4. In strict mode, the value of «this» may change from whatever it is set to, when entering the execution context.

118.Which of the following is not a correct way to empty the array a?

Answer:

  1. a = new Array();
  2. a = [];
  3. a.splice(0,a.length);
  4. a.clear()

119.Which of the following is the correct way to resize an iframe based on content?

Answer:

  1. function resizeIframe(height)
    {document.getElementById(‘frame_name_here’).height = parseInt(height)+60;}
    <iframe id=’frame_name_here’ src=’src.htm’></iframe>
  2. function resizeIframe(height)
    {document.getElementByName(‘frame_name_here’).height = parseInt(height)+60;}
    <iframe id=’frame_name_here’ src=’src.htm’></iframe>
  3. function resizeIframe(height)
    {document.getElementByDivId(‘frame_name_here’).height = parseInt(height)+60;}
    <iframe id=’frame_name_here’ src=’src.htm’></iframe>
  4. None of these

120.Which of the following is not a valid JavaScript function?

Answers:

  1. apply()
  2. call()
  3. toString()
  4. All the other options are valid.

121.What does the following code snippet do?

<input type=»radio»name=»r1″value=»radio1″onclick=»this.checked=false;alert(‘sorry’)»>

Answers:

  1. The code is invalid.
  2. The code makes it necessary for the user to select the radio button.
  3. The code disables the radio button.
  4. The code displays an alert when the user selects the button.

122.How can properties be added to an object class?

Answers:

  1. With the prototype() method
  2. With the prototype property
  3. It cannot be done.
  4. With the «this» object

123.Which of the following will correctly check if an object is an array?
Note: There may be more than one right answer.

Answers:

  1. Object.prototype.toString.call(arr) === ‘[object Array]’
  2. Object.isArray(arr)
  3. None of these
  4. With the «this» object

124.Which of the following check if an object has a specific property?

Answers:

  1. hasOwnProperty()
  2. hasProperty()
  3. It is browser-dependent
  4. None of these

125. Given the following window.open function:
window.open(url,name,»attributes»)
How can it be ensured that different URLs are opened in the same window?

Answers:

  1. The second attribute, name, should be the same.
  2. The name attribute should be null.
  3. The name attribute should be omitted.
  4. The name attribute should be different.
  5. None of these.

126.Which of the following code snippets renders a button invisible?

Answers:

  1. var button = document.getElementById(‘buttonId’);
    button.style.display=’none’
  2. var button = document.getElementById(‘buttonId’);
    button.style.display=’block’
  3. var button = document.getElementById(‘btn’);
    button.style.visibility=’false’;
  4. var button = document.getElementById(‘btn’);
    button.style.visibility=’disabled’;
  5. None of these.

127. Why does (0 < 5 < 3) return true?

Answers:

  1. Order of operations produces (true < 3), which returns true.
  2. Order of precedence produces (true < 3), which returns true.
  3. Order of operations produces (false < 3), which returns true.
  4. None of these.

128. What is the cleanest, most effective way to validate decimal numbers in JavaScript?

Answers:

  1. IsNumeric()
  2. isNaN()
  3. valid()
  4. isDecimal()

129. Which of the following is the best reason for not using «for…in» with array iteration?

Answers:

  1. for..in should be used to iterate over an array where index order is important.
  2. for..in should not be used to iterate over an array where index order is important.
  3. for…in loops iterate over non–enumerable properties.
  4. for…in loops do not iterate over enumerable properties.

130. Which of the following is the best reason for not using «for…in» with array iteration?

Answers:

  1. It forces the parser to treat the + sign as a part of an expression.
  2. The + sign is used as a cast operator.
  3. It is used to denote a type of object in JavaScript.
  4. None of these.

131.Which of the following will implement a singleton pattern in JavaScript?

Answers:

  1. <script>
    var anObject = {
    method1: function () {
    // …<
    },
    method2: function () {
    // …
    }
    };
    ></script>
  2. <script>
    function method1(){
    // …
    }
    function method2(){
    // …
    }
    </script>
  3. <script>
    var method1 = function(){
    // …
    }
    var method2 = function(){
    // …
    }
    </script>
  4. <script>
    var method1;
    var method2;
    </script>

132. Which of the following code snippets will correctly detect a touchscreen device?

Answers:

  1. function isTouchDevice() {
    return !!(‘ontouchstart’ in window) || !!(‘onmsgesturechange’ in window);
    };
  2. function isTouchDevice() {
    try {
    document.body.createEvent(«TouchEvent»);
    return true;
    } catch (e) {
    return false;
    }
    }
  3. function isTouchDevice(){
    return (typeof(navigator.ontouchstart) != ‘undefined’) ? true : false;
    }
  4. function isTouchDevice(){
    return (navigator.msMaxTouchPoints == 0);
    }

133. Which of the following shows examples of valid auto increment/decrement loops?

Answers:

  1. for(var i=0; i < 100; i++){} for(var i=0; i > -100; i—){}
  2. for(var i=0; i < 100; i+){} for(var i=0; i > -100; i-){}
  3. for(var i=0; i > 100; i++){}
    for(var i=0; i < -100; i—){}
  4. for(var i=0; i > 100; i+){}
    for(var i=0; i < -100; i-){}

134. Analyze the following code snippet. What will be the output of this code?
<html>
<body>
<script type=»text/javascript»>
var str = «The drain of the plane is plain»;
var patt1 =/ain/g;
document.write(str.match(patt1));
</script>
</body>
</html>
Answers:

  1. a
  2. ain
  3. 7,29
  4. 7
  5. ain,ain

135.The following are sample codes on how to merge properties of two JavaScript objects dynamically:
var obj1 = { food: ‘pizza’, car: ‘ford’ }
var obj2 = { animal: ‘dog’ }
Which of the following are JavaScript codes?

Answer:

  1. obj1.merge(obj2);
  2. function MergeRecursive(obj1,obj2){
    var obj3 = {};
    for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; }
    for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; }
    return obj3;
    }
  3. function MergeRecursive(obj1, obj2) {
    for (var p in obj2) {
    try {
    // Property in destination object set; update its value.
    if ( obj2[p].constructor==Object ) {
    obj1[p] = MergeRecursive(obj1[p], obj2[p]);
    } else {
    obj1[p] = obj2[p];
    }
    } catch(e) {
    // Property in destination object not set; create it and set its value.
    obj1[p] = obj2[p];}
    }
    return obj1;
    }
  4. Object.extend = function(destination,source) {
    for (var property in source)
    destination[property] = source[property];
    return destination;
    }
    obj1.extend(obj2)

136.You need to be able to determine which page of the web site has been the most recently modified. Which object would enable you to do this?

Answers:

  1. document
  2. window
  3. history
  4. browser
  5. form
  6. location

137.Which of the following are the valid JavaScript codes to obtain the number of milliseconds since the epoch?
Note: There may be more than one right answer.

Answers:

  1. var timestamp = new Date().getTime();
  2. var timestamp = Number(new Date());
  3. var timestamp = Date.now;
  4. var timestamp = new Date().valueOf();

138.Which of the following ‘if’ statements is correctly used to get the size of both ‘variable1’ and ‘variable2’ objects?
var variable1 = {‘name’:’theName’, ‘address’:’theAddress’,’age’: ’18’}
var variable2 = [‘theName’,’theAddress’,’18’];

variable1[«name»] = «theName2»;
variable1[«name»] = «theName3»;
variable1[«name2»] = «theName4»;
variable1[«name2»] = «theName5»;

Object.size = function(importer) {
var exporter = 0, key;
for (key in importer) {
if (importer.hasOwnProperty(key)) exporter++;
}
return exporter;
};

Answers:

  1. if(typeof(variable1)==’object’ && typeof(variable2)==’array’){
    Object.size(variable1);
    variable2.length;
    }
  2. if(typeof(variable1)==’array’ && typeof(variable2)==’object’){
    Object.size(variable1);
    variable2.length;
    }
  3. if(typeof(variable1) > typeof(variable2)){
    Object.size(variable1);
    variable2.length;
    }
  4. if(typeof(variable1) == typeof(variable2)){
    Object.size(variable1);
    variable2.length;
    }

139.Consider the following JavaScript arrays:
var a = [1, 2];
var b = [3, 4, 5];
Which of the following will append the contents of array «b» to array «a»?

Answers:

  1. a.push(b);
  2. a.splice(0,0,b);
  3. a = b.concat(a);
  4. a.join(b);

140.How can it be determined if JavaScript is disabled in the user’s browser?

Answers:

  1. It is browser-dependent.
  2. There is no way to detect if JavaScript is disabled.
  3. Use the HTML<noscript> tag to display different content if JavaScript is disabled.
  4. None of these.

141.Which of the following choices shows the correct result for the code below? var arr = []; arr[0] = «Jani»; arr[1] = «Hege»; arr[2] = «Stale»; arr[3] = «Kai Jim»; arr[4] = «Borge»; console.log(arr.join()); arr.splice(2, 0, «Lene»); console.log(arr.join());

Answers:

  1. Jani,Hege,Stale,Kai Jim,Borge
    Lene,Jani,Hege,Stale,Kai Jim,Borge
  2. Jani,Hege,Stale,Kai Jim,Borge
    Jani,Hege,Lene,Stale,Kai Jim,Borge
  3. Jani,Hege,Stale,Kai Jim,Borge
    Jani,Hege,Stale,Kai Jim,Lene,Borge
  4. Jani,Hege,Stale,Kai Jim,Borge
    Jani,Hege,Stale,Kai Jim,Borge

142. Consider the following scenario:
The document.write() method is embedded to write some text within a pair of 

table tags. Upon loading the file, however, garbled text appears on the section of the page where the text should be. What could be the reason for this?

Answers:

  1. The browser does not support JavaScript.
  2. An older version of the browser is being used.
  3. The browser does not support cookies.

143. What is the output of the following code?
var a = 5;
var b = 1;
if(!!»false») {
a = a + 5;
b = 3;
};
if(!!0) {
a = a + 5;
b = b + 2;
};
alert(a+b);

Answers:

  1. 20
  2. 6
  3. None of these

144.Consider the following code:
var vNew=new Date()
Which of the following options will return true?

Answers:

  1. vNew instanceof boolean
  2. vNew instanceof boolean
  3. vNew instanceof Date
  4. All of these

145.Which of the following will detect if the browser supports a certain CSS property?

Answers:

  1. typeof document.body.style.borderRadius == ‘string’
  2. typeof document.body.style.borderRadius == ‘undefined’
  3. typeof document.body.style.borderRadius == true
  4. It is impossible.

146.Which of the following is not a valid code for redirect to stackoverflow.com?
Note: There may be more than one right answer.

Answers:

  1. window.location.href = «http://stackoverflow.com»;
  2. window.location.href («http://stackoverflow.com»);
  3. window.location.replace=»http://stackoverflow.com»;
  4. window.location.replace(«http://stackoverflow.com»);

147.The following statements show two ways of calling a JavaScript function:
i)onclick = «a();»
ii)onclick=»JavaScript:a();»
Which of the following options is correct, with regard to the two statements above?

Answers:

  1. There is no difference between the two statements
  2. The first statement is incorrect and the second one is correct.
  3. The first statement is correct and the second statement is incorrect.

148.Which of the following code snippets will trigger an input type=»file» attribute when an element with a «newbtn» ID is clicked?

Answers:
<button id»newbtn» onclick=»grt();»>Upload</button>
<form>
<input id=»thisId» type=»file» name=»upload» />
</form>
</form>

  1. function grt(){document.getElementById(‘thisId’).keypress();}
  2. function grt(){document.getElementById(‘thisId’).load();}
  3. function grt(){document.getElementById(‘thisId’).dblclick();}
  4. function grt(){document.getElementById(‘thisId’).click();}

149.Which of the following JavaScript code snippets is the more efficient and why?
Code Snippet 1
<script language=»javascript»>
for(i=0;i<document.images.length;i++)
document.images[i].src=»blank.gif»;
</script>
Code Snippet 2
<script language=»javascript»>
var theimages = document.images;
for(i=0;i<theimages.length;i++)
theimages[i].src=»blank.gif»;
</script>

Answers:

  1. Both codes are equally efficient.
  2. The first code is more efficient because it contains less code.
  3. The first code is more efficient because it employs object caching.
  4. The second code is more efficient because it employs object caching.

150.Which of the following cope samples will correctly search for the word «for» in a string?
Note: There may be more than one right answer.

Answers:

  1. var str=»This is test for javascript search !!!»;
    if(str.search(«for») != -1) {
    alert(«true»);
    }
    else {
    alert(«false»);
    }
  2. var str=»This is test for javascript search !!!»;
    if(str.indexof(«for») != -1) {
    alert(«true»);
    }
    else {
    alert(«false»);
    }
  3. var str=»This is test for javascript search !!!»;
    if(str.indexOf(«for») != -1) {
    alert(«true»);
    }
    else {
    alert(«false»);
    }
  4. var str=»This is test for javascript search !!!»;
    if(str.contains(«for») != -1) {
    alert(«true»);
    }
    else {
    alert(«false»);
    }

151.Given two frames Frame1 and Frame2, where Frame2 has a div element with id «some», how can the div element’s color be changed in Frame2, using JavaScript code in Frame1?

Answers:

  1. var div = top.Frame2.document.getElementById(‘some’);
    div.style.color= «orange»;
  2. var div = document.getElementById(‘some’);
    div.style.color= «orange»;
  3. var div = top.Frame1.document.getElementById(‘some’);
    div.style.color= «orange»;
  4. None of these.

152.Which of the following JavaScript Regular Expression character classes finds any non-digit character in a given string?

Answers:

  1. \W
  2. \S
  3. \B
  4. \D

153. Which best describes void?

Answers:

  1. A method
  2. A function
  3. A statement
  4. An operator
  5. A built-in object

154.Which of the following is used to solve the problem of enumerations in JavaScript?

Answers:

  1. let
  2. Regex
  3. Generators
  4. E4X

155.Which of the following cannot be achieved using JavaScript?
Note: There may be more than one right answer.

Answers:

  1. Read or write from external files (except .js files)
  2. Access or modify browser settings
  3. Launch client processes (eg windows applications)
  4. Launching the default email application of the client

156.The following are sample codes on how to loop through JavaScript object literals with objects as members:
var validation_messages = {
«key_1»: {
«your_name»: «jimmy»,
«your_msg»: «hello world»
},
«key_2»: {
«your_name»: «billy»,
«your_msg»: «foo equals bar»
}
}
Which of the following are invalid native JavaScript codes?
Note: There may be more than one right answer.

Answers:

  1. for (var key in validation_messages) {
    var obj = validation_messages[key];
    for (var prop in obj) {
    alert(prop + » = » + obj[prop]);
    }
    }
  2. Object.keys(validation_messages).forEach(function(key) {
    var obj = validation_messages[key];
    Object.keys(obj).forEach(function(key) {
    alert (prop + “ = “ + obj[key]);
    )};
  3. (validation_messages.hasOwnProperty(key)) {
    var obj = validation_messages[key];
    for (var prop in obj) {
    if (obj.hasOwnProperty(prop)) {
    alert(prop + “ = “ + obj[prop]);
    }
    }
    }
    }
  4. _.each(validation_messages, function(value, key){
    _.each(value, function(value, key){
    alert(prop + » = » + value);
    });
    });

157.Analyze the following code snippet. What will be the output of this code?
html>
<body>
<script type=»text/javascript»>
var str = «Visit Gardens(now)»;
var patt1 = new RegExp(«(now)», «g»);
patt1.test(str);
document.write(RegExp.lastParen);
</script>
</body>
</html>
Answers:

  1. now
  2. (now)
  3. 15
  4. 19

158.Consider the following code:
var variable=2*2+10000/10-133%5;
Which of the following combinations have the lowest operator precedence in «variable»?

Answers:

  1. «*» and «+»
  2. «/» and «%»
  3. «/» and «+»
  4. «*» and «%»

159.While coding a loop, you come across a condition where you have to terminate the loop and continue with the statements following the loop. Which statement would you use?

Answers:

  1. exit
  2. return
  3. continue
  4. while
  5. break

160. What is the best way to make optional parameters of functions?

Answers:

  1. function someFunction(requiredArg, optionalArg) {
    optionalArg = optionalArg || ‘defaultValue’;
    alert(optionalArg);
    }
  2. function someFunction(requiredArg, optionalArg) {
    optionalArg = (typeof optionalArg === «undefined») ? «defaultValue» : optionalArg;
    alert(optionalArg);
    }
  3. function someFunction(requiredArg, optionalArg) {
    optionalArg = (optionalArg === «undefined») ? «defaultValue» : optionalArg;
    alert(optionalArg);
  4. All of these

161. Which of the following are correct closure functions?

Answers:

  1. function foo(x) {
    var tmp = 3;
    return function (y) {
    alert(x + y + (++tmp));
    }
    }
    var bar = foo(2); // bar is now a closure.
    bar(10);
  2. function foo(x) {
    var tmp = 3;
    function bar(y) {
    alert(x + y + (++tmp));
    }
    bar(10);
    }
    foo(2)
  3. function foo(x) {
    var tmp = 3;
    function bar(y) {
    function bar1(tmp) {
    alert(x + y + (++tmp));
    }
    }
    bar(10);
    }
    foo(2)
  4. function foo(x) {
    var tmp = 3;
    return function (y) {
    alert(x + y + tmp);
    x.memb = x.memb ? x.memb + 1 : 1;
    alert(x.memb);
    }
    }
    var age = new Number(2);
    var bar = foo(age); // bar is now a closure referencing age.
    bar(10);

162.Which of the following will correctly detect browser language preference?

Answers:

        1. var language = window.navigator.userLanguage || window.navigator.language;
          alert(language);
        2. var language = navigator.browserLanguage || window.navigator.language;
          alert(language);
        3. var language =navigator.userLanguage;
          alert(language);
        4. var language = window.navigator.language;
          alert(language);

163.What is the output of the following code?
var container = {
someKey: 3,
someOtherKey: “someObject”,
anotherKey: “Some text”
};
if (“someOtherKey” in container) {
alert (true);
}
delete container [“someOtherKey”];
if (container[“someOtherKey”] === null) {
alert (false);
}
if (container[“someOtherKey”] === undefined) {
alert (true);
}
if (container.someOtherKey === undefined) {
alert (false);
}
if (container.someOtherKey === undefined) {
alert (true);
}
delete container[“someKey”];
if (container.someKey === 3) {
alert (true);
}
Answers:

        1. true
          true
          false
        2. true
          true
          true
        3. true
          false
          true
          false
          true
          true
        4. true
          true
          false
          true

164. Which of the following is a good reason why JavaScript variables would start with a dollar sign ($)?

Answers:

        1. $ is a prefix used to create a instance of a object.
        2. $ is a keyword in JavaScript.
        3. $ is used to quickly identify and parse variables
        4. None of these

165.Which of the following code is correct for validating date values?
Note: There may be more than one right answer.

Answers:

        1. var d = Date.parse(‘foo’);
          if (isNaN(d)==false)
          {
          alert(new Date(d));
          } else {
          alert(‘Invalid date’);
          }
        2. var d = new Date(‘foo’);
          if (d instanceof Date && isFinite(d))
          {
          alert(d);
          } else {
          alert(‘Invalid date’);
          }
        3. Date.prototype.valid = function() {
          return isFinite(this);
          }
          var d = new Date(‘foo’);
          if (d.valid())
          {
          alert(d);
          } else {
          alert(‘Invalid date’);
          }
        4. All of the above

166. Which of the following correctly explains the difference between a «for…in» and a «for» loop?

Answers:

        1. «for…in» has two expressions. It iterates over the enumerable properties of an object, in an arbitrary order, for each distinct property, statements can be executed. This should not be used to iterate over an array where index order is important.
          «for» consists of three optional expressions enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
        2. «for…in» has three expressions. It iterates over the enumerable properties of an object, in an arbitrary order, for each distinct property, statements can be executed. This should not be used to iterate over an array where index order is important.
          «for» consists of four optional expressions enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
        3. «for…in» iterates over the enumerable properties of an object, in an arbitrary order, for each distinct property, statements can be executed. This should be used to iterate over an array where index order is important.
          «for» consists of three optional expressions enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
        4. «for…in» iterates over the enumerable properties of an object, in arbitrary order, for each distinct property, statements can be executed, this should be used to iterate over an array where index order is important.
          «for» consists of two optional expressions enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.

167.Which of the following will list the properties of a JavaScript object?

Answers:

      1. var keys = Object.keys(myJsonObject);
      2. var keys = Object.value(myJsonObject)
      3. var keys = Object.keys(myJsonValue)
      4. None of these

17,508 total views, 285 views today

Top 10 popular test answers

HTML5 Test

Published by:

1. Which of the following statements regarding WebSockets is true?

Answers:

  1. It communicates with the server with only the data required by the application.
  2. It lowers the latency of connections for interactive web applications.
  3. It scales better and consumes less server resources than HTTP AJAX/long-poll.
  4. All of the above.

2. 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>

Answers:

  1. var context = canvas.getContext();
  2. var context = canvas.getElementById(“context”);
  3. var context = canvas.getContext(“2d”);
  4. var context = canvas.getElementById(“2d”);

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

Answers:

  1. It is used to define important text.
  2. It is used to define computer code text.
  3. It is used to define sample computer code.
  4. It is used to define a definition term.

4. Which of the following is a possible way to get fullscreen video played from the browser using HTML5?

Answers:

  1. <object> <param name=”allowFullScreen” value=”true” />
  2. <video allowFullScreen=”true”>
  3. <video height=”100%” width=”100%”>
  4. None of these.

5. Consider 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?

Answers:

  1. 89
  2. 90
  3. Item 1
  4. Item 2

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

Answers:

  1. Drag and drop files from the desktop
  2. Full file system access
  3. Use of the HTML5 File API
  4. Use of files as HTML5 input types

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

Answers:

  1. _blank
  2. _self
  3. _top
  4. _bottom

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

Answers:

  1. An input tag button can be a reset button too.
  2. A button tag button can be a reset button too.
  3. An input tag button can include images as well.
  4. A button tag can include images as well.

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

Answers:

  1. toDataURL()
  2. saveAsImage()
  3. saveFile()
  4. exportImage()

10. Can we store JavaScript Objects directly into localStorage?

Answers:

  1. Yes
  2. No

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

Answers:

  1. It gets fired when an element has been dragged to a valid drop target.
  2. It gets fired when an element leaves a valid drop target.
  3. It gets fired at the end of a drag operation.
  4. It gets fired while an element is being dragged.

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

Answers:

  1. The application cache is programmatically updated.
  2. The application cache gets automatically cleared by the browser.
  3. The manifest file is modified.
  4. The user clears their browser’s data storage for the site.

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

Answers:

  1. DD-MM-YYYY
  2. YYYY-MM-DD
  3. MM-DD-YYYY
  4. YYYY-DD-MM

14. Which of the following is not a valid syntax for the <link> element in HTML5?

Answers:

  1. <link rel=”icon” href=”abc.jpg” sizes=”16×16″>
  2. <link rev=”stylesheet” href=”abc.css” type=”text/css” target=”_parent”>
  3. <link rel=”alternate” type=”application/pdf” hreflang=”fr” href=”manual-fr”>

15. What does P2P streaming mean when web applications establish a P2P HTTP connection using HTML?

Answers:

  1. It means that streaming of a voice/video frame is direct, without using any server between them.
  2. It means that streaming of a voice/video frame is first between one peer to the server then the server to another peer.
  3. Communication does not rely on a shared relay server in the network.

16. Which of the following will detect when an HTML5 video has finished playing?

Answers:

  1. var video = document.getElementsByTagName(‘video’)[0]; video.onended = function(e) { }
  2. var video = document.getElementsByTagName(‘video’)[0]; video.onPlayend = function(e) { }
  3. var video = document.getElementsByTagName(‘video’)[0]; video.onPlayFinish = function(e) { }
  4. var video = document.getElementsByTagName(‘video’)[0]; video.onPlayBackended = function(e) { }

17. What is the difference between Server-Sent Events (SSEs) and WebSockets in HTML5?

Answers:

  1. WebSockets can perform bi-directional (client-server and vice versa) data transfers, while SSEs can only push data to the client/browser.
  2. SSEs can perform bi-directional (client-server and vice versa) data transfers, while WebSockets can only push data to the client/browser.
  3. WebSockets and SSEs are functionally equivalent.
  4. None of these.

18. Which of the following methods can be used to estimate page load times?

Answers:

  1. Using _gaq.push([‘_trackPageLoadTime’]) with Google Analytics.
  2. Using the Navigation Timing JavaScript API.
  3. Page load times cannot be estimated.
  4. Using built-in JavaScript methods.

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

Answers:

  1. <tr class=”foo” data-id-type=”4″>
  2. <tr class=”foo” id-type=”4″>
  3. <tr class=”foo” data-id_type=”4″>
  4. All of the above.

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

Answers:

  1. #myCanvas {height: 100%; width: 100%;}
  2. <script type=”text/javascript”> function resize_canvas(){ canvas = document.getElementById(“canvas”); if (canvas.width < window.innerWidth) { canvas.width = window.innerWidth; } if (canvas.height < window.innerHeight) { canvas.height = window.innerHeight; } } </script>
  3. It depends upon the complexity of the canvas, and the frequency of redraws.
  4. Calling the JavaScript getWidth() function.

21. Which method of the HTMLCanvasElement is used to represent an image of a canvas element?

Answers:

  1. toDataURL
  2. toImageURL
  3. saveAsPNG
  4. saveAsJPEG

22. Which of the following is the correct way to store an object in localStorage?var obj = { ‘one’: 1, ‘two’: 2, ‘three’: 3 };

Answers:

  1. localStorage.setItem(‘obj’, obj);
  2. localStorage.setItem(‘obj’, JSON.stringify(obj));
  3. localStorage.setItem(‘testObject’, JSON.parse(testObject));
  4. localStorage.setItem(obj);

23. 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>

Answers:

  1. var context = canvas.getContext();
  2. var context = canvas.getElementById(“context”);
  3. var context = canvas.getContext(“2d”);
  4. var context = canvas.getElementById(“2d”);

24. Which of the following code is used to prevent Webkit spin buttons from appearing on web pages?

Answers:

  1. input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
  2. input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
  3. noindex:-o-prefocus, input[type=number] { padding-right: 1.2em; }
  4. input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; padding-right: 1.2em; }

25. Which of the following will restrict an input element to accept only numerical values in a text field?

Answers:

  1. <input type=”text” pattern=”[0-9]*” />
  2. <input type=”number” />
  3. <input type=”text” pattern=”d*”/>
  4. <input type=”text” pattern=”number”/>

26. Which of the following is the correct way to display a PDF file in the browser?

Answers:

  1. <object type=”application/pdf” data=”filename.pdf” width=”100%” height=”100%”/>
  2. <object type=”application/pdf” id=”filename.pdf” width=”100%” height=”100%”/>
  3. <input type=”application/pdf” data=”filename.pdf” width=”100%” height=”100%”/>
  4. <input type=”application/pdf” src=”filename.pdf” width=”100%” height=”100%”/>

27. Which of the following is the best method to detect HTML5 Canvas support in web browsers?

Answers:

  1. isCanvasSupported()
  2. !!document.createElement(“canvas”)
  3. !isCanvasSupported()
  4. !!window.HTMLCanvasElement

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

Answers:

  1. onstalled
  2. onwaiting
  3. onsuspend
  4. oninvalid

29. Which of the following is the correct way to check browser support for WebSocket?

Answers:

  1. console.log(WebSocket ? ‘supported’ : ‘not supported’);
  2. console.log(window.WebSocket ? ‘supported’ : ‘not supported’);
  3. console.log(window[WebSocket] ? ‘supported’ : ‘not supported’);
  4. console.log(window[‘WebSocket’] ? ‘supported’ : ‘not supported’);

30. Which of the following video file formats are currently supported by the <video> element of HTML5?

Answers:

  1. CCTV
  2. MPEG 4
  3. Ogg
  4. 3GPP

31. Which of the following shows correct use of client-side data validation in HTML5, on username and password fields in particular?

Answers:

  1. <input name=”username” required /> <input name=”pass” type=”password” required/>
  2. <input name=”username” validate=”true”/> <input name=”pass” type=”password” validate=”true”/>
  3. <input name=”username” validate/> <input name=”pass” type=”password” validate/>
  4. There is no way to implement client-side validation for the username and password fields in HTML5.

32. Which of the following is not a valid attribute for the <video> element in HTML5?

Answers:

  1. controls
  2. autoplay
  3. disabled
  4. preload

33. 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?

Answers:

  1. ctx.drawImage(img,10,10);
  2. context.drawImage(img,20,10,10,10);
  3. context.drawImage(img,10,20,10,10,20,20,10,10);
  4. All of these

34. Which of the following is the correct way to store an object in a localStorage?

Answers:

  1. localStorage.setItem(‘testObject’, JSON.stringify(testObject))
  2. localStorage.setItem(‘testObject’, testObject)
  3. localStorage.add(‘testObject’, testObject)
  4. localStorage.addItem(‘testObject’, testObject)

35. How can audio files be played in HTML5?

var sound = new Audio(“file.wav”);

Answers:

  1. sound.begin();
  2. sound.resume();
  3. sound.start();
  4. sound.play();

36. Which of the following is the correct way to play an audio file in HTML5?

Answers:

  1. var snd = new Audio(“file.wav”); snd.play();
  2. <audio controls> <source src=”file.ogg” type=”audio/ogg”> <source src=”file.mp3″ type=”audio/mpeg”> </audio>
  3. <source src=”file.mp3″ type=”audio/mpeg”>
  4. All of these.

37. Which HTML5 doctype declarations are correct?

Answers:

  1. <!doctype html>
  2. <!DOCTYPE html>
  3. <!DOCTYPE HTML5>
  4. <!DOCTYPE HTML>

38. 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?

Answers:

  1. <a href=”mailto:webmaster@xcompany.com”>webmaster</a>
  2. <a href=”webmaster@xcompany.com”>webmaster</a>
  3. <a http=”mail:webmaster@xcompany.com”>webmaster</a>
  4. <mail http=”send:webmaster@xcompany.com”>webmaster</mail>

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

Answers:

  1. Polling URLs in background
  2. Syntax highlighting without blocking code editing capabilities in online IDEs
  3. Motion tracking input in realtime with a video element
  4. All of these.

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

Answers:

  1. onerror
  2. onended
  3. onloadeddata
  4. onemptied

41. 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?

Answers:

  1. accept
  2. autofocus
  3. autocomplete
  4. formtarget

42. Which of the following HTML5 features is capable of taking a screenshot of a web page?

Answers:

  1. Server-Sent Events
  2. SVG
  3. Canvas
  4. Web Workers

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

Answers:

  1. Every HTML element can have an ARIA role attribute specified.
  2. Every HTML element is required have an ARIA role attribute specified.
  3. The attribute must have a value that is a set of space-separated tokens representing the various WAI-ARIA roles that the element belongs to.
  4. There is no ARIA attribute called “role”.

44. Which of the following video tag attributes are invalid in HTML5?

Answers:

  1. play
  2. loop
  3. mute
  4. pause

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

Answers:

  1. True
  2. False

46. Which of the following statements are correct with regard to the <hr> and <br> elements of HTML5?
Answers:

  1. The <hr> element acts in the same way as the tab key and the <br> element acts in the same way as the shift key.
  2. 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.
  3. The <hr> element is used to put a line across the page and the <br> element acts in the same way as a return/enter key press.

 

47. The following link is placed on an HTML webpage:<a href=”http://msdn.com/” target=”_blank”> MSDN </a>.What can be inferred from it?

Answers:

  1. It will open the site msdn.com in the same window.
  2. It will open the site msdn.com in a new window.
  3. It will open the site msdn.com in a frame below.
  4. It will not be clickable as it is not formed correctly.

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

Answers:

  1. now
  2. 2013-05-30
  3. 2013-30-05
  4. today

49. True or false:JavaScript objects can be stored directly into localStorage.

Answers:

  1. True
  2. False

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

Answers:

  1. 65536
  2. 64
  3. There is no limit.
  4. None of these.

51. Which of the following examples contain invalid implementations of the ampersand character in HTML5?

Answers:

  1. foo & bar
  2. foo &0 bar
  3. foo &0; bar
  4. foo&&& bar

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

Answers:

  1. context.clearRect ( x , y , w , h );
  2. canvas.width = canvas.width;
  3. context.clear();
  4. All of these.

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

Answers:

  1. sizes
  2. rev
  3. rel
  4. charset

54. 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>

Answers:

  1. button
  2. command
  3. checkbox
  4. radio

55. 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)

Answers:

  1. autocomplete
  2. autofocus
  3. placeholder
  4. formnovalidate

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

Answers:

  1. onfocus
  2. onload
  3. onblur
  4. onselect

57. What is the purpose of the <q> element in HTML5?

Answers:

  1. It is used to define the start of a term in a definition list.
  2. It is used to define attribute values for one or more columns in a table.
  3. It is used to define the start of a short quotation.
  4. It is used to define what to show browsers that do not support the ruby element.

58. Consider 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?

Answers:

  1. 89
  2. 90
  3. Item 1
  4. Item 2

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

Answers:

  1. var localStorage[names]=new Array(); localStorage.names[0]=prompt(“New member name?”);
  2. var names = []; names[0] = prompt(“New member name?”); localStorage[“names”] = JSON.stringify(names); var storedNames = JSON.parse(localStorage[“names”]);
  3. Storage.prototype.setObj = function(key, obj) { return this.setItem(key, JSON.stringify(obj)) } Storage.prototype.getObj = function(key) { return JSON.parse(this.getItem(key)) }
  4. localStorage.setItem(‘names_length’, names.length); localStorage.setItem(‘names_0’, names[0]); localStorage.setItem(‘names_1’, names[1]); localStorage.setItem(‘names_’ + n, names[n]);

60. Which of the following are valid HTML5 elements?

Ans:

  1. canvas
  2. summary
  3. aside
  4. video

61. Which of the following are possible ways to make the browser automatically adds new images and discards deleted images with server-side events in HTML5?

Ans:

  1. Long Polling Ajax Requests
  2. Server-sent Events
  3. WebSockets
  4. JavaScript objects on the client via JSON.parse().

62. Which of the following input element variations will show a numeric keypad in mobile browsers?

Ans: 

  1. <input type=”text” pattern=”[0-9]*” />
  2. <input type=”number” />
  3. <input type=”text” keyboard=”numeric” />
  4. <input type=”text” keyboard=”number11″ />

63. Which of the following elements have the correct attribute assignment as per HTML5?
Ans:

a. <section id=”example”>…</section id=”example”>
b. <section id=”example”>…</section id=”example2″>
c. <section id=”EXAMPLE”>…</section>
d. <section id=”Example”>…</section>
e. <section id=”example”>…</section>

64. True or false:

JavaScript objects can be stored directly into localStorage.

Ans: 

  1. True
  2. False

65. What is the proper syntax for a line break tag as W3C specs defines?.

Ans: 

  1.   <br>
  2. </br>
  3. <br/>
  4. All of these

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

Ans: 

  1. <tr class=»foo» data-id-type=»4″>
  2.  <tr class=»foo» id-type=»4″>
  3. <tr class=»foo» data-id_type=»4″>
  4. All of the above.

67.Which of the following elements have the correct attribute assignment as per HTML 5.0?

Ans:

  1. <section id=»example»>…</section id=»example»>
  2. <section id=»example»>…</section id=»example2″>
  3. <section id=»EXAMPLE»>…</section>
  4. <section id=»Example»>…</section>
  5. <section id=»example»>…</section>

68.What does the icon attribute of the HTML5 command tag define?
<command icon=»?»>Click Me!</command>
Ans: 

  1. It is used to define the URL of an image to display as the command.
  2. It is used to define the name of the radiogroup this command belongs to.
  3. It is used to define if the command is checked or not.
  4. It is used to define if the command is available or not.

69.Which of the following methods are valid for navigating to a fragment identifier?

http://demo.com/#foo

Note: There may be more than one right answer.
Ans: 

  1. <a name=»foo»>bar</a>;
  2. <a id=»foo»>bar</a>
  3. <div id=»foo»>bar</div>
  4. <div class=»foo»>bar</div>

70.Which of the following events is not supported in HTML5?

Ans: 

  1. oninput
  2. oninvalid
  3. ondrop
  4. onrest

71.Which of the following is an invalid value for the type attribute of a command tag?

Ans: 

  1. checkbox
  2. radio
  3. command
  4. text

72.Which of the following are true regarding the <keygen> tag in HTML5? 

Ans: 

  1. The <keygen> tag specifies a key-pair generator field used for forms.
  2. The <keygen> tag generates a public/private key pair and then creates a certificate request. This certificate request will be sent to a Certificate Authority (CA), which then creates a certificate and sends it back to the browser.
  3. The <keygen> tag generates random passwords when the user requests for a password reset.
  4. The <keygen> tag is deprecated in HTML5.

73. Which of the following is not an attribute of theelement in HTML5?

Ans: 

  1. charset
  2. content
  3. http-equiv
  4. scheme

74.Which of the following is a proper syntax for
tag as W3C specs for HTML5 defines?

Ans: 

  1. <br/>
  2. <br/>
  3. <br>
  4. <br></br>

74.What does the icon attribute of the HTML5 command tag define?
Click Me!

Ans: 

  1. It is used to define the URL of an image to display as the command.
  2. It is used to define the name of the radiogroup this command belongs to.
  3. It is used to define if the command is checked or not.
  4. It is used to define if the command is available or not.

75.Which of the following input element variations will show a numeric keypad in mobile browsers?

Ans: 

  1. <input pattern=”[0-9]*” type=”text” />
  2. <input type=”number” />
  3. <input type=”text” />
  4. <input type=”text” />

76.Which of the following is not a method of WebSQL Database API?

Ans: 

  1. openDatabase.
  2. transaction.
  3. executeSql.
  4. connect.

77.Which of the following is not a valid control in HTML5?

Ans: 

  1. range.
  2. url
  3. address
  4. number

78.Which one of the following is not a valid input control in HTML5?

Ans: 

  1. range.
  2. url
  3. address
  4. number

79.Play Audio Loop using the following example?

Ans: 

  1. audio=new Audio(‘asound.ogg’);
    audio.addEventListener(‘ended’,function(){
    this.currentTime=0;
    this.play();
    },false);
    audio.play();
  2. audio=newAudio(‘someSound.ogg’);
    if(typeof audio.loop==’boolean’)
    {
    audio.loop=true;
    }
    else
    {
    audio.AddEventListener(‘loop’,function(){
    this.currentTime=1;
    this.autoplay();
    },false);
    }
    audio.play();
  3. audio=new Audio(‘asound.ogg’);
    audio.addEventListener(‘loop’,function(){
    this.currentTime=1;
    this.autoplay();

80.Which of these elements are deprecated in HTML5?

Answers:

  1. <center >
  2. <font>
  3. <iframe>
  4. <tfoot >

81.Which method is used to fetch the current geographic location of the user and update it as a user moves?

Answers:

  1. getCurrentPosition()
  2. watchPosition()
  3. getContinousPosition()
  4. watchContinuousPosition()

82.The element to specify a list of predefined options for input control is

Answers:

  1. <source >
  2. <datalist>
  3. <tracklist>
  4. <toptionlist >

83.Which of the following method is used to check if the browser can play the specified audio/video

Ans: 

  1. checkType
  2. canplayType
  3. typesupport
  4. mediaPlayType

84.Drawing text, The canvas context provides following method to render the text?

Ans: 

  1. fileText(text,x,y[,maxwidth])
  2. fileText(text,x,y{,maxwidth})
  3. strokeText(text,x,y{,maxwidth})
  4. strokeText(text,x,y[,maxwidth])

85.What is used to continously push events from the web server to the client’s browser?

Ans: 

  1. Server Sent Events
  2. Web Workers
  3. AJAX
  4. Push Notifications

86.Which of the following attributes requires you to have a value in an input control in HTML5?

Ans: 

  1. autofoucs
  2. required
  3. placehlder
  4. output

87.Which of the following is not a valid attribute for the audio element in HTML5?

Ans: 

  1. preload
  2. loop
  3. stopped
  4. muted

88. Which of the following shows correct use of client-side data validation in HTML5, on username and password fields in particular?

Answers:

  1. <background >red</background>
  2. <body bg=”red”>>
  3. <body style=”background-color:red;”>

89.Which method is used to finish a launched worker?

Ans: 

  1. endWorker
  2. terminate
  3. finish

90.Which of the following is a new input type introduced in HTML5?

Ans: 

  1. text
  2. password
  3. email
  4. radio

91.How can audio files be played in HTML5?

Ans: 

  1. var sound=new Audio(“file.wav”);
  2. sound.begin ( );
  3. sound.resume ( );
  4. sound.start ( );
  5. sound.play ( );

92.Which of these elements are deprecated in HTML5?

Answers:

  1. <object type=”application/pdf” data=”filename.pdf” widh=”100%” height=”100%” >
  2. <object type=”application/pdf” id=”filename.pdf” widh=”100%” height=”100%”>
  3. <input type=”application/pdf” data=”filename.pdf” widh=”100%” height=”100%”>
  4. <input type=”application/pdf” source=”filename.pdf” widh=”100%” height=”100%”>

93.Which of the following staement is correct about Server-Side image maps?

Ans: 

  1. This is enabled by the ismap attribute of the < img > tag and required access to the server and related image-map processing applications
  2. This is created with the usemap attribute of the < img > tag, along with corresponding <map> and <div>tags
  3. This is created with the image attribute of the < img> tag, along with corresponding image < map> and
    data < area>
  4. None of the above

94.Which element defines the title of a work(e.g. a book, a song, a movie, etc.)?

Answers:

  1. <details >
  2. <font>
  3. <cite>
  4. <bdi >
  5. <title>

95.Which method is used to execute a query in WebSQL?

Ans: 

  1. execute
  2. execute WebSQL
  3. executeSQL
  4. executeQuery

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

Ans: 

  1. DD-MM-YYYY
  2. YYYY-MM-DD
  3. MM-DD-YYYY
  4. YYYY-DD-MM

97. Which of the following elements have the correct attribute assignment as per HTML5?
Ans:

a. <section id=»example»>…</section id=»example»>
b. <section id=»example»>…</section id=»example2″>
c. <section id=»EXAMPLE»>…</section>
d. <section id=»Example»>…</section>
e. <section id=»example»>…</section>

98. Which of the following is not an attribute of the element in HTML5?

Answers:

  1. charset
  2. content
  3. http-equiv
  4. scheme

99.Which of the following is a proper syntax for
tag as W3C specs for HTML5 defines?

Ans: 

  1. <br/>
  2. <br/>
  3. <br>
  4. <br></br>

100.Can we use SVG tags directly in HTML5 without using any plugin?

Answers:

  1. Yes
  2. No

101. Which of the following elements have the correct attribute assignment as per HTML5?
Ans:

    a.<div class=»one,two,three»></div>
    b.<div class=»one;two;three»></div>
    c.<div class=»one two three»></div>
    d.<div class=»one» class=»two» class=»three»></div>

102.How to make an element draggable in HTML5?

Answers:

  1. set the draggable attribute to true as draggable=»true»
  2. set the movable attribute to true as movable=»true»
  3. set the dropable attribute to true as dropable =»true»
  4. You can not make an element draggable in HTML5

103.Which of the following is not a core method of WebSQL Database API?

Answers:

  1. openDatabase
  2. transaction
  3. executeSql
  4. connect

104.Which element defines the title of a work (e.g. a book, a song, a movie, etc.)?

Ans: 

  1. <details>
  2. <cite>
  3. <bdi>
  4. <title>

105.The HTML5 element used to draw a graphics via scripting?

Answers:

  1. mark
  2. figure
  3. Canvas
  4. figcaption

106.Which value of Socket.readyState atribute of WebSocket indicates that the connection is going through the closing handshake?

Answers:

  1. 0
  2. 1
  3. 2
  4. 3

107.How to declare HTML5 document type?

Ans: 

  1. <!DOCTYPE html5>
  2. <!DOCTYPE html>
  3. <!DOCTYPE HTML PUBLIC «-//W3C//DTD HTML 5.00 Transitional//EN» «http://www.w3.org/TR/html5/loose.dtd»>
  4. <!DOCTYPE HTML PUBLIC VERSION «5.00»>

108.Is WebSQL a part of HTML5 specification?

Answers:

  1. Yes
  2. No

109.Which of these statements are considered as best practices?

Answers:

  1. Place all CSS/ JavaScript files within the <head> element
  2. Place all CSS/ JavaScript files at the bottom of <body> element
  3. Place CSS files within the <head > element
  4. Place JavaScript files at the bottom of <body> element

110. In HTML5, drag and drop is part of the standard?

Answers:

  1. True
  2. False

111. Which of the following attribute triggers an abort event?

Answers:

  1. abort
  2. offline
  3. onabort
  4. onbeforeonload

112. Which is the following represents that the document is using HTML5?

Ans: 

  1. <!DOCTYPE HTML PUBLIC «-//W3C//DTD HTML 4.01//EN» «http://www.w3.org/TR/html4/strict.dtd»>
  2. <!DOCTYPE HTML PUBLIC «-//W3C//DTD HTML 4.01 Transitional//EN» «http://www.w3.org/TR/html4/loose.dtd»>
  3. <!DOCTYPE html PUBLIC «-//W3C//DTD XHTML 1.0 Strict//EN» «http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd»>
  4. <!DOCTYPE html>

113. Which of the following attribute triggers an abort event?

Answers:

  1. fillStyle()
  2. fill()
  3. color()
  4. fillColor()

114. How do you specify where the dragged data can be dropped?

Answers:

  1. Setting attribute dropable = «true»
  2. Calling the event.preventDefault() method for the ondragover event.
  3. Setting attribute draggable = «true»
  4. Calling the event.preventDefault() method for the ondragstart event.

115. Which of the following video formats is not supported by the video tag?

Answers:

  1. MP4
  2. WebM
  3. color()
  4. Ogg
  5. Mov

116. Which tag is used to show subtitles in a video in HTML5?

Answers:

  1. track
  2. source
  3. video
  4. audio

117. Which methods are provided by geolocation?

Answers:

  1. getCurrentPosition
  2. watchPosition
  3. clearWatch
  4. All of the above

118. Which of the following tag can be used to associate a caption together with some embedded content in HTML5?

Answers:

  1. caption
  2. figure
  3. nav
  4. dialog

119. Which attribute specifies that the video will be loaded at page load, and ready to run. Ignored if autoplay is present.

Answers:

  1. poster
  2. loop
  3. preload
  4. src

120. How do you declare HTML5 document type?
Ans: 

  1. <!DOCTYPE html5>
  2. <!DOCTYPE html>
  3. <!DOCTYPE HTML PUBLIC «-//W3C//DTD HTML 5.00 Transitional//EN» «http://www.w3.org/TR/html5/loose.dtd»>
  4. <!DOCTYPE HTML PUBLIC VERSION «5.00»

121. Which of the following code is valid?
Ans:

a. <div id=»container» class=»home-page» datasize=»960px»>< /div>
b. <div id=»#container» class=».home-page» data-size=»960px»></div>
c. <div id=»container» class=»home-page» data-size=»960px»></div>
d. <All of these codes are valid>

122.Which tag in HTML5 can be used to define navigation links?

Answers:

  1. navigation
  2. footer
  3. nav
  4. meter

123. Which among the following tags define a caption for a fieldset element?
Answers:

  1. egend
  2. select
  3. input
  4. textarea

124. Which of the following attribute triggers event when an element gets user input?

Answers:

  1. oninput
  2. ondata
  3. onput
  4. onhaschange

125.Which of the following tags used to specify subtitles for <video>?
Answers:

  1. <sub>
  2. <title>
  3. <subtitle>
  4. < track>

126. Which tags are most commonly used by search engines?

Answers:

  1. Paragraph
  2. Heading Correct
  3. Title
  4. All of above

127.Which of the following is not a valid input type of the form tag?

Answers:

  1. email
  2. checkbox
  3. hidden
  4. video

128.What is the correct HTML5 element for playing video files?

Ans: 

  1. <movie>
  2. <media>
  3. <video>
  4. All of the above

129.Why should you add alternative text to your images?

Answers:

  1. In case the user wishes to load a different picture
  2. So the users can get an idea of what the image is before it loads and it is also helpful in SEO
  3. So the user can save the image using the text as a name
  4. Just to keep your document valid

129.The way the browser displays the object can be modified by

Answers:

  1. attributes
  2. parameters
  3. modifiers
  4. None of above

130.When using video on a page, if autoplay attribute is set then which of the following attributes is ignored?

Answers:

  1. loop
  2. preload
  3. controls
  4. muted

131. What is used to continuously push events from the web server to the client’s browser?

Answers:

  1. Server Sent Events
  2. Web Workers
  3. AJAX
  4. Push

132.Which of the following event occurs when the document comes online?

Answers:

  1. onload
  2. onloadstart
  3. onmessage
  4. ononline

133.Which is the recommended standard video format in HTML5?

Answers:

  1. Theora video and Vorbis audio, as well as the Ogg container format.
  2. The HTML5 specification does not specify which video and audio formats browsers should support.
  3. H.264/MPEG-4 AVC

134.Which method is used to fetch the current geographic location of the user and update it as the user moves?

Answers:

  1. getCurrentPosition()
  2. watchPosition()
  3. getContinuousPosition()
  4. watchContinuousPosition()

135.Which of the following input control accepts only numerical value in HTML5?

Answers:

  1. range
  2. number
  3. time
  4. week

136.How many h1 elements are recommended on a single page?

Answers:

  1. Unlimited.
  2. One per section (HTML5) or one per document (HTML4).
  3. Depends on the size of the page.

138. Which of the following input control is provided by HTML5 for input fields that should contain an e-mail address?

Answers:

  1. url
  2. email
  3. email-address

139.What is the correct HTML for making a checkbox?

Answers:

  1. <input type=»checkbox»>
  2. <check>
  3. <input type=»check»>
  4. <checkbox >

140. Which of the following is a new input restriction introduced in HTML5?

Answers:

  1. disabled
  2. maxlength
  3. readonly
  4. required

141. HTML tags are used to describe document ____?

Answers:

  1. Image
  2. Content
  3. Definition
  4. Groups

142.To specify a font for your whole page add which tag?

Answers:

  1. <defaultfont>
  2. <targetfont>
  3. <basefont>
  4. < body >

143. The background image will scroll when the user scrolls down the page, unless you add which property to the body tag ?

Answers:

  1. bgproperties=»stationary»
  2. bgproperties=»fixed»
  3. bgproperties=»holdstill»
  4. bgproperties=»scroll»

144. Which of the following method is used to import external scripts?Which of the following method is used to import external scripts?

Answers:

  1. import
  2. importScripts
  3. scriptsImport
  4. importJS

145. Which of the following creates an email address hyperlink?

Answers:

  1. <a href=»me@domainname.com»>Email me</a>
  2. <a href=»mailto:me@domainname.com»>Email me</a>
  3. <a href=»email:me@domainname.com»>Email me</a>
  4. <a href=»send:me@domainname.com»>Email me</a>

146. When images are used as links they get a blue border?

Answers:

  1. Type
  2. Never
  3. Unless border is set to zero
  4. Always

147. Which attribute specifies that the image is part of a server-side image-map?

Answers:

  1. IMAP
  2. SMAP
  3. ISMAP
  4. imageMap

148. Please select the correct media attributes of the style element:

Answers:

  1. all
  2. printscreen
  3. not phone and (color)
  4. speech and (min-device-width: 800px)

149. Which of these statements are true?

Answers:

  1. A block-level element always starts on a new line and takes up the full width available.
  2. An inline element does not start on a new line and only takes up as much width as necessary.
  3. A block-level element always starts on a new line and only takes up as much width as necessary.
  4. A block-level element can be placed into inline elements.

150. The default character encoding in HTML5 is?

Answers:

  1. UTF-16
  2. UTF-8
  3. UTF-32
  4. ISO-8859-1

151. Please select the correct usage of the address element:

Answers:

  1. <address>Last Modified: 2016/05/12 21:32:56</address>
  2. <footer>
  3. <address>
  4. Feel free to contact me at
  5. <a href=»mailto:johns@upwork.com»>John Smith</a>
  6. <p><mall>© copyright 2016 Upwork.</small></p>
  7. </address>
  8. </footer>
  9. <address>
  10. Feel free to contact me at
  11. <a href=»mailto:johns@upwork.com»>John Smith</a>
  12. </address>
  13. <p><mall>© copyright 2016 Upwork.</small></p>

152.To specify a font for your whole page add which tag?

Answers:

  1. <tfoot>
  2. <th>
  3. <col>
  4. < tcol >

153.How many tags are in a regular element?
Ans:

  • 1
  • 2
  • 3
  • 4

154. Which of the following code is valid?
Ans:

a. <div data=»{ ‘key’:’value’ }»>< /div>
b. <div data-key=»value»></div>
c. <div data_key=»value»></div>
d. <div key=»value»></div>

155. Which of the following is a new form element introduced in HTML5?

Answers:

  1. button
  2. textarea
  3. datalist
  4. select

156.Which of the following is/are valid HTML5 attributes?

Answers:

  1. webgl
  2. spellcheck
  3. manualfocus
  4. contextmenu

157. Which HTML tag is NOT used when formatting text?

Answers:

  1. <img>
  2. <small>
  3. <p>
  4. < strong >

158.Which of these values are allowed for attribute “method” for form element?

Answers:

  1. get
  2. post
  3. patch
  4. delete

159. Which of these elements are block-level?

Answers:

  1. <h1>…<h6>
  2. <p>
  3. <img>
  4. < span >

160.Which of these values are allowed for attribute “method” for form element?

Answers:

  1. Text displayed when you hold your mouse over an image
  2. Text displayed when an image is not found
  3. Text displayed when a user has images switched off in the browser
  4. All of the above

161. How do you make the content inside an element editable?

Answers:

  1. Setting the attribute contenteditable = «true»
  2. Setting the attribute editable = «true»
  3. Setting the attribute content = «editable»
  4. The content inside all the elements is editable by default in HTML5.

162. Which of these elements are block-level?

Answers:

  1. <list>
  2. <input type=»list»>
  3. <input type=»dropdown»>
  4. < select >

163.A 6 digit Hex color (#FF9966) defines values of Red, Blue and Green in which order ?

Answers:

  1. #BBRRGG
  2. #BBGGRR
  3. #RRGGBB
  4. #RRBBGG

164.Using Hspace will add what to your image?

Answers:

  1. Space to the left and right
  2. Space to the right and left
  3. Height to all equal
  4. Space to top and left

165.Which of the following is not valid about MediaRecorder API ?

Answers:

  1. MediaRecorder.start() method is called to start the recording.
  2. MediaRecorder.process() method is called to start the recording.
  3. MediaRecorder API works alongside Navigator.getUserMedia() to capture media data.
  4. The contents of the recording will be made available in the platform’s default encoding via the dataavailable event

166.Which of the following method is used to check if the browser can play the specified audio/video type?

Answers:

  1. checkType
  2. canPlayType
  3. typeSupport
  4. mediaPlayType

167.Which of the following method is used to check if the browser can play the specified audio/video type?

Answers:

  1. contenteditable
  2. height
  3. id
  4. name
  5. spellcheck
  6. translate
  7. value

168.Which of the following tag is used for a multi line text input control?

Answers:

  1. textarea
  2. textml
  3. text
  4. None of the above

169.Which of the following attribute specifies whether or not a user is allowed to drag an element?

Answers:

  1. draggable
  2. context
  3. content
  4. drag

23,801 total views, 26 views today

Top 10 popular test answers

PHP Test 2016

Published by:

1. What is the best practice for running MySQL queries in PHP? Consider the risk of SQL injection.

Answers:

  1. Use mysql_query() and variables: for example: $input = $_POST[‘user_input’]; mysql_query(“INSERT INTO table (column) VALUES (‘” . $input . “‘)”);
  2. Use PDO prepared statements and parameterized queries: for example: $input= $_POST[“user-input”] $stmt = $pdo->prepare(‘INSERT INTO table (column) VALUES (“:input”); $stmt->execute(array(‘:input’ => $input));
  3. Use mysql_query() and string escaped variables: for example: $input= $_POST[“user-input”] $input_safe = mysql_real_escape_string($input); mysql_query(“INSERT INTO table (column) VALUES (‘” . $input. “‘)”);
  4. Use mysql_query() and variables with a blacklisting check: for example: $blacklist = array(“DROP”,”INSERT”,”DELETE”); $input= $_POST[“user-input”] if (!$array_search($blacklist))) mysql_query(“INSERT INTO table (column) VALUES (‘” . $input. “‘)”);

2. Which of the following methods should be used for sending an email using the variables $to, $subject, and $body?

Answers:

  1. mail($to,$subject,$body)
  2. sendmail($to,$subject,$body)
  3. mail(to,subject,body)
  4. sendmail(to,subject,body)

3. Which of the following is used to maintain the value of a variable over different pages?

Answers:

  1. static
  2. global
  3. session_register()
  4. None of these

4. Which of the following will check if a function exists?

Answers:

  1. function_exists()
  2. has_function()
  3. $a = “function to check”; if ($a ()) // then function exists
  4. None of these

5. Which of the following is not a file-related function in PHP?

Answers:

  1. fclose
  2. fopen
  3. fwrite
  4. fgets
  5. fappend

6.Which of the following is true about the singleton design pattern?

Answers:

  1. A singleton pattern means that a class will only have a single method.
  2. A singleton pattern means that a class can have only one instance object.
  3. A singleton pattern means that a class has only a single member variable.
  4. Singletons cannot be implemented in PHP.

7. Which of the following characters are taken care of by htmlspecialchars?

Answers:

  1. <
  2. >
  3. single quote
  4. double quote
  5. &
  6. All of these

8. Which of the following will read an object into an array variable?

Answers:

  1. $array_variable = get_object_vars($object);
  2. $array_variable = (array)$object;
  3. $array_variable = array $object;
  4. $array_variable = get_object_vars $object;

9. Which of the following variable declarations within a class is invalid in PHP?

Answers:

  1. private $type = ‘moderate’;
  2. internal $term = 3;
  3. public $amnt = ‘500’;
  4. protected $name = ‘Quantas Private Limited’;

10. Which of the following is not a PHP magic constant?

Answers:

  1. __FUNCTION__
  2. __TIME__
  3. __FILE__
  4. __NAMESPACE__
  5. __CLASS__

11. Which of the following will print out the PHP call stack?

Answers:

  1. $e = new Exception; var_dump($e->debug());
  2. $e = new Exception; var_dump($e->getTraceAsString());
  3. $e = new Exception; var_dump($e->backtrace());
  4. $e = new Exception; var_dump($e->getString());

12. What will be the output of the following code?
<?php
var_dump (3*4);
?>

Answers:

  1. int(3*4)
  2. int(12)
  3. 3*4
  4. 12
  5. None of the above

13. Which of the following is correct about Mysqli and PDO?

Answers:

  1. Mysqli provides the procedural way to access the database while PDO provides the object oriented way.
  2. Mysqli can only be used to access MySQL database while PDO can be used to access any DBMS.
  3. MySQLi prevents SQL Injection whereas PDO does not.
  4. MySQLi is used to create prepared statements whereas PDO is not.

14. What is the correct way to send a SMTP (Simple Mail Transfer Protocol) email using PHP?

Answers:

  1. s.sendmail($EmailAddress, [$MessageBody], msg.as_string())
  2. sendmail($EmailAddress, “Subject”, $MessageBody);
  3. mail($EmailAddress, “Subject”, $MessageBody);
  4. <a href=”mailto:$EmailAddress”>$MessageBody</a>

15. Which of the following will start a session?

Answers:

  1. session(start);
  2. session();
  3. session_start();
  4. login_sesion();

16. For the following code:
<?php

function Expenses()
{
function Salary()
{
}

function Loan()
{
function Balance()
{
}
}
}

?>
Which of the following sequence will run successfully?

Answers:

  1. Expenses();Salary();Loan();Balance();
  2. Salary();Expenses();Loan();Balance();
  3. Expenses();Salary();Balance();Loan();
  4. Balance();Loan();Salary();Expenses();

17. What enctype is required for file uploads to work?

Answers:

  1. multipart/form-data
  2. multipart
  3. file
  4. application/octect-stream
  5. None of these

18. Which of the following is incorrect with respect to separating PHP code and HTML?

Answers:

  1. Use an MVC design pattern.
  2. As PHP is a scripting language, HTML and PHP cannot be separated.
  3. Use any PHP template engine e.g: smarty to keep the presentation separate from business logic.
  4. Create one script containing your (PHP) logic outputting XML and one script produce the XSL to translate the XML to views.

19. Which one of the following is not an encryption method in PHP?

Answers:

  1. crypt()
  2. md5()
  3. sha1()
  4. bcrypt()

20. What function should you use to join array elements with a glue string?

Answers:

  1. join_st
  2. implode
  3. connect
  4. make_array
  5. None of these

21. Which function can be used to delete a file?

Answers:

  1. delete()
  2. delete_file()
  3. unlink()
  4. fdelete()
  5. file_unlink()

22. What is the string concatenation operator in PHP?

Answers:

  1. +
  2. ||
  3. .
  4. |||
  5. None of these

23.Which of the following is useful for method overloading?

Answers:

  1. __call,__get,__set
  2. _get,_set,_load
  3. __get,__set,__load
  4. __overload

24. Which of the following will store order number (34) in an ‘OrderCookie’?

Answers:

  1. setcookie(“OrderCookie”,34);
  2. makeCookie(“OrderCookie”,34);
  3. Cookie(“OrderCookie”,34);
  4. OrderCookie(34);

25. What would occur if a fatal error was thrown in your PHP program?

Answers:

  1. The PHP program will stop executing at the point where the error occurred.
  2. The PHP program will show a warning message and program will continue executing.
  3. Since PHP is a scripting language so it does not have fatal error.
  4. Nothing will happen.

26. What is the correct line to use within the php.ini file, to specify that 128MB would be the maximum amount of memory that a script may use?

Answers:

  1. memory_limit = 128M
  2. limit_memory = 128M
  3. memory_limit: 128M
  4. limit_memory: 128M

27. What is the best way to change the key without changing the value of a PHP array element?

Answers:

  1. $arr[$newkey] = $oldkey; unset($arr[$oldkey]);
  2. $arr[$newkey] = $arr[$oldkey]; unset($arr[$oldkey]);
  3. $newkey = $arr[$oldkey]; unset($arr[$oldkey]);
  4. $arr[$newkey] = $oldkey.GetValue(); unset($arr[$oldkey]);

28. What will be the output of the following code?
<?
echo 5 * 6 / 2 + 2 * 3;
?>

Answers:

  1. 1
  2. 20
  3. 21
  4. 23
  5. 34

29. Does PHP 5 support exceptions?

Answers:

  1. Yes
  2. No

30.Which of the following is true about posting data using cURL in PHP?

Answers:

  1. Data can be posted using only the POST method.
  2. Data can be posted using only the GET method.
  3. Data can be posted using both GET and POST methods.
  4. Data cannot be posted using cURL.

31.Which of the following is the correct way to check if a session has already been started?

Answers:

  1. if (session_id()) echo ‘session started’;
  2. if ($_SESSION[«session_id»]) echo ‘session started’;
  3. if ($GLOBALS[«session_id»]) echo ‘session started’;
  4. if ($_SERVER[«session_id»]) echo ‘session started’;

32.Given the following array:
$array = array(0 => ‘blue’, 1 => ‘red’, 2 => ‘green’, 3 => ‘red’);

Which one of the following will print 2?

Answers:

  1. echo array_search(‘green’, $array);
  2. echo array_key_exists(2, $array);
  3. echo in_array(‘green’, $array);
  4. echo array_search(‘red’,$array);

33.What is the output of the following code?
echo 0x500;
?>

Answers:

  1. 500
  2. 0x500
  3. 0500
  4. 1280
  5. 320

34.Which of the following regular expressions can be used to check the validity of an e-mail address?

Answers:

  1. ^[^@ ]+@[^@ ]+\.[^@ ]+$
  2. ^[^@ ]+@[^@ ]+.[^@ ]+$
  3. $[^@ ]+@[^@ ]+\.[^@ ]+^
  4. $[^@ ]+@[^@ ]+.[^@ ]+^

35.Which of the following is not a valid DOM method in PHP?

Answers:

  1. loadXMLFile()
  2. loadHTML()
  3. loadXML()
  4. loadHTMLFile()

36.What is the fastest way to insert an item $item into the specified position $position of the array $array?

Answers:

  1. array_splice()
  2. array_merge() and array_slice()
  3. PHP does not have any built-in function that can do this: the source array will have to be copied, and $item inserted in to the required position:
    $n = 0;
    foreach ($array as $key => $val) {
    if ($n == $position) {
    $target[] = $item;
    }
    ++$n;
    $target[$key] = $val;
    }
  4. array_insert()

37.Consider the following 2D array in PHP:
$array = array(array(141,151,161), 2, 3, array(101, 202, 303));
Which of the following will display all values in the array?

Answers:

  1. function DisplayArray($array) {
    foreach ($array as $value) {
    if (array_valid($value)) {
    DisplayArray($value);
    } else {
    echo $value. “ ”;
    }
    }
    }
    DisplayArray($array);
  2. function DisplayArray($array) {
    for ($array as $value) {
    if (valid_array($value)) {
    DisplayArray($value);
    } else {
    echo $value. “ ”;
    }
    }
    }
    DisplayArray($array);
  3. function DisplayArray($array) {
    for ($array as $value) {
    if (is_array($value)) {
    DisplayArray($value);
    } else {
    echo $value. “ ”;
    }
    }
    }
    DisplayArray($array);
  4. function DisplayArray($array) {
    foreach ($array as $value) {
    if (is_array($value)) {
    DisplayArray($value);
    } else {
    echo $value “ ”;
    }
    }
    }
    DisplayArray($array);

38. Why is it not recommended to use $_REQUEST when handling form submissions in PHP?

Answers:

  1. It’s difficult to determine whether it is a $_POST or $_GET request.
  2. $_REQUEST is deprecated
  3. $_REQUEST includes $_COOKIE by default, and parameters from $_COOKIE with the same name may be overriden with parameters from $_GET or $_POST.
  4. $_REQUEST does not handle HTTP rquests, it handles database requests.

39.How should a variable be declared in a function, if the value has to be retained over multiple calls?

Answers:

  1. local
  2. global
  3. static
  4. None of these

40.Which is the best way to automatically deploy a PHP website using git push?

Answers:

  1. . It is not possible.
  2. You should have two copies on your server. A bare copy, that you can push/pull from, to which you would push your changes to when you are done. Then you would clone this into your web directory and set up a cronjob to update git pull from your web directory every day or couple of days.
  3. Developing from scratch a custom deployment script to manage all the aspects.
  4. Copy over your git directory to your web server. On your local copy, modify your .git/config file and add your web server as a remote. On the server, replace .git/hooks/post-update with an existing script to process the rest of the workflow.
    Make the script executable.

41.With what encoding does chr () work?

Answers:

  1. ASCII
  2. UTF-8
  3. UTF-16
  4. Implementation dependent
  5. None of the above

42.Which of the following file modes is used to write into a file at the end of the existing content, and create the file if the file does not exist?

Answers:

  1. r+
  2. w+
  3. a()
  4. x

43.Without introducing a non-class member variable, which of the following can be used to keep an eye on the existing number of objects of a given class?

Answers:

  1. Adding a member variable that gets incremented in the default constructor and decremented in the destructor.
  2. This cannot be accomplished since the creation of objects is being done dynamically via «new.»
  3. Add a static member variable that gets incremented in each constructor and decremented in the destructor.
  4. Adding a local variable that gets incremented in each constructor and decremented in the destructor.

44.What is the output of the following code?

<?php
function abc()
{
return __FUNCTION__;
}
function xyz()
{
return abc();
}
echo xyz();
?>
Answers:

  1. abc
  2. __FUNCTION__
  3. xyz

45.Which of the following is the operator with the highest precedence?

Answers:

  1. +
  2. instanceof
  3. new
  4. =
  5. none of above

46.Which function is used to remove the first element of an array?

Answers:

  1. array_remove_first_element
  2. array_shift
  3. array_ltrim
  4. a[0] = nil
  5. None of these

47.Which of the following functions output text?
Note: There may be more than one right answer.

Answers:

  1. echo()
  2. print()
  3. println()
  4. display()

48. What is the best way to load a file that contains necessary functions and classes?

Answers:

  1. include($filename);
  2. require($filename);
  3. include_once($filename);
  4. require_once($filename);

49.With regard to abstract classes, which of the following statements is false?

Answers:

  1. Abstract classes are not available in PHP.
  2. A class with a single abstract method must be declared abstract.
  3. An abstract class can contain non-abstract methods.
  4. An abstract method must have a method definition and can have optional empty braces following it.

50. What is the output of the following code?
<?php
function
vec_add (&amp;$a, $b)
{
$a[‘x’] += $b[‘x’];
$a[‘y’] += $b[‘y’];
$a[‘z’] += $b[‘z’];
}
$a = array (x =&gt; 3, y =&gt; 2, z =&gt; 5);
$b = array (x =&gt; 9, y =&gt; 3, z =&gt; -7);
vec_add (&amp;$a, $b);
print_r ($a);
?>
Answers:

  1. Array
    (
    [x] => 9
    [y] => 3
    [z] => -7
    )
  2. Array
    (
    [x] => 3
    [y] => 2
    [z] => 5
    )
  3. Array
    (
    [x] => 12
    [y] => 5
    [z] => -2
    )
  4. Error
  5. None of these

51.Which of the following are not considered as Boolean false?

Answers:

  1. FALSE
  2. 0
  3. «0»
  4. «FALSE»
  5. 4
  6. -4
  7. null

52.Which of the following code snippets has the most appropriate headers to force the browser to download a CSV file?

Answers:

  1. header(«Content-type: text/csv»);
    header(«Content-Disposition: attachment; filename=file.csv»);
    header(«Pragma: no-cache»);
    header(«Expires: 0»);
  2. header(‘Content-Type: application/download’);
    header(«Content-Disposition: attachment; filename=file.csv»);
    header(«Pragma: no-cache»);
    header(«Expires: 0»);
  3. header(‘Content-Type: application/csv’);
    header(«Content-Disposition: attachment; filename=file.csv»);
    header(«Pragma: no-cache»);
    header(«Expires: 0»);
  4. header(‘Content-Type: application/octet-stream’);
    header(«Content-Disposition: attachment; filename=file.csv»);
    header(«Pragma: no-cache»);
    header(«Expires: 0»);

53. What is the output of the following code?
<?php
echo «<pre>»;
$array = array(«red»,»green»,»blue»);
$last_key = end(array_keys($array));
foreach ($array as $key => $value) {
if ($key == $last_key) {
echo «a<br>»;
} else {
echo «b<br>»;
}
}
?>
Answers:

  1. b
    a
    b
  2. b
    a
    a
  3. b
    a
    a
  4. b
    b
    b

54.With regards to the «static» keyword in PHP, which of the following statements is false?

Answers:

  1. The $this variable can be used inside any static method.
  2. Static properties may only be initialized using a literal or a constant.
  3. A property declared as static can not be accessed with an instantiated class object.
  4. A static variable or method can be accessed without requiring instantiation of the class.

55. What is «empty()»?

Answers:

  1. A function
  2. A language construct
  3. A variable
  4. A reference
  5. None of these

56.Which of the following is not a valid cURL parameter in PHP?

Answers:

  1. CURLOPT_RETURNTRANSFER
  2. CURLOPT_GET
  3. CURLOPT_POST
  4. CURLOPT_POSTFIELDS

57.What will be the output of the following code?
<?
$a = 0;
echo ~$a;
?>
Answers:

  1. -1
  2. 0
  3. 1
  4. 10
  5. Syntax error

58.When comparing two arrays, what is the difference between «==» and «===»?

Answers:

  1. «==» compares keys while «===» compares keys and values.
  2. «===» also compares the order and types of the objects.
  3. «===» compares the array references.
  4. «===» They are identical.
  5. None of these

59.Which of the the following are PHP file upload-related functions?

Answers:

  1. upload_file()
  2. is_uploaded_file()
  3. move_uploaded_file()
  4. None of these

60.Which of the following is not a valid API?

Answers:

  1. trigger_print_error()
  2. trigger_error()
  3. debug_backtrace()
  4. debug_print_backtrace()

61.What will be the output of the following code?

<?php echo 30 * 5 . 7; ?>

Answers:

  1. 150.7
  2. 1507
  3. Integers can’t be concatenated.
  4. An error will be thrown.

62.Which of these is not a valid SimpleXML Parser method?

Answers:

  1. simplexml_import_dom()
  2. simplexml_import_sax()
  3. simplexml_load_string()

63.Which of the following environment variables is used to fetch the IP address of the user in a PHP application?

Answers:

  1. $IP_ADDR
  2. $REMOTE_ADDR_USER
  3. $REMOTE_ADDR
  4. $IP_ADDR_USER

64.Consider the following class:

  1. class Insurance
  2. {
  3. function clsName()
  4. {
  5. echo get_class($this);
  6. }
  7. }
  8. $cl = new Insurance();
  9. $cl->clsName();
  10. Insurance::clsName();

Which of the following lines should be commented to print the class name without errors?

Answers:

  1. Line 8 and 9
  2. Line 10
  3. Line 9 and 10
  4. All the three lines 8,9, and 10 should be left as it is.

65.What is the correct syntax of mail() function in PHP?

Answers:

  1. mail($from,$to,$subject,$message)
  2. mail($to,$subject,$message,$headers)
  3. mail($from,$to,$subject,$message)
  4. mail($to,$from,$subject,$message)
  5. mail($to,$from,$message,$headers).

66.Given the following array:
$array = array(0 => ‘blue’, 1 => ‘red’, 2 => ‘green’, 3 => ‘red’);
Which one of the following will print 2?
Answers:

  1. echo array_search(‘green’, $array);
  2. echo in_array(‘green’, $array);
  3. echo array_key_exists(2, $array);
  4. echo array_search(‘red’,$array);

67.Which function will suitably replace ‘X’ if the size of a file needs to be checked?
$size=X(filename);

Answers:

  1. size
  2. filesize
  3. sizeofFile
  4. getSize

68. Which of the following will not give the correct date and time in PHP?

Answers:

  1. date(“Y-m-d H:i:s”)
  2. date(“y-m-d H:i:s”)
  3. date(“f, j Y H:i:s”)
  4. date(“F, j Y H:i:s”)

69.Which of the following functions is not used in debugging?

Answers:

  1. var_dump()
  2. fprintf()
  3. print_r()
  4. var_export()

70.What is the difference between die() and exit() in PHP?

Answers:

  1. die() is an alias for exit().
  2. exit() is a function, die() is a language construct and cannot be called using variable functions.
  3. die() accepts a string as its optional parameter which is printed before the application terminates; exit() accepts an integer as its optional parameter which is passed to the operating system as the exit code.
  4. die() terminates the script immediately, exit() calls shutdown functions and object destructors first.

71.Should assert() be used to check user input?

Answers:

  1. Yes
  2. No

72.Without introducing a non-class member variable, which of the following can be used to keep an eye on the existing number of objects of a given class?

Answers:

  1. Adding a member variable that gets incremented in the default constructor and decremented in the destructor.
  2. Adding a local variable that gets incremented in each constructor and decremented in the destructor.
  3. Add a static member variable that gets incremented in each constructor and decremented in the destructor.
  4. This cannot be accomplished since the creation of objects is being done dynamically via “new.”

73.Which of the following is the right MIME to use as a Content Type for JSON data?

Answers:

  1. text/x-json
  2. text/javascript
  3. application/json
  4. application/x-javascript

74.What would be the output of the following code?
<?php
$arr = array(«foo»,
«bar»,
«baz»);
for ($i = 0; $i < count($arr); $i++) {
$item = $arr[$i];
}
echo «<pre>»;
print_r($item);
echo «</pre>»;
?>
Answers:

  1. Array ( [0] => foo [1] => bar [2] => baz )
  2. foot
  3. bar
  4. baz

75.Which of the following is the correct way to check if a session has already been started?

Answers:

  1. if ($_SERVER[“session_id”]) echo ‘session started’;
  2. if (session_id()) echo ‘session started’;
  3. if ($_SESSION[“session_id”]) echo ‘session started’;
  4. if ($GLOBALS[“session_id”]) echo ‘session started’;

76.What is the correct PHP command to use to catch any error messages within the code?

Answers:

  1. set_error(‘set_error’);
  2. set_error_handler(‘error_handler’);
  3. set_handler(‘set_handler’);
  4. set_exception(‘set_exception’);

77.What is the correct PHP command to use to catch any error messages within the code?

Answers:

  1. set_error(‘set_error’);
  2. set_error_handler(‘error_handler’);
  3. set_handler(‘set_handler’);
  4. set_exception(‘set_exception’);

78.What is wrong with the following code?

<?php
curl_setopt($ch, CURLOPT_URL, «http://www.example.com/»);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
?>
Answers:

  1. There is nothing wrong with the code.
  2. The cURL resource $ch has not been created using the curl_init() method.
  3. The $ch variable needs to be initialized as $ch=null;.
  4. The code will cause a parse error.

79.With what encoding does chr() work?

Answers:

  1. ASCII
  2. UTF-8
  3. UTF-16
  4. Implementation dependent
  5. None of these

80.Which of the following is not related to debugging in PHP?

Answers:

  1. PDO
  2. watch
  3. breakpoints
  4. call stack

81.Which of the following is not a predefined constant?

Answers:

  1. TRUE
  2. __FILE__
  3. FALSE
  4. NULL
  5. CONSTANT

82. What will be the output of the following code?
<?php
$str=»Hello»;
$test=»lo»;
echo substr_compare($str, $test, -strlen($test), strlen($test)) === 0;
?>
Answers:

  1. Syntax error
  2. 1
  3. FALSE
  4. 0

83. With the following code, will the word Hello be printed?
<?
//?>Hello
Answers:

  1. Yes
  2. No

84.Which of the following features are supported in PHP5?
Note: There may be more than one right answer.

Answers:

  1. Multiple Inheritance
  2. Embedded Database with SQLite
  3. Exceptions and Iterators
  4. Interoperable XML Tools

85.Consider the following statements:
I : while (expr) statement
II : while (expr): statement … endwhile;

Answers:

  1. I is correct and II is wrong.
  2. I is wrong and II is correct.
  3. Both I and II are wrong.
  4. Both I and II are wrong.

86.Which of the following type cast is not correct?
<?php
$fig = 23;
$varb1 = (real) $fig;
$varb2 = (double) $fig;
$varb3 = (decimal) $fig;
$varb4 = (bool) $fig;
?>
Answers:

  1. real
  2. double
  3. decimal
  4. boolean

87.Which of the following printing construct/function accepts multiple parameters?
Note: There may be more than one right answer.

Answers:

  1. echo
  2. print
  3. printf
  4. All of these

88.Which of the following is false about cURL?

Answers:

  1. cURL can be used to send plain text data to a remote server.
  2. cURL can be used to send both text as well as files using a single request.
  3. cURL can be used to send files to a remote server.
  4. Files cannot be sent using cURL.

28,077 total views, 118 views today

Top 10 popular test answers

Photoshop CS5 Extended Test 2016

Published by:

1. It is possible to avoid Adjustment Layers while working with the Healing Brush tool.

Answers:

  1. True
  2. False

2. What does the Use Global Light option in the Layer Style dialog box do when checked?

Answers:

  1. It indicates the lighting angle that has been used for every style that you added in your document.
  2. It shows the opacity that has been used for every style that you added in your document.
  3. It uses the same lighting angle in every style you add in your document.
  4. It indicates that the same opacity level will be used for every style you add in your document.

3. What do the Horizontal Type Mask Tool and Vertical Type Mask Tool do?

Answers:

  1. These tools create a layer mask when you click on stage to enter the text.
  2. These tools create normal text on screen without creating a new layer.
  3. These tools create a selection of whatever you type without creating a new layer.
  4. These tools do nothing special other than creating a simple type layer.

4. ____________________ is a grid-like mesh on your image that contains handles to distort the content the way you want.

Answers:

  1. Content Aware Scale
  2. Puppet Warp
  3. Mixer Brush
  4. There is no such tool available in Photoshop.

5. You can apply Brush, Eraser and Clone Stamp on vector based layers.

Answers:

  1. True
  2. False

6. How does the “Expansion Field” of Puppet Warp tool work?

Answers:

  1. It lets you expand or contract the outer edge of the mesh by a pixel value.
  2. It turns the mesh on or off.
  3. It lets you determine how deep the warping goes.
  4. It controls the spacing of mesh points.

7. ___________________is a process in which Photoshop responds to your size-change request either by adding or subtracting pixels.

Answers:

  1. Scale Styles
  2. Resampling
  3. Constrain proportions
  4. None of the above

8. Which of the following settings is/are available in the Lighting Effects dialog box?

Answers:

  1. Gloss
  2. Material
  3. Exposure
  4. All of the above

9. What purpose does the area marked in blue in the given image serve?

Answers:

  1. It lets you select between the various options available for workspace.
  2. It lets you select between the screen modes available in Photoshop.
  3. It lets you choose how you want your documents to appear on screen.
  4. None of the Above.

10. __________________filter helps to draw perspective planes or a mesh grid that can be used in editing.

Answers:

  1. Crosshatch
  2. Trace Contour
  3. Vanishing Point
  4. Graphic Pen

11. Bit depth controls the amount of color information that a pixel can hold.

Answers:

  1. True
  2. False

12. It is possible to convert a type layer into a shape layer.

Answers:

  1. True
  2. False

13. _____________ makes the pixels you are painting appear behind the pixels already on that layer, while ________________ makes the pixels you paint transparent in brush panel.

Answers:

  1. Airbrush, Brush Panel
  2. Opacity, Flow
  3. Behind mode, Clear mode
  4. None of the above

14. Which command lets you paste an image inside the selection you have made?

Answers:

  1. Paste Into
  2. Paste In Place
  3. Paste Outside
  4. All of the above

15. How do you use a shape with gradient as a mask as shown in the image above?

Answers:

  1. Mask the object. Select the shape layer and go to the Blending Options. Check Blend Interior Effects as a Group and uncheck Blend Clipped Layers as a Group.
  2. Mask the object. Select the shape layer and go to the Blending Options. Check Blend Clipped Layers as a Group and uncheck Blend Interior Effects as a Group.
  3. Mask the object. Select the shape layer and go to the Blending Options. Check Layer Mask Hide Effects.
  4. Mask the object. Select the shape layer and go to the Blending Options. Check Transparency Shape Layers and uncheck Vector Mask Hide Effects.

16. A gray warning symbol means that you are using a font that is not installed in your system, whereas a yellow warning symbol means that the document you have opened was created in a different version of Photoshop and that the text may get reflowed if you edit it.

Answers:

  1. True
  2. False

17. How do you write around any shape as shown in the image above?

Answers:

  1. Select Type tool>> Mouseover the shape or path and start writing when the cursor shape changes to type cursor with a curved line on it.
  2. Select Type tool>> Choose the Warp text option from the Options bar and choose the shape you want to give the text.
  3. Type the required text and transform it with the help of different transform tools to adjust it according to the shape.
  4. It is not possible to achieve this effect in Photoshop.

18. Which of the following values define the maximum hardness and softness limits of the round brush tip?

Answers:

  1. 50, 75
  2. 0, 50
  3. 0, 100
  4. 50, 100

19. What option in the Character panel will you choose for moving the text away or toward the shape it is bound to?

Answers:

  1. Kerning
  2. Leading
  3. Baseline shift
  4. Tracking

20. What effect will checking the Constrain Proportions option shown above have on the size of an image?

Answers:

  1. It will let you change the width and height of the document independently.
  2. It will fix the width and the height of the document.
  3. It will scale the image proportionally.
  4. It has nothing to do with the size of the document.

21. Using Render filters, you can :

Answers:

  1. sharply define a selection.
  2. create cloud patterns.
  3. remove noise.
  4. geometrically distort an image.

22. Which method of Resample Image gives the lowest image quality?

Answers:

  1. Bicubic Sharper
  2. Bilinear
  3. Nearest Neighbor
  4. Bicubic

23. Which of the following options will you choose if you want to increase or decrease the size of the mask while editing the mask?

Answers:

  1. Density
  2. Apply Mask
  3. Mask Edge
  4. Load selection from mask

24. ____________________is the process of converting vector based layers into pixel based layers.

Answers:

  1. Rasterizing
  2. Masking
  3. Convert to Smart Object
  4. Link layers

25. _________________control how pixels on different layers interact with each other.

Answers:

  1. Gradient Mask
  2. Channels
  3. Layer Blend Modes
  4. Path

26. In the Screen layer blend mode, Photoshop multiplies the opposite of the blend and base colors, making everything very light.

Answers:

  1. True
  2. False

27. Filters can affect multiple layers simultaneously.

Answers:

  1. True
  2. False

28. What do the width and height of the histogram in levels adjustments represents?

Answers:

  1. Brightness, Contrast
  2. Tonal range from darkest to lightest, number of pixels at particular level of brightness
  3. Hue/Saturation, Lightness
  4. None of the above

29. Levels adjustments do NOT change the intensity levels of your shadows, midtones, and highlights.

Answers:

  1. True
  2. False

30. Anti-aliasing allows you to smoothen the edges of a selection as well as smoothen text.

Answers:

  1. True
  2. False

31. Smooth and Corner are two kinds of anchor points in Photoshop.

Answers:

  1. True
  2. False

32. What option will you choose if you want to merge a selected layer with the layer lying immediately below it?

Answers:

  1. Merge linked
  2. Merge selected
  3. Merge down
  4. Merge visible

33. What are the names of the tools marked in red in the image above?

Answers:

  1. New path, Delete path
  2. Load path as selection, Make work path from selection
  3. Fill path with foreground color, Stroke path with brush
  4. None of the above

34. Revert command reverts the document to its most recent saved state.

Answers:

  1. True
  2. False

35. The Fractional widths command in the Character panel rounds character widths to the nearest part of a pixel instead of the normal whole pixel.

Answers:

  1. True
  2. False

36. Duotone refers to an image that’s made from two ink colors.

Answers:

  1. True
  2. False

37. Which layer blend mode lightens the image by decreasing its contrast?

Answers:

  1. Overlay
  2. Color Burn
  3. Vivid Light
  4. Color Dodge

38. Which option in Stamp tool will you select if you want to clone all the layers simultaneously?

Answers:

  1. Opacity
  2. Flow
  3. Sample All Layers
  4. Mode

39. Alpha Channels are basically grayscale representations of saved selections.

Answers:

  1. True
  2. False

40. ________________ does NOT affect the original quality and size even if you resize the object.

Answers:

  1. Transform
  2. Clipping Mask
  3. Smart Object
  4. Rasterizing

41. Images in which mode are called 1-bit images?

Answers:

  1. CMYK color mode
  2. RGB color mode
  3. Bitmap color mode
  4. High Dynamic Range

42. What are anchor points?

Answers:

  1. They define the ending points of a path and makes it closed path.
  2. They define the starting point of any shape.
  3. They are the control points which gives shape to each segment of a line.
  4. They just define the outer boundary of any shape.

43. Channels contain all the color information of a Photoshop document.

Answers:

  1. True
  2. False

44. You can define the area that you want to crop out of any image using the Crop tool.

Answers:

  1. True
  2. False

45. Which of the following action sequences will make the above given dialog box appear on screen?

Answers:

  1. File>Scripts>Load Images into Stack
  2. File>Import>Video Frames to Layers
  3. File>Automate>Photomerge
  4. File>Scripts>Image Processor

46. Content Aware Scale tool can work on the locked background layer.

Answers:

  1. True
  2. False

47. Which of the following are image sharpening techniques available in Photoshop?

Answers:

  1. High Pass
  2. Unsharp Mask
  3. Smart Sharpen
  4. All of the above

48. The Mode pop-up menu of Puppet warp tells Photoshop how stretchable you want the mesh to be.

Answers:

  1. True
  2. False

49. ____________________ helps change the spacing between all letters in a word by the same amount.

Answers:

  1. Horizontal scale
  2. Leading
  3. Kerning
  4. Tracking

50. What is the subtractive color system used for?

Answers:

  1. For printing colors
  2. For onscreen colors
  3. Both a and b
  4. None of the above

51. What will be the default blending mode of a layer group?

Answers:

  1. Hard Mix
  2. Pass Through
  3. Dissolve
  4. Multiply

52. Which among the following is measured in terms of pixels per inch in any Photoshop document?

Answers:

  1. Bit
  2. Bit depth
  3. Pixel Aspect Ratio
  4. Resolution

53. Which tool of Photoshop makes the image shown above appear on screen?

Answers:

  1. Levels
  2. Curves
  3. Vibrance
  4. Threshold

54. Proximity Match option in Spot Healing Brush tells it to use pixels just outside the edge of your cursor to fix spots.

Answers:

  1. True
  2. False

55. The Path Selection tool lets you select individual nodes on the path, whereas the Direct Selection tool lets you the select path as a whole.

Answers:

  1. True
  2. False

56. With which options can you get the effects shown in the image above?

Answers:

  1. Drop Shadow, Inner Shadow, Bevel and Emboss, Pattern Overlay
  2. Inner Shadow, Bevel and Emboss, Satin, Stroke
  3. Bevel and Emboss, Satin, Stroke, Gradient Overlay
  4. Outer Glow, Color Overlay, Stroke, Inner Glow

57. __________________ appears when you check the Tint checkbox, as shown in the image above, in the Adjustments panel>> Black & White layer.

Answers:

  1. Sepia tone
  2. Fake duotone
  3. Hue/Saturation
  4. Color Balance

58. What file formats are available to you when you save a file using the Save for Web & Devices dialog box?

Answers:

  1. JPEG
  2. PNG-8
  3. WBMP
  4. All of the above

59. How many drawing modes are available in Photoshop?

Answers:

  1. 3
  2. 5
  3. 4
  4. 2

60. How many channels do lab colors have?

Answers:

  1. 5
  2. 2
  3. 4
  4. 3

61. Which of the following options are contained in the Brush dialog box?

Answers:

  1. Scattering
  2. Color Dynamics
  3. Transfer
  4. All of the above

62. Image Processor option is used for resizing the Images in masses.

Answers:

  1. True
  2. False

63. Onscreen images are called ___________________because they are made up of red, blue, green light.

Answers:

  1. Colored Images
  2. Vector Images
  3. Raster Images
  4. Composite Images

64. What does the Baseline option in the Curves Display Options dialog box do?

Answers:

  1. It lets you see a separate curve for each channel in your document.
  2. It tells Photoshop to display the original curve as a straight line.
  3. It determines whether Photoshop displays a light-gray version of your image’s histogram behind the grid.
  4. It makes Photoshop display horizontal and vertical “helper” lines when you drag a point to help you align it properly.

65. __________________ is/are available only if you have an alpha channel selected.

Answers:

  1. Channel Options
  2. Split Channels
  3. Panel Options
  4. Spot Channel

66. Which option allows you to change the Background layer’s appearance when part of your image is transparent?

Answers:

  1. Opacity
  2. Transparency
  3. Performance
  4. Interface

67. Which of the given image(s) belongs to the red channel if the source image is in RGB mode?
Answers:

  1. First
  2. Second
  3. Third
  4. None of the above

68. How many drawing modes are available in Photoshop, when you work with shape or pen tools?

Answers:

  1. 3
  2. 5
  3. 4
  4. 2

69. Which of the following values define the maximum softness and hardness limits of the round brush tip?

Answers:

  1. 50, 75
  2. 0, 50
  3. 0, 100
  4. 50, 100

70. Which “layer blend mode” lightens the image by increasing its contrast?

Answers:

  1. Overlay
  2. Color Burn
  3. Vivid Light
  4. Color Dodge

9,157 total views, 21 views today

Top 10 popular test answers

Android Programming Test 2016

Published by:

1. Which of the following are UI elements that you can use in a window in an Android application?

Answers:

  1. TextBox
  2. TextView
  3. TextField
  4. TextElement
  5. EditText
  6. RichText

2. What is the correct way to fix if checking the status of the GPS_PROVIDER throws SecurityException?

Answers:

  1. request permission for ACCESS_COARSE_LOCATION
  2. request permission for ACCESS_FINE_LOCATION
  3. request permission for INSTALL_LOCATION_PROVIDER
  4. None of the above

3. Which of the following is not Content Provider?

Answers:

  1. Contacts
  2. Contacts
  3. Shared Preferences
  4. MediaStore
  5. Bookmarks
  6. Settings

4. Which of the following statements are correct with regards to signing applications?

a) All applications must be signed.
b) No certificate authority is needed.
c) When releasing application special debug key that is created by the Android SDK build tools can be used.

Answers:

  1. a) and b) are true
  2. a) and c) are true
  3. b) and c) are true
  4. all statements are true

5. What does the following code do?

SensorManager mgr = (SensorManager) getSystemService(SENSOR_SERVICE);
List<Sensor> sensors = mgr.getSensorList(Sensor.TYPE_ALL);
for (Sensor sensor : sensors) {
System.out.println(“”+sensor.getName());
}

Answers:

  1. prints names of all available sensors in device
  2. prints names of all available sensor types in device
  3. prints names of all sensors which are not available
  4. none of above

6. What does the following code do?

try {
String token = GoogleAuthUtil.getToken(this, email, “https://www.googleapis.com/auth/devstorage.read_only”);
System.out.println(token);
} catch (IOException e) {
System.out.println(“IOException”);
} catch (UserRecoverableAuthException e) {
System.out.println(“UserRecoverableAuthException”);
} catch (GoogleAuthException e) {
System.out.println(“GoogleAuthException”);
}

Answers:

  1. prints token
  2. prints IOException
  3. prints UserRecoverableAuthException
  4. prints GoogleAuthException

7. Which of the following is correct to use for data transfer regularly and efficiently, but not instantaneously?

Answers:

  1. AsyncTask
  2. IntentService
  3. Sync adapters
  4. All of these

8. What is the ListActivity class used for?

Answers:

  1. Create a view to display a list of items from a data source.
  2. List all the activities currently running on the Android device.
  3. List all the activites that are installed on the Android device.
  4. List the activities whose IntentFilters match with a particular Intent type.

9. Using a content provider, which of the following operations are able to perform?
a) create
b) read
c) update
d) delete

Answers:

  1. a, b and c
  2. b, c and d
  3. all of these
  4. none of these

10. Which of the following widgets helps to embed images in activities?

Answers:

  1. ImageView
  2. ImageButton
  3. both of above
  4. none of these

11. What is the best way of opening camera as sub-activity?

Answers:

  1. Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivity(takePictureIntent);
  2. Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) != null) { startActivityForResult(takePictureIntent, 1); }
  3. Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(takePictureIntent, 1);
  4. Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) != null) { startActivityForResult(takePictureIntent, -1); }

12. What is the correct way to restrict app visibility on Google Play to devices that have a camera?

Answers:

  1. <uses-feature android:name=”android.hardware.camera”/>
  2. <uses-feature android:name=”android.hardware.camera” android:required=”true” />
  3. <uses-feature android:name=”android.hardware.camera.front” android:required=”true” />
  4. <uses-permission android:name=”android.permission.CAMERA”/>

13. Which of the following sensors is only hardware-based?

Answers:

  1. linear acceleration sensor
  2. gravity sensor
  3. rotation vector sensor
  4. accelerometer sensor

14. Which of the following formats is not supported in Android?

Answers:

  1. MP4
  2. MPEG
  3. AVI
  4. MIDI

15. Which of the following permissions and configurations must be added in manifest file for implementing GCM Client?

A) com.google.android.c2dm.permission.RECEIVE
B) android.permission.INTERNET
C) android.permission.GET_ACCOUNTS
D) android.permission.WAKE_LOCK
E) applicationPackage + “.permission.C2D_MESSAGE”
F) A receiver for com.google.android.c2dm.intent.RECEIVE, with the category set as applicationPackage. The receiver should require the com.google.android.c2dm.SEND permission

Answers:

  1. A, B, C and D
  2. C, D, E and F
  3. A, B, E and F
  4. all of these

16. Which of the following permissons is needed to perform the network operations through internet?
a) INTERNET
b) ACCESS_NETWORK_STATE

Answers:

  1. a
  2. b
  3. both
  4. none

17. Consider the following snippet of code:

@Override
protected void onStop
{
Super.onStop();
SharedPreferences setting = getSharedPreferences(“MyPrefs”, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean(“MyBool”, true);

<some more code here>
}

Which of the following should be used <some more code here>?

Answers:

  1. editor.save(); editor.close();
  2. editor.save(); editor.finish();
  3. editor.commit();
  4. editor.save();
  5. editor.close();
  6. editor.finish();

18. What does the following statement define?

It provides query(), insert(), update(), and delete() methods for accessing data from a content provider and invokes identically-named methods on an instance of a concrete content provider.

Answers:

  1. CursorLoader
  2. ContentResolver
  3. ContentProvider
  4. Loader

19. What is the advantage of using AsyncTaskLoader instead of AsyncTask?

Answers:

  1. a bit easier to work with
  2. the possibility easily update progress bar
  3. no comparison, because it implements completely different functionality
  4. less work with the configuration of applicationM

20. What does the following code do?

public boolean isOnline() {
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
return (networkInfo != null && networkInfo.isConnected());
}

Answers:

  1. checking Network connection.
  2. checking only WIFI network connectivity.
  3. checking only Bluetooth data connection.
  4. checking only Ethernet data connection

21. Which of the following statements are correct with regards to running of the Sync Adapter?

A) Running sync adapter in response to a user request.
B) Running sync adapter periodically by setting a period of time to wait between runs, or by running it at certain times of the day, or both.

Answers:

  1. Statement A is true, while Statement B is false.
  2. Statement B is true, while Statement A is false.
  3. Both statements are true.
  4. Both statements are false.

22. Which of the following statements are correct with regards to calling place GoogleAuthUtil.getToken()?
A) call getToken() on the UI thread
B) call getToken() on AsyncTask

Answers:

  1. Statement A is true, while Statement B is false.
  2. Statement B is true, while Statement A is false.
  3. Both statements are true.
  4. Both statements are false.

23. Which of the following protocols are provided by Google for GCM Connection Servers?
A) HTTP
B) XMPP
C) SOAP
D) RMI

Answers:

  1. A and B
  2. A, B, C
  3. C, D
  4. all of these

24. Which of the following 4 classes does not relate to others?

ApplicationInfo, SyncInfo, ActivityInfo, PackageInfo

Answers:

  1. ApplicationInfo
  2. SyncInfo
  3. ActivityInfo
  4. PackageInfo

25. Which of the following are valid ways to deploy an Android application to a device?

Answers:

  • Using the “adb install /path/to/apk” command from the command prompt/terminal, when USB Debugging Mode is enabled in the device.
  • Exporting and signing the package, then browsing it to install.
  • Launching the application from an IDE, when USB Debugging Mode is enabled in the device.
  • All of these.

26. Which of the following classes is not used in working with database?

Answers:

  1. SQLiteOpenHelper
  2. SQLiteDatabase
  3. ContentProvider
  4. DatabaseHelper

27. Consider the XML fragment below, which is taken from one of the files in an Android project:
<MyElement xmlns:”http://schemas.androd.com/apk/res/android”
android:layout_width = “fill_parent”
android:layout_height = “fill_parent”
android:text = “Some Text”>
</MyElement>
Which of the following are true about the XML fragment above?

Answers:

  1. It is taken from the manifest XML file of the Android project.
  2. It is taken from an XML file used to define a view.
  3. It is taken from the package file (.apk) of the Android project.
  4. The xmlns: attribute is a compulsory attribute.
  5. If this is not the outer most tag in the XML file then it need not contain the xmlns: attribute.
  6. MyElement should be the name of a class derived, directly or indirectly, from the View class.

28. Which of the following statement is correct regarding StrictMode?

Answers:

  1. StrictMode detects improper layouts
  2. StrictMode detects operation which blocks UI
  3. StrictMode detects the speed of the connection
  4. All of the above

29. Consider the code snippet below:
MediaPlayer mp = new MediaPlayer();

mp.setDataSource(PATH_TO_FILE);

<Some code here>

mp.start();
Which of the following should be placed at <Some code here>?

Answers:

  1. mp.prepare();
  2. mp.prepareAsync();
  3. mp.loadMedia();
  4. mp.loadSource();
  5. mp.loadSource(); mp.prepare();
  6. No code is required at <Some code here> to start playback.

30. Consider the code snippet below:

public class MyReceiver extends PhoneStateIntentReceiver

{

@Override

public void onReceiveIntent(Context context, Intent intent)

{

if (intent.action == Intent.CALL_ACTION)

{

}

}

}

Assuming that notifyPhoneCallState has been called to enable MyReceiver to receive notifications about the phone call states, in which of the following cases will the code in get executed?

Answers:

  1. When the device receives an incoming phone call.
  2. When an outgoing phone call is initiated on the device.
  3. When the user presses the CALL button on the device.
  4. The code in will never get executed.

31. Which of the following are true about enabling/disabling menu items from an Activity class?

Answers:

  1. onCreateOptionsMenu can be used to enable/disable some menu items in an Android application.
  2. onPrepareOptionsMenu can be used to enable/disable some menu items in an Android application.
  3. onShowOptionsMenu can be used to enable/disable some menu items in an Android application.
  4. The menu items in an Android application cannot be disabled.

32. Which of the following should be used to save the unsaved data and release resources being used by an Android application?

Answers:

  1. Activity.onStop()
  2. Activity.onPause()
  3. Activity.onDestroy()
  4. Activity.onShutdown()
  5. Activity.onFreeze()

33. Which of the following statements are correct with regards to publishing updates of apps on Google Play?

Answers:

  1. The android:versionCode attribute in the manifest file must be incremented and the APK file must be signed with the same private key.
  2. The android:versionCode attribute in the manifest file must be same and the APK file must be signed with the same private key.
  3. The android:versionCode attribute in the manifest file must be incremented and the APK file must be signed with the new private key.
  4. The android:versionCode attribute in the manifest file must be same and the APK file must be signed with the new private key.

34. Which of the following would you have to include in your project to use the SimpleAdapter class?

Answers:

  1. import android.content;
  2. import android.widget;
  3. import android.database;
  4. import android.database.sqlite;
  5. import android.util;

35. Which of the following is/are appropriate for saving the state of an Android application?

Answers:

  1. Activity.onFreeze()
  2. Activity.onPause()
  3. Activity.onStop()
  4. Activity.onDestroy()

36. Which of the following is the parent class for the main application class in an Android application that has a user interface?

Answers:

  1. MIDLet
  2. AndroidApp
  3. Activity
  4. AppLet
  5. Application

37. Which of the following can be used to bind data from an SQL database to a ListView in an Android application?

Answers:

  1. SimpleCursor
  2. SimpleCursorAdapter
  3. SimpleAdapter
  4. SQLiteCursor
  5. SQLLiteAdapter

38. Consider the code snippet below:

MediaPlayer mp = new MediaPlayer();

mp.setDataSource(PATH_TO_FILE);

<Some code here>

mp.start();

Which of the following should be placed at <Some code here>?

Answers:

  1. mp.prepare();
  2. mp.prepareAsync();
  3. mp.loadMedia();
  4. mp.loadSource();
  5. mp.loadSource(); mp.prepare();
  6. No code is required at <Some code here> to start playback.

39. Which of the following packages provide the classes required to manage the Bluetooth functionality on an Android device?

Answers:

  1. android.hardware
  2. android.bluetooth
  3. android.bluez
  4. org.bluez

40. Which of the following can be accomplished by using the TelephoneNumberUtil class?

Answers:

  1. Save a phone number to the contacts in the phone device.
  2. Retrieve a phone number from the contacts in the phone device.
  3. Delete a phone number from the contacts in the phone device.
  4. Format an international telephone number.
  5. Setting and retrieving the call forwarding phone number on the phone device.

41. Which of the following is the best way to request user permission if an Android application receives location updates from both NETWORK_PROVIDER and GPS_PROVIDER?

Answers:

  1. Adding this line to the Android manifest file: <uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION” />
  2. Adding these two lines to the Android manifest file: <uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION” /> <uses-permission android:name=”android.permission.ACCESS_COARSE_LOCATION” />
  3. Adding this line to the Android manifest file: <uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION” />
  4. Adding this line to the Android manifest file: <uses-permission android:name=”android.permission.CONTROL_LOCATION_UPDATES” />

42. Which of the following are true about PhoneStateIntentReceiver.notifyPhoneCallState?

Answers:

  1. notifyPhoneCallState has to be called if your application wishes to receive a notification about an incoming phone call.
  2. notifyPhoneCallState is a call back function that is called when the call state changes.
  3. notifyPhoneCallState is called to initiate a call from the device.
  4. notifyPhoneCallState is used to send notifications about call states.
  5. notifyPhoneCallState gets called when the device receives an incoming phone call.

43. Which of the following statements are correct with regards to Content Providers?

A) A content provider allows applications to access data.
B) A content provider must be declared in the AndroidManifest.xml file.

Answers:

  1. Statement A is true, while Statement B is false.
  2. Statement B is true, while Statement A is false.
  3. Both statements are true.
  4. Both statements are false.

44. Which of the following functions will return all available Content Providers?

Answers:

  1. List<ProviderInfo> returnList = new ArrayList<ProvderInfo>(); for (PackageInfo pack : getPackageManager().getInstalledPackages(PackageManager.GET_PROVIDERS)) { ProviderInfo[] providers = pack.providers; if (providers != null) { returnList.addAll(Arrays.asList(providers)); } } return returnList;
  2. return getContext().getPackageManager().queryContentProviders(“com.google”, Process.myUid(), 0);
  3. List<ActivityInfo> returnList = new ArrayList<ActivityInfo>(); for (PackageInfo pack : getPackageManager().getInstalledPackages(PackageManager.GET_RECEIVERS)) { ActivityInfo[] providers = pack.receivers; if (providers != null) { returnList.addAll(Arrays.asList(providers)); } } return returnList;
  4. None of these.

45. What is the purpose of the ContentProvider class?

Answers:

  1. To play rich media content files.
  2. To create and publish rich media files.
  3. To share data between Android applications.
  4. To access the global information about an application environment.
  5. To maintain global application state.

46. Which of the following are true?

Answers:

  1. Both startActivity and startSubActivity start an activity synchronously.
  2. Both startActivity and startActivityForResults start an activity asynchronously.
  3. startActivity is an asynchronous call, but startSubActivity is synchronous.
  4. startActivity is a synchronous call, but startSubActivity is asynchronous.

47. Which of the following is the immediate base class for Activity and Service classes?

Answers:

  1. Application
  2. ApplicationContext
  3. Context
  4. Component
  5. Object

48. Which of the following are classes that can be used to handle the Bluetooth functionality on a device?

Answers:

  1. Adapte
  2. Manage
  3. Matche
  4. BluetoothAdapte

49. How many expansion files can an APK file have? Select all correct options.

Answers:

  1. one
  2. two
  3. three
  4. four

50. Which of the following are Android build modes?

Answers:

  1. Debug mode
  2. Release mode
  3. Production mode
  4. Development mode

51. What is “Android-dx”?

Answers:

  1. A command line tool to create Android project files.
  2. A framework to create unit tests for Android projects.
  3. A resource editor to create user interface for Android applications.
  4. A tool to generate Android byte code from .class files.
  5. An emulator to execute and debug Android projects.

52. Consider the XML fragment below, which is taken from one of the files in an Android project:

<MyElement xmlns:”http://schemas.androd.com/apk/res/android”

android:layout_width = “fill_parent”

android:layout_height = “fill_parent”

android:text = “Some Text”>

</MyElement>

Which of the following are true about the XML fragment above?

Answers:

  1. It is taken from the manifest xml file of the Android project.
  2. It is taken from an XML file used to define a view.
  3. It is taken from the package file (.apk) of the Android project.
  4. The xmlns: attribute is a compulsory attribute.
  5. If this is not the outer most tag in the XML file then it need not contain the xmlns: attribute.
  6. MyElement should be the name of a class derived, directly or indirectly, from the View class.

53. Which of the following fields of the Message class should be used to store custom message codes about the Message?

Answers:

  1. tag
  2. what
  3. arg1
  4. arg2
  5. userData

54. Suppose Screen1 is the main screen of an Android application MyAndroid. Now if another screen, Screen2 has to be opened from Screen1, then which of the following are true?

Answers:

  1. Screen2 has to be a part of MyAndroid.
  2. Screen2 can exist in any other Android application installed on the device.
  3. Screen2 will always be launched asynchronously.
  4. Screen2 can be launched synchronously.
  5. Screen2 can return a result code to Screen1 if launched with startActivity.
  6. Screen2 can return a result code to Screen1 if launched with startActivityForResult.

55. Select the two function calls that can be used to start a Service from your Android application?

Answers:

  1. bindService
  2. startService
  3. runService
  4. startActivity

56. Which of the following Integrated Development Environments can be used for developing software applications for the Android platform?

Answers:

  1. Android IDE
  2. Eclipse
  3. Visual Studio 2005
  4. Visual Studio 2008

57. Which of the following can you use to display an HTML web page in an Android application?

Answers:

  1. WebBrowser
  2. BrowserView
  3. WebView
  4. Browser
  5. HtmlView

58. Consider the following snippet of code:
<font size =2>
@Override
protected void onStop
{
Super.onStop();
SharedPreferences setting = getSharedPreferences(“MyPrefs”, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean(“MyBool”, true);

<some more code here>
}

Which of the following should be used <some more code here>?
</font

Answers:

  1. editor.save(); editor.close();
  2. editor.save(); editor.finish();
  3. editor.commit();
  4. editor.save();
  5. editor.close();
  6. editor.finish();

59. What is “Android-Positron”?

Answers:

  1. A command line tool to create Android project files.
  2. A framework to create unit tests for Android projects.
  3. A resource editor to create user interface for Android applications.
  4. A tool to generate Android byte code from .class files.
  5. An emulator to execute and debug Android projects.

60. Which of the following can you use to add items to the screen menu?

Answers:

  1. Activity.onCreate
  2. Activity.onCreateOptionsMenu
  3. Constructor of the Activity class.
  4. Activity.onCreateMenu
  5. Activity.onStart
  6. Activity.onPrepareOptionsMenu

61. Which of the following is not a life-cycle methods of an Activity that can be implemented to perform various operations during the lifetime of an Activity?

Answers:

  1. onCreate
  2. onInit
  3. onCompleteThaw
  4. onRestart

62. What is the interface Spannable used for?

Answers:

  1. Manipulate text that can span across multiple pages.
  2. Manipulate text that can span across multiple TextView windows.
  3. This is the interface for text to which markup objects can be attached and detached.
  4. String parsing.

63. What is correct regarding GCM – Google Cloud Messaging service?

Answers:

  1. It does server to device communication.
  2. It does device to server communication.
  3. It does device to server communication and vice versa.
  4. It does device to device communication.

64. Which of the following procedures will get the package name of an APK file?

Answers:

  1. Looking for the package attribute’s value of the <manifest> element in the manifest file.
  2. Executing the command, “pm list packages -f”, in the ADB shell.
  3. Programmatically, using PackageManager in an installed Android app.
  4. Using the AAPT platform tool, “aapt dump badging apkName.apk”.

65. What is the maximum supported file size for a single APK file (excluding expansion packages) in the Google Play Store?
Answers:

  1. 50MB
  2. 2GB
  3. 30MB
  4. unlimited

66. What is Android?
Answers:

  1. A new programming language that can be used to develop applications for mobile devices.
  2. A new IDE that can be used to develop applications for mobile devices.
  3. A software stack for mobile devices that includes an operating system, middleware and key applications.
  4. A new mobile device developed by Google.

67. Which of the following can be used to navigate between screens of different Android applications?

Answers:

  1. Binde
  2. Flow
  3. Navigate
  4. Intent
  5. ApplicationContext

68. Which of the following are valid features that you can request using requestWindowFeature?

Answers:

  1. FEATURE_NO_TITLE
  2. FEATURE_NO_ICON
  3. FEATURE_RIGHT_ICON
  4. FEATURE_NO_MENU
  5. FEATURE_TRANSPARENT_WINDOW

69. Which of the following are true?

Answers:

  1. startActivity and startActivityForResult can both be used to start a new activity from your activity class.
  2. Only startActivityForResult can be used to launch a new activity from your activity class.
  3. startActivity(myIntent); and startActivityForResult(myIntent, -1); have the same result.
  4. startActivity(myIntent); and startActivityForResult(myIntent, 0); have the same result.
  5. When startActivity is used to launch a new activity from your activity class then your activity class gets notified when the new activity is completed.
  6. When startActivityForResult is used to launch a new activity from your activity class then your activity class gets notified when the new activity is completed.

70. Which of the following can you use to display a progress bar in an Android application?

Answers:

  1. ProgressBa
  2. ProgressDialog
  3. ProgressItem

71. Which of the following can be used to handle commands from menu items in an Android application?

Answers:

  1. commandAction
  2. onMenuItem
  3. onMenuItemSelected
  4. onMenuItemClicked
  5. onOptionsItemSelected

72. Fill in the blank:

Once an app is published, the ________ cannot be changed. It should be unique for each APK.

Answers:

  1. private key
  2. package name
  3. main activity
  4. APK file name

73. Which of the following attributes in the manifest file defines version information of an application for the Google Play Store (as opposed to defining version information for display to users)?

Answers:

  1. android:versionCode
  2. android:versionName
  3. android:targetSdkVersion
  4. android:maxSdkVersion

74. Which of the following are true about Intent.CALL_ACTION and Intent.DIAL_ACTION?

Answers:

  1. Both of them are used to dial a phone number on the device.
  2. Intent.action == Intent.CALL_ACTION is true when a phone call is received on the device.
  3. Intent.action = Intent.CALL_ACTION is used when a phone number is to be dialled without showing a UI on the device.
  4. Intent.action = Intent.DIAL_ACTION is used when a phone number is to be dialled without showing a UI on the device.
  5. Intent.action = Intent.CALL_ACTION is used when a phone number is to be dialled without the user having to explicitly initiate the call.
  6. Intent.action = Intent.DIAL_ACTION is used when a phone number is to be dialled without the user having to explicitly initiate the call.

75. Suppose MyView is a class derived from View and mView is a variable of type MyView. Which of the following should be used to display mView when the Android application is started?

Answers:

  1. Call setCurrentView(mView) in the startApp() of the main application class.
  2. Call setContentView(mView) in the startApp() of the main application class.
  3. Call setContentView(mView) in the onStart() of the main application class.
  4. Call setContentView(mView) in the onCreate() of the main application class.

76. Which of the following programming languages can be used to develop software applications for the Android platform?

Answers:

  1. Java
  2. C# with .NET Compact Framework for mobile devices.
  3. C programming language.
  4. Android programming language.

77. Which of the following would you have to include in your project to use the APIs and classes required to access the camera on the mobile device?

Answers:

  1. import android.drivers;
  2. import android.hardware.camera;
  3. import android.camera;
  4. import android.util;
  5. import android.hardware;

78. What is “Android-activityCreator”?

Answers:

  1. A command line tool to create Android project files.
  2. A framework to create unit tests for Android projects.
  3. A resource editor to create user interface for Android applications.
  4. A tool to generate Android byte code from .class files.
  5. An emulator to execute and debug Android projects.

79. What is the maximum supported size for a single expansion file in the Google Play Store?

Answers:

  1. 50MB
  2. 2GB
  3. 30MB
  4. unlimited

80. Which of the following tools can be used to reduce apk package size?

Answers:

  1. lint
  2. ProGuard
  3. zipalign
  4. etc1tool

10,935 total views, 74 views today

Top 10 popular test answers

English Spelling Test (U.S. Version) 2016

Published by:

1. Identify the misspelled word in the list below.

Answers:

  1. Pageant
  2. Poignant
  3. Plummage
  4. Priggish

2. Choose the correct spelling of the word from the options below.

Answers:

  1. Persue
  2. Parsue
  3. Persou
  4. Pursue

3. Complete the following sentence by choosing the correct spelling of the missing word.

The judge granted the reluctant witness complete ____________ from prosecution for his part in the crime.

Answers:

  1. amnesty
  2. amnasty
  3. anmesty
  4. emnesty

4. Choose the correct spelling of the word from the options below.

Answers:

  1. Vacuum
  2. Vaccuum
  3. Vacumm
  4. Vaccum

5. Complete the following sentence by choosing the correct spelling of the missing word.

Arthur spent hours admiring the gothic ____________of all those French cathedrals.

Answers:

  1. architecture
  2. arkhitecture
  3. arcitecture
  4. arckitecture

6. Choose the correct spelling of the word from the options below.

Answers:

  1. Forfiet
  2. Forfeit
  3. Forefeit
  4. Fourfit

7. Complete the following sentence by choosing the correct spelling of the missing word.

The waitress brought me a plate of squid even though I _____________ asked for clams.

Answers:

  1. specificaly
  2. specifically
  3. specifycally
  4. specificly

8. Choose the correct spelling of the word from the options below.

Answers:

  1. Posess
  2. Poesess
  3. Possess
  4. Pozess

9. Choose the correct spelling of the word from the options below.

Answers:

  1. Idiosyncracy
  2. Idiosincrasy
  3. Idiosyncrasy
  4. Ideosyncracy

10. Choose the correct spelling of the word from the options below.

Answers:

  1. Manoeuvar
  2. Manouver
  3. Maneuver
  4. Manuver

11. Identify the misspelled word in the list below.

Answers:

  1. CouncelorM
  2. Condescend
  3. Camouflage
  4. Criticize

12. Complete the following sentence by choosing the correct spelling of the missing word.

Sam _________ a successful political campaign.

Answers:

  1. orchestraited
  2. orchestrated
  3. orchestreated
  4. orcestrated

13. Identify the misspelled word in the list below.

Answers:

  1. Rhythmical
  2. Reminiscence
  3. Rheumatism
  4. Resevoir

14. Choose the correct spelling of the word from the options below.

Answers:

  1. Reminiscience
  2. Reminiscence
  3. Reminescence
  4. Reminisense

15. Identify the misspelled word in the list below.

Answers:

  1. Yacht
  2. Youthful
  3. Yeilding
  4. Yesterday

16. Identify the misspelled word in the list below.

Answers:

  1. Wierd
  2. Wired
  3. Whined
  4. Willful

17. Choose the correct spelling of the word from the options below.

Answers:

  1. Embarassment
  2. Embrassement
  3. Embarrasment
  4. Embarrassment

18. Complete the following sentence by choosing the correct spelling of the missing word.

He __________ a summer house, an exercise bike, and a hamster in the divorce settlement.

Answers:

  1. accquired
  2. ecquired
  3. acquired
  4. akquired

19. Identify the misspelled word in the list below.

Answers:

  1. Cachet
  2. Connoisseur
  3. Charateristic
  4. Catastrophe

20. Choose the correct spelling of the word from the options below.

Answers:

  1. Adress
  2. Addrress
  3. Addres
  4. Address

21. Choose the correct spelling of the word from the options below.

Answers:

  1. Temperamental
  2. Tempermental
  3. Temperamentle
  4. Temparamental

22. Identify the misspelled word in the list below.

Answers:

  1. Accomodate
  2. Analyze
  3. Acknowledgment
  4. Asterisk

23. Choose the correct spelling of the word from the options below.

Answers:

  1. Heinous
  2. Henous
  3. Heinus

24. Complete the following sentence by choosing the correct spelling of the missing word.

The protesters hurled ___________ insults at us as we walked by.

Answers:

  1. vicous
  2. vicious
  3. vicoius
  4. vicius

25. Choose the correct spelling of the word from the options below.

Answers:

  1. Gauge
  2. Gaje
  3. Guage
  4. Gaige

26. Complete the following sentence by choosing the correct spelling of the missing word.

Their relationship was plagued by __________ problems.

Answers:

  1. perpetual
  2. perpechual
  3. purpetual
  4. perptual

27. Choose the correct spelling of the word from the options below.

Answers:

  1. Excesive
  2. Exccesive
  3. Excessive
  4. Exceesive

28. Choose the correct spelling of the word from the options below.

Answers:

  1. Priveledge
  2. Privilage
  3. Privilege
  4. Privelege

29. Complete the following sentence by choosing the correct spelling of the missing word.

The purpose of your report should be to ___________ the most relevant facts, not to obscure them.

Answers:

  1. illumenate
  2. iluminate
  3. illuminate
  4. elluminate

30. Complete the following sentence by choosing the correct spelling of the missing word.

On the ____________ day of Christmas, Lucy was annoyed to find her yard full of noisy drummers drumming.

Answers:

  1. twelvth
  2. twelfth
  3. twelfeth
  4. twelth

31. Choose the correct spelling of the word from the options below.

Answers:

  1. Exhilirate
  2. Exhilarate
  3. Exhilireat
  4. Exhilrate

32. Choose the correct spelling of the word from the options below.

Answers:

  1. Bureaucrasy
  2. Buroucracy
  3. Bureaucracy
  4. Beuraucracy

33. Complete the following sentence by choosing the correct spelling of the missing word.

Hazel Dormouse is a _________ creature.

Answers:

  1. nocternal
  2. nocturnal
  3. noctarnal
  4. nacturnal

34. Complete the following sentence by choosing the correct spelling of the missing word.

The church members accused the cult of _______________ practices.

Answers:

  1. sacreligious
  2. sacrelegious
  3. sacrilegious
  4. sacrilgious

35. Identify the misspelled word in the list below.

Answers:

  1. Hemorrhage
  2. Harass
  3. Hankerchief
  4. Hypocrisy

36. Identify the misspelled word in the list below.

Answers:

  1. Sophomore
  2. Supersede
  3. Susceptable
  4. Spontaneous

37. Choose the correct spelling of the word from the options below.

Answers:

  1. Conscentiuos
  2. Consentious
  3. Conscientous
  4. Conscientious

38. Identify the misspelled word in the list below.

Answers:

  1. Enhancement
  2. Elicit
  3. Enegma
  4. Ecstasy

39. Complete the following sentence by choosing the correct spelling of the missing word.

No one knew what devious experiments the scientist conducted in his ______________ .

Answers:

  1. labretory
  2. laboratary
  3. laboratory
  4. labratory

40. Complete the following sentence by choosing the correct spelling of the missing word.

Emma has always been fascinated by the way the mind works, so she’s decided to get a degree in __________.

Answers:

  1. pshycology
  2. psycology
  3. psyhcology
  4. psychology

41. Complete the following sentence by choosing the correct spelling of the missing word.

Helen was surprised by the __________ stature of her blind date.

Answers:

  1. diminutive
  2. diminuative
  3. deminutive
  4. dimminutive

42. Complete the following sentence by choosing the correct spelling of the missing word.

Peter always makes such a _____________ of himself!

Answers:

  1. nuisance
  2. nuisents
  3. newsanse
  4. nuisince

43. Complete the following sentence by choosing the correct spelling of the missing word.

Mrs. Baker took her ______________ class on a field trip to the zoo.

Answers:

  1. kindergarden
  2. kindegarten
  3. kindergarten
  4. kindegarden

44. Complete the following sentence by choosing the correct spelling of the missing word.

The crowd ________________ me on my acceptance into Mensa.

Answers:

  1. congradulated
  2. congrachulated
  3. congratulated
  4. congratilated

45. Complete the following sentence by choosing the correct spelling of the missing word.

The annual _____________ was ruined when a family of bears stole all the hotdogs.

Answers:

  1. barbecue
  2. barbequeue
  3. barbycue
  4. barbcue

46. Complete the following sentence by choosing the correct spelling of the missing word.

Sally’s nervous __________ left her standing at the altar.

Answers:

  1. fiancé
  2. finance
  3. feancé
  4. fience

47. Complete the following sentence by choosing the correct spelling of the missing word.

Clara the cat simply chose to ignore the ______________ of our dog.

Answers:

  1. existence
  2. existance
  3. existense
  4. existanse

48. Complete the following sentence by choosing the correct spelling of the missing word.

My father does not believe in ____________ , but my mother does.

Answers:

  1. reincanation
  2. reincarenation
  3. reincarnation
  4. reincantation

49. Complete the following sentence by choosing the correct spelling of the missing word.

The savvy dancer acted as a __________ between the detective and the cabaret owner.

Answers:

  1. liasion
  2. liaison
  3. liasone
  4. leason

50. Which of the following options means, “the owner or manager of a restaurant”?

Answers:

  1. Restaureter
  2. Restaurater
  3. Restaurateur
  4. Restourateur

51. Complete the following sentence by choosing the correct spelling of the missing word.

Be sure to leave your travel __________with the secretary so he’ll know how to reach you while you’re away.

Answers:

  1. tenreray
  2. itinerary
  3. iteneray
  4. itinirary

52. Complete the following sentence by choosing the correct spelling of the missing word.

The clown’s performance was _______________, to say the least.

Answers:

  1. dissapointing
  2. dissappointing
  3. disapointing
  4. disappointing

53. Complete the following sentence by choosing the correct spelling of the missing word.

_________animals feed almost exclusively on meat.

Answers:

  1. Carnivorus
  2. Carnivorous
  3. Carnivoures
  4. Carnivoreus

54. Complete the following sentence by choosing the correct spelling of the missing word.

After my grandfather was diagnosed with chronic_________, he moved to Arizona.

Answers:

  1. Neumonia
  2. Penumonia
  3. Pneumonia
  4. Pnuemonia

55. Complete the following sentence by choosing the correct spelling of the missing word.

He wrote __________on every topic from shoestrings to string theory.

Answers:

  1. prollifically
  2. prolificaly
  3. prollificaly
  4. prolifically

56. Complete the following sentence by choosing the correct spelling of the missing word.

Let me tie your mittens to your sleeves so you don’t ______________ them.

Answers:

  1. loose
  2. looze
  3. lose
  4. louse

57. Complete the following sentence by choosing the correct spelling of the missing word.

Many would-be travelers were _____________ by the price of gas last summer.

Answers:

  1. flabergasted
  2. flabberghasted
  3. flabbergasted
  4. flabbergashted

58. Complete the following sentence by choosing the correct spelling of the missing word.

The professor made it clear that ___________ would not be tolerated.

Answers:

  1. plagiarism
  2. plagiarizm
  3. plagerism
  4. plagirism

10,497 total views, 41 views today

Top 10 popular test answers

Search Engine Optimization Test 2016

Published by:

1. Which of the following factors have an impact on the Google PageRank?

Answers:

  1. The total number of inbound links to a page of a web site
  2. The subject matter of the site providing the inbound link to a page of a web site
  3. The text used to describe the inbound link to a page of a web site
  4. The number of outbound links on the page that contains the inbound link to a page of a web site

2. If your site is not appearing in Google search results because of some unethical SEO practices in the recent past, _________________.

Answers:

  1. abandon and close your website permanently.
  2. modify the page contents, make them useful and relevant to the human users, and request Google to reconsider your site.
  3. start a PPC campaign to get your site included in the sponsored results.
  4. it is better to discontinue the website and shift your webpages to a fresh website with a new domain name.

3. What does the term Keyword Prominence refer to?

Answers:

  1. It refers to the fact that the importance of choosing high traffic keywords leads to the best return on investment
  2. It refers to the importance attached to getting the right keyword density
  3. It refers to the fact that the keywords placed in important parts of a webpage are given priority by the search engines
  4. It refers to the fact that the keywords in bold font are given priority by the search engines

4. What will happen if you type the words ‘Certification -Networking’ in the Google search box?

Answers:

  1. Google will find the web pages about Certification and also containing the word “Networking”
  2. Google will find all the web pages containing the words “Certification” and “Networking”
  3. Google will find all the web pages in which the words “Certification” and “Networking” appear together
  4. Google will find the web pages about Certification that do not contain the word Networking

5. Which black hat SEO technique is characterized by a method to deceive search engines, by detecting the search engine bot and “feeding” it with a different HTML code than the HTML actually served to users?

  1. Answers:
  2. Coating
  3. Foisting
  4. Slighting
  5. Cloaking

6. Which of the following statements is correct with regard to the description meta tag?

Answers:

  1. It should be about 50 characters in length
  2. The description should not contain the keywords
  3. If the meta description is not included, the search engines will use the meta keywords for information
  4. Google uses the meta description to generate the search engine results pages

7. Which of the following factors contribute towards link popularity of a website?

Answers:

  1. The number of websites that link to it
  2. The number of pages of the website indexed by Google
  3. The number of pages in the website
  4. The quality of websites that link to it

8. Which of the following statements about the Google Sitemap are correct:

Answers:

  1. Repeated submission of the Sitemap to Google could be penalized
  2. It is possible to create and submit specialized Sitemaps to Google for Video and Mobile content
  3. The Sitemap acceptable to Google follows an XML format

9. Which of the following statements about Google’s technical and quality guidelines are true?

Answers:

  1. It is advantageous if your web server supports the If-Modified-Since HTTP header
  2. If using dynamic pages, it helps to keep the parameters short and the number of them few
  3. Avoid using robots.txt to prevent crawling of search results pages or other auto-generated pages, even if they don’t add much value for users coming from search engines
  4. Submitting new pages of your website at http://www.google.com/addurl.html as soon as they are online, helps to speed up indexing

10. Which of the following conditions will Google treat favorably from the ‘Relevancy’ perspective?

Answers:

  1. The website offering products and services to the visitors country
  2. A website that provides free content for the related keywords
  3. Hidden keywords on the home page matching the search term
  4. Image Alt tags on the home page matching the search term

11. Some words, when followed by a colon, have special meanings to Yahoo. What is performed by the link: operator?

Answers:

  1. It shows all the outbound links from the URL
  2. It shows how many pages of the site Yahoo is pointing to
  3. It shows all the pages that point to that URL
  4. It shows URLs with broken links

12. Search engines do not index some common words (such as “or”, “and”, “when”, and “in”) within the webpage. What are these common words called?

Answers:

  1. Barrier words
  2. Non-indexable words
  3. Slow words
  4. Stop words

13. Which of the following statements about search engine optimization techniques are correct:

Answers:

  1. Making a keyword bold does not influence the way that the search engine looks at the keyword
  2. Websites with deep linking are looked at favorably by search engines
  3. Search engine robots follow the first link they find to any particular page and they do not follow additional links to the same page
  4. It is not a good idea to have the same anchor text for all inbound links as it could look automated to the search engines

14. Which of the following can be termed as good keyword selection and placement strategies?

Answers:

  1. Targeting synonyms of the main keyword
  2. Targeting the highest searched keywords only
  3. Copying competitor keywords
  4. Optimizing five or more keywords per page

15. What is Keyword Density?

Answers:

  1. The number of times the keyword is used / (DIVIDED BY) the total word count on page – (MINUS)the total words in HTML on the page
  2. The number of times the keyword is used X (MULTIPLIED BY) the total word count on page
  3. The number of times the keyword is used in the page description
  4. The number of times the keyword is used in the page title
  5. The number of times the keyword is used and multiplied by hundred / (DIVIDED BY) the total word count on the page.

16. If a website’s search engine saturation with respect to a particular search engine is 20%, what does it mean?

Answers:

  1. 20% of the webpages of the website have been indexed by the search engine
  2. Only 20% of the pages of the website will be indexed by the search engine
  3. 20% of the websites pages will never be indexed
  4. The website ranks in the first 20% of all websites indexed by the search engine for its most important search terms

17. _________________ use both crawlers and directories to generate relevant results.

Answers:

  1. Crawler-based Search Engines
  2. Human-Powered Directories
  3. Hybrid Search Engines
  4. Meta Search Engines

18. What term is commonly used to describe the shuffling of positions in search engine results in between major updates?

Answers:

  1. Waves
  2. Flux
  3. Shuffling
  4. Swaying

19. Which of the following statements about FFA pages are true?

Answers:

  1. They are greatly beneficial to SEO
  2. They are also called link farms
  3. They are paid listings
  4. They contain numerous inbound links

20. Which of the following actions could get you banned by Google?

Answers:

  1. Hiding text on the webpage
  2. Stuffing keywords on the webpage
  3. Linking to sites banned by Google
  4. None of the above

21. Which of the following website design guidelines have been recommended by Google?

Answers:

  1. Having a clear hierarchy and text links
  2. Every page should be reachable from at least one static text link
  3. If the site map is larger than 100 or so links, you should break the site map into separate pages
  4. Keeping the links on a given page to a reasonable number (fewer than 100)
  5. Use less than 30 images or graphics per page

22. While grading your website, Google gives credit to outbound links pointing to authority websites?

Answers:

  1. True
  2. False

23. Google looks down upon paid links for enhancing page rank. If a website sells links, what action/s does Google recommend to avoid being penalized?

Answers:

  1. The text of the paid links should state the words “paid text link” for Google to identify it as a paid link
  2. Only Paid text links to non profit websites should be accepted
  3. Paid links should be disclosed through the “rel=nofollow” attribute in the hyperlink
  4. Paid links should be disclosed through the “index=nofollow” attribute in the hyperlink

24. All major search engines are case sensitive.

Answers:

  1. True
  2. False

25. 10 people do a web search. In response, they see links to a variety of web pages. Three of the 10 people choose one particular link. That link then has a __________ click through rate.

Answers:

  1. less than 30%
  2. 30 percent
  3. more than 30%

26. Which of the following is an ethical SEO Technique?

Answers:

  1. Creating a subdomain with the hottest keyword and creating duplicate copies of existing pages on it
  2. Filling your pages with keywords, whether relevant to the page content or not
  3. Creating a page which serves a different content to the search engine bots and different to human users
  4. None of the above

27. What will the following robots.txt file do?

User-agent:Googlebot
Disallow:/*?
User-agent:Scooter
Disallow:

Answers:

  1. It will allow Google to crawl any of the dynamically generated pages. It will also allow the altavista scooter bot to access every page
  2. It will disallow Google from crawling any of the dynamically generated pages. It will also disallow the altavista scooter bot from accessing any page
  3. It will disallow Google from crawling any of the dynamically generated pages. It will allow the altavista scooter bot to access every page
  4. None of the above

28. What is Anchor Text?

Answers:

  1. It is the main body of text on a particular web page
  2. It is the text within the left or top panel of a web page
  3. It is the visible text that is hyper linked to another page
  4. It is the most prominent text on the page that the search engines use to assign a title to the page

29. Why is it a bad idea from the seo perspective to host free articles and write ups that are very common on the internet.

Answers:

  1. Because they will not lead to fresh traffic
  2. Because you could get penalized by search engines for using duplicate content
  3. Because you will not get the benefits of proper keyword targeting
  4. Because people could turn up claiming copy right infringement

30. Cloaking is a controversial SEO technique. What does it involve?

Answers:

  1. Increasing the keyword density on the web pages
  2. Offering a different set of web pages to the search engines
  3. Hiding the keywords within the webpage
  4. Creating multiple pages and hiding them from the website visitors

31. Which of the following statements is correct with regard to the images within a webpage?

Answers:

  1. Images cannot be spidered by the search engines
  2. Important keywords related to the image should be placed in the ALT text
  3. Images should always be kept close to the top of a webpage
  4. Image maps should be used while including the images

32. Which of the following statement about RSS is correct?
Answers:

  1. It is a form of XML
  2. It stands for Realtime streamlined syndication
  3. It is a good way of displaying static information
  4. It is a Microsoft technology

33. What is the function of “indexer” part of the Google search engine?

Answers:

  1. It helps to retrieve web pages from the world wide web
  2. It helps to gather information from other search engines
  3. It helps to sort the documents that Google has retrieved
  4. It helps to generate meaningful results based upon the user’s search term

34. Which of the following free tools/websites could help you identify which city in the world has the largest search for the keyword – “six sigma”?

Answers:

  1. Yahoo Search Term Suggestion Tool
  2. Alexa
  3. Google Traffic Estimator
  4. Google Trends
  5. WordTracker

35. Do search engines such as Google detect unnatural linking patterns by checking the Class C IP address of the page where the link to the website originates?

Answers:

  1. Yes
  2. No

36. What does the 302 server response code signify?

Answers:

  1. It signifies conflict, too many people wanted the same file at the same time
  2. The page has been permanently removed
  3. The method you are using to access the file is not allowed
  4. The page has temporarily moved
  5. What you requested is just too big to process

37. While optimizing your website it is important to generate the right type of traffic, how does the Bounce Rate information help in this regard?

Answers:

  1. By letting you know the percentage of users who entered the website and then went on to visit additional pages
  2. By letting you know the percentage of users who entered the website and then left without viewing any other page
  3. By letting you know the percentage of users who decided to go back to the source from where they found your website
  4. By letting you know the percentage of users who left your website within 10 seconds of viewing the first page

38. Which of the following statements is correct with regard to natural links?

Answers:

  1. They are two way links (reciprocal links)
  2. They are from authority websites
  3. They are voluntary in nature
  4. They are from .edu or .gov extension websites

39. Which of the following facts about Alexa are correct?

Answers:

  1. Alexa provides free data on relative website visitor traffic
  2. Alexa and Quantcast provide information on visitor household incomes
  3. Alexa is biased towards US based traffic
  4. Quantcast only tracks people who have installed the Quantcast toolbar

40. Are RSS/Atom feeds returned in Google’s search results?
Answers:

  1. Yes
  2. No

41. How are site maps important for the search engine optimization process?

Answers:

  1. Site maps help the search engine editorial staff to quickly go through a website, hence ensuring quicker placement
  2. Google gives credit to the websites having site maps. The GoogleBot looks for the keyword or title “Site Map” on the home page of a website.
  3. Site maps help the search engine spider pick up more pages from the website
  4. None of the above

42. Implementing a 301 Permanent Redirects on the old pages to redirect to the new pages is a good idea from the SEO perspective.

Answers:

  1. True
  2. False

43. What is the name of the search engine technology due to which a query for the word ‘actor’ will also show search results for related words such as actress, acting or act?

Answers:

  1. Spreading
  2. Dilating
  3. RSD (real time synonym detection)
  4. Stemming
  5. Branching

44. What is the illegal act of copying of a page by unauthorized parties in order to filter off traffic to another site called?

Answers:

  1. Trafficjacking
  2. Visitorjacking
  3. Viewjacking
  4. Pagejacking

45. Google gives priority to themed inbound links.

Answers:

  1. True
  2. False

46. What is the main reason for the effectiveness of optimizing a webpage towards a long tail keyword search?

Answers:

  1. There are more long tail searches than shorter keyword queries
  2. Search engines often pass on long tail searches to lesser known and new websites
  3. Search engines do not pass on long tail search traffic to websites that rank high for shorter keyword searches
  4. There are fewer websites that have targeted such keywords

47. Google displays up to _____ characters of a webpage’s Title Tag.

Answers:

  1. 56
  2. 60
  3. 70
  4. 80

48. What is the term for Optimization strategies that are in an unknown area of reputability/validity?

Answers:

  1. Red hat techniques
  2. Silver hat techniques
  3. Grey hat techniques
  4. Shady hat techniques

49. A Hallway Page is used to:

Answers:

  1. Attract visitors from the search engines straight onto the Hallway Page
  2. Organize the Doorway Pages
  3. Help people navigate to different Doorway Pages
  4. Enable search engine bots to index the Doorway Pages

50. Which of the following search engines or directories provides the directory search results for Yahoo?

Answers:

  1. Windows Live
  2. Yahoo Directory
  3. Google
  4. Wikipedia
  5. DMOZ

51. _________ is usually the best web page to get linked to while receiving a themed in-bound link from another website.

Answers:

  1. The sitemap
  2. The contact page
  3. The home page
  4. The page which you would like to improve in the search engine rankings

52. The following robots meta tag directs the search engine bots:

<META NAME=”robots” CONTENT=”noindex,nofollow”>

Answers:

  1. Not to index the homepage and not to follow the links in the page
  2. Not to index the page and not to follow the links in the page
  3. To index the page and not to follow the links in the page
  4. Not to index the page but to follow the links in the page

53. If you enter ‘Help site:www.expertrating.com’ in the Google search box, what will Google search for?

Answers:

  1. It will open up the Google help pages applicable to www.expertrating.com
  2. It will find pages about help within www.expertrating.com
  3. It will only find page titles about help within www.expertrating.com
  4. It will direct you to the request page for re-indexing of www.expertrating.com

54. Which of the following activities could be looked down upon by Google as per their quality guidelines?

Answers:

  1. Using automated website submission software
  2. Loading pages with irrelevant links
  3. Intentionally adding keywords to the TITLE tags and ALT attributes
  4. Registering misspellings of well-known websites

55. Which search engine technology prevents a website from appearing in numerous top positions in the search engine result pages?

Answers:

  1. Clustering
  2. Normalizing
  3. Sifting
  4. Combing

56. If you search for the term “iq test” in the Word Tracker keyword suggestion tool, will it return the number of independent searches for the term “iq”?

Answers:

  1. Yes
  2. No

57. Which of the following factors does Google take into account while assessing whether or not a website is an authority website?

Answers:

  1. The frequency with which the content of the website is updated
  2. The number of web pages containing relevant information on the main theme of the website
  3. The number of in-bound natural links related to the website’s theme (or keywords)
  4. None of the above

58. State whether true or false.

The Yahoo Directory listing is a free service for commercial sites.

Answers:

  1. True
  2. False

59. State whether the following statement is true or false.

A Sitemap provides a list of internal links to user accessible pages on a website.

Answers:

  1. True
  2. False

60. Which of the following statements regarding website content are correct?

Answers:

  1. If you have two versions of a document on your website, Google recommends that you only allow the indexing of the better version
  2. Linking to a page inconsistently does not affect the way Google views the page/s. Examples of inconsistent linking could be http://www.expertrating.com/page/ and http://www.expertrating.com/page and http://www.expertrating.com/page/index.htm
  3. Syndicating your content could lead to Google viewing the material as duplicate
  4. Placeholders for pages which do not have content are never viewed as duplicate content by Google

61. Which of the following does Google uses to display characters of a web page’s Title Tag?

Answers:

  1. Pixel Width
  2. Title Tag Character count
  3. None of the above

8,620 total views, 30 views today

Top 10 popular test answers

WordPress Test 2016

Published by:

1. You can limit the number of revisions WordPress stores by _____Note: Categories must have distinct slugs. Even if two categories have different parents and would therefore have different permalinks, you can’t assign them the same slug.

Answers:

  1. adding the following line to your wp-config.php file: define(‘WP_POST_REVISIONS’, 3);
  2. using a plugin
  3. changing a setting on admin panel

2. Which of the following will hash a string/password to its md5 equivalent?

Answers:

  1. md5()
  2. wp_generate_password()
  3. wp_generate_md5()
  4. password_md5()

3. Which conditional tag checks if the dashboard or the administration panel is attempting to be displayed by returning “true’ (if the URL being accessed is in the admin section) or “false” (for a front-end page).

Answers:

  1. my_admin()
  2. view_admin()
  3. is_admin()
  4. root_admin()

4. Which of the following functions are used to add administration menu item in WordPress ?

Answers:

  1. add_menu_page();
  2. add_admin_item();
  3. add_admin_page();
  4. add_admin_option();

5. Which of the following WordPress Multisite functions allows for getting content from one blog and display it on another?

Answers:

  1. switch_blog()
  2. switch_to_blog()
  3. restore_current_blog()
  4. restore_to_current_blog()

6. What is the BEST way to get last inserted row ID from WordPress database ?

Answers:

  1. Use the following code snippet $lastid->$wpdb=$last->get_row;
  2. The call to mysql_insert_id() inside a transaction should be added: mysql_query(‘BEGIN’); // Whatever code that does the insert here. $id = mysql_insert_id(); mysql_query(‘COMMIT’); // Stuff with $id.
  3. The following code snippet should be added $last = $wpdb->get_row(“SHOW TABLE STATUS LIKE ‘table_name'”); $lastid = $last->Auto_increment;
  4. Straight after the $wpdb->insert() insert, the following code should be added: $lastid = $wpdb->insert_id;

7. Which of the follow is a WordPress alternatives for Ruby on Rails?

Answers:

  1. Refinery
  2. Typof
  3. Symenta
  4. Rubyalt

8. Which of the following code snippets can be used to create custom POST status in wordpress 3.0 +?

Answers:

  1. register_new_post()
  2. register_post_status()
  3. add_new_post_status()
  4. modify_post_status()

9. How can the upload media panel be included in a WordPress template/plugin?

Answers:

  1. By using function wp_enqueue_script(‘media-upload’)
  2. By using function wp_add_media( );
  3. By using function wp_enqueue_script(‘upload’);
  4. By using function wp_add_script(‘media-upload’);

10. What are the database privileges that are required for WordPress?
Answers:

  1. insert, delete, update, drop and alter
  2. select, insert, delete, update, create, drop and alter
  3. insert, delete, update, create, drop and alter
  4. insert and delete

11. Which of the following is an example of a WordPress plugin that provides multilingual capabilities?

Answers:

  1. WP Super Cache
  2. qTranslate
  3. BuddyPress
  4. Hotfix

12. Which of the following functions can be used to create a WordPress page?

Answers:

  1. wp_insert_post()
  2. wp_insert_page()
  3. wp_create_post()
  4. wp_create_page()

13. Which function is used to display the name of current page in wordpress?
Answers:

  1. get_the_title()
  2. content_title()
  3. page_name()
  4. post_name()

14. Which of the following methods can be used to make permalinks SEO friendly?

Answers:

  1. Updating the database.
  2. Changing the source code.
  3. Configuring the feature in the config file.
  4. Configuring the feature in the admin settings.

15. User Level 7 converts to _________?

Answers:

  1. Contributo
  2. Autho
  3. Edito
  4. Subscribe
  5. Administrato

16. Which of the following is the correct way to add custom excerpts length identifiers in WordPress?

Answers:

  1. By adding excerpt_length filter in function.php
  2. Can’t declare custom excerpts in wordpress
  3. Custom exceprts are already available in wordpress
  4. Using the_excerpt(‘long’); or the_excerpt(‘short’)

17. Which of the following is the correct sequence of steps to adapt a WordPress plugin to a multisite?

Answers:

  1. 1. Use $wpdb to iterate through all blogs 2. Hook according to the $blog_id 3. Install the plugin as Network only 4. Uninstall depends the specific plugin
  2. 1. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. IInstall the plugin as Network only 4. Uninstall depends the specific plugin
  3. 1. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. Install other activations except Network 4. Uninstall is the same for all the plugins
  4. 1. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. Install the plugin as Network only 4. Uninstall is same for all the plugins

18. On which of the following databases can WordPress be installed by default?

Answers:

  1. MySQL
  2. Oracle Database
  3. Microsoft SQL Server
  4. PostgreSQL

19. Which of the following actions must be performed to import data from wordpress.com?

Answers:

  1. Enter the full access to wordpress.com into the data import form so that it can automatically connect and directly retrieve content.
  2. Import from wordpress.com’s RSS.
  3. Login to wordpress.com, then the export data using the export tool, then import an exported xml file to the site.

20. Meta tags can be added to WordPress pages by ________________.

Answers:

  1. using plug-ins
  2. adding them to the header.php file
  3. updating the database
  4. a and
  5. and c

21. Which of the following codes will return the current plugin directory in WordPress?

Answers:

  1. <!–?php plugin_basename($file); ?–>
  2. <!–?php plugin_basename(‘url’); ?–>
  3. < !–?php bloginfo_plugin(‘url’); ?–>
  4. < !–?php content_plugin_url( $path ); ?–>

22. WordPress’s requirements are modest. At minimum, which of the following standards should your server support for WordPress 3.1?

Answers:

  1. PHP version 4.4.9 or greater, MySQL version 4.0 or greater
  2. PHP version 4.3 or greater, MySQL version 4.1.2 or greater
  3. PHP version 4.4.9 or greater, MySQL version 5.1 or greater
  4.  PHP version 4.3 or greater, MySQL version 5.1 or greater

23. Which of the following will give the option to add inline Ajax for comment posting?

Answers:

  1. Enabling Ajax in the wp-config.php file
  2. Activating Ajax from the admin settings of WordPress
  3. Using the Ajax Comment Posting plugin
  4. WordPress doesn’t support inline Ajax.

24. What is the limitation to the depth of your categories?

Answers:

  1. 10 levels
  2. 20 levels
  3. No limit levels

25. Can the contents of the wp-content folder be moved or renamed without changing any settings?

Answers:

  1. Yes
  2.  No

26. Which of the following code snippets best protects a system from SQL injections?

Answers:

  1. sql_real_escape_strong()
  2. mysql_real_escape()
  3. mysql_real_escape_string()
  4. mysql_not_real_delete_string()

27. Which of the following role levels has the highest privilege?

Answers:

  1. Level_0
  2. Level_10
  3. Depends on your settings.
  4. Every role level has the same privilege.

28. How can the Home link be disable from the WordPress top nav?

Answers:

  1. Using Jquery to hide it
  2. By adding this code in functions.php function page_menu_args( $args ) { $args[‘show_home’] = FALSE; return $args; } add_filter( ‘wp_page_menu_args’, ‘page_menu_args’ );
  3. wp_nav_menu( array(‘menu’ => ‘news’, ‘show_home’ => false))
  4. Can not disable the default Home link from wordpress top nav

29. Which of the following is the correct way to retrieve a featured image from a post?
Answers:

  1. <!–?php echo get_post_thumb($page->ID, ‘thumbnail’); ?–>
  2. <!–?php echo get_featured_image($page->ID, ‘thumbnail’); ?–>
  3. <!–?php echo get_the_post_thumbnail($page->ID, ‘thumbnail’); ?–>
  4. <!–?php echo get_post_thumbnail($page->ID, ‘thumbnail’); ?–>

30. Which of the following will correctly load localized (translated) text for a WordPress plugin?

Answers:

  1. function custom_theme_setup() { $lang_dir = get_template_directory() . ‘/lang’); load_theme_textdomain(‘tutsplus’, $lang_dir); } add_action(‘after_setup_theme’, ‘custom_theme_setup’);
  2. function custom_theme_setup() { $lang_dir = get_template_directory() . ‘/lang’); add_action(‘after_setup_theme’, ‘custom_theme_setup’); }
  3. function custom_theme_setup() { $lang_dir = get_template_directory() . ‘/lang’); add_action(‘after_setup_theme’, ‘custom_theme_setup’); } load_theme_textdomain(‘tutsplus’, $lang_dir);
  4. function load_theme_textdomain(‘tutsplus’, $lang_dir); { $lang_dir = get_template_directory() . ‘/lang’); custom_theme_setup(); } add_action(‘after_setup_theme’, ‘custom_theme_setup’);

31. Image size limits can be set _______________.

Answers:

  1. directly in the posts
  2. in the wp-imageresize plug-in
  3. in the admin settings
  4. a and

32. How can a user be found through its meta data?

Answers:

  1. User can not be retrieved through its meta data
  2. get_user_by_metadata($metaid,$metavalue)
  3. get_user($args)
  4. get_users($args)

33. Which PHP method(s) can be used to send form data that is persistent across succeeding page views (such as for a language selection feature) in WordPress?

Answers:

  1. POST
  2. GET
  3. SESSION or COOKIE
  4. POST or GET

34. Which of the following will call the WordPress media uploader form element?

Answers:

  1. <form enctype=”multipart/form-data” method=”post” action=”<?=bloginfo(“siteurl”);?>/wp-admin/media-upload.php?inline=&upload-page-form=” class=”media-upload-form type-form validate” id=”file-form”>
  2.  <a onclick=”return false;” title=”Upload image” class=”thickbox” id=”add_image” href=”media-upload.php?type=image&TB_iframe=true&width=640&height=105″>Upload Image</a>
  3. <a href=”media-upload.php?type=image&TB_iframe=true&width=640&height=105″>Upload Image</a>
  4. <form enctype=”multipart/form-data” method=”post” action=”<?=bloginfo(“bloginfo”);?>/wp-admin/media-upload.php?inline=&upload-page-form=” class=”media-upload-form type-form validate” id=”file-form”>

35. Which of the following is the correct way to print the slug property of $firstTag object in this code snippet?$tags = wp_get_post_tags($post->ID);
$firstTag = $tags[0];

Answers:

  1. $firstTag[‘slug’];
  2. $firstTag->slug
  3. $firstTag.slug
    $firstTag[0][‘slug’]

36. Which of the following code snippets is the correct way to get content from Tinymce via javascript ?

Answers:

  1. document.getElementById(‘content’)
  2. tinymce.activeEditor.getContent();
  3. tinymce.element.getContent();
  4. document.getElement(‘tinymce_content’)

37. Is super cache a built-in plugin of WordPress?

Answers:

  1. Yes
  2. No

38. A possible way to allow the display of several authors’ names on one post is to ______

Answers:

  1. update the database
  2. change the admin settings
  3. change the config files
  4. use a plug-in

39. In which way MD5 hash does wordpress stores and represents?

Answers:

  1. In Hex string
  2. In Base64 string
  3. in raw data file
  4. text file

40. What is the first action you need to take for enabling WordPress MU feature?

Answers:

  1. Enable WordPress MU feature on admin panel
  2. Enable Network feature
  3. Add this code to wp-config.php file: define( ‘WP_ALLOW_MULTISITE’, true );

41. What is Automated Testing in WordPress?

Answers:

  1. Automated testing is running test cases where manual intervention is not required to run each one.
  2. It is a plugin which is used to test your custom template or plugin.
  3. It is a function available in WordPress to test the custom template/plugin.
  4.  There is no such thing as Automated Testing in WordPress.

42. Which of the following snippets disable depreciated warnings in WordPress like this one ?

“Deprecated: Assigning the return value of new by reference is deprecated in /home//public_html/hub/wp-settings.php on line 647”

Answers:

  1. define(E_DEPRECATED, false);
  2. error_reporting(E_ALL ^ E_DEPRECATED);
  3. define(E_NOTICE, false);
  4. error_reporting(WP_DEBUG, true)

43. One possible way to collect realtime statistics about traffic on a WordPress site is:

Answers:

  1. using a built-in tool
  2. using a plugin
  3. using a widget
  4. Traffic statistics cannot be collected on a WordPress site.

44. _____________ 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.

Answers:

  1. Contributo
  2. Autho
  3. Edito
  4. Subscribe
  5. Administrato

45. How can an < li >tag’s class and ID attributes be removed from menu items and page lists?

Answers:

  1. add_filter(‘nav_menu_css_class’, ‘my_css_attributes_filter’, 100, 1); add_filter(‘nav_menu_item_id’, ‘my_css_attributes_filter’, 100, 1); add_filter(‘page_css_class’, ‘my_css_attributes_filter’, 100, 1); function my_css_attributes_filter($var) { return is_array($var) ? array() : ”; }
  2. add_filter(‘nav_menu_css_class’, ‘my_css_attributes_filter’, 100, 1); add_filter(‘nav_menu_item_id’, ‘my_css_attributes_filter’, 100, 1); function my_css_attributes_filter($var) { if(is_array($var)){ $varci= array_intersect($var, array(‘current-menu-item’)); $cmeni = array(‘current-menu-item’); $selava = array(‘selectedmenu’); $selavaend = array(); $selavaend = str_replace($cmeni, $selava, $varci); } else{ $selavaend= ”; } return $selavaend; }
  3. add_filter (‘wp_nav_menu’,’strip_empty_classes’); function strip_empty_classes($menu) { $menu = preg_replace(‘/ class=([“‘])(?!active).*?1/’,”,$menu); return $menu; }
  4. None of the above

46. ____________ 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.

Answers:

  1. Contributor
  2. Author
  3. Editor
  4. Subscriber
  5. Administrator

47. Which of the following will show the most recent post (by date) from a custom taxonomy?

Answers:

  1. select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_term_relationships as b on ( a.ID = b.object_id) join wp_term_taxonomy as c on (b.term_taxonomy_id = c.term_taxonomy_id) join wp_terms as d on (c.term_id = d.term_id) where c.taxonomy = ‘post-series’ group by d.name having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)
  2. select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_terms as d on (c.term_id = d.term_id) where c.taxonomy = ‘post-series’ group by d.name having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)
  3. select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_term_relationships as b on ( a.ID = b.object_id) join wp_term_taxonomy as c on (b.term_taxonomy_id = c.term_taxonomy_id) join wp_terms as d on (c.term_id = d.term_id) having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)
  4. select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_term_relationships as b on ( a.ID = b.object_id) join wp_terms as d on (c.term_id = d.term_id) where c.taxonomy = ‘post-series’ group by d.name having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)

48. What are the correct steps in wordpress plugin development:

Answers:

  1. Step 1 – Create your file and let it be known as a plugin Step 2 – Create the objects of your plugin Step 3 – Adding your actions and filters Step 4 – Adding settings/options to your plugin Step 5 – Finishing the code
  2. Step 1 – Adding settings/options to your plugin Step 2 – Create your file and let it be known as a plugin Step 3 – Create the objects of your plugin Step 4 – Adding your actions and filters Step 5 – Finishing the code
  3. Step 1 – Create the objects of your plugin Step 2 – Adding settings/options to your plugin Step 3 – Create your file and let it be known as a plugin Step 4 – Finishing the code
  4. Step 1 – Create the objects of your plugin Step 2 – Adding settings/options to your plugin Step 3 – Finishing the code

49. What is the output of the following code?

<li>example 1

<li>example 2

<li>example 3

<li>example 4

$(document).ready(function(){
$(‘#sortable’).sortable({
update: function(event, ui) {
var newOrder = $(this).sortable(‘toArray’).toString();
$.get(‘saveSortable.php’, {order:newOrder});
}
});
});

Answers:

  1. Removes positions from data base based on the user input
  2. Saves sortable positions to data base based on the user input
  3. Adding new sortable positions from another data base
  4. Sorting out existing positions without updating the data base with the new user inputs

50. Which of the following is the correct way to assign a category to a WordPress post?

Answers:

  1. wp_set_post_categories($postId,$categories)
  2. wp_set_category($catId,$postId)
  3. By XML-RPC call to wpc.newPost
  4. This is not possible

51. Conditional tags can be used to _______________________.

Answers:

  1. get all comments from one post
  2. get all posts from one category
  3. change the content to be displayed
  4. None of the above: conditional tags are not available in WordPress.

52. Which of the following commands can change the ownership of WordPress directory to www-data (for Apache)?

Answers:

  1. sudo chown -Rf www-data *
  2. chown -Rf www-data *
  3. sudo crown -Df www-data *
  4. Alldo chown -Rf www-data *

53. How can a custom content filter be added?

Answers:

  1. By using add_action(‘the_content’,’my_custom_filter’)
  2. By using add_filter(‘the_content’,’my_custom_filter’)
  3. By using wp_filter(‘the_content’,’my_custom_filter’)
  4. By using add_action(‘content’,’my_custom_filter’)

54. How can a post ID be retrieved from the permalink?

Answers:

  1. Its not possible to retrieve the post ID from a permalink due to its structure.
  2. It can be retrieved by using a Regular Expression.
  3. wp_get_post_id($permalink)
  4. url_to_postid($permalink)

55. Which of the following is the correct way to redirect the default login and registration page URL to a custom login and registration page URL?

Answers:

  1. add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { return(‘Your custom url’); exit(); } }
  2. add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { wp_redirect(‘Your custom url’); exit(); } }
  3. add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { redirect(‘Your custom url’); exit(); } }
  4. add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { wp_return(‘Your custom url’); exit(); } }

56. How can a WordPress template be integrated inside a codeigniter framework using WordPress functions like wp_header,wp_footer,wp_sidebar?

Answers:

  1. Include the file wp-blog-header.php from WordPress installation directory to codeigniters index.php and create template inside codeigniter’s view.
  2. Include the file wp-settings.php from WordPress installation directory to codeigniters index.php and create template inside codeigniter’s view.
  3. Create template inside WordPress theme directory and include the file in codeigniter’s view.php file.
  4. It is not possible to integrate wordpress with codeigniter.

57. What is the first action you need to take for enabling the WordPress multisite (MS) feature?

Answers:

  1. Enable the WordPress multisite feature on admin panel
  2. Enable the Network feature
  3. Add this code to wp-config.php file: define( ‘WP_ALLOW_MULTISITE’, true );

58. Which of the functions below is required to create a new taxonomy?

Answers:

  1. add_taxonomy
  2. register_taxonomy
  3. create_taxonomy

59. Which of the following actions cannot be hooked in with add_submenu_page() function?

Answers:

  1. admin_submenu
  2. admin_menu
  3. user_admin_menu
  4. network_admin_menu

60. Which of the following is the correct way to filter the content for a few posts?

Answers:

  1. By using apply_filters(filter,postId)
  2. This is not possible in wordpress
  3. Can create filter for posts in a specific wordpress category
  4. Passing arguments into the_content()

61. What is the function of add_filter in WordPress?

Answers:

  1. It registers a filter for a tag.
  2. It removes line breaks from the pages list.
  3. It is a companion function to apply_filters().
  4. All of the above.

62. Which of the following code snippets will create plugins back-end page without showing it as menu item?

Answers:

  1. add_submenu_page with parent slug = null
  2. add_menu_page with parent slug = null
  3. add_submenu_page without parent slug = null
  4. add_menu_page without parent slug = null

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

Answers:

  1. Contributor
  2. Author
  3. Editor
  4. Subscriber
  5. Administrator

64. Are categories and tags available for pages?

Note: Categories must have distinct slugs. Even if two categories have different parents and would therefore have different permalinks, you can’t assign them the same slug.

Answers:

  1. Yes
  2. No

65. Which of the following is the correct way to get WordPress Post ID from the Post title?

Answers:

  1. $page = get_page_title( ‘About’ ); wp_pages( ‘exclude=’ . $page->ID );
  2. $page = get_page_by_title( ‘Home’ ); $page_id = $page->ID;
  3. $page = get_page_by_title( ‘About’ ); wp_pages( ‘exclude=’ . $page->ID );
  4. None of the above

66. Which of the following will correctly add custom mod rewrite rules to .htaccess from a WordPress plugin?

Answers:

  1. $custom_mod_rewrite = new custom_mod_rewrite; register_activation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); register_deactivation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); add_action(‘generate_rewrite_rules’, array($custom_mod_rewrite, “generate_rewrite_rules”)); class custom_mod_rewrite { function __construct() { $this->wp_rewrite = & $POST[“wp_rewrite”]; }}
  2. $custom_mod_rewrite = new custom_mod_rewrite; register_activation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); register_deactivation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); add_action(‘generate_rewrite_rules’, array($custom_mod_rewrite, “generate_rewrite_rules”)); class custom_mod_rewrite { function __construct() { $this->wp_rewrite = & $GLOBALS[“wp_rewrite”]; } }
  3. $custom_mod_rewrite = new custom_mod_rewrite; register_activation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); register_deactivation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); add_action(‘generate_rewrite_rules’, array($custom_mod_rewrite, “generate_rewrite_rules”)); class custom_mod_rewrite { function __construct() { $this->wp_rewrite = & $GLOBALS[“wp_rewrite”]; } function mod_rewrite_rules($rules) { return preg_replace(‘#^(RewriteRule ^.*/)?$plugin_name .*(http://.*) [QSA,L]#mi’, ‘$1 $2 [R=301,L]’, $rules); } }
  4. $custom_mod_rewrite = new custom_mod_rewrite; register_activation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); register_deactivation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); add_action(‘generate_rewrite_rules’, array($custom_mod_rewrite, “generate_rewrite_rules”)); class custom_mod_rewrite { function __construct() { $this->wp_rewrite = & $SESSION[“wp_rewrite”]; } }

67. Which of the following is the correct code to get an array of every image uploaded to a particular post?

Answers:

  1. $images =& get_children( ‘post_type=attachment&post_mime_type=image&post_parent=10’ );
  2. $images = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
  3. $images = get_post(7, ARRAY_A);
  4. It cannot be done

68. Which of the following will echo the base URL of a WordPress site?
Answers:

  1. <?php echo get_bloginfo(‘base_url’) ?>
  2. <?php echo get_bloginfo(‘url’) ?>
  3. <?php echo get_bloginfo(‘site_url’) ?>
  4. <?php echo get_website_url() ?>

69. Which of the following functions are used when adding CSS and jQuery codes on a WordPress plugin?

Answers:

  1. wp_register_style
  2. wp_enqueue_style
  3. wp_enqueue_script
  4. None of these.

70. In order to display a widget, the user must _________________.

Answers:

  1. set the “show property” of the desired widget to “true”
  2. drag the desired widget to the side ba
  3. add the desired widget to the post
  4. change the source code

21,620 total views, 82 views today

Top 10 popular test answers

U.S. English Basic Skills Test 2016

Published by:

1. Which of the following sentences illustrates correct usage of articles and conjunctions?

Answers:

  1. Celine lives on Arthur Street; however, she works on Beatrice Boulevard.
  2. I would eat a peach every day if I could, nor the doctor told me I couldn’t.
  3. Will Gertrude play the piano or an harp at the concert?
  4. Although she is angry at them, neither her son and her father will be at the party.

2. Choose the series of verbs and phrases that best completes the following passage.

Answers:

  1. is, did the chef have to use
  2. was, the chef is using
  3. is, did the chef use
  4. was, the chef used
  5. a and c

3. Choose the series of articles and conjunctions that best completes the following sentence.
Neither we ________ Sal, our neighbor, could understand ________ it had been our dog Rover or Sal’s cat’s kittens _________ had destroyed all the flower beds in the middle of _______ night.

Answers:

  1. nor, whether, that, the
  2. or, if, who, the
  3. and, whether, than, a
  4. nor, if, that, a

4. Choose the series of verbs that best completes the following sentence.

Alison regrets _________ you with her remarks; she never meant _________ so.

Answers:

  1. to hurt, doing
  2. to hurt, to do
  3. hurting, doing
  4. hurting, to do

5. Which of the following sentences is NOT punctuated correctly?

Answers:

  1. We expect only three things from our dog: loyalty, affection, and tail wagging.
  2. I need you to pick up several boxes of paperclips, pens, and pencils; three pounds each of potatoes, carrots, and peas; and my dry cleaning.
  3. Marcy, my parrot, squawked for an hour, before finally calming down.
  4. All of the above are punctuated correctly.

6. Which of the following sentences illustrates the proper use of apostrophes?

Answers:

  1. Helga borrowed her friend’s skates for the day; however, she failed to return them.
  2. Thousand’s of bargains are available during the holiday season, but I cant find time to shop.
  3. The koala bear closed it’s eyes and fell fast asleep.
  4. Although I like the Joneses, I’m angry at them for breaking all of Ralphs’ tools.

7. Which of the following sentences does NOT illustrate correct verb and verb tense usage?

Answers:

  1. These repetitive and misleading guidelines could easily be interpreted in several different ways.
  2.  Clarabelle’s mother absolutely hated nicknames and always calls her daughter by her full name.
  3.  The Imagist movement in poetry is commonly regarded as having begun in the early twentieth century.
  4.  We all danced across the lawn and lifted Zoe above our heads in triumph.

8. Which of the following sentences illustrates incorrect pronoun usage?

Answers:

  1. The wet dog shook itself off, wagged its tail, and proceeded on its way.
  2. Don’t take the silver goblet out of its protective case or you’ll ruin it.
  3. You should wear that jacket to their wedding because it’s the nicest one you have.
  4. It’s not too late to answer their ad for a waitress, is it?
  5. None of the above

9. Which of the following sentences illustrate(s) the proper use of commas?

Answers:

  1. Randy wanted to end the meeting, but Amy wanted to prolong it.
  2.  After pouring herself a glass of water in silence, Nicky answered my question.
  3.  The committee, which had failed to come to a consensus decided to meet again on Tuesday.
  4. Mr. Bridges is never home on the weekends, he always goes to his home in the country.
  5. a and b
  6. All of the above

10. Choose the series of pronouns that best completes the following sentence.

Victor, who stole _______ ideas and used them to make _______ a millionaire, never once offered _______ a word of thanks.

Answers:

  1. our, himself, we
  2. their, them, himself
  3. your, us, you
  4. our, himself, us

11. Choose the series of prepositions that best completes the following sentence.

Although the issue was very serious, the committee disposed ______ it in a few minutes and moved _______ to other business.

Answers:

  1. onto, off
  2. of, away
  3. on, out
  4. of, on

12. Choose the series of prepositions that best completes the following passage.

Although Marvin said he had hidden the keys _______ the flower pot, we were unable to find them _______ the dark. In the end, we waited for him at the coffee shop ___________ the corner.

Answers:

  1. under, in, around
  2. in, with, at
  3. around, at, on
  4. beside, from, around.

13. Rearrange the following words to create the most logical and grammatically correct sentence .work . is always to brother willing not My

Answers:

  1. My brother is not willing to work always.
  2. My brother is not always willing to work.
  3. is not willing to work always My brother.
  4. My work is not willing to always brother.

14. Change the following sentence from a quotation to indirect speech.”I’m not feeling well,” Agatha said.
< strong>Answers:

  1. Agatha has said that she doesn’t feel well.
  2. According to Agatha, she isn’t feeling well.
  3. Agatha said she wasn’t feeling well.
  4. Agatha says she isn’t feeling well.

15. Which of the following sentences illustrates proper sentence structure?

Answers:

  1. Everyone knows that a mango is much sweeter to an orange.
  2. I saw the girl with my own eyes who said she had been abducted by aliens.
  3. Either one of you should try and to fix their broken fence.
  4. The queen had hardly finished her speech when the people began to disperse.

16. Choose the verb that best completes the following sentence.Do you know if Harlon ____________Japanese before moving to Japan?

Answers:

  1. has studied
  2. has been studying
  3. will have been studying
  4. will be studying

17. Which of the following sentences is NOT punctuated correctly?

Answers:

  1. All of the apple’s at the grocer’s were rotten, so I bought oranges instead.
  2. “Seven canteens full of water should be enough for the hike,” said Tabitha.
  3. Until the stove is fixed, there’s no way I can bake a lemon meringue pie.
  4. The woman, whose name escapes me at the moment, disappeared into the limousine.

18. Choose the series of prepositions that best completes the following sentence.Jeremy drove his motorcycle _______ the bridge, _______ the hill, and _______ the diner before finally parking it _______ two police cars.

Answers:

  1. beside, among, behind, near
  2. beneath, over, under, on
  3. across, down, past, between
  4. under, around, through, into

19. Choose the series of prepositions that best completes the following sentence.The deer ran quickly _______ the trees, its hooves pounding _______ the forest floor.

Answers:

  1. amid, from
  2. over, at
  3. through, on
  4. throughout, on

20. Which of the following sentences illustrates correct verb and verb tense usage?

Answers:

  1. Until the snow is melting, the train is not able to move.
  2. Until the snow does not melt, the train will not be able to move.
  3. Until the snow melts, the train will not be able to move.
  4. Until the snow will melt, the train will not be able to move.

 

21. Choose the series of articles and conjunctions that best completes the following sentence.I think Fran could be ______ great public speaker, _______ she is still too shy to try it.

Answers:

  1. the, although
  2. a, but
  3. an, however
  4. a, and

22. Which of the following sentences illustrates proper sentence structure?

Answers:

  1. Walking down the street, my eyes were drawn to a diamond in a store window.
  2. A small red car pulled up behind the woman with tinted windows.
  3. The man in the black cape mounted his powerful stallion and rode away.
  4. The cats chased the birds around the yard with the yellow beaks.

23. Which of the following sentences illustrates the proper use of parallel construction?

Answers:

  1. Terry hoped to find a new job that would let him earn extra cash in the summer and to work fewer hours.
  2. Although Tommy was failing his biology class at college, he was passing his chemistry class.
  3. Trina loved to sail, skate, swim, and surfing.
  4. Tatiana declared that the people in her office are smarter than the people who work in Tad’s office.

24. Choose the series of pronouns that best completes the following sentence.After realizing that our hosts hadn’t actually invited ______ to ______ party, ______ excused ______ from the table and slipped out the back door.

Answers:

  1. us, their, we, ourselves
  2. ourselves, theirs, we, us
  3. them, our, they, themselves
  4. us, our, we, himself

25. Read the following question and choose the response that uses the correct corresponding verb tense.Does Jack wear that furry hat often?

Answers:

  1. No, he just liked to wear it for fun sometimes.
  2. Yes, but don’t said anything about it to him.
  3. Yes, and it can so annoying!
  4. No, he only wears it when his ears are cold.

26. Complete the following sentence by choosing the phrase with the best word order from the options given.The excited children, who had run toward the loud _____________ .

Answers:

  1. music and then told the others about the ice cream truck outside
  2. music, are telling to the others about the ice cream truck outside
  3. ice cream truck to tell the others about the music outside
  4. music, told the others about the ice cream truck outside

27. Choose the series of verbs that best completes the following passage.I find it very hard to remember _________ letters that are entrusted to me. In fact, I remember _________ to do so dozens of times!

Answers:

  1. to mail, forgetting
  2. mailing, to forget
  3. to mail, to forget
  4. mailing, forgetting

28. Choose the series of prepositions that best completes the following sentence.Charlotte knew ___________ the secret investigation _________ her past, but she closed her eyes to it and pretended it wasn’t happening.

Answers:

  1. of, about
  2. on, of
  3. about, to
  4. of, after

29. Which of the following sentences illustrates correct verb and verb tense usage?

Answers:

  1. Did Annabel knowingly lie on the witness stand?
  2. We think the judge will have noticed something strange in her behavior.
  3. The lawyers had decided to keep her testimony a secret.
  4. Somehow, all of the newspapers gotten hold of the story.

30. Choose the series of adjectives and adverbs that best completes the following sentence.I think Pamela deserves to be punished for her __________ stupid and __________ behavior.

Answers:

  1. irresponsible, totally
  2. totally, irresponsibility
  3. totally, irresponsible
  4. total, irresponsibly

31. Rearrange the following words to create the most logical and grammatically correct sentence.with can’t phone . on Whenever always to the time spend I speak I my friend , him

Answers:

  1. Whenever I always phone on my friend to speak, I can’t spend the time with him.
  2. Whenever I spend time on the phone to him, I can’t always speak with my friend.
  3. Whenever I speak to him, I can’t always spend time with my friend on the phone.
  4. Whenever I can’t speak to him on the phone, I always spend time with my friend.
  5. Whenever I can’t spend time with my friend, I always speak to him on the phone.

32. Choose the series of articles and conjunctions that best completes the following sentence._______ she was feeling ill, Teresa wanted to eat only _____ apple _____ some soup.

Answers:

  1. Yet, the, or
  2. After, an, and
  3. Because, an, or
  4. If, a, and

33. Choose the series of pronouns that best completes the following sentence.That house used to be ______ , but ______ have given it to ______.

Answers:

  1. my, I, her
  2. mine, me, her
  3. mine, I, her
  4. myself, she, her

34. Change the following sentence from a quotation to indirect speech.”It may snow tomorrow,” he said.

Answers:

  1. He said it should snow tomorrow.
  2. He might say it will snow tomorrow.
  3.  He says it may snow tomorrow.
  4. He said it might snow the next day.

35. Which of the following sentences illustrates correct usage of articles and conjunctions?

Answers:

  1. The cake that I ate was better that the one you had.
  2. An house is not the home, or so they saying goes.
  3. For my birthday, I would like a book, an hourglass, and the keys to a new boat.
  4. Has a package I’ve been waiting for been delivered yet, nor must I wait longer?

36. Change the following sentence from a quotation to indirect speech.Rhonda says, “I get to work early every day.”

Answers:

  1. Rhonda says she gets to work early every day.
  2. Rhonda said she gets to work early every day.
  3. Rhonda has said that she got to work early every day.
  4. Rhonda says she had gotten to work early every day.

37. Read the following question and choose the response that uses the correct corresponding verb tense.Did you see the show last night?

Answers:

  1. No, because by the time I got there all the tickets had already been sold.
  2. Yes, and it was one of the best shows I had ever seen.
  3. Yes, but my seat was behind a pole so I couldn’t barely see anything.
  4. No, but I am hope to see it tonight.

38. Choose the series of adjectives and adverbs that best completes the following sentence.While __________ of our relatives live on the __________ hill in the county, __________ of our friends live in the __________ __________ areas of the valley.

Answers:

  1. more, windy, many, most, protection
  2. most, windier, more, most, protective
  3. many, windiest, most, more, protected
  4. many, winding, more, most, protected

39. Rearrange the following words to create the most logical and grammatically correct sentence.last what ! it’s did you night, over After

Answers:

  1. After what night, it’s over you did last!
  2. After what you did last night, it’s over!
  3.  over what you did last night, it’s After!
  4. After, it’s over what you did last night!

40. Choose the series of pronouns that best completes the following sentence._______ is the name of the opera, and _______ role did you say Maria would play?

Answers:

  1. This, which
  2. Who, that
  3. What, which
  4. Which, what

41. Which of the following sentences does NOT illustrate proper use of articles and conjunctions?

Answers:

  1. I thought about keeping an orangutan as a pet; however, my apartment complex does not allow exotic animals on the premises.
  2. Bertha decided to change a locks of her house after burglars stole a computer or an oil painting.
  3. After thinking about the problem for half an hour, Glen finally came up with a perfect solution.
  4. Arlene loves nature and the outdoors in general, yet she spends most of her time inside because of her job.

42. Choose the series of adjectives and adverbs that best completes the following sentence.The helium-__________ balloon rose __________ into the air; the villagers knew then that their __________ leader was off on another mission.

Answers:

  1. power, powerful, powered
  2. powered, powered, powerful
  3. powered, powerfully, powerful
  4. powerful, powered, powerfully

43. Rearrange the following words to create the most logical and grammatically correct sentence.days . for last has good weather few The been the not

Answers:

  1. weather for The last few good has not been the days.
  2. The good days has not been for the last few weather.
  3. The few days has not been good for the last weather.
  4. The weather has not been good for the last few days.

44. Which of the following sentences is punctuated correctly?

Answers:

  1. Come here, she said, and let me get a good look at you.’
  2. Come here she said, and let me get a good look at you.
  3. “Come here,” she said. “and let me get a good look at you.”
  4. “Come here,” she said, “and let me get a good look at you.”

45. Change the following sentence from a quotation to indirect speech.Carol has said, “I am responsible for this project.”

Answers:

  1. Carol has said that she is responsible for this project.
  2. Carol says she is responsible for this project.
  3. Carol said that she was responsible for this project.
  4. Carol had said that she would be responsible for this project.

46. Choose the phrase that best completes the sentence below without creating a run-on sentence.Mr. Peach has sent his four children to Ivy League colleges __________ he has sacrificed his health working day and night in that dusty factory.

Answers:

  1. however
  2. ; however,
  3. , however
  4. however,

47. Choose the series of pronouns that best completes the following sentence.Don’t ________ think Larry should call ________ wife if ________ is going to be late for dinner?

Answers:

  1. you, his, he
  2. we, your, his
  3. he, his, he
  4. you, his, himself

48. Choose the series of adjectives and adverbs that best completes the following sentence.Knowing that February was the _________ month of the year, Cheryl planned her vacation ___________.

Answers:

  1. short, in accordance
  2. shortest, accordingly
  3. shorter, according
  4. shortness, accordion

49. Choose the series of prepositions that best completes the following sentence.I placed my notes _______ my desk and referred to them _______ the meeting.

Answers:

  1. at, among
  2. beside, during
  3. with, at
  4. upon, around

50. Which of the following sentences illustrates correct pronoun usage?

Answers:

  1. Is those the set of plates the bride wanted, or did she want this set?
  2. Which of these glasses is half full—that one or this one?
  3. To whom did them give the gold medal?
  4. Whose book is that—his or our?
  5. None of the above

51. Choose the series of prepositions that best completes the following sentence.Jack, leaning casually ________ the tree, watched as Sally walked slowly ________ him.

Answers:

  1. against, toward
  2. toward, against
  3. upon, past
  4. off, beside

52. Read the following question and choose the response that uses the correct corresponding verb tense.Will you be going to the company picnic this year?

Answers:

  1. Yes, I will have always gone every year.
  2. No, unfortunately I didn’t have time this year.
  3. Yes, and I plan on swimming, fishing, and eating all day!
  4. I might go if I had known about it sooner.

53. Choose the series of verbs that best completes the following sentence.Everyone __________ too busy cooking and __________ the campsite __________ the family of bears __________ from the woods.

Answers:

  1. were, setting up, to notice, watch
  2. was, set up, noticing, to watch
  3. is, setting, to notice, watching
  4. was, setting up, to notice, watching

54. Change the following sentence from a quotation to indirect speech.”I can meet with you at noon,” said Peter.

Answers:

  1. Peter says he can meet with me at noon.
  2. Peter said he will meet with me at noon.
  3. Peter said he could meet with me at noon.
  4. Peter can meet with me at noon, so he said.

55. Choose the phrase that best completes the sentence below without creating a run-on sentence.It’s never too late to learn how to swim ________________ you may fall off a boat!

Answers:

  1. you never know when
  2. you never know when
  3. you never know as
  4.  you never know when

56. Complete the following sentence by choosing the phrase with the best word order from the options given.Only after they had completed an exhaustive study __________ how to adapt the technology to the needs of our company.

Answers:

  1. did they understand to begin
  2. did they begin to understand
  3. they did begin to understand
  4. to understand did they begin

57. Choose the series of adjectives and adverbs that best completes the following sentence.Of the two books, Sam’s is definitely the __________ ; however, even though Sandra’s didn’t turn out as __________ as expected, she still did a __________ job of writing it.

Answers:

  1. better, well, good
  2. best, good, good
  3. better, good, better
  4. best, well, well

58. Change the following sentence from a quotation to indirect speech.”I will be moving soon,” said Alma.

Answers:

  1. Alma said she would be moving soon.
  2. Alma said she will move soon.
  3. Alma says she’ll be moving soon.
  4. Alma says she would move soon.

59. Choose the series of adjectives and adverbs that best completes the following sentence.The archaeologists were ________ to discover such a __________ and __________ _________ artifact at that mostly uncovered site.

Answers:

  1. amazing, rarely, incredible, beautifully
  2. amazed, rare, incredibly, beautiful
  3. beautiful, rarity, amazingly, incredible
  4. amazingly, beautiful, rarely, incredible

60. Read the original sentence below and then choose the rewritten sentence that illustrates proper sentence structure.

ORIGINAL SENTENCE:
It is easy to carry solid objects, but the same cannot be said of liquids.

REWRITTEN SENTENCES:

Answers:

  1. Unlike liquids, solid objects are easy to carry.
  2. Unlike liquids, we can easily carry solid objects.
  3. Unlike liquids; solid objects can easily be carried.
  4. Unlike liquids, solid objects easy to be carried.

61. Complete the following sentence by choosing the phrase with the best word order from the options given.Those who are not wise ____________ .

Answers:

  1. do not need be necessarily stupid
  2. need not necessarily be stupid
  3. need not to be necessarily stupid
  4. does not need to be necessarily stupid

62. Change the following sentence from a quotation to indirect speech.Jerry said, “I saw my cousin at the fair.”

Answers:

  1. Jerry had said he’d seen his cousin at the fair.
  2. Jerry said he had seen his cousin at the fair.
  3. Jerry said he’d saw his cousin at the fair.
  4. Jerry says he saw his cousin at the fair.

63. Choose the series of adjectives and adverbs that best completes the following sentence.The _______ , _______ odor was ________ coming from the chemistry lab up the street.

Answers:

  1. pungent, nastily, clearness
  2. pungently, nastily, clearly
  3. pungently, nasty, clear
  4. nasty, pungent, clearly

64. Choose the series of verbs that best completes the following sentence.If Harry __________ to the party too early, don’t let him in; he __________ outside like everyone else.

Answers:

  1. gets, will have to wait
  2. got, waits
  3. gets, is waiting
  4. has gotten, must be waiting

65. Choose the series of prepositions that best completes the following sentence.Whiskey, my pet squirrel, jumped ________ my head and ________ the windowsill.

Answers:

  1. over, onto
  2. through, into
  3. from, under
  4. into, onto

66. Rearrange the following words to create the most logical and grammatically correct sentence.sleeping likes the . midday Katie until on weekends

Answers:

  1. sleeping Katie likes until midday on the weekends.
  2. Katie likes sleeping until weekends on the midday.
  3. Katie likes on sleeping until the midday weekends.
  4. Katie likes sleeping on midday until the weekends.
  5. Katie likes sleeping until midday on the weekends.

67. Choose the series of adjectives and adverbs that best completes the following sentence.We were surprised when the ________ parade ________ turned into a ________ party!

Answers:

  1. dull, suddenly, wild
  2. duller, all of a sudden, wilder
  3. dullest, suddenly, wildest
  4. dull, sudden, wild

68. Choose the option that correctly changes the original sentence from active voice to passive voice.ORIGINAL SENTENCE:

That tall man is carrying a lot of lumber.

REWRITTEN SENTENCES:

Answers:

  1. The tall man carries a lot of lumber.
  2. Is being carried by that tall man, the lumber.
  3. The lumber is carried by the tall man.
  4. A lot of lumber is being carried by that tall man.

69. Rearrange the following words to create the most logical and grammatically correct sentence.would I have it anything if had . I you known said would not bother

Answers:

  1. Would I have not said anything if you had known it would bother I?
  2. I would not have said anything if I had known it would bother you.
  3. Had I known if it would bother you I would not have said anything.
  4. If I had known it would not bother you I would have said anything.

70. Change the following sentence from a quotation to indirect speech.”Sharon must go to the bank today,” said Albert.

Answers:

  1. Albert says Sharon will have to go to the bank today.
  2. Albert said Sharon has to go to the bank today.
  3. Albert says Sharon must go to the bank today.
  4. Albert said Sharon had to go to the bank that day.

71. Choose the series of articles and conjunctions that best completes the following sentence.Lilacs ______ violets are usually purple, ______ I have seen some ______ are white.

Answers:

  1. and, however, that
  2. or, yet, which
  3. and, although, that
  4. or, but, and

72. Choose the series of articles and conjunctions that best completes the following sentence.Julia, who is studying to be _______foreign correspondent, is currently doing _______ internship in _______ Middle East _______ will return before the end of _______ year.

Answers:

  1. (no article required), an, the, but, the
  2. the, a, the, however, a
  3. a, an, (no article required), yet, a
  4. a, an, the, but, the

73. Rearrange the following words to create the most logical and grammatically correct sentence.your company name ? of What the is

Answers:

  1. What is the company of your name?
  2. your company What is the name of?
  3. What is the name of your company?
  4. The name of your company What is?

14,503 total views, 35 views today