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?
Answer
Correct Answer:
onmouseover= paragraph..
p onmouseover=
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
178. The following are sample codes on how to merge properties of two JavaScript objects dynamically:
var objl = { food: var obj2 = { animal: "dog"}
function MergeRecursive(objl,obj2){
var obj3 = {};
for (var attrname in objl) { obj3[attrname]= objl[attrname]; }
for (var attrname in obj2) { obj3[attrname]= obj2[attrname]; }
return obj3;
}
Function MergeRecursive(objl, obj2){
for (var p in obj2) {
try {
// Property in destination object set; update its value,
if ( obj2[p].constructor==Object ) {
objl[p] = MergeRecursive(objl[p], obj2[p]);
} else {
objl[p] = obj2[p];
}
}catch(e) {
// Property in destination object not set; create it and set its value.
objl[p] = obj2[p];
}
}
return objl;
Object.extend = function(destination., source) {
for (var property in source)
destination[property] = source[property];
return destination;
}
objl.extend(obj2)
Answer
Correct Answer:
function MergeRecursive(objl,obj2){
var obj3 = {};
for (var attrname in objl) { obj3[attrname]= objl[attrname]; }
for (var attrname in obj2) { obj3[attrname]= obj2[attrname]; }
return obj3;
}
Function MergeRecursive(objl, obj2){
for (var p in obj2) {
try {
// Property in destination object set; update its value,
if ( obj2[p].constructor==Object ) {
objl[p] = MergeRecursive(objl[p], obj2[p]);
} else {
objl[p] = obj2[p];
}
}catch(e) {
// Property in destination object not set; create it and set its value.
objl[p] = obj2[p];
}
}
return objl;
Object.extend = function(destination., source) {
for (var property in source)
destination[property] = source[property];
return destination;
}
objl.extend(obj2)
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
179. What is the following code output?
(function() {
var objl = new Object({name: "Jacob"});
var obj2 = new Object({name: "Alex"});
console.log(objl == obj2);
console.log(objl === obj2);
Answer
Correct Answer:
None of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
180. What method can't be used with a window object?
open
read
write
close
Note: This Question is unanswered, help us to find answer for this one
Check Answer
181. Which of the following functions determines whether the beginning of the paraml instance matches the param2?
function (paraml, param2) {
return paraml.indexOf(param2) == 0;
};
function (paramlj param2) {
return param2.indexOf(paraml) == 0;
};
function (paraml, param2) {
return paraml.startsWith(param2)
};
function (paraml, param2) {
return param2.startsWith(paraml)
};
Answer
Correct Answer:
function (paraml, param2) {
return param2.startsWith(paraml)
};
Note: This Question is unanswered, help us to find answer for this one
Check Answer
182. A form contains two fields named idl and id2. How can you copy the value of the id2 field to idl?
document.forms[0].idl.value=document.forms[0].id2.value
document.forms[0].id2.value=document.forms[0].idl.value
document.idl.value=document.id2.value
document.id2.value=document.idl.value
Answer
Correct Answer:
document.forms[0].idl.value=document.forms[0].id2.value
Note: This Question is unanswered, help us to find answer for this one
Check Answer
183.
What will happen if this single code is executed? 'use strict'; foo = true;
Global variable will be created
ReferenceError thrown
Block scoped variable will be created
Nothing happens
Answer
Correct Answer:
Global variable will be created
Note: This Question is unanswered, help us to find answer for this one
Check Answer
184.
For the following html element, which is the correct method to change the font size to 25px using javascript?
< p id = "foo">Lorem Ipsum</ p >
document.getElementById("foo").setFontSize = "25px";
document.getElementById("foo").style.fontSize = "25px";
document.getElementById("foo").fontSize = "25px";
document.getElementById("foo").style("font-size = 25px");
Answer
Correct Answer:
document.getElementById("foo").style.fontSize = "25px";
Note: This Question is unanswered, help us to find answer for this one
Check Answer
185.
How can you create a function with the JavaScript Function constructor ?
var func = Function("x","y","return x+y");
var func = new Function("x", "y", "return x + y")
var func = Function(x,y){ return x+y;}
None of the above
Answer
Correct Answer:
None of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
186.
What is true about an Array?
To detect if a variable is an array this code can be used: Boolean(a typeof === 'array')
To create a new array with single value at index 0 this code can be used: let a = Array(10.5);
This code can be used to create an array: let a = []; a[10.5] = 'Hey';
This code can be used to create an array: let a = new Array('Hey', 10.50);
Answer
Correct Answer:
This code can be used to create an array: let a = []; a[10.5] = 'Hey'; This code can be used to create an array: let a = new Array('Hey', 10.50);
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
187.
Which of the following code is correct for validating date values?
var d = Date.parse('foo'); if (isNaN(d)==false) { alert(new Date(d)); } else { alert('Invalid date'); }
var d = new Date('foo'); if (d instanceof Date && isFinite(d)) { alert(d); } else { alert('Invalid date'); }
Date.prototype.valid = function() { return isFinite(this); } var d = new Date('foo'); if (d.valid()) { alert(d); } else { alert('Invalid date');
All of the above.
Answer
Correct Answer:
var d = Date.parse('foo'); if (isNaN(d)==false) { alert(new Date(d)); } else { alert('Invalid date'); } var d = new Date('foo'); if (d instanceof Date && isFinite(d)) { alert(d); } else { alert('Invalid date'); }
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
188.
Cookies are a plain text data record with the following variable-length fields?
Secure
Domain
Package
Media
Navigator
Answer
Correct Answer:
Secure Domain
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
189.
What is the result of console.log? var xyz = true; if (xyz) { let res = 42; } console.log(res);
true
42
false
ReferenceError
undefined
Answer
Correct Answer:
ReferenceError
Note: This Question is unanswered, help us to find answer for this one
Check Answer
190.
Which types of image maps can be used with JavaScript?
Server-side image maps
Client-side image maps
Server-side image maps and Client-side image maps
None of the above
Answer
Correct Answer:
Client-side image maps
Note: This Question is unanswered, help us to find answer for this one
Check Answer
191.
Which of the following represents when a String object splits a String object into an array of strings by separating the string into substrings?
slice()
split()
replace()
search()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
192.
Evaluate the following expression: ~-(2 + "2")
undefined
SyntaxError
21
-22
Note: This Question is unanswered, help us to find answer for this one
Check Answer
193.
Which of the following Popup Boxes have support in JavaScript?
Alert Box
Confirm Box
Prompt Box
All of the above
Answer
Correct Answer:
All of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
194.
Which of the following is used in JavaScript to insert special characters?
&
+
-
%
None of the above
Answer
Correct Answer:
None of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
195.
How do you create a Date object in JavaScript?
dateObjectName = new Date([parameters])
dateObjectName.new Date([parameters])
dateObjectName := new Date([parameters])
dateObjectName Date([parameters])
Answer
Correct Answer:
dateObjectName = new Date([parameters])
Note: This Question is unanswered, help us to find answer for this one
Check Answer
196.
Select all correct statements about Object.prototype
Property attributes are writable
Property attributes are enumerable
Property attributes are configurable
Property attributes are readable
Answer
Correct Answer:
Property attributes are readable
Note: This Question is unanswered, help us to find answer for this one
Check Answer
197.
Is it possible using JavaScript, without 3rd party libraries, to select DOM elements with such selector: #question > option
No. It requires jQuery
Yes
No. It requires SizzleJs
This is CSS selector and has nothing with JavaScript
Answer
Correct Answer:
This is CSS selector and has nothing with JavaScript
Note: This Question is unanswered, help us to find answer for this one
Check Answer
198.
How can you remove all of an Element’s children from the DOM?
function remove( element ) { if ( element ) element.parentNode.removeChild( element ); }
function empty( element ) { while ( element.firstChild ) remove( element.firstChild ); }
var listItems = document.getElementsByTagName('li'); remove(listItems[0]);
function empty( element ) { while ( element.firstChild ) remove(firstChild ); }
Answer
Correct Answer:
function empty( element ) { while ( element.firstChild ) remove( element.firstChild ); }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
199.
What is the value of b? let a = [1, 2, 3, 4, 5]; let b = [1, 2, ...a];
[1, 2, 3, 4, 5]
[1, 2, 1, 2, 3, 4, 5]
Some error
[1, 2]
[3, 4, 5]
Answer
Correct Answer:
[1, 2, 1, 2, 3, 4, 5]
Note: This Question is unanswered, help us to find answer for this one
Check Answer
200.
Which example is correct of Local Scope Variable?
var b = 3; function myFunc() { return b * b; }
function myFunc() { var b = 3; return b * b; }
var a = 2; function myFunc(){ console.log(a); }
All of the above
Answer
Correct Answer:
function myFunc() { var b = 3; return b * b; }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
201.
What will this code output? console.log(typeof a); console.log(typeof b); function a() { } var b = function () { };
function, function
function, undefined
undefined, undefined
undefined, function
An error
Answer
Correct Answer:
function, undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
202.
Which event handlers can be used to create hover effect on HTML element?
onhoverstart and onhoverend
onmouseover and onmouseout
onhover and onout
mouseenter and mouseleave
Answer
Correct Answer:
onmouseover and onmouseout
Note: This Question is unanswered, help us to find answer for this one
Check Answer
203.
Which function will return 10 when called like this: f(10);
const f = (...f) => f;
const f = (...f) => f.reduce(f => f);
function f() { return arguments; }
const f = f => f;
Answer
Correct Answer:
const f = (...f) => f.reduce(f => f); const f = f => f;
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
204.
What will be the value of a? let a = 'a'; let b = 'b'; a = [a, , b] = [1, 2, 3];
TypeError
RangeError
[1, 2, 3]
SyntaxError
Answer
Correct Answer:
[1, 2, 3]
Note: This Question is unanswered, help us to find answer for this one
Check Answer
205.
What will be returned if we call f(1);? const b = [1, 2, 3]; const f = (a, ...b) => a + b;
7
1
6
Some error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
206.
Why do web programmers use node.js?
Node.js is a client-side software system where Programmers can customize jQuery code library.
Node.js is a server-side software system where Programmers can write server-side network applications in.
Node.js is a client-side software system where Programmers use this plugin to create video playing website like Youtube without FFmpeg and FFmpegx.
Node.js is a server-side software system, programmers use Node.js to debug javascript erros automatically when a website visitor visits the website.
Answer
Correct Answer:
Node.js is a server-side software system where Programmers can write server-side network applications in.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
207.
What is the correct syntax for referring to an external script called "test.js"?
script name="test.js">
<script href="test.js">
<script src="test.js">
None of these
Answer
Correct Answer:
<script src="test.js">
Note: This Question is unanswered, help us to find answer for this one
Check Answer
208.
What will be written in the alert box after executing 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); ```
13
20
6
None of these
Note: This Question is unanswered, help us to find answer for this one
Check Answer
209.
What will be the output of the following code? var x = [typeof x, typeof y][1]; console.log(typeof typeof x);
string
object
array
It will raise an exception
Note: This Question is unanswered, help us to find answer for this one
Check Answer
210.
Select the existing event handler for DOM elements.
onDrag
onClick
close
onload
Note: This Question is unanswered, help us to find answer for this one
Check Answer
211.
What is JavaScript?
It's the same language as Java just more suitable for web scripting
It's the programming language used by only web developers
It's the programming language used by only server developers
It's the programming language used by web and server developers
It's one of the programming languages based on ECMAScript standard
Answer
Correct Answer:
It's one of the programming languages based on ECMAScript standard
Note: This Question is unanswered, help us to find answer for this one
Check Answer
212.
What will be the value of a? let a = void function f() { let a = 1 - 2; let b = 2 - 3 + 1; if (a) { return true; } else if (b) { return false; } else { return null; } return -1; }();
false
null
-1
undefined
Answer
Correct Answer:
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
213.
Which statement about Promises is not correct?
Promise may never resolve value
.catch() must be used with all Promises
It's possible to test which Promise resolves first with method from Promise object
All Promises will eventually resolve or reject
Answer
Correct Answer:
Promise may never resolve value .catch() must be used with all Promises It's possible to test which Promise resolves first with method from Promise object
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
214.
What's the point of code around the variable statement: (function() { var a = true; })();
It's self-executing anonymous function
It isolates the environment not to leak variables to global space
It make code more readable
It creates anonymous function
Answer
Correct Answer:
It's self-executing anonymous function
Note: This Question is unanswered, help us to find answer for this one
Check Answer
215.
How often will message "hey" be logged in console? setInterval(() => {console.log('hey')},1);
Every 1 milliseconds
Every 1 seconds
Every 0.01 seconds
No correct answer
Answer
Correct Answer:
Every 1 milliseconds
Note: This Question is unanswered, help us to find answer for this one
Check Answer
216.
Select options which create object type variables:
let a = '';
let a = {};
let a = [];
let a = new String('a');
let a = null;
Answer
Correct Answer:
let a = ''; let a = {}; let a = []; let a = new String('a'); let a = null;
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
217.
How many operations can be done simultationsly with JavaScript?
2
1
8
32
Limited only by RAM and CPU
Note: This Question is unanswered, help us to find answer for this one
Check Answer
218.
What will be the value of s.size after executing this code? let s = new Set(); s.add('aa').add('bb').add('cc').add('aa').add('bb')
3
6
undefined
This is not valid JavaScript code
5
10
Note: This Question is unanswered, help us to find answer for this one
Check Answer
219.
What is true about JavaScript language? (choose all that apply)
All objects can inherit from another object
Inherit properties by following the class chain
Can add or remove properties to individual objects or to the entire set of objects at run time
None of these
Answer
Correct Answer:
All objects can inherit from another object Can add or remove properties to individual objects or to the entire set of objects at run time
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
220.
What does let mean in JavaScript?
It's used to create any variable
It's used to create local block scoped variable
It's used to create variable which overrides variables in upper scope
It creates variable which can be used anywhere in code
It's `var` upgrade to show that ES6 is used and compiler must run code in ES6 mode
Answer
Correct Answer:
It's used to create local block scoped variable
Note: This Question is unanswered, help us to find answer for this one
Check Answer
221.
How many yield keywords can be used in function* functions?
As many as needed
1
Same amount as `return` keyword
As many as needed if followed by `return` keyword
Answer
Correct Answer:
As many as needed
Note: This Question is unanswered, help us to find answer for this one
Check Answer
222.
What is the Promise?
Async call
Ajax call
Object
Sync call
Note: This Question is unanswered, help us to find answer for this one
Check Answer
223.
What will be logged in the console? let a = { [ 'foo_' + (() => 1)() ]: 2 }; console.log(a);
TypeError
SyntaxError
{ foo_1: 2 }
ReferenceError
Answer
Correct Answer:
{ foo_1: 2 }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
224.
What's true about the document object in any environment? (choose all that apply)
It's always defined and available to use
The document object can be used to load new URL in the browser
The document object can be used to get an element from DOM
The document object has all active DOM elements in his prototype for quick access
Answer
Correct Answer:
It's always defined and available to use The document object can be used to get an element from DOM The document object has all active DOM elements in his prototype for quick access
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
225.
What will be returned if we call f(3)? const f = (x, y = true) => x * y;
4
NaN
3
Some error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
226.
What is TypeError?
It's a human-friendly string with description about unexpected variable type used
It's an object with message parameter
It's instance of Error which has the name of TypeError and message property with human-friendly message
It's instance of TypeError which has some own methods to get human-friendly error message and has name of TypeError
Answer
Correct Answer:
It's instance of Error which has the name of TypeError and message property with human-friendly message
Note: This Question is unanswered, help us to find answer for this one
Check Answer
227.
What will be the value of a? let a = -1 ? 'foo' ? null : -1 : 1;
foo
null
-1
1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
228.
What does ~ mean in bitwise operation?
OR
SPREAD
XOR
ZERO-FILL
NOT
Note: This Question is unanswered, help us to find answer for this one
Check Answer
229.
What are valid states of the created Promise?
pending
fulfilled
initializing
rejected
Answer
Correct Answer:
pending fulfilled rejected
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
230.
Which statements are true about web workers?
It's possible to spawn new workers inside a web worker
Worker's error bubble and is thrown in script which created the worker
When sending a message to worker with postMessage function connection handler is returned which can be reused for faster messaging
Worker ignores `Content-Security-Policy` header of the script which constructed the worker
Answer
Correct Answer:
It's possible to spawn new workers inside a web worker Worker's error bubble and is thrown in script which created the worker When sending a message to worker with postMessage function connection handler is returned which can be reused for faster messaging
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
231.
What kind of function is function* in JavaScript? (choose all that apply)
It's not a valid code
It is a function which can return value several times
It is a function which can be paused in the middle of execution
No correct answer
Answer
Correct Answer:
It is a function which can return value several times It is a function which can be paused in the middle of execution
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
232.
What is true about strict mode? (choose all that apply)
It applies to block statements
It applies to individual functions
It applies to entire script
It applies to HTML page
Answer
Correct Answer:
It applies to individual functions It applies to entire script
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
233.
Select the event handlers that exist on the HTMLElement.
title
contentEditable
onmousedown
ondblclick
ondragaround
Answer
Correct Answer:
contentEditable
Note: This Question is unanswered, help us to find answer for this one
Check Answer
234.
What will be logged in console? const data = [{a: true, b: false}, {a: false, b: true}]; let result = false; let sample; while (sample = data.pop()) { result = sample.a; } console.log(result);
ReferenceError
TypeError
true
false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
235.
What will be logged to the console? const a = new Promise(function (resolve, reject) { setTimeout(resolve, 100 * .9, '1'); }); const b = new Promise(function (resolve, reject) { setTimeout(reject, .9 * .0, '2'); }); Promise .race([a, b]) .then((value) => { console.log(value); });
undefined
Some error
1
2
a
b
Answer
Correct Answer:
Some error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
236.
How can you get the type of the variable?
using typeof operator
using getType function
Both of the above.
None of the above.
Answer
Correct Answer:
using typeof operator
Note: This Question is unanswered, help us to find answer for this one
Check Answer
237.
How do you remove property a from this object? let a = {a:1, b:2};
a.a = null;
a.a = false;
a.a = 'undefined';
delete a.a;
remove a.a;
Answer
Correct Answer:
delete a.a;
Note: This Question is unanswered, help us to find answer for this one
Check Answer
238.
What is the output of the following code? var foo = 123e5; var bar = 10; var foobar = foo + bar; console.log(foobar)
12300010
1230000010
123e510
133
Note: This Question is unanswered, help us to find answer for this one
Check Answer
239.
What will be in the alert box? let a = {}; a.foo = 'bar'; let b = {a}; alert(b);
some error
{ a: { foo: 'bar' } }
{ a: null }
{ a: undefined }
[object Object]
Answer
Correct Answer:
[object Object]
Note: This Question is unanswered, help us to find answer for this one
Check Answer
240.
What is the following code output? (function() { var obj1 = new Object({name: "Jacob"}); var obj2 = new Object({name: "Alex"}); console.log(obj1 == obj2); console.log(obj1 === obj2); }());
Jacob Alex
true false
false true
None of the above
Answer
Correct Answer:
None of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
241.
What are the Behavioral patterns as follows?
Template method
Chain of responsibility
Mediator
Proxy
Facade
Answer
Correct Answer:
Chain of responsibility Mediator
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
242.
When formal arguments value changes, what is the output of Arguments object? function myFunc(a, b) { arguments[1] = 20; arguments[2] = 79; console.log(a + ", " + b); } myFunc(1, 2);
20, 79
20 + 79
2, 20
1, 20
99
Note: This Question is unanswered, help us to find answer for this one
Check Answer
243.
What will be the output when the following statement code is executed? if(true){ const a=1; console.log(a); a=100; }
1
100
Uncaught TypeError
ReferenceError
Note: This Question is unanswered, help us to find answer for this one
Check Answer
244.
Which of the following code samples creates an alert box with "false" in it?
var n = 3.2; alert(n===+n && n!==(n|0));
var n = 3; alert(n===+n && n===(n|0));
var boolValue = new Boolean("false"); alert(boolValue);
var n=3.2; alert(n % 1 === 0);
Answer
Correct Answer:
var n=3.2; alert(n % 1 === 0);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
245.
Which of the following code is self-executing anonymous function expression?
var bar = function () { console.log('This function worked!' ); };
function foo() { console.log('This function worked!'); }
(function () { console.log( 'This function invoked!' ) })();
All of the above
Answer
Correct Answer:
(function () { console.log( 'This function invoked!' ) })();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
246.
What is printed in the console? for (let i = 0; i<5; i++) { console.log(i); } console.log(i);
0 1 2 3 4
undefined
ReferenceError
SyntaxError
Answer
Correct Answer:
0 1 2 3 4
Note: This Question is unanswered, help us to find answer for this one
Check Answer
247.
How you will do empty an array in JavaScript? var array = ['1', '2', '3', '4', '5', '6'];
while(array.length) { array.pop(); }
array.length = 0
array=[]
var anotherArray = array; array.length = 0;
while(array.length) { array.removeAll(); }
Answer
Correct Answer:
array.length = 0
Note: This Question is unanswered, help us to find answer for this one
Check Answer
248.
Which of the following right code for Function expression?
var bar = function () { console.log( ‘This function worked!’ ); };
function foo() { console.log( ‘This function worked!’ ); }
(function () { console.log( 'This function invoked!' ) })();
All of the above
Answer
Correct Answer:
All of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
249.
Consider the following code output? var name = "falleyr*"; if (name == "jolly") { name += "!"; } else if (name == "falleyr**") { name += "!!"; } else { name = "!" + name; } name == "falleyr***" console.log( name);
falleyr!
jolly
!falleyr*
!falleyr*!
Answer
Correct Answer:
!falleyr*
Note: This Question is unanswered, help us to find answer for this one
Check Answer
250.
The Error event is fired when progression has failed and it have the following Property's?
lengthComputable
loaded
bubbles
id
total
Answer
Correct Answer:
lengthComputable
Note: This Question is unanswered, help us to find answer for this one
Check Answer
251.
The WheelEvent.deltaMode read-only property returns an unsigned long representing and the Permitted Constant values are?
DOM_DELTA_PIXEL
DOM_DELTA_X
DOM_DELTA_Y
DOM_DELTA_PAGE
DOM_DELTA_LINE
Answer
Correct Answer:
DOM_DELTA_PIXEL DOM_DELTA_PAGE DOM_DELTA_LINE
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
252.
Every array method tests whether all the elements in an array passes, what are the correct statement about parameter Details? (Check all that apply)
callback : Function to test for each element
thisObject: Object to use when load callback
callback : Function to executing for each array
callback : Function to executing for each callback
thisObject : Object to use as this when executing callback
Answer
Correct Answer:
callback : Function to test for each element
Note: This Question is unanswered, help us to find answer for this one
Check Answer
253.
The following code create Boolean objects with an initial value of false?
var myBol =new Boolean(null);
var myBol =new Boolean("");
var myBol=new Boolean(0);
var myBol =new Boolean(false);
var myBol =new Boolean(1);
Answer
Correct Answer:
var myBol =new Boolean(null);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
254.
What are the following EventTarget Methods?
target
currentTarget
EventTarget.removeEventListener()
EventTarget.addEventListener()
EventTarget.dispatchEvent()
Answer
Correct Answer:
EventTarget.removeEventListener() EventTarget.addEventListener() EventTarget.dispatchEvent()
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
255.
There are several Navigator-specific methods which include the following? (check all that apply)
plugings.refresh
plugins[]
userAgent[]
taintEnabled()
Answer
Correct Answer:
plugings.refresh
Note: This Question is unanswered, help us to find answer for this one
Check Answer
256.
XMLHttpRequest has the following properties?
XMLHttpRequest.responseText
XMLHttpRequest.responseURL
XMLHttpRequest.responseXML
XMLHttpRequest.responseTypeData
All of the above
Answer
Correct Answer:
XMLHttpRequest.responseText
Note: This Question is unanswered, help us to find answer for this one
Check Answer
257.
Which statement is correct about null and undefined?
Undefined indicates that a variable is not defined in the scope. Null can be assigned to a variable as a representation of no value.
Both undefined and null indicate that a variable has not been assigned a value.
Null is a primitive value used when a variable has not been assigned a value. Undefined is a primitive value that represents an empty or non-existent reference.
None of these.
Answer
Correct Answer:
Undefined indicates that a variable is not defined in the scope. Null can be assigned to a variable as a representation of no value.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
258.
Which functions determine whether the beginning of the param1 instance matches the param2?
function (param1, param2) { return param1.indexOf(param2) == 0; };
function (param1, param2) { return param2.indexOf(param1) == 0; };
function (param1, param2) { return param1.startsWith(param2); };
function (param1, param2) { return param2.startsWith(param1); };
Answer
Correct Answer:
function (param1, param2) { return param1.startsWith(param2); };
Note: This Question is unanswered, help us to find answer for this one
Check Answer
259.
Which of the following are the valid JavaScript codes to obtain the number of milliseconds since the epoch? (check all that apply)
Var timestamp = new Date() .getTime ();
Var timestamp = Number (new Date () );
Var timestamp = Date.now;
Var timestamp = new Date () .value of ();
Answer
Correct Answer:
Var timestamp = new Date() .getTime (); Var timestamp = new Date () .value of ();
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
260.
The replacement string can include the following special replacement patterns?
$`
$&
$$
$'
None of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
261.
Javascript provides the following functions to be frequently used in animation programs? (check all that apply)
.Fadein/FadeOut
.animation()
setTimeout (function, duration)
setInterval (function, duration)
Answer
Correct Answer:
setTimeout (function, duration)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
262.
Document Properties in W3C DOM, supports all the properties available in Legacy DOM?
Implementation
documentElement
createComment( text)
createElement( tagName)
Answer
Correct Answer:
Implementation
Note: This Question is unanswered, help us to find answer for this one
Check Answer
263.
The following global properties return a value and they have no properties/methods? (check all that apply)
Infinity
Nan
isFinite()
eval()
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
264.
Which of the following will correctly check if an object is an array? (check all that apply)
Object.prototype.toString.call(arr) === '[object Array]'
Array.isArray(arr)
Object.isArray(arr)
None of these
Answer
Correct Answer:
Object.prototype.toString.call(arr) === '[object Array]'
Note: This Question is unanswered, help us to find answer for this one
Check Answer
265.
what will be the output of the following code?
var flg = true;
console.log(flg + 1);
console.log(flg + “xyz”);
console.log(flg + true);
console.log(flg + false);
1
truexyz
0
2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
266.
Regular-expression anchor has the following characters?
^
$
(?!p)
(?/\b)
All of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
267.
What are the RegExp Properties as follows?
sourceIndex
lastCase
constructor
global
Answer
Correct Answer:
constructor
Note: This Question is unanswered, help us to find answer for this one
Check Answer
268.
Which of the following are legal event handlers for the image object?
Onload
Onabort
Onmove
All of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
269.
Consider the following code output? var val = "var global"; function constructFun() { var scope = "var local"; return new Function("return val"); } constructFun()());
var global
return val
var global
Error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
270.
What will be the output of the following code?
function User(name) {
this.name = name || “Mike”;
}
var usr = new User(“VRU”)[“location”] = “John”;
Mike
VRU
John
ReferenceError
Note: This Question is unanswered, help us to find answer for this one
Check Answer
271.
What is the output if following code executed?
function sayHello() {
“user strict”
for (x = 0; x < 10; x++)
console.log(Hi John!”);}
sayHelo();
RederenceError
TypeError
Hi John!
Null
Answer
Correct Answer:
TypeError
Note: This Question is unanswered, help us to find answer for this one
Check Answer
272.
What is the correct syntax to create a new object ‘car’ with the following attributes?
Color = red
Model = 2016
Weight = 500kg
var car = {color:”red”, model:”2016”, weight:”500kg”};
var car = {color => ”red”, model => ”2016”, weight => ”500kg”};
var car = {color = ”red”, model = ”2016”, weight = ”500kg”};
var car.color = ”red”
var car.model = ”2016”
var car.weight = ”500kg”;
Answer
Correct Answer:
var car = {color:”red”, model:”2016”, weight:”500kg”};
Note: This Question is unanswered, help us to find answer for this one
Check Answer
273.
Which of the following is not a valid JavaScript variable name?
3names
_first_name
FirstName
None of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
274.
What is the output of the below code?
X = 50 / “Apple”;
alert(x);
undefined
NaN
Infinity
50
Note: This Question is unanswered, help us to find answer for this one
Check Answer
275.
Consider parsing a URL with the following code snippet?
var reg = /(\w+):\/\/([\w.]+)\/(\S*)/; var url = "http://www.myblog.com/"; var result = url.match(reg); if (result != null) { var path = result[1]; }
http://www.myblog.com/
www.myblog.com/
myblog.com/
http
Note: This Question is unanswered, help us to find answer for this one
Check Answer
276.
A property is the object oriented equivalent of:
a function
an if statement
a variable
a reserved word
Answer
Correct Answer:
a variable
Note: This Question is unanswered, help us to find answer for this one
Check Answer
277.
How do you round the number 3.14, to the nearest integer?
Math.round(3.14)
round(3.14)
rnd(3.14)
Math.rnd(3.14)
Answer
Correct Answer:
Math.round(3.14)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
278.
_____ JavaScript is also called client-side JavaScript?
Microsoft
Navigator
PHP
Web
Answer
Correct Answer:
Navigator
Note: This Question is unanswered, help us to find answer for this one
Check Answer
279.
Document Methods in W3C DOM, supports all the methods available in Legacy DOM?
createTextNode( text)
getElementById( id)
getElementsByName( name)
documentElement
defaultView
Answer
Correct Answer:
createTextNode( text)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
280.
What will the output of the below code? function clickValue(){ alert(Math.round(-20.5)); } clickValue();
-20
-21
20
19.5
Note: This Question is unanswered, help us to find answer for this one
Check Answer
281.
How can you detect the client's browser name?
client.navName
browser.appName
navigator.appName
None of these
Answer
Correct Answer:
navigator.appName
Note: This Question is unanswered, help us to find answer for this one
Check Answer
282.
javascript can be termed as which of the following?
Web client side language
Object-oriented language
Object-based language
HighLevel language
Answer
Correct Answer:
HighLevel language
Note: This Question is unanswered, help us to find answer for this one
Check Answer
283.
Which of the following is the correct way to append a value to an array in JavaScript?
arr[arr.length+1] = value
arr[arr.length] = value
arr[arr.length-1] = value
arr[arr.length*1] = value
Answer
Correct Answer:
arr[arr.length] = value
Note: This Question is unanswered, help us to find answer for this one
Check Answer
284.
What is the correct JavaScript syntax to change the content of the HTML element with id "header"?
document.getElementById("header").innerHTML = "Updated Header!";
#header.innerHTML = "Updated Header!";
$header.innerHTML = "Updated Header!";
document.getElement("p").innerHTML = "Updated Header!";
Answer
Correct Answer:
document.getElementById("header").innerHTML = "Updated Header!";
Note: This Question is unanswered, help us to find answer for this one
Check Answer
285.
A property of myobj is defined using:
property myobj x
myobj.x
myobj property x
var x propertyOf myob
Note: This Question is unanswered, help us to find answer for this one
Check Answer
286.
How can you concatenate the following strings in javascript? var foo = "Lorem "; var bar = "Ipsum";
foo + bar;
foo.bar;
concatenate(foo,bar);
foo.concatenate(bar);
Answer
Correct Answer:
foo + bar;
Note: This Question is unanswered, help us to find answer for this one
Check Answer
287.
Which of the following would be the correct way to read the "age" property of a "person" object?
person[age]
person::age
person.age
person['age']
Answer
Correct Answer:
person.age person['age']
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
288.
What is the correct way to create a JavaScript array?
var cars = ["Saab", "Volvo", "BMW"];
var cars= "Saab", "Volvo", "BMW"
var cars= 1 = ("Saab"), 2 = ("Volvo"), 3 = ("BMW")
var cars= (1:"Saab", 2:"Volvo", 3:"BMW")
Answer
Correct Answer:
var cars = ["Saab", "Volvo", "BMW"];
Note: This Question is unanswered, help us to find answer for this one
Check Answer
289.
When does the function name become optional?
Function is defined within a funtion
Function is defined as an expression
Function is predefined
Function is defined using Function constructor
Answer
Correct Answer:
Function is defined as an expression
Note: This Question is unanswered, help us to find answer for this one
Check Answer
290.
What is the correct method to replace all occurrences of "Foo" with "Bar" in the following statement? var mystring = "Replace Foo with Bar at Foo and Foo.";
var replacedString = mystring.replace("Foo","Bar");
var replacedString = mystring.replace(/Foo/g,"Bar");
var replacedString = mystring.replace("/Foo/g","Bar");
var replacedString = mystring.replaceAll("Foo","Bar");
Answer
Correct Answer:
var replacedString = mystring.replace(/Foo/g,"Bar");
Note: This Question is unanswered, help us to find answer for this one
Check Answer
291.
What is the correct regular expression to replace Mango with Apple in a string: var str = "Eat Mango!";
var res = str.replace(/mango/i, "apple");
var res = str.replace(%mango%,"apple");
var res = str.replace(*mango*,"apple");
var res = str.replace(/mango/, "apple");
Answer
Correct Answer:
var res = str.replace(/mango/i, "apple");
Note: This Question is unanswered, help us to find answer for this one
Check Answer
292.
Which of following statements is incorrect regarding localStorage and sessionStorage?
localStorage - stores data with no expiration date
sessionStorage - stores data for one session
The data stored with sessionStorage is deleted when the user closes the browser window.
The data stored with localStorage will not be deleted when the browser is closed, and will be available the next day, week, or year.
None of above
Answer
Correct Answer:
None of above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
293.
Which JavaScript class represents regular expressions?
RegExpObj
RegExp
RegExpClass
StringExp
Note: This Question is unanswered, help us to find answer for this one
Check Answer
294.
What will the following code return: Boolean(6 > 5)
NaN
false
true
1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
295.
Which of the following code snippets is best way to clear the canvas for redrawing?
var canvas = document.getElementById('canvasId'); var context = canvas.getContext('2d'); context.fillStyle = "#ffffff"; context.fillRect(0,0,canvas.width, canvas.height);
var canvas = document.getElementById('canvasId'); var context = canvas.getContext('2d'); ctx.save(); ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.restore();
CanvasRenderingContext2D.prototype.clear = CanvasRenderingContext2D.prototype.clear || function (preserveTransform) { if (preserveTransform) { this.save(); this.setTransform(1, 0, 0, 1, 0, 0); } this.clearRect(0, 0, this.canvas.width, this.canvas.height); if (preserveTransform) { this.restore(); } }; var canvas = document.getElementById('canvasId'); var context = canvas.getContext('2d'); context.clear(); context.setTransform(-1, 0, 0, 1, 200, 200); context.clear(true);
var canvas = document.getElementById('canvasId'); var context = canvas.getContext('2d'); ctx.clearRect(0, 0, canvas.width, canvas.height);
Answer
Correct Answer:
var canvas = document.getElementById('canvasId'); var context = canvas.getContext('2d'); ctx.save(); ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.restore();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
296.
Which of the following can be used to handle the user clicking on a node?
node.addEventListener("click", myFunction, false)
node.addEventListener("onclick", myFunction, false)
node.onclick = myFunction
node.attachEvent("onclick", myFunction)
Answer
Correct Answer:
node.addEventListener("click", myFunction, false)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
297.
Which of the following methods is used to get the current location of a user?
getUserPosition()
getCurrentPosition()
getPosition()
None of above
Answer
Correct Answer:
getCurrentPosition()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
298.
do while (a < b) runs
until a >= b
until a < b
until a > b
until a <= b
Answer
Correct Answer:
until a >= b
Note: This Question is unanswered, help us to find answer for this one
Check Answer
299.
Which of the following is not a mouse event?
onmousescroller
onclick
onmouseover
onmousemove
Answer
Correct Answer:
onmousescroller
Note: This Question is unanswered, help us to find answer for this one
Check Answer
300.
What will be the value of "mystring" variable when the following code is executed? var fruits = ["Banana", "Orange", "Apple", "Mango"]; fruits.pop(); var mystring = fruits.join(" * ");
Banana * Orange * Apple
Banana * Orange * Apple * Mango
Orange * Apple * Mango
mystring will be empty
Answer
Correct Answer:
Banana * Orange * Apple
Note: This Question is unanswered, help us to find answer for this one
Check Answer
301.
What will be the final output ? var x=3; x=x<<3;
1
3
24
9
Note: This Question is unanswered, help us to find answer for this one
Check Answer
302.
What is the event that fires when the form element textarea loses the focus?
Onclick
Ondblclick
Onfocus
Onblur
Note: This Question is unanswered, help us to find answer for this one
Check Answer
303.
How would you change the date to one week later assuming myDate is a date object?
myDate.chgDate(7);
myDate.setDate(myDate.getDate()+7);
myDate.setDate(+7);
myDate.chgDate(myDate.getDate()+7);
Answer
Correct Answer:
myDate.setDate(myDate.getDate()+7);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
304.
Which of the following is incorrect way of instantiating a date?
new Date(dateString)
new Date()
new Date(seconds)
new Date(year, month, day, hours, minutes, seconds, milliseconds)
Answer
Correct Answer:
new Date(seconds)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
305.
What will following code print on browser console? var foo = function foo() { console.log(foo === foo); }; foo();
true
false
nothing
It will raise an exception.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
306.
Which of the following statements is incorrect regarding HTML5 Web Worker?
A web worker is a JavaScript that runs in the background.
It runs independently of other scripts, without affecting the performance of the page
The data from the web worker is stored in event.source
postMessage() method - which is used to posts a message back to the HTML page.
Answer
Correct Answer:
The data from the web worker is stored in event.source
Note: This Question is unanswered, help us to find answer for this one
Check Answer
307.
What would be the output of below regular expression code: /e/.exec("The best things in life are free!");
e
6
4
true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
308.
What is the output of the following code? if(typeof(Storage)!=="undefined") { localStorage.age=5; sessionStorage.age=5; alert(localStorage.age + sessionStorage.age); } else { alert("Sorry, your browser does not support web storage..."); }
55
10
Sorry, your browser does not support web storage...
5undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
309.
What will be the output of following code snippet? var result = (function(a) { return a*a; }(5.5)); alert(result);
5
25
10
30.25
Note: This Question is unanswered, help us to find answer for this one
Check Answer
310.
Which of the following is not a valid JavaScript Assignment Operator?
/=
*=
= %=
^
Note: This Question is unanswered, help us to find answer for this one
Check Answer
311.
How can you convert a comma separated string variable txt into an array?
txtArray = txt.indexOf(',');
txtArray = txt.split(',');
txtArray = txt.trim(',');
txtArray = txt.substring(',');
Answer
Correct Answer:
txtArray = txt.split(',');
Note: This Question is unanswered, help us to find answer for this one
Check Answer
312.
How do you find the number with the highest value of variable a and b?
top(a, b)
Math.max(a, b)
Math.ceil(a, b)
Math.highest(a, b)
Answer
Correct Answer:
Math.max(a, b)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
313.
Which of the following is not a JavaScript datatype?
Function
Boolean
Number
String
Note: This Question is unanswered, help us to find answer for this one
Check Answer
314.
Which of the following statements are true for Java script?
a) JavaScript is case sensitive
b) JavaScript statements can be grouped together in blocks
c) semicolon at the end of statement is mandatory
Both a and b above
Both a and c above
Both b and c above
All of the above
Answer
Correct Answer:
All of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
315.
What will be the output of the following code? var foo = 10 << 1;
10
20
0
30
Note: This Question is unanswered, help us to find answer for this one
Check Answer
316.
Which of the following is/are the correct way to redirect to a URL in javascript?
document.href= 'http://www.foobar.com';
window.location.assign("http://www.foobar.com")
window.location = 'http://www.foobar.com';
navigator.location = 'http://www.foobar.com';
Answer
Correct Answer:
window.location.assign("http://www.foobar.com")
Note: This Question is unanswered, help us to find answer for this one
Check Answer
317.
Which of the following code snippets deletes cookie correctly?
var mydate = new Date(); mydate.setTime(mydate.getTime() - 1); document.cookie = "username=; expires=" + mydate.toGMTString();
document.cookie = null;
document.cookie = "username=John;password=John#1";
var mydate = new Date(); mydate.setTime(mydate.getTime() + 1000000); document.cookie = "username=; expires=" + mydate .toGMTString();
Answer
Correct Answer:
var mydate = new Date(); mydate.setTime(mydate.getTime() - 1); document.cookie = "username=; expires=" + mydate.toGMTString();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
318.
Which Window method is used to call a function or evaluate an expression at specified intervals?
setInterval()
repeat()
setTimeout()
Answer
Correct Answer:
setInterval()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
319.
What will be the output of following code? var x = 1; { var x = 2; } alert(x);
1
2
undefined
code will raise an exception
Note: This Question is unanswered, help us to find answer for this one
Check Answer
320.
Which of the following is a valid syntax to create a function?
Function = demoFunction()
function:demoFunction()
function demoFunction()
function create demoFunction()
Answer
Correct Answer:
function demoFunction()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
321.
Which of the following code samples will correctly search for the word "for" in a string?
var str="This is test for javascript search !!!"; if(str.search("for") != -1) { alert("true"); } else { alert("false"); }
var str="This is test for javascript search !!!"; if(str.indexof("for") != -1) { alert("true"); } else { alert("false"); }
var str="This is test for javascript search !!!"; if(str.indexOf("for") != -1) { alert("true"); } else { alert("false"); }
var str="This is test for javascript search !!!"; if(str.contains("for") != -1) { alert("true"); } else { alert("false"); }
Answer
Correct Answer:
var str="This is test for javascript search !!!"; if(str.search("for") != -1) { alert("true"); } else { alert("false"); }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
322.
Which of the following is the most efficient way to clone a JavaScript object?
var newObject = jQuery.extend(true, {}, oldObject);
var newObject = JSON.parse(JSON.stringify(oldObject));
function clone(obj) { var target = {}; for (var i in obj) { if (obj.hasOwnProperty(i)) { target[i] = obj[i]; } } return target; } var newObject = clone(oldObject);
var newObject = jQuery.extend({}, oldObject);
Answer
Correct Answer:
var newObject = jQuery.extend(true, {}, oldObject);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
323.
What kind of Typed Arrays representation of the pixels does Canvas ImageData return when you call ImageData.data?
Uint8ClampedArray
Uint8Array
Int8Array
Uint32Array
Answer
Correct Answer:
Uint8ClampedArray
Note: This Question is unanswered, help us to find answer for this one
Check Answer
324.
Which method evaluates a string of JavaScript code in the context of the specified object?
parseInt
Eval
parseFloat
Efloat
Note: This Question is unanswered, help us to find answer for this one
Check Answer
325.
The following codes are for comparing equality operators "==" and "===" in JavaScript. Which of the following are the correct results?
var a = "12" + "3"; var b = "123"; return (a === b); result: true
var a = [1,2,3]; var b = [1,2,3]; return (a == b); result: false
var a = { x: 1, y: 2 }; var b = { x: 1, y: 2 }; return (a === b); result: true
var a = new String("123"); var b = "123"; return (a === b); result: true
var a = { x: 1, y: 2 }; var b = { x: 1, y: 2 }; return (a == b); result: true
Wrong ans MCQ MA type
Answer
Correct Answer:
var a = { x: 1, y: 2 }; var b = { x: 1, y: 2 }; return (a == b); result: true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
326.
What is the output of the given code? public class Test15 { public static void main(String[] args) { VO a = new VO(2); VO b = new VO(3); swapONE(a, b); print(a, b); swapTWO(a, b); print(a, b); } private static void print(VO a, VO b) { System.out.print(a.toString() + b.toString()); } public static void swapONE(VO a, VO b) { VO tmp = a; a = b; b = tmp; } public static void swapTWO(VO a, VO b) { int tmp = a.x; a.x = b.x; b.x = tmp; } } class VO { public int x; public VO(int x) { this.x = x; } public String toString() { return String.valueOf(x); } }
2332
3232
3223
2323
Note: This Question is unanswered, help us to find answer for this one
Check Answer
327.
var p = { "p1": "value1", "p2": "value2", "p3": "value3" }; Which of the choices below produces the following output? output: p2 = value2
for (var key in p) { alert(key + " = " + p[key]); }
for (var key in p) { if (p.hasOwnProperties(key)) { alert(key + " = " + p[key]); } }
for(key in p) { alert( p[key] ); }
for (var key in p) { if (p.hasOwnProperty(key)) { alert(key + " = " + p[key]); } }
Answer
Correct Answer:
for (var key in p) { alert(key + " = " + p[key]); }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
328.
Which of the following is the correct syntax for using the JavaScript exec() object method?
RegExpObject.exec()
RegExpObject.exec(string)
RegExpObject.exec(parameter1,parameter2)
None of these
Answer
Correct Answer:
RegExpObject.exec(string)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
329.
Which of the following code snippets removes objects from an associative array?
delete array["propertyName"];
array.propertyName.remove();
array.splice(index, 1);
array["propertyName"].remove();
Answer
Correct Answer:
delete array["propertyName"];
Note: This Question is unanswered, help us to find answer for this one
Check Answer
330.
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());
Jani,Hege,Stale,Kai Jim,Borge Lene,Jani,Hege,Stale,Kai Jim,Borge
Jani,Hege,Stale,Kai Jim,Borge Jani,Hege,Lene,Stale,Kai Jim,Borge
Jani,Hege,Stale,Kai Jim,Borge Jani,Hege,Stale,Kai Jim,Lene,Borge
Jani,Hege,Stale,Kai Jim,Borge Jani,Hege,Stale,Kai Jim,Borge
Answer
Correct Answer:
Jani,Hege,Stale,Kai Jim,Borge Jani,Hege,Lene,Stale,Kai Jim,Borge
Note: This Question is unanswered, help us to find answer for this one
Check Answer
331.
Which of the following will invoke the browser's Add To Favorite dialog box?
window.AddFavorite
document.AddFavorite
window.external.AddFavorite
It is not possible using JavaScript.
Answer
Correct Answer:
window.external.AddFavorite
Note: This Question is unanswered, help us to find answer for this one
Check Answer
332.
Which of the following declarations is not valid?
var a var b var c
var a, b, c
var a=10, b=20, c=30
All the other options are valid.
Answer
Correct Answer:
All the other options are valid.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
333.
What does the following JavaScript code do?
<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>
The code will cause an error alert to be displayed if a numeric character is entered, and the numeric character is removed.
The code will cause an error alert to be displayed if a non-numeric character is entered, and the non-numeric character is removed.
The code will cause an error alert to be displayed if a numeric character is entered, and the value of textbox is reset.
The code will cause an error alert to be displayed if a non-numeric character is entered, and the value of textbox is reset.
Answer
Correct Answer:
The code will cause an error alert to be displayed if a numeric character is entered, and the numeric character is removed.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
334.
Which of the following statements are true regarding "window.onload" and "<body onload=""/>"?
There is no difference between "window.onload" and "body onload=""/>", and there is no general preference between the two, as far as best practices is concerned.
"window.onload" and "<body onload=""/>" are functionally equivalent, but "<body onload=""/>" is preferred because it combines the JavaScript code with the HTML markup.
"window.onload" and "<body onload=""/>" are functionally equivalent, but "window.onload" is preferred because it separates the JavaScript code from the HTML markup.
None of the above.
Answer
Correct Answer:
"window.onload" and "<body onload=""/>" are functionally equivalent, but "window.onload" is preferred because it separates the JavaScript code from the HTML markup.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
335.
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>
Both are equally efficient.
The first code is more efficient as it contains less code.
The first code is more efficient as it employs object caching.
The second code is more efficient as it employs object caching.
Answer
Correct Answer:
The second code is more efficient as it employs object caching.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
336.
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>
now
(now)
15
19
Note: This Question is unanswered, help us to find answer for this one
Check Answer
337.
Which of the following cannot be achieved using JavaScript?
Read or write from external files (except .js files).
Access or modify browser settings.
Launch client processes (e.g. Windows applications).
Launching the default email application of the client.
Answer
Correct Answer:
Read or write from external files (except .js files).
Note: This Question is unanswered, help us to find answer for this one
Check Answer
338.
While coding a loop, which statement can be used to ignore the rest of the statements, and continue with the beginning of the loop?
exit
return
continue
while
break
Note: This Question is unanswered, help us to find answer for this one
Check Answer
339.
Which of the following properties can be used to dynamically change the value of a <tr> tag?
HTML
innerHTML
outerHTML
text
innerText
None of these
Answer
Correct Answer:
innerText
Note: This Question is unanswered, help us to find answer for this one
Check Answer
340.
Consider the following code:
<script type="application/javascript;version=1.8">
var x = 5;
var y = 0;
var variable2=x + y;
let (x = x+10, y = 12) {
var variable1=x+y;
}
variable2=x + y;
</script>
Which of the following choices shows the correct values for "variable1" and "variable2"?
variable1: 27 variable2: 5
variable1: 27 variable2: 27
variable1: 32 variable2: 5
variable1: 32 variable2: 27
Answer
Correct Answer:
variable1: 27 variable2: 5
Note: This Question is unanswered, help us to find answer for this one
Check Answer
341.
A form contains two fields named id1 and id2. How can you copy the value of the id2 field to id1?
document.forms[0].id1.value=document.forms[0].id2.value
document.forms[0].id2.value=document.forms[0].id1.value
document.id1.value=document.id2.value
document.id2.value=document.id1.value
Answer
Correct Answer:
document.forms[0].id1.value=document.forms[0].id2.value
Note: This Question is unanswered, help us to find answer for this one
Check Answer
342.
How can it be determined if JavaScript is disabled in the user’s browser?
It is browser-deoendent.
There is no way to detect if javascript is disabled.
Use the HTML <noscript> tag to display different content if javaScript is disabled.
None of these.
Answer
Correct Answer:
Use the HTML <noscript> tag to display different content if javaScript is disabled.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
343. Which of the following statements regarding JSON is incorrect?
JSON is a lightweight data-interchange format.
JOSN is built on tow structures: A collection of name/value pairs and an ordered list of values.
JSON is a text format that is completely language independent.
Comments in JSON are allowed.
Answer
Correct Answer:
Comments in JSON are allowed.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
344. Which best describes void?
A method
A function
A statement
An operator
A built-in object
Answer
Correct Answer:
An operator
Note: This Question is unanswered, help us to find answer for this one
Check Answer
345. Are the two statements below interchangeable?
Object.property
Object [‘’property’’]
Yes
No
Note: This Question is unanswered, help us to find answer for this one
Check Answer
346.
Which of the following code prints false?
Var boolValue = new Boolean(‘’false’’);
alert (boolValue);
Var boolValue = new Boolean(‘’false’’);
alert (boolValue);
Var boolValue = string (‘’false’’) == ‘’false’’;
alert (boolValue);
Var boolValue = ‘’false’’;
alert ( !! boolValue);
Answer
Correct Answer:
Var boolValue = ‘’false’’;
alert ( !! boolValue);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
347.
Which of the following JavaScript Regular Expression object methods is used to search a string for a specified value and return the result as or false?
Exec { }
Compile { }
return { }
Test { }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
348.
What is the meaning of obfuscation in JavaScript?
Obfuscation is a keyword in javaScript.
Making code unreadable using advanced algorithms.
Decrypting encrypted source code using advanced algorithms.
None of these.
Answer
Correct Answer:
Making code unreadable using advanced algorithms.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
349.
What is the result of compiling and running the given code?
Public class test75 {
Public static void main(string[] args) {
System.out.printIn(new A(){{}}.tostring());
}
}
Class A {
Public string tostring() { return getclass().getName(); }
}
It gets a compiler error.
It complies, but throws NullPointerException at run-time.
It complies, runs, and prints “Test75” (without quotation marks).
It complies, runs, and prints “Test75$1” (without quotation marks).
Answer
Correct Answer:
It gets a compiler error.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
350.
Which event can detect when the user highlights text within a text or textarea object?
onSelect
onBlur
onChange
onMove
None of these
Answer
Correct Answer:
None of these
Note: This Question is unanswered, help us to find answer for this one
Check Answer
351.
Which of the following browsers support a script tag's async attribute?
Firefox(Gecko), Internet Explorer, Opera, Safari.
Chrome, Internet Explorer, Opera, Safari.
Chrome, Firefox(Gecko), Opera, Safari.
Chrome, Firefox(Gecko), Internet Explorer, Safari.
Answer
Correct Answer:
Chrome, Firefox(Gecko), Opera, Safari.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
352.
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;
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.
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.
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.
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.
Answer
Correct Answer:
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.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
353.
What is the final value of the variable apt? var apt=2; apt=apt<<2;
2
4
6
8
16
Note: This Question is unanswered, help us to find answer for this one
Check Answer
354.
Which of the following is not a valid HTML event?
ondblclick
onmousemove
onclick
onblink
Note: This Question is unanswered, help us to find answer for this one
Check Answer
355.
Consider the following scenario: The document.write() method is embedded to write some text within a pair of <td></td> 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?
The browser does not support JavaScript.
An older version of the browser is being used.
The browser does not support cookies.
Answer
Correct Answer:
The browser does not support JavaScript.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
356.
Consider three variables: someText = 'JavaScript1.2'; pattern = /(\w+)(\d)\.(\d)/i; outCome = pattern.exec(someText); What does pattern.global contain?
true
false
undefined
null
1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
357.
Select the following function that shuffles an array?
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; }
function shuffle(array) { return array.sort(function(a,b) { return (a-b); }); }
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; }
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(); }
Answer
Correct Answer:
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; }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
358.
What will the following code snippet do? document.alinkColor="green"
It makes the background color of the document green.
It makes the color of the active links green.
It makes the color of the visited links green.
It makes the color of all links green.
None of these.
Answer
Correct Answer:
It makes the color of the active links green.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
359.
Which of the following correctly explains the difference between a "for...in" and a "for" loop?
"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.
"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.
"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.
"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.
Answer
Correct Answer:
"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.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
360.
Which of the following check if an object has a specific property?
hasownproperty ()
hasProperty ()
It is browser-dependent.
None of these.
Answer
Correct Answer:
hasownproperty ()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
361.
What value would JavaScript assign to an uninitialized array element?
NaN
Null
Undefined
False
0
Answer
Correct Answer:
Undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
362.
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?
The paragraph.
The image.
It depends on other rules.
Answer
Correct Answer:
It depends on other rules.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
363.
Consider the three variables: someText = 'JavaScript1.2'; pattern = /(\w+)(\d)\.(\d)/i; outCome = pattern.exec(someText); What does outCome[0] contain?
true
false
JavaScript1.2
null
0
Answer
Correct Answer:
JavaScript1.2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
364.
The statement navigator.platform indicates 'Win16' on user's computer that's running Windows NT. Which of the following is true?
navigator.platform is supposed to show 'Win16' on Windows NT.
The userAgent property reflects the correct operating system.
The property can be modified.
navigator.platform shows the operating system for which the browser was compiled for.
The browser version is outdated.
Answer
Correct Answer:
navigator.platform shows the operating system for which the browser was compiled for.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
365.
Which of the following Regular Expression pattern flags is not valid?
gi
p
i
g
Note: This Question is unanswered, help us to find answer for this one
Check Answer
366.
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>
bar['baz']();
object['foo']['bar']['baz']();
document['foo']['bar']['baz']();
window['foo']['bar']['baz']();
Answer
Correct Answer:
window['foo']['bar']['baz']();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
367.
Consider the three variables: someText = 'JavaScript1.2'; pattern = /(\w+)(\d)\.(\d)/i; outCome = pattern.exec(someText); What does pattern.ignoreCase contain?
true
false
undefined
null
0
Note: This Question is unanswered, help us to find answer for this one
Check Answer
368.
What value would JavaScript assign to an uninitialized variable?
NaN
null
undefined
false
Answer
Correct Answer:
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
369.
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?
body onload="message()"
body onunload="message()"
body onsubmit="message()"
body onreset="message()"
Answer
Correct Answer:
body onload="message()"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
370.
Which of the following JavaScript Regular Expression modifiers finds one or more occurrences of a specific character in a string?
?
*
+
#
Note: This Question is unanswered, help us to find answer for this one
Check Answer
371.
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"
define(E_DEPRECATED, false);
error_reporting(E_ALL ^ E_DEPRECATED);
define(E_NOTICE, false);
error_reporting(WP_DEBUG, true)
Answer
Correct Answer:
error_reporting(E_ALL ^ E_DEPRECATED);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
372.
Image size limits can be set _______________.
directly in the posts
in the wp-imageresize plug-in
in the admin settings
both directly in the posts and in the wp-imageresize plug-in
Answer
Correct Answer:
in the admin settings
Note: This Question is unanswered, help us to find answer for this one
Check Answer
373.
User Level 7 converts to _________?
Contributor
Author
Editor
Subscriber
Administrator
Answer
Correct Answer:
Administrator
Note: This Question is unanswered, help us to find answer for this one
Check Answer
374.
From which version of WordPress can you choose your username during the installation process?
2.7
2.8
3.0
3.0.1
3.1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
375.
Which of the following is the correct way to change the admin URL to something else other than wp-admin?
Use the admin_default_page() function.
Change the site URL settings in General Settings.
Change the wp-admin folder name to something else.
This cannot be done.
Answer
Correct Answer:
This cannot be done.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
376.
Which of the following theme files can be used to customize the "page not found error" error page?
index.php
404.php
functions.php
page.php
Note: This Question is unanswered, help us to find answer for this one
Check Answer
377.
Which of the following is the correct sequence of steps to adapt a WordPress plugin to a multisite?
Use $wpdb to iterate through all blogs 2. Hook according to the $blog_id 3. Install the plugin as Network only 4. Uninstall depends on the specific plugin
. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. Install the plugin as Network only 4. Uninstall depends on the specific plugin
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
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
Answer
Correct Answer:
Use $wpdb to iterate through all blogs 2. Hook according to the $blog_id 3. Install the plugin as Network only 4. Uninstall depends on the specific plugin
Note: This Question is unanswered, help us to find answer for this one
Check Answer
378.
How can a featured image be added to a WordPress post programmatically?
'alignleft')); ?>
add_theme_support( 'post-thumbnails' );
get_the_post_thumbnail()
Answer
Correct Answer:
'alignleft')); ?>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
379.
How can a plugin function be called using Ajax?
Adding the JavaScript file: jQuery(document).ready(function($) { jQuery.post(ajax_object.ajax_url, data, function(response) {alert('Got this from the server: ' + response);}); }); 2. Then adding the PHP file: add_action('wp_ajax_my_action', 'my_action_callback'); function my_action_callback() { $whatever = intval( $_POST['whatever'] ); $whatever += 10; echo $whatever; return(); }
1. Adding the JavaScript file: jQuery(document).ready(function($) { var data = {action: 'my_action',whatever: ajax_object.we_value }; jQuery.post(ajax_object.ajax_url, data, function(response) {alert('Got this from the server: ' + response);}); }); 2. Then adding the PHP file: add_action('wp_ajax_my_action', 'my_action_callback'); function my_action_callback() { $whatever = intval( $_POST['whatever'] ); $whatever += 10; echo $whatever; true(); }
1. Adding the JavaScript file: jQuery(document).ready(function($) { var data = {action: 'my_action',whatever: ajax_object.we_value }; jQuery.post(ajax_object.ajax_url, data, function(response) {alert('Got this from the server: ' + response);}); }); 2. Then adding the PHP file: function my_action_callback() { $whatever = intval( $_POST['whatever'] ); $whatever += 10; echo $whatever; end(); }
1. Adding the JavaScript file: jQuery(document).ready(function($) { var data = {action: 'my_action',whatever: ajax_object.we_value }; jQuery.post(ajax_object.ajax_url, data, function(response) {alert('Got this from the server: ' + response);}); }); 2. Then adding the PHP file:
Answer
Correct Answer:
1. Adding the JavaScript file: jQuery(document).ready(function($) { var data = {action: 'my_action',whatever: ajax_object.we_value }; jQuery.post(ajax_object.ajax_url, data, function(response) {alert('Got this from the server: ' + response);}); }); 2. Then adding the PHP file:
Note: This Question is unanswered, help us to find answer for this one
Check Answer
380.
Which of the following will automatically create a page upon activating a WordPress plugin?
register_activation_hook( __FILE__, 'my_plugin_install_function'); function my_plugin_install_function() { $post = array( 'comment_status' => 'closed', 'ping_status' => 'closed' , 'post_author' => 1, 'post_date' => date('Y-m-d H:i:s'), 'post_name' => 'Checklists', 'post_status' => 'publish' , 'post_title' => 'Checklists', 'post_type' => 'post', ); $newvalue = wp_insert_post( $post, true); update_option( 'hclpage', $newvalue ); }
register_activation_hook( __FILE__, 'my_plugin_install_function'); function my_plugin_install_function() { $post = array( 'comment_status' => 'closed', 'ping_status' => 'closed' , 'post_author' => 1, 'post_date' => date('Y-m-d H:i:s'), 'post_name' => 'Checklists', 'post_status' => 'publish' , 'post_title' => 'Checklists', 'post_type' => 'page', ); $newvalue = wp_insert_post( $post, false ); update_option( 'hclpage', $newvalue ); }
register_activation_hook( __FILE__, 'my_plugin_install_function'); function my_plugin_install_function() { $post = array( 'comment_status' => 'closed', 'ping_status' => 'closed' , 'post_author' => 1, 'post_date' => date('Y-m-d H:i:s'), 'post_name' => 'Checklists', 'post_status' => 'publish' , 'post_title' => 'Checklists', 'post_type' => 'post', ); $newvalue = wp_insert_posts( $post, true); update_option( 'hclpage', $newvalue ); }
register_activation_hook( __FILE__, 'my_plugin_install_function'); function my_plugin_install_function() { $post = array( 'comment_status' => 'closed', 'ping_status' => 'closed' , 'post_author' => 1, 'post_date' => date('Y-m-d H:i:s'), 'post_name' => 'Checklists', 'post_status' => 'publish' , 'post_title' => 'Checklists', 'post_type' => 'page', ); $newvalue = wp_insert_posts( $post, false ); update_option( 'hclpage', $newvalue ); }
Answer
Correct Answer:
register_activation_hook( __FILE__, 'my_plugin_install_function'); function my_plugin_install_function() { $post = array( 'comment_status' => 'closed', 'ping_status' => 'closed' , 'post_author' => 1, 'post_date' => date('Y-m-d H:i:s'), 'post_name' => 'Checklists', 'post_status' => 'publish' , 'post_title' => 'Checklists', 'post_type' => 'page', ); $newvalue = wp_insert_posts( $post, false ); update_option( 'hclpage', $newvalue ); }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
381.
Which of the following code snippets is the correct way to get content from Tinymce via javascript ?
document.getElementById('content')
tinymce.activeEditor.getContent();
tinymce.element.getContent();
document.getElement('tinymce_content')
Answer
Correct Answer:
tinymce.activeEditor.getContent();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
382.
Which of the following will echo the base URL of a WordPress site?
<?php echo get_bloginfo('base_url') ?>
<?php echo get_bloginfo('url') ?>
<?php echo get_bloginfo('site_url') ?>
<?php echo get_website_url() ?>
Answer
Correct Answer:
<?php echo get_bloginfo('url') ?>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
383.
What should be done if a fatal error message "Out of Memory" is received while adding a new post in WordPress?
Contact hosting provider to get memory increased.
Add clear('WP_CACHE', '0'); to your wp-config.php file.
Add define('WP_MEMORY_LIMIT', '64M'); to your wp-config.php file.
Install a cache plugin and clear the cache memory from it.
Answer
Correct Answer:
Add define('WP_MEMORY_LIMIT', '64M'); to your wp-config.php file.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
384.
Who of the following persons can read a post locked by password?
Only administrators, editors and authors
Registered users who knows password
Anyone who knows a password
Answer
Correct Answer:
Anyone who knows a password
Note: This Question is unanswered, help us to find answer for this one
Check Answer
385.
How would you integrate WordPress Tiny MCE editor with a plugin?
wp_enqueue_script('tiny_mce')
wp_editor( $content, $id );
add_action('init','tiny_mce')
Cannot integrate Tiny MCE with custom plug ins
Answer
Correct Answer:
wp_editor( $content, $id );
Note: This Question is unanswered, help us to find answer for this one
Check Answer
386.
How can the Home link be disable from the Wordpress top nav?
Using Jquery to hide it
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' );
wp_nav_menu( array('menu' => 'news', 'show_home' => false))
Can not disable the default Home link from wordpress top nav
Answer
Correct Answer:
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' );
Note: This Question is unanswered, help us to find answer for this one
Check Answer
387.
Which of the following is an incorrect way to force www to a WordPress URL?
Modify the config.php file.
Modify the .htaccess file.
Change the WordPress and site address in General Settings.
Install and configure a redirection plugin.
Answer
Correct Answer:
Modify the config.php file.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
388.
Which of the following code snippets removes the "Home" link from the "wp_nav_menu" ?
news', 'show_home' => false)); ?>
news', 'show_home' =0 )); ?>
In functions.php following code should be added: function page_menu_args( $args ) { $args['show_home'] = FALSE; return $args; } add_filter( 'wp_page_menu_args', 'page_menu_args' ); Plus additional snippet code: wp_nav_menu( array('echo'=>true));
$("div.menu > ul li:first-child").css("display","none");
Answer
Correct Answer:
In functions.php following code should be added: function page_menu_args( $args ) { $args['show_home'] = FALSE; return $args; } add_filter( 'wp_page_menu_args', 'page_menu_args' ); Plus additional snippet code: wp_nav_menu( array('echo'=>true));
Note: This Question is unanswered, help us to find answer for this one
Check Answer
389.
Conditional tags can be used to _______________________.
get all comments from one post
get all posts from one category
change the content to be displayed
None of the above: conditional tags are not available in WordPress.
Answer
Correct Answer:
change the content to be displayed
Note: This Question is unanswered, help us to find answer for this one
Check Answer
390.
Which of the following role levels has the highest privilege?
Level_0
Level_10
Depends on your settings.
Every role level has the same privilege.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
391.
Which function is used to display the name of current page in wordpress?
get_the_title()
content_title()
page_name()
post_name()
Answer
Correct Answer:
get_the_title()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
392.
User Level 1 converts to _________?
Contributor
Author
Editor
Subscriber
Administrator
Answer
Correct Answer:
Contributor
Note: This Question is unanswered, help us to find answer for this one
Check Answer
393.
In which way MD5 hash does wordpress stores and represents?
In Hex string
In Base64 string
in raw data file
text file
Answer
Correct Answer:
In Hex string
Note: This Question is unanswered, help us to find answer for this one
Check Answer
394.
What is the output of the following code? <?php // example from php.net function callback($buffer) { // replace all the apples with oranges return (str_replace("apples", "oranges", $buffer)); } ob_start("callback"); ?> <html><body> <p>It's like comparing apples to oranges.</p> </body></html> <?php ob_end_flush(); ?> /* output: <html><body> <p>It's like comparing oranges to oranges.</p> </body></html> */
Wordpress output buffer filter catching the final html output
Wordpress input buffer filter modify the final html input
Wordpress output buffer filter deleting the final html input
Wordpress filter caching the final html input
Answer
Correct Answer:
Wordpress input buffer filter modify the final html input
Note: This Question is unanswered, help us to find answer for this one
Check Answer
395.
What is the output of the following code? <ul id="sortable"> <li id="1">example 1</li> <li id="2">example 2</li> <li id="3">example 3</li> <li id="4">example 4</li> </ul> $(document).ready(function(){ $('#sortable').sortable({ update: function(event, ui) { var newOrder = $(this).sortable('toArray').toString(); $.get('saveSortable.php', {order:newOrder}); } }); });
Removes positions from data base based on the user input
Saves sortable positions to data base based on the user input
Adding new sortable positions from another data base
Sorting out existing positions without updating the data base with the new user inputs
Answer
Correct Answer:
Saves sortable positions to data base based on the user input
Note: This Question is unanswered, help us to find answer for this one
Check Answer
396.
____________ can write their own posts but may not publish or delete them. Their HTML is limited to the set of allowed tags and they cannot upload media files.
Contributor
Author
Editor
Subscriber
Administrator
Answer
Correct Answer:
Contributor
Note: This Question is unanswered, help us to find answer for this one
Check Answer
397.
How can a WordPress template be integrated inside a codeigniter framework using WordPress functions like wp_header,wp_footer,wp_sidebar?
Include the file wp-blog-header.php from WordPress installation directory to codeigniters index.php and create template inside codeigniter's view.
Include the file wp-settings.php from WordPress installation directory to codeigniters index.php and create template inside codeigniter's view.
Create template inside WordPress theme directory and include the file in codeigniter's view.php file.
It is not possible to integrate wordpress with codeigniter.
Answer
Correct Answer:
Include the file wp-blog-header.php from WordPress installation directory to codeigniters index.php and create template inside codeigniter's view.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
398.
Which of the following will return only the src attribute of an tag while using the post_thumbnail() function in WordPress?
get_the_post_thumbnail_src( $post->ID, 'thumbnail' );
wp_get_attachment_image_src( get_post_thumbnail_id($post->ID),
KickExam Pvt. Ltd.
array(320,240), false, '' );
the_post_src_thumbnail( $size, $attr );
set_post_thumbnail_size( 50, 50 );
Answer
Correct Answer:
wp_get_attachment_image_src( get_post_thumbnail_id($post->ID),
KickExam Pvt. Ltd.
array(320,240), false, '' );
Note: This Question is unanswered, help us to find answer for this one
Check Answer
399.
Which deprecated functions are still in use in WordPress?
register_globals()
magc_quotes()
addslashers()
get_permalink()
Answer
Correct Answer:
magc_quotes()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
400.
Which of the following cannot be used to output content from WordPress?
WP_Query
get_query_posts
query_posts
get_posts
Answer
Correct Answer:
get_query_posts
Note: This Question is unanswered, help us to find answer for this one
Check Answer
401.
How can the class name of a sub-menu be changed in the wp_nav_menu?
By manually adding the class name in Appearance-->Menus
Wordpress does not support the ability to change the class name of a sub-menu in the wp_nav_menu.
By adding the following code in functions.php: class UL_Class_Walker extends Walker_Nav_Menu { function start_lvl(&$output, $depth) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<ul class=\"level-".$depth."\">\n"; } }
By adding the following code in header.php: class UL_Class_Walker extends Walker_Nav_Menu { function start_lvl(&$output, $depth) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<ul class=\"level-".$depth."\">\n"; } }
Answer
Correct Answer:
By adding the following code in functions.php: class UL_Class_Walker extends Walker_Nav_Menu { function start_lvl(&$output, $depth) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<ul class=\"level-".$depth."\">\n"; } }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
402.
What is the right order (by priority in use) to display page in Template Hierarchy?
page-{slug}.php, page-{id}.php, page.php, index.php
page-{id}.php, page-{slug}.php, page.php, index.php
page-{slug}.php, page-{id}.php, page.php, archive.php, index.php
page-{slug}.php, page-{id}.php, page.php, 404.php
Answer
Correct Answer:
page-{slug}.php, page-{id}.php, page.php, index.php
Note: This Question is unanswered, help us to find answer for this one
Check Answer
403.
How can widgets for individual pages be managed within the page editor?
By creating a new sidebar for every page
By including sidebar.php in every page
By creating a new sidebar for the page, followed by conditional display rules on individual widgets
By using a custom widget plugin
Answer
Correct Answer:
By using a custom widget plugin
Note: This Question is unanswered, help us to find answer for this one
Check Answer
404.
Which of the following is a Online Code Coloring Service?
Prettify
SyntaxHighligherText
Edit Pad
Collabedit
Note: This Question is unanswered, help us to find answer for this one
Check Answer
405.
Meta tags can be added to WordPress pages by ________________.
using plug-ins
adding them to the header.php file
updating the database
using plug-ins and adding them to the header.php file
adding them to the header.php file and updating the database
Answer
Correct Answer:
using plug-ins and adding them to the header.php file
Note: This Question is unanswered, help us to find answer for this one
Check Answer
406.
How many built-in user roles does WordPress have?
3
4
5
6
Note: This Question is unanswered, help us to find answer for this one
Check Answer
407.
How can the use of html code in comments be disabled?
By disabling the feature in the config file.
By disabling the feature in admin settings.
By changing the theme's source code.
Answer
Correct Answer:
By changing the theme's source code.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
408.
_____________ 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.
Contributor
Author
Editor
Subscriber
Administrator
Note: This Question is unanswered, help us to find answer for this one
Check Answer
409.
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.
adding the following line to your wp-config.php file: define('WP_POST_REVISIONS', 3);
using a plugin
changing a setting on admin panel
Answer
Correct Answer:
adding the following line to your wp-config.php file: define('WP_POST_REVISIONS', 3);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
410.
How can a user be found through its meta data?
User can not be retrieved through its meta data
get_user_by_metadata($metaid,$metavalue)
get_user($args)
get_users($args)
Answer
Correct Answer:
get_users($args)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
411.
Which of the following will hash a string/password to its md5 equivalent?
md5()
wp_generate_password()
wp_generate_md5()
password_md5()
Answer
Correct Answer:
wp_generate_password()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
412.
Which of the following will give the option to add inline Ajax for comment posting?
Enabling Ajax in the wp-config.php file
Activating Ajax from the admin settings of WordPress
Using the Ajax Comment Posting plugin
Wordpress doesn't support inline Ajax.
Answer
Correct Answer:
Using the Ajax Comment Posting plugin
Note: This Question is unanswered, help us to find answer for this one
Check Answer
413.
Which of the following is the correct code to get an array of every image uploaded to a particular post?
$images =& get_children( 'post_type=attachment&post_mime_type=image&post_parent=10' );
$images = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
$images = get_post(7, ARRAY_A);
It cannot be done
Answer
Correct Answer:
$images = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
Note: This Question is unanswered, help us to find answer for this one
Check Answer
414.
Which of the following will show the most recent post (by date) from a custom taxonomy?
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)
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)
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)
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)
Answer
Correct Answer:
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)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
415.
Which of the following can be used to create a folder if it does not already exist on server through WordPress?
function createPath($path) { if (is_dir($path)) return true; $prev_path = substr($path, strrpos($path, '/', -2) + 1 ); $return = createPath($prev_path); return ($return && is_writable($prev_path)) ? mkdir($path) : false; }
function createPath($path) { if (is_dir($path)) return true; $prev_path = substr($path, 0, strrpos($path, '/', -2) + 1 ); $return = createPath($prev_path); return ($return && is_writable($prev_path)) ? mkdir($path) : false; }
function createPath($path) { if (is_dir($path)) return true; $prev_path = substr($path, 0, strrpos($path, -2) + 1 ); $return = createPath($prev_path); return ($return && is_writable($prev_path)) ? mkdir($path) : false; }
function createPath($path) { if (is_dir($path)) return true; $prev_path = substr($path, 0, strrpos($path, '/', -2) + 1 ); $return = createPath($prev_path); return ($return && is_writable($prev_path1)) ? mkdir($path) : false; }
Answer
Correct Answer:
function createPath($path) { if (is_dir($path)) return true; $prev_path = substr($path, 0, strrpos($path, -2) + 1 ); $return = createPath($prev_path); return ($return && is_writable($prev_path)) ? mkdir($path) : false; }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
416.
Which of the following codes is correct for sorting tags of the "WordPress Tag Cloud", when those tags contain special characters?
function custom_tag_sort($tags, $args) { if ($args['orderby'] != 'name') { return $tags; } uasort($tags, 'custom_tag_sort_compare'); } function custom_tag_sort_compare($a, $b) { return strnatcasecmp( custom_tag_sort_normalize($a->name), custom_tag_sort_normalize($b->name) ); } function custom_tag_sort_normalize($tag) { $tag = trim($tag, '"'); $tag = preg_replace('/^\s+the\s+/i', '', $tag); return $tag; } add_filter('tag_cloud_sort', 'custom_tag_sort');
function custom_tag_sort($tags, $args) { if ($args['orderby'] != 'name') { return $tags; } uasort($tags, 'custom_tag_sort_compare'); } function custom_tag_sort_compare($a, $b) { return strnatcasecmp( custom_tag_sort_normalize($a->name), custom_tag_sort_normalize($b->name) ); } function custom_tag_sort_normalize($tag) { $tag = trim($tag, '"'); $tag = preg_replace('/^\s*the\s+/i', '', $tag); return $tag; } add_filter('tag_cloud_sort', 'custom_tag_sort');
function custom_tag_sort($tags, $args) { if ($args['orderby'] = 'name') { return $tags; } uasort($tags, 'custom_tag_sort_compare'); } function custom_tag_sort_compare($a, $b) { return strnatcasecmp( custom_tag_sort_normalize($a->name), custom_tag_sort_normalize($b->name) ); } function custom_tag_sort_normalize($tag) { $tag = trim($tag, '"'); $tag = preg_replace('/^\s*the\s+/i', '', $tag); return $tag; } add_filter('tag_cloud_sort', 'custom_tag_sort');
function custom_tag_sort($tags, $args) { if ($args['orderby'] = 'name') { return $tags; } uasort($tags, 'custom_tag_sort_compare'); } function custom_tag_sort_compare($a, $b) { return strnatcasecmp( custom_tag_sort_normalize($a->name), custom_tag_sort_normalize($b->name) ); } function custom_tag_sort_normalize($tag) { $tags = trim($tag, '"'); $tags = preg_replace('/^\s+the\s+/i', '', $tag); return $tags; } add_filter('tag_cloud_sort', 'custom_tag_sort');
Answer
Correct Answer:
function custom_tag_sort($tags, $args) { if ($args['orderby'] != 'name') { return $tags; } uasort($tags, 'custom_tag_sort_compare'); } function custom_tag_sort_compare($a, $b) { return strnatcasecmp( custom_tag_sort_normalize($a->name), custom_tag_sort_normalize($b->name) ); } function custom_tag_sort_normalize($tag) { $tag = trim($tag, '"'); $tag = preg_replace('/^\s+the\s+/i', '', $tag); return $tag; } add_filter('tag_cloud_sort', 'custom_tag_sort');
Note: This Question is unanswered, help us to find answer for this one
Check Answer
417.
Which of the following is the correct way to assign a category to a Wordpress post?
wp_set_post_categories($postId,$categories)
wp_set_category($catId,$postId)
By XML-RPC call to wpc.newPost
This is not possible
Answer
Correct Answer:
wp_set_post_categories($postId,$categories)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
418.
____________ can manage their own profiles, but can do virtually nothing else in the administration area.
Contributor
Author
Editor
Subscriber
Administrator
Answer
Correct Answer:
Subscriber
Note: This Question is unanswered, help us to find answer for this one
Check Answer
419.
How can the upload media panel be included in a Wordpress template/plugin?
By using function wp_enqueue_script('media-upload')
By using function wp_add_media( );
By using function wp_enqueue_script('upload');
By using function wp_add_script('media-upload');
Answer
Correct Answer:
By using function wp_enqueue_script('media-upload')
Note: This Question is unanswered, help us to find answer for this one
Check Answer
420.
A possible way to allow the display of several authors' names on one post is to ______
update the database
change the admin settings
change the config files
use a plug-in
Answer
Correct Answer:
use a plug-in
Note: This Question is unanswered, help us to find answer for this one
Check Answer
421.
Which of the following is the correct way to retrieve a featured image from a post?
<?php echo get_post_thumb($page->ID, 'thumbnail'); ?>
<?php echo get_featured_image($page->ID, 'thumbnail'); ?>
<?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
<?php echo get_post_thumbnail($page->ID, 'thumbnail'); ?>
Answer
Correct Answer:
<?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
422.
What are the database privileges that are required for WordPress?
insert, delete, update, drop and alter
select, insert, delete, update, create, drop and alter
insert, delete, update, create, drop and alter
insert and delete
Answer
Correct Answer:
select, insert, delete, update, create, drop and alter
Note: This Question is unanswered, help us to find answer for this one
Check Answer
423.
Which of the following codes will return the current plugin directory in WordPress?
<?php plugin_basename($file); ?>
<?php plugin_basename('url'); ?>
<?php bloginfo_plugin('url'); ?>
<?php content_plugin_url( $path ); ?>
Answer
Correct Answer:
<?php plugin_basename($file); ?>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
424.
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.
Yes
No
Note: This Question is unanswered, help us to find answer for this one
Check Answer
425.
Which of the following WordPress Multisite functions allows for getting content from one blog and display it on another?
switch_blog()
switch_to_blog()
restore_current_blog()
restore_to_current_blog()
Answer
Correct Answer:
switch_to_blog()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
426.
One possible way to collect realtime statistics about traffic on a WordPress site is:
using a built-in tool
using a plugin
using a widget
Traffic statistics cannot be collected on a WordPress site.
Answer
Correct Answer:
using a plugin
Note: This Question is unanswered, help us to find answer for this one
Check Answer
427.
How can a custom content filter be added?
By using add_action('the_content','my_custom_filter')
By using add_filter('the_content','my_custom_filter')
By using wp_filter('the_content','my_custom_filter')
By using add_action('content','my_custom_filter')
Answer
Correct Answer:
By using add_filter('the_content','my_custom_filter')
Note: This Question is unanswered, help us to find answer for this one
Check Answer
428.
Which of the following is the correct way to get WordPress Post ID from the Post title?
$page = get_page_title( 'About' ); wp_pages( 'exclude=' . $page->ID );
$page = get_page_by_title( 'Home' ); $page_id = $page->ID;
$page = get_page_by_title( 'About' ); wp_pages( 'exclude=' . $page->ID );
None of the above
Answer
Correct Answer:
$page = get_page_by_title( 'About' ); wp_pages( 'exclude=' . $page->ID );
Note: This Question is unanswered, help us to find answer for this one
Check Answer
429.
Is super cache a built-in plugin of WordPress?
Yes
No
Note: This Question is unanswered, help us to find answer for this one
Check Answer
430.
Which of the following functions are used when adding CSS and jQuery codes on a WordPress plugin?
wp_register_style
wp_enqueue_style
wp_enqueue_script
None of these.
Answer
Correct Answer:
wp_enqueue_script
Note: This Question is unanswered, help us to find answer for this one
Check Answer
431.
What is the BEST way to get last inserted row ID from Wordpress database ?
Use the following code snippet $lastid->$wpdb=$last->get_row;
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.
The following code snippet should be added $last = $wpdb->get_row("SHOW TABLE STATUS LIKE 'table_name'"); $lastid = $last->Auto_increment;
Straight after the $wpdb->insert() insert, the following code should be added: $lastid = $wpdb->insert_id;
Answer
Correct Answer:
Straight after the $wpdb->insert() insert, the following code should be added: $lastid = $wpdb->insert_id;
Note: This Question is unanswered, help us to find answer for this one
Check Answer
432.
Which of the following functions can be used to create a WordPress page?
wp_insert_post()
wp_insert_page()
wp_create_post()
wp_create_page()
Answer
Correct Answer:
wp_insert_post()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
433.
On which of the following databases can WordPress be installed by default?
MySQL
Oracle Database
Microsoft SQL Server
PostgreSQL
Note: This Question is unanswered, help us to find answer for this one
Check Answer
434.
Which of the following actions cannot be hooked in with add_submenu_page() function?
admin_submenu
admin_menu
user_admin_menu
network_admin_menu
Answer
Correct Answer:
admin_menu
Note: This Question is unanswered, help us to find answer for this one
Check Answer
435.
Which of the following is the correct way to filter the content for a few posts?
By using apply_filters(filter,postId)
This is not possible in wordpress
Can create filter for posts in a specific wordpress category
Passing arguments into the_content()
Answer
Correct Answer:
By using apply_filters(filter,postId)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
436.
What is the first action you need to take for enabling the WordPress multisite (MS) feature?
Enable the WordPress multisite feature on admin panel
Enable the Network feature
Add this code to wp-config.php file: define( 'WP_ALLOW_MULTISITE', true );
Answer
Correct Answer:
Add this code to wp-config.php file: define( 'WP_ALLOW_MULTISITE', true );
Note: This Question is unanswered, help us to find answer for this one
Check Answer
437.
Which of the following methods can be used to make permalinks SEO friendly?
Updating the database.
Changing the source code.
Configuring the feature in the config file.
Configuring the feature in the admin settings.
Answer
Correct Answer:
Configuring the feature in the admin settings.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
438.
Which of the functions below is required to create a new taxonomy?
add_taxonomy
register_taxonomy
create_taxonomy
Answer
Correct Answer:
register_taxonomy
Note: This Question is unanswered, help us to find answer for this one
Check Answer
439.
What is the BEST option to integrate Facebook into Wordpress registration/login ?
By using "Simple Facebook Connect" wordpress plugin
By using the "OpenID" plugin
By using the "Social Connect" plugin
By using the "Facebook Registration Tool" plugin
Answer
Correct Answer:
By using "Simple Facebook Connect" wordpress plugin
Note: This Question is unanswered, help us to find answer for this one
Check Answer
440.
Which of the following is a quick way to move a Wordpress website from one server to another?
Using migration plugin
Copying wordpress files and database from source to destination server
Using XML export through wp-admin interface
Install new wordpress and copy theme and plugin directory
Answer
Correct Answer:
Using migration plugin
Note: This Question is unanswered, help us to find answer for this one
Check Answer
441.
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).
my_admin()
view_admin()
is_admin()
root_admin()
Answer
Correct Answer:
is_admin()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
442.
Which of the following will correctly load localized (translated) text for a WordPress plugin?
function custom_theme_setup() { $lang_dir = get_template_directory() . '/lang'); load_theme_textdomain('tutsplus', $lang_dir); } add_action('after_setup_theme', 'custom_theme_setup');
function custom_theme_setup() { $lang_dir = get_template_directory() . '/lang'); add_action('after_setup_theme', 'custom_theme_setup'); }
function custom_theme_setup() { $lang_dir = get_template_directory() . '/lang'); add_action('after_setup_theme', 'custom_theme_setup'); } load_theme_textdomain('tutsplus', $lang_dir);
function load_theme_textdomain('tutsplus', $lang_dir); { $lang_dir = get_template_directory() . '/lang'); custom_theme_setup(); } add_action('after_setup_theme', 'custom_theme_setup');
Answer
Correct Answer:
function custom_theme_setup() { $lang_dir = get_template_directory() . '/lang'); load_theme_textdomain('tutsplus', $lang_dir); } add_action('after_setup_theme', 'custom_theme_setup');
Note: This Question is unanswered, help us to find answer for this one
Check Answer
443.
How can a post ID be retrieved from the permalink?
Its not possible to retrieve the post ID from a permalink due to its structure.
It can be retrieved by using a Regular Expression.
wp_get_post_id($permalink)
url_to_postid($permalink)
Answer
Correct Answer:
url_to_postid($permalink)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
444.
Which of the following code snippets will create plugins back-end page without showing it as menu item?
add_submenu_page with parent slug = null
add_menu_page with parent slug = null
add_submenu_page without parent slug = null
add_menu_page without parent slug = null
Answer
Correct Answer:
add_menu_page without parent slug = null
Note: This Question is unanswered, help us to find answer for this one
Check Answer
445.
Which of the following functions are used to add administration menu item in WordPress ?
add_menu_page();
add_admin_item();
add_admin_page();
add_admin_option();
Answer
Correct Answer:
add_menu_page();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
446.
Which of the following will correctly add custom mod rewrite rules to .htaccess from a WordPress plugin?
$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"]; }}
$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"]; } }
$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
KickExam Pvt. Ltd.
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); } }
$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"]; } }
Answer
Correct Answer:
$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
KickExam Pvt. Ltd.
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); } }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
447.
Which of the following code snippets can be used to create custom POST status in wordpress 3.0 +?
register_new_post()
register_post_status()
add_new_post_status()
modify_post_status()
Answer
Correct Answer:
register_post_status()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
448.
Which of the following is an example of a WordPress plugin that provides multilingual capabilities?
WP Super Cache
qTranslate
BuddyPress
Hotfix
Answer
Correct Answer:
qTranslate
Note: This Question is unanswered, help us to find answer for this one
Check Answer
449.
Which of the following commands can change the ownership of WordPress directory to www-data (for Apache)?
sudo chown -Rf www-data *
chown -Rf www-data *
sudo crown -Df www-data *
Alldo chown -Rf www-data *
Answer
Correct Answer:
sudo chown -Rf www-data *
Note: This Question is unanswered, help us to find answer for this one
Check Answer
450.
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];
$firstTag[‘slug’];
$firstTag->slug
$firstTag.slug
$firstTag[0][‘slug’]
Answer
Correct Answer:
$firstTag->slug
Note: This Question is unanswered, help us to find answer for this one
Check Answer
451.
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?
add_action('init','possibly_redirect'); function possibly_redirect(){ global $pagenow; if( 'wp-login.php' == $pagenow ) { return('Your custom url'); exit(); } }
add_action('init','possibly_redirect'); function possibly_redirect(){ global $pagenow; if( 'wp-login.php' == $pagenow ) { wp_redirect('Your custom url'); exit(); } }
dd_action('init','possibly_redirect'); function possibly_redirect(){ global $pagenow; if( 'wp-login.php' == $pagenow ) { redirect('Your custom url'); exit(); } }
add_action('init','possibly_redirect'); function possibly_redirect(){ global $pagenow; if( 'wp-login.php' == $pagenow ) { wp_return('Your custom url'); exit(); } }
Answer
Correct Answer:
add_action('init','possibly_redirect'); function possibly_redirect(){ global $pagenow; if( 'wp-login.php' == $pagenow ) { wp_redirect('Your custom url'); exit(); } }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
452.
What does a "for...in" loop do?
It iterates over the enumerable properties of an object, in arbitrary order.
It iterates over the enumerable properties of an string, in arbitrary order.
It iterates over the enumerable properties of an intenger, in arbitrary order.
It iterates over the enumerable properties of an function, in arbitrary order.
Answer
Correct Answer:
It iterates over the enumerable properties of an object, in arbitrary order.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
453.
Consider the following code: var setter=new Object() setter.color="blue" How would you delete the color property of the variable seter?
setter.color delete;
delete setter.color
delete(setter.color)
setter.color.delete
Answer
Correct Answer:
delete setter.color
Note: This Question is unanswered, help us to find answer for this one
Check Answer
454.
Which of the following is the best way to show both single and double quotes in the same sentence?
alert("It's "+'"game"'+" time.");
alert('It\'s \"game\" time.');
alert('It\'\s "game" time.');
alert('It\'s "game" time.');
Answer
Correct Answer:
alert('It\'s "game" time.');
Note: This Question is unanswered, help us to find answer for this one
Check Answer
455.
Which of the following is not a valid code for redirect to stackoverflow.com?
window.location.href = "http://stackoverflow.com";
window.location.href ("http://stackoverflow.com");
window.location.replace="http://stackoverflow.com";
window.location.replace("http://stackoverflow.com");
Answer
Correct Answer:
window.location.replace="http://stackoverflow.com";
Note: This Question is unanswered, help us to find answer for this one
Check Answer
456.
Which of the following are JavaScript unit testing tools?
Buster.js, jQuery, YUI Yeti
QUnit, Modernizr, JsTestDriver
Node.js, Modernizr, Jasmine
Buster.js, YUI Yeti, Jasmine
Answer
Correct Answer:
Buster.js, YUI Yeti, Jasmine
Note: This Question is unanswered, help us to find answer for this one
Check Answer
457.
Which of the following code snippets returns "[object object]"?
<script> var o = new Object(); o.toSource(); </script>
<script> var o = new Object(); o.valueOf(); </script>
<script> var o = new Object(); o.toString(); </script>
<script> var o = new Object(); o.getName(); </script>
Answer
Correct Answer:
<script> var o = new Object(); o.toString(); </script>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
458.
What is the cleanest, most effective way to validate decimal numbers in JavaScript?
IsNumeric()
isNaN()
valid()
isDecimal()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
459.
Which of the following modifiers must be set if the JavaScript lastIndex object property was used during pattern matching?
i
m
g
s
Note: This Question is unanswered, help us to find answer for this one
Check Answer
460.
Which of the following code snippets shows the correct way to detect an array that does not contain a specific value?
script>
var aVar = ["Banana", "Orange", "Apple", "Mango"];
var bVar = fruits.indexOf("Lichi")
if(bVar == 1){
//requirement
}
</script>
<script>
var aVar = ["Banana", "Orange", "Apple", "Mango"];
var bVar = fruits.valueOf("Lichi")
if(bVar == -1){
//requirement
}
</script>
<script>
var aVar = ["Banana", "Orange", "Apple", "Mango"];
var bVar = fruits.indexOf("Lichi")
if(bVar == -1){
//requirement
}
</script>
<script>
var aVar = ["Banana", "Orange", "Apple", "Mango"];
var bVar = fruits.valueOf("Lichi")
if(bVar == 1){
//requirement
}
</script>
Answer
Correct Answer:
<script>
var aVar = ["Banana", "Orange", "Apple", "Mango"];
var bVar = fruits.valueOf("Lichi")
if(bVar == -1){
//requirement
}
</script>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
461.
Which of the following will correctly detect browser language preference?
var language = window.navigator.userLanguage || window.navigator.language; alert(language);
var language = navigator.browserLanguage || window.navigator.language; alert(language);
var language = navigator.userLanguage; alert(language);
var language = window.navigator.language; alert(language);
Answer
Correct Answer:
var language = window.navigator.language; alert(language);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
462.
Which of the following code snippets will correctly detect a touchscreen device?
function isTouchDevice() { return !!('ontouchstart' in window) || !!('onmsgesturechange' in window); };
function isTouchDevice() { try { document.body.createEvent("TouchEvent"); return true; } catch (e) { return false; } }
function isTouchDevice(){ return (typeof(navigator.ontouchstart) != 'undefined') ? true : false; }
function isTouchDevice(){ return (navigator.msMaxTouchPoints == 0); }
Answer
Correct Answer:
function isTouchDevice() { return !!('ontouchstart' in window) || !!('onmsgesturechange' in window); };
Note: This Question is unanswered, help us to find answer for this one
Check Answer
463.
Which of the following choices is the correct way to create an XML object in E4X? A. var languages = new XML('JavaScriptPython'); B. var languages XML = new XML('JavaScriptPython'); C. var languages = JavaScript Python ;
A
B
C
A, B, and C
A and C
B and C
Note: This Question is unanswered, help us to find answer for this one
Check Answer
464.
What is the output of the following code? var obj = { "first":"first", "2":"2", "34":"34", "1":"1", "second":"second" }; for (var i in obj) { alert(i); };
"1", "2", "34", "first", "second"
"first", "1", "2", "34", "second"
"first", "2", "34", "1", "second"
"first", "second", "1", "2", "34",
Answer
Correct Answer:
"1", "2", "34", "first", "second"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
465.
When toggling a variable, its cycle must be 0 and 1. When the variable's active value is 0, the next value should be 1, and when the variable's active value is 1, the next value should be 0. Considering the scenario above, which of the following is correct?
q = (q == 1 ? 1 : 0);
q = 1 - q;
q ^= 0;
q = inv(0);
Answer
Correct Answer:
q = 1 - q;
Note: This Question is unanswered, help us to find answer for this one
Check Answer
466.
Which of the following is not a JavaScript string method?
ep
split
subst
slice
Note: This Question is unanswered, help us to find answer for this one
Check Answer
467.
Consider the following code snippet: <form name="frmOne"> <select name="selList" size="1" onChange="change()"> <option value="http://www.hotmail.com">tHomail</option> <option value="http://www.yahoo.com">Yahoo</option> </select> </form> Considering that when an option button is selected, the appropriate website should be opened immediately, what should the change() function look like?
url=document.frmOne.selList.options[document.frmOne.selList..item].value
url=document.frmOne.selList.options[document.frmOne.selList.selectedIndex].value
ocation=document.frmOne.selList.options[document.frmOne.selList.item].value.value
location=document.frmOne.selList.options[document.frmOne.selList.selectedIndex].value
Answer
Correct Answer:
location=document.frmOne.selList.options[document.frmOne.selList.selectedIndex].value
Note: This Question is unanswered, help us to find answer for this one
Check Answer
468.
Which of the following built-in functions is used to access form elements using their IDs?
getItem(id)
getFormElement(id)
getElementById(id)
All of these
Answer
Correct Answer:
getElementById(id)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
469.
Which of the following options is used to access the attributes in E4X?
@
::
#
*
Note: This Question is unanswered, help us to find answer for this one
Check Answer
470.
An HTML form contains 10 checkboxes all named "chkItems". Which JavaScript function can be used for checking all the checkboxes together?
function CheckAll() { for (z = 0; z < document.forms.chkItems.length; z++) { document.forms.chkItems[z].checked=true } }
function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems[z].checked=true } }
function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems.list[z].checked=true } }
function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems.list[z].checked=false } }
Answer
Correct Answer:
function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems[z].checked=true } }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
471.
Why does Google prepend while(1); to their JSON responses?
It prevents JSON hijacking.
It prevents eval() from rogue scripts from being run on their JSON responses.
Google doesn't prepend while(1); to their JSON responses.
Answer
Correct Answer:
It prevents JSON hijacking.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
472.
Which of the following can be used for disabling the right click event in Internet Explorer?
event.button == 2
event.button == 4
event.click == 2
event.click == 4
Answer
Correct Answer:
event.button == 2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
473.
Which of following uses the "with" statement in JavaScript correctly?
with (document.getElementById("blah").style) { background = "black"; color = "blue"; border = "1px solid green"; }
with document.getElementById("blah").style background = "black"; color = "blue"; border = "1px solid green"; End With
With document.getElementByName("blah").style background = "black"; color = "blue"; border = "1px solid green"; End With
with (document.getElementById("blah").style) { .background = "black"; .color = "blue"; .border = "1px solid green"; }
Answer
Correct Answer:
with (document.getElementById("blah").style) { background = "black"; color = "blue"; border = "1px solid green"; }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
474.
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; };
if(typeof(variable1)=='object' && typeof(variable2)=='array'){ Object.size(variable1); variable2.length; }
if(typeof(variable1)=='array' && typeof(variable2)=='object'){ Object.size(variable1); variable2.length; }
if(typeof(variable1) > typeof(variable2)){ Object.size(variable1); variable2.length; }
if(typeof(variable1) == typeof(variable2)){ Object.size(variable1); variable2.length; }
Answer
Correct Answer:
if(typeof(variable1) == typeof(variable2)){ Object.size(variable1); variable2.length; }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
475.
Which of the following will correctly check if a variable is undefined in JavaScript?
if (typeof something === "undefined")
if (typeof something == "undefined")
if (typeof something === undefined)
if (typeof something == undefined)
Answer
Correct Answer:
if (typeof something === "undefined")
Note: This Question is unanswered, help us to find answer for this one
Check Answer
476.
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;
10
14
3
7
Note: This Question is unanswered, help us to find answer for this one
Check Answer
477.
Which of the following is a good reason why JavaScript variables would start with a dollar sign ($)?
$ is a prefix used to create a instance of a object.
$ is a keyword in JavaScript.
$ is used to quickly identify and parse variables.
None of these.
Answer
Correct Answer:
None of these.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
478.
What is the difference between call() and apply()?
The call() function accepts an argument list of a function, while the apply() function accepts a single array of arguments.
The apply() function accepts an argument list of a function, while the call() function accepts a single array of arguments.
The call() function accepts an object list of a function, while the apply() function accepts a single array of an object.
The call() function accepts an object list of a function, while the apply() function accepts a single array of an object.
Answer
Correct Answer:
The call() function accepts an argument list of a function, while the apply() function accepts a single array of arguments.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
479.
Which of the following is/are true regarding JavaScript and multi-threading/concurrency?
JavaScript is single-threaded, forcing asynchronous events to a queue to wait for execution.
JavaScript is multi-threaded, and behaves in a synchronous manner.
Script can be single or multi-threaded, depending on the browser's capabilities.
None of these.
Answer
Correct Answer:
JavaScript is single-threaded, forcing asynchronous events to a queue to wait for execution.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
480.
Which of the following code snippets will trigger an input type="file" attribute when an element with a "newbtn" ID is clicked? <button id"newbtn" onclick="grt();">Upload</button> <form> <input id="thisId" type="file" name="upload" /> </form> </form>
function grt(){document.getElementById('thisId').keypress();}
function grt(){document.getElementById('thisId').load();}
function grt(){document.getElementById('thisId').dblclick();}
function grt(){document.getElementById('thisId').click();}
Answer
Correct Answer:
function grt(){document.getElementById('thisId').click();}
Note: This Question is unanswered, help us to find answer for this one
Check Answer
481.
Which of the following will determine if the user's browser is named "Netscape"?
if(appName=="Netscape"){}
if(document.appName=="Netscape"){}
if(navigator=="Netscape"){}
if(browser=="Netscape"){}
None of these
Answer
Correct Answer:
None of these
Note: This Question is unanswered, help us to find answer for this one
Check Answer
482.
Which of the following is used to solve the problem of enumerations in JavaScript?
let
Regex
Generators
E4X
Answer
Correct Answer:
Generators
Note: This Question is unanswered, help us to find answer for this one
Check Answer
483.
Which of following is an invalid function declaration?
function () {}
function () {}()
!function () {}()
(function () {})()
Answer
Correct Answer:
(function () {})()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
484.
Which of the following is not a valid JavaScript operator?
|
===
%=
^
Note: This Question is unanswered, help us to find answer for this one
Check Answer
485.
Which of the following is the best reason for not using "for...in" with array iteration?
for..in should be used to iterate over an array where index order is important.
for..in should not be used to iterate over an array where index order is important.
for...in loops iterate over non–enumerable properties.
for...in loops do not iterate over enumerable properties.
Answer
Correct Answer:
for..in should not be used to iterate over an array where index order is important.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
486.
Which of the following are not valid HTML events?
onmouseover
onmouseout
onmouseabove
onmousedown
onmousein
Answer
Correct Answer:
onmouseabove
Note: This Question is unanswered, help us to find answer for this one
Check Answer
487.
The following functions are for encoding URL parameters in Javascript. Which function escape converts non-ASCII characters into its Unicode escape sequences, like %uxxx?
escape()
encodeURI()
encodeURIComponent()
encodeURL()
Answer
Correct Answer:
encodeURI()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
488.
Which of the following can be used to write a JavaScript function that will accept user input?
The prompt method
The alert method
A form field
All of these
Answer
Correct Answer:
The prompt method
Note: This Question is unanswered, help us to find answer for this one
Check Answer
489.
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?
var p = document.getElementById(elementId); p.setAttribute("style", "background-color:yellow;color:red;font-size:20px;");
var p = document.getElementById(elementId); p.style.background = 'yellow'; p.style.color= 'red'; p.style.size= '20px';
var p = document.getElementById(elementId); p.style.background = 'yellow'; p.style.color= 'red'; p.style.font.size= '20px';
var p = document.getElementById(elementId); p.setAttribute("style", "background-color:red;color:yellow;font-size:20;");
Answer
Correct Answer:
var p = document.getElementById(elementId); p.setAttribute("style", "background-color:yellow;color:red;font-size:20px;");
Note: This Question is unanswered, help us to find answer for this one
Check Answer
490.
Which of the following shortcuts can be used for writing multiple document.write statements?
for(document){}
with(document) {}
withThis(document){}
None of these
Answer
Correct Answer:
with(document) {}
Note: This Question is unanswered, help us to find answer for this one
Check Answer
491.
Which of the following will include a JavaScript file in another JavaScript file?
Adding a script tag with the script URL in the HTML
Loading it with an AJAX call then using eval
Using 'import' operator
Using 'include' operator
Answer
Correct Answer:
Loading it with an AJAX call then using eval
Note: This Question is unanswered, help us to find answer for this one
Check Answer
492.
Which of the following is not a valid method for looping an array?
var a= [1,2]; for (var i = 0; i < a.length; i++) { alert(a[i]); }
var a= [1,2]; a.forEach( function(item) { alert(item); })
var a= [1,2]; a.map( function(item) { alert(item); })
var a= [1,2]; a.loop( function(item) { alert(item); })
Answer
Correct Answer:
var a= [1,2]; a.loop( function(item) { alert(item); })
Note: This Question is unanswered, help us to find answer for this one
Check Answer
493.
Which of the given options represents the correct length when alert(Emp..*.length()); is applied to the following code?
var Emp = <Emp>
<name>Mark</name>
<likes>
<os>Linux</os>
<browser>Firefox</browser>
<language>JavaScript</language>
<language>Python</language>
</likes>
</Emp>
11
5
6
12
Note: This Question is unanswered, help us to find answer for this one
Check Answer
494.
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?
The second attribute, name, should be the same.
The name attribute should be null.
The name attribute should be omitted.
The name attribute should be different.
None of these.
Answer
Correct Answer:
None of these.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
495.
What would be the default setting for the expires attribute of the document.cookie property?
The duration of the browser session
The duration the current document stays loaded
Twenty-four hours from the time the cookie is set
There is no default setting
The duration for which the machine is on
Answer
Correct Answer:
The duration of the browser session
Note: This Question is unanswered, help us to find answer for this one
Check Answer
496.
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; }
It calculates an array's length.
It compares 'a' and 'obj' in an array.
The code will cause an error.
It checks if an array contains 'obj'.
Answer
Correct Answer:
It checks if an array contains 'obj'.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
497.
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?
<script> foo.value.split(/\r\n\|\r\|\n/g); </script>
<script> foo.value.split(/\r\/n\|\r\|\n/g); </script>
<script> foo.value.split(/\rn\|\r\|\n/g); </script>
<script> foo.value.split(/\r\n|\r|\n/g); </script>
Answer
Correct Answer:
<script> foo.value.split(/\r\n|\r|\n/g); </script>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
498.
Which of the following statements are true regarding the code below?
<script>
alert("foo" === new String("foo")); // output false
</script>
The "===" operator always returns false.
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.
The "===" operator returns true only if the object (comparing by reference) and the primitive have the same value.
The "===" operator does not work for objects.
Answer
Correct Answer:
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.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
499.
Which of the following is incorrect regarding Strict mode in JavaScript?
It catches some common coding errors, throwing exceptions.
It enables features that are confusing or poorly thought out.
It prevents, or throws errors, when relatively "unsafe" actions are taken (such as gaining access to the global object).
Answer
Correct Answer:
It enables features that are confusing or poorly thought out.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
500.
Choose another way to write x ? a = b : a = c
if ('x') { a = b; } else { a = c; }
if (x) { a = c; } else { a = b; }
x : a = c ? a =
None of above
Answer
Correct Answer:
if ('x') { a = b; } else { a = c; }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
501.
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; };
This method determines whether or not a string ends with another string.
This method determines whether or not a string begins with another string.
This method returns the position of the last occurrence of a specified value in a string.
This method returns the position of the first occurrence of a specified value in a string.
Answer
Correct Answer:
This method determines whether or not a string ends with another string.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
502.
How can the user's previously navigated page be determined using JavaScript?
It is not possible in JavaScript. This can be done only through server-side scripting.
Using the document.referrer property
Using the window object
None of these
Answer
Correct Answer:
Using the document.referrer property
Note: This Question is unanswered, help us to find answer for this one
Check Answer
503.
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.
True
False
Note: This Question is unanswered, help us to find answer for this one
Check Answer
504.
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?
onblur
onfocus
lostfocus
gotfocus
None of these
Note: This Question is unanswered, help us to find answer for this one
Check Answer
505.
Which of the following is not a valid Date Object method in JavaScript?
parse()
setDay()
setTime()
valueOf()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
506.
What does the + sign in front of a function name mean in JavaScript?
It forces the parser to treat the + sign as a part of an expression.
The + sign is used as a cast operator.
It is used to denote a type of object in JavaScript.
None of these.
Answer
Correct Answer:
It forces the parser to treat the + sign as a part of an expression.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
507.
Which of the following is true about setTimeOut()?
The statement(s) it executes run(s) only once.
It pauses the script in which it is called.
clearTimeOut() won't stop its execution.
The delay is measured in hundredths of a second.
It is required in every JavaScript function.
Answer
Correct Answer:
The statement(s) it executes run(s) only once.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
508.
Which is the top most object in the object hierarchy?
document
window
history
browse
form
Note: This Question is unanswered, help us to find answer for this one
Check Answer
509.
Which of the following code snippets will return all HTTP headers?
var req = new XMLHttpRequest(); req.open('GET', document.location, false); req.send(null); var headers = req.getAllResponseHeaders().toLowerCase(); alert(headers);
var req = new XMLHttpAccess(); req.open('GET', document.location, false); req.send(null); var headers = req.getAllResponseHeaders().toLowerCase(); alert(headers);
var req = new XMLHttpRequest(); req.open('GET', document.location, false); req.send(null); var headers = req.getResponseHeader().toLowerCase(); alert(headers);
var req = new XMLHttpRequestHeader(); req.open('GET', document.location, false); req.send(null); var headers = req.retrieveAllResponseHeaders().toLowerCase(); alert(headers);
Answer
Correct Answer:
var req = new XMLHttpRequest(); req.open('GET', document.location, false); req.send(null); var headers = req.getAllResponseHeaders().toLowerCase(); alert(headers);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
510.
Which of these options is the most maintainable way to attach JavaScript functionality to an HTML element?
<p onclick="alert('You clicked me!')">some text</p>
<script>function fun(){alert('You clicked me!')}</script> <a onclick=fun()>...</a>
<script> function fun(){ alert('You clicked me!'); }; var el = document.getElementById("click-target"); el.onClick = fun; </script> <a id="click-target">...</a>
<a href="javascript:alert('You clicked me!')">...</a>
Answer
Correct Answer:
<script>function fun(){alert('You clicked me!')}</script> <a onclick=fun()>...</a>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
511.
What does the following code snippet do?
<input type="radio" name="r1" value="radio1" onclick="this.checked=false;alert('sorry')" />
The code is invalid.
The code makes it necessary for the user to select the radio button.
The code disables the radio button.
The code displays an alert when the user selects the button.
Answer
Correct Answer:
The code displays an alert when the user selects the button.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
512.
What will be the result of the following code? document.getElementById("banana").className = document.getElementById("banana").className.replace( /(?:^|\s)apple(?!\S)/g ,'e' );
Replace class ‘apple’ with ‘g’ in the HTML element which contains ID ‘banana’
Replace current class with ‘apple’ in the HTML element which contains ID ‘banana’
Replace class ‘apple’ with ‘e’ in the HTML element which contains ID ‘banana’
Replace ID ‘apple’ with ‘banana’ in the HTML element which contains ID ‘banana’ and class ‘g’
Answer
Correct Answer:
Replace class ‘apple’ with ‘e’ in the HTML element which contains ID ‘banana’
Note: This Question is unanswered, help us to find answer for this one
Check Answer
513.
Which of the following code snippets will correctly get the length of an object?
<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>
<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>
<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>
<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>
Answer
Correct Answer:
<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>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
514.
Which of the following code snippets shows an alert for an empty string? var a = "";
If(a){ alert(‘This is empty string’);}
If(a == NUL){ alert(‘This is empty string’);}
If(!a){ alert(‘This is empty string’);}
If(a.empty){ alert(‘This is empty string’);}
Answer
Correct Answer:
If(!a){ alert(‘This is empty string’);}
Note: This Question is unanswered, help us to find answer for this one
Check Answer
515.
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. $
A
B
C
D
A and B
C and D
Note: This Question is unanswered, help us to find answer for this one
Check Answer
516.
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>
<script> var button = document.getElementById('toggle'); button.click = function() { terd.style.backgroundColor = terd.style.backgroundColor == 'blue' ? 'red' : 'blue'; }; </script>
<script> var button = document.getElementById('toggle'); button.ready = function() { terd.style.backgroundColor = terd.style.backgroundColor == 'blue' ? 'red' : 'blue'; }; </script>
<script> var button = document.getElementById('toggle'); button.focus = function() { terd.style.backgroundColor = terd.style.backgroundColor == 'blue' ? 'red' : 'blue'; }; </script>
<script> var button = document.getElementById('toggle'); button.onclick = function() { terd.style.backgroundColor = terd.style.backgroundColor == 'blue' ? 'red' : 'blue'; }; </script>
Answer
Correct Answer:
<script> var button = document.getElementById('toggle'); button.onclick = function() { terd.style.backgroundColor = terd.style.backgroundColor == 'blue' ? 'red' : 'blue'; }; </script>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
517.
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(); } }
It will force a user to enter only numeric values.
It will force a user to enter only alphanumeric values.
It will force a user to enter only English alphabet character values.
None of these.
Answer
Correct Answer:
It will force a user to enter only English alphabet character values.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
518.
Which of the following statements is correct?
There is no undefined property in JavaScript.
Undefined object properties can be checked using the following code: if (typeof something == null) alert("something is undefined");
It is not possible to check for undefined object properties in JavaScript.
Undefined object properties can be checked using the following code: if (typeof something === "undefined") alert("something is undefined");
Answer
Correct Answer:
Undefined object properties can be checked using the following code: if (typeof something === "undefined") alert("something is undefined");
Note: This Question is unanswered, help us to find answer for this one
Check Answer
519.
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?
<script type="text/javascript"> function Validate() { if(document.forms[0].name.value == "") return true; else return false; } </script>
<script type="text/javascript"> function Validate() { if(document.forms[0].name.value == "") return false; else return true; } </script>
script type="text/javascript"> function Validate() { if(document.forms[0].name== "") return false; else return true; } </script>
<script type="text/javascript"> function Validate() { if(document.forms[0].name == "") return true; else return false; } </script>
Answer
Correct Answer:
<script type="text/javascript"> function Validate() { if(document.forms[0].name.value == "") return false; else return true; } </script>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
520.
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?
input name=txtId type="text" onreset="return ValidateField()"
input name=txtId type="text" onfocus="return ValidateField()"
input name=txtId type="text" onsubmit="return ValidateField()"
input name=txtId type="text" onblur="return ValidateField()"
Answer
Correct Answer:
input name=txtId type="text" onblur="return ValidateField()"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
521.
Which of the following will list the properties of a JavaScript object?
var keys = Object.keys(myJsonObject);
var keys = Object.value(myJsonObject)
var keys = Object.keys(myJsonValue)
None of these
Answer
Correct Answer:
var keys = Object.keys(myJsonObject);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
522.
Which of the following statements are true regarding the "this" keyword in JavaScript?
The value of "this" can be set by assignment during execution, and it will be the same each time the function is called.
Inside a function, the value of "this" depends on how many times the function is called.
Inside a function, the value of "this" depends on how the function is called (as a simple call, an object method, a constructor, etc.).
In strict mode, the value of "this" may change from whatever it is set to, when entering the execution context.
Answer
Correct Answer:
Inside a function, the value of "this" depends on how the function is called (as a simple call, an object method, a constructor, etc.).
Note: This Question is unanswered, help us to find answer for this one
Check Answer
523.
What would be the value of 'ind' after execution of the following code? var msg="Welcome to ExpertRating" var ind= msg.substr(3, 3)
lco
com
ome
Welcome
Note: This Question is unanswered, help us to find answer for this one
Check Answer
524.
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?
reduce()
reduceRight()
reverse()
pop()
Answer
Correct Answer:
reverse()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
525.
Which of the following choices will change the source of the image to "image2.gif" when a user clicks on the image?
img id="imageID" src="image1.gif" width="50" height="60" onmousedown="changeimg(image1.gif)" onmouseup="changeimg(image2.gif)"
img id="imageID" src="image1.gif" width="50" height="60" onmouseclick="changeimg(image2.gif)" onmouseup="changeimg(image1.gif)"
img id="imageID" src="image2.gif" width="50" height="60" onmousedown="changeimg(image1.gif)" onmouseup="changeimg(image2.gif)"
img id="imageID" src="image2.gif" width="50" height="60" onmousedown="changeimg(image2.gif)" onmouseup="changeimg(image1.gif)"
img id="imageID" src="image1.gif" width="50" height="60" onmousedown="changeimg('image2.gif')" onmouseup="changeimg('image1.gif')"
Answer
Correct Answer:
img id="imageID" src="image1.gif" width="50" height="60" onmousedown="changeimg('image2.gif')" onmouseup="changeimg('image1.gif')"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
526.
How can properties be added to an object class?
With the prototype() method
With the prototype property
It cannot be done.
With the "this" object
Answer
Correct Answer:
With the prototype property
Note: This Question is unanswered, help us to find answer for this one
Check Answer
527.
Which of the following is the correct way to stop setInterval() from calling a function in JavaScript?
setInterval() returns an interval ID, which can pass to clearInterval() to stop it from calling its designated function.
Cannot stop the setInterval() from calling its designated function.
Stopping setInterval() is browser-dependent; some browsers support stopping setInterval(), others don't.
None of these.
Answer
Correct Answer:
setInterval() returns an interval ID, which can pass to clearInterval() to stop it from calling its designated function.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
528.
Which of the following will implement a singleton pattern in JavaScript?
<script> var anObject = { method1: function () { // ... }, method2: function () { // ... } }; </script>
<script> function method1(){ // ... } function method2(){ // ... } </script>
<script> var method1 = function(){ // ... } var method2 = function(){ // ... } </script>
<script> var method1; var method2; </script>
Answer
Correct Answer:
<script> var anObject = { method1: function () { // ... }, method2: function () { // ... } }; </script>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
529.
Which of the following determines whether cookies are enabled in a browser or not?
(navigator.Cookie)? true : false
(application.cookieEnabled)? true : false
(navigator.cookieEnabled)? true : false
(application.cookie)? true : false
Answer
Correct Answer:
(navigator.cookieEnabled)? true : false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
530.
Which of the following correctly sets a class for an element?
document.getElementById(elementId).className = "Someclass";
document.getElementById(elementId).setAttribute("className", "Someclass");
document.getElementById(elementId).class = "Someclass";
document.getElementById(elementId).style = "Someclass";
Answer
Correct Answer:
document.getElementById(elementId).className = "Someclass";
Note: This Question is unanswered, help us to find answer for this one
Check Answer
531.
Which object can be used to manipulate the user's list of visited URLs?
document
window
history
browse
form
Note: This Question is unanswered, help us to find answer for this one
Check Answer
532.
Which of the following correctly uses a timer with a function named rearrange()?
tmr=setTimeout("rearrange ()",1)
tmr=Timer(1,"rearrange ()")
tmr=Timer("rearrange ()",1)
tmr=setTimeout(1,"rearrange ()")
Answer
Correct Answer:
tmr=setTimeout("rearrange ()",1)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
533.
Which of the following can be used to escape the ' character?
*
\
-
@
#
%
|
~
Note: This Question is unanswered, help us to find answer for this one
Check Answer
534.
Which of the following can be used to determine which page of the website has been most recently modified?
document
window
history
browse
form
location
Note: This Question is unanswered, help us to find answer for this one
Check Answer
535.
Consider the following JavaScript function to change the color of the text box named txtName: function color(col) { document.forms[0].txtName.style.background=col } Which of the following will change the color of the text box to green, as long as the user is pressing a key?
input type="text" onkeydown="color('white')" onkeyup="color('green')" name="txtName"
input type="text" onkeydown="color('green')" onkeyup="color('white')" name="txtName"
input type="text" onkeydown="color('green')" name="txtName"
input type="text" onkeydown="color('white')" name="txtName"
input type="text" onkeypress="color('green')" onkeyup="color('white')" name="txtName"
Answer
Correct Answer:
input type="text" onkeydown="color('green')" onkeyup="color('white')" name="txtName"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
536.
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>
<script> function g(){ var index = 1; var d = document.getElementById("selectBox"); var d_nested = d.childNodes[index]; var throwawayNode = d.deleteChild(d_nested); } </script>
<script> function g(){ var index = 1; var d = document.getElementById("selectBox"); var d_nested = d.childNodes[index]; var throwawayNode = d.clearChild(d_nested); } </script>
<script> function g(){ var index = 1; var d = document.getElementById("selectBox"); var d_nested = d.childNodes[index]; var throwawayNode = d.emptyChild(d_nested); } </script>
<script> function g(){ var index = 1; var d = document.getElementById("selectBox"); var d_nested = d.childNodes[index]; var throwawayNode = d.removeChild(d_nested); } </script>
Answer
Correct Answer:
<script> function g(){ var index = 1; var d = document.getElementById("selectBox"); var d_nested = d.childNodes[index]; var throwawayNode = d.removeChild(d_nested); } </script>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
537.
Which of the following statements is true regarding importing JavaScript files inside of other JavaScript files?
There is no import/include/require keyword in JavaScript, but there ways to import JS files inside of other JS files.
There is an import keyword in JavaScript, which allows importing JS files inside of other JS files.
There is no option to do so in JavaScript.
Answer
Correct Answer:
There is no option to do so in JavaScript.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
538.
Which of the following options can be used for adding direct support for XML to JavaScript?
E4X
Regex
Generators and Iterators
let
Note: This Question is unanswered, help us to find answer for this one
Check Answer
539.
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>
I
Is
s
I,s,
Note: This Question is unanswered, help us to find answer for this one
Check Answer
540.
How can created cookies be deleted using JavaScript?
They can't be deleted. They are valid until they expire.
Overwrite with an expiry date in the past
Use escape() on the value of the path attribute
Use unescape() on the value of the path attribute
The cookie file will have to be removed from the client machine.
Wait till the expiry date is reached
Answer
Correct Answer:
Overwrite with an expiry date in the past
Note: This Question is unanswered, help us to find answer for this one
Check Answer
541.
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?
document.getElementById('ERImage').src="Image1.jpg"
document.getElementById('ERImage').src="Image2.jpg"
document.getElementById('ERImage').style.src="Image1.jpg"
document.getElementById('ERImage').style.src="Image2.jpg"
Answer
Correct Answer:
document.getElementById('ERImage').src="Image2.jpg"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
542.
Which of the following will check whether the variable vRast exists or not?
if (typeof vRast="undefined") {}
if (typeof vRast =="undefined") {}
if (vRast.defined =true) {}
if (vRast.defined ==true) {}
Answer
Correct Answer:
if (typeof vRast =="undefined") {}
Note: This Question is unanswered, help us to find answer for this one
Check Answer
543.
Which of the following code snippets changes an image on the page?
var img = document.getElementById("imageId"); img.src = "newImage.gif";
var img = document.getElementById("imageId"); img.style.src = "newImage.gif";
var img = document.getElementById("imageId"); img.src.value = "newImage.gif";
var img = document.getElementById("imageId"); img = "newImage.gif";
Answer
Correct Answer:
var img = document.getElementById("imageId"); img.src = "newImage.gif";
Note: This Question is unanswered, help us to find answer for this one
Check Answer
544.
Consider the following variable declarations: var a="adam" var b="eve" Which of the following would return the sentence "adam and eve"?
a.concatinate("and", b)
a.concat("and", b)
a.concatinate(" and ", b)
a.concat(" and ", b)
Answer
Correct Answer:
a.concat(" and ", b)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
545.
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());
firststep1second
step1step2
step1
step1step2step3
Answer
Correct Answer:
firststep1second
Note: This Question is unanswered, help us to find answer for this one
Check Answer
546.
How can the operating system of the client machine be detected?
It is not possible using JavaScript.
Using the navigator object
Using the window object
Using the document object
None of these.
Answer
Correct Answer:
Using the navigator object
Note: This Question is unanswered, help us to find answer for this one
Check Answer
547.
How can a JavaScript object be printed?
console.log(obj)
console.print(obj)
console.echo(obj);
None of these
Answer
Correct Answer:
console.log(obj)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
548.
Which of the following is not a valid method in generator-iterator objects in JavaScript?
send()
throw()
next()
stop()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
549.
When setting cookies with JavaScript, what will happen to the cookies.txt data if the file exceeds the maximum size?
The script automatically generates a run-time error.
The script automatically generates a load-time error.
All processes using document.cookie are ignored.
The file is truncated to the maximum length.
Answer
Correct Answer:
The file is truncated to the maximum length.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
550.
Consider the following image definition:
Which of the following will change the image to companylogo2.gif when the page loads?
Location
Window
Screen
Navigator
Answer
Correct Answer:
Navigator
Note: This Question is unanswered, help us to find answer for this one
Check Answer
551.
Which of the following objects in JavaScript contains the collection called "plugins"?
Location
Window
Screen
Navigator
Answer
Correct Answer:
Navigator
Note: This Question is unanswered, help us to find answer for this one
Check Answer
552.
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"};
myJSONObject.regex.delete;
myJSONObject.regex.remove;
delete myJSONObject.regex;
remove myJSONObject.regex;
Answer
Correct Answer:
delete myJSONObject.regex;
Note: This Question is unanswered, help us to find answer for this one
Check Answer
553.
The following are sample code on how to loop through JavaScript object literals with objects as members:
Var validation_messages = {
“key_1” : {
“your_msg” : “hello world”
} ,
“Key_2” : {
“your_name” : “billy”,
“your_msg” : “foo equals bar”
}
}
Which of the following are invalid native JavaScript codes?
For (var key in validation_messages) {
Var obj = validation_messages[key];
For (var prop in obj) {
Alert(prop + “ = “ + obj[prop]);
}
}
Object.keys(validation_messages).forEach(function(key) {
Var obj = validation_messages[key];
Object.keys(obj).forEach(function (key){
Alert(prop + “ = “ + obj [key] );
});
(validation_messages.hasOwnProperty(key) {
Var obj = validation_messages[key];
For (var prop in obj) {
If (obj.hasOwnproperty(prop) {
Alert (prop + “ = “ + obj [prop]);
}
}
}
}
_.each(validation_messages, function(value,key) {
_.each(value,function(value,key){
Alert(prop + “ = ” + value);
});
Answer
Correct Answer:
For (var key in validation_messages) {
Var obj = validation_messages[key];
For (var prop in obj) {
Alert(prop + “ = “ + obj[prop]);
}
}
Note: This Question is unanswered, help us to find answer for this one
Check Answer
554.
Which of the following code snippets will correctly split “str”?
<script>
Var str = ‘something – something_else’;
Var substrn = str.split(‘--’);
</script>
<script>
Var str = ‘something – something_else’;
Var substrn = split.str(‘---’);
</script>
<script>
Var str = ‘something – something_else’;
Var substrn = str.split(‘-’ , ’-’);
</script>
<script>
Var str = ‘something – something_else’;
Var substrn = split.str(‘-’ , ‘-’);
</script>
Answer
Correct Answer:
<script>
Var str = ‘something – something_else’;
Var substrn = str.split(‘--’);
</script>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
555.
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.someKey === undefined) {
Alert(true);
}
Delete container[“someKey”];
If (container.someKey === 3) {
Alert(true);
}
True
True
False
True
True
True
True
False
True
False
True
True
True
True
False
True
Answer
Correct Answer:
True
True
False
Note: This Question is unanswered, help us to find answer for this one
Check Answer
556.
Consider the following code:
Var vNew=new Date()
Which of the following options will return true?
vNew instanceof Boolean
vNew instanceof object
vNew instanceof Date
All of these
Answer
Correct Answer:
vNew instanceof Date
Note: This Question is unanswered, help us to find answer for this one
Check Answer
557.
Why does (0 <5 < 3) return true?
Order of operations produces (true < 3), which returns true.
Order of precedence produces (true < 3), which returns true.
Order of operations produces (false < 3), which returns true.
None of these
Answer
Correct Answer:
Order of operations produces (true < 3), which returns true.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
558.
Which object can be used to ascertain the protocol of the current URL?
Document
Window
History
Browser
Form
location
Note: This Question is unanswered, help us to find answer for this one
Check Answer
559.
Which of the following code snippets renders a button invisible?
Var button = document.getElementById(‘buttonId’);
Button.style.display=‘none’
Var button = document.getElementById(‘buttonId’);
Button.style.display=‘block’
Var button = document.getElementById(‘buttonId’);
Button.style.visibility=‘false’;
Var button = document.getElementById(‘btn’);
Button.style.visibility=‘disabled’;
Answer
Correct Answer:
Var button = document.getElementById(‘buttonId’);
Button.style.display=‘none’
Note: This Question is unanswered, help us to find answer for this one
Check Answer
560.
Var profits=2489.8237
Which of the following code(s) produces the following output?
Output : 2489.824
Profits.toFixed(4)
Profits.toFixed(3)
Profits.formatDollar(3)
Profits.nuberFormat(3)
Answer
Correct Answer:
Profits.toFixed(3)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
561.
How does the this keyword work within a JavaScript Object literal?
<script>
Var foo = {};
Foo.someMethod = function(){
Alert(this);
}
</script>
<script>
someMethod = function(){
Alert(this);
}
</script>
<script>
Var foo = {};
someMethod.foo = function(){
Alert(this);
}
</script>
<script>
Var foo = {};
someMethod = function(foo){
Alert(this);
}
</script>
Answer
Correct Answer:
<script>
Var foo = {};
Foo.someMethod = function(){
Alert(this);
}
</script>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
562.
What is the fiinal value of the variable apt?
Var apt=2;
Apt=apt<<2;
2
4
6
8
16
Note: This Question is unanswered, help us to find answer for this one
Check Answer
563.
Which of the following are correct closure functions?
Function foo(x) {
Var tmp = 3;
Return function (y) {
Alert(x + y + (++tmp));
}
}
Var bar = foo(2); // bar is now a closure.
Bar(10)
Function foo(x) {
Var tmp = 3;
function bar (y) {
Alert(x + y + (++tmp));
}
Bar(10);
}
foo(2)
Function foo(x) {
Var tmp = 3;
function bar (y) {
function bar1 (tmp) {
Alert(x + y + (++tmp));
}
}
Bar(10);
}
foo(2)
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);
Answer
Correct Answer:
Function foo(x) {
Var tmp = 3;
Return function (y) {
Alert(x + y + (++tmp));
}
}
Var bar = foo(2); // bar is now a closure.
Bar(10)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
564.
Which of the following statements about the ‘new’ keyword is incorrect?
It creates a new object.
It sets the constructor property of the object to ‘object’.
It prevents any user-defined function from being called as a constructor.
It executes a constructor function.
Answer
Correct Answer:
It prevents any user-defined function from being called as a constructor.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
565.
<a href=’http://w3.org/’ onclick=’someFunc()”; return false; ’> Click here! </a>
What does “return false” do to this onclick event?
It prevents the default browser behavior from taking place alongside someFunc().
It prevents someFunc() to run from a second click.
It prevents someFunc() from returning any values.
None of the above.
Answer
Correct Answer:
It prevents the default browser behavior from taking place alongside someFunc().
Note: This Question is unanswered, help us to find answer for this one
Check Answer
566.
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']]]]
It's invalid JSON code.
It makes it difficult for a third-party to insert the JSON response into an HTML document with a <script> tag.
It iterates the JSON response.
It prevents the JSON response from getting executed.
Answer
Correct Answer:
It makes it difficult for a third-party to insert the JSON response into an HTML document with a <script> tag.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
567.
Which of the following is the correct method to use, in order to know the name of both the Object and Object Class in JavaScript?
toSource()
valueOf()
toString()
getName()
Answer
Correct Answer:
toSource()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
568.
Analyze the following code snippet. What will be the output of this code?
<html>
<body>
<script type="text/javascript">
var str = "The rose";
var patt1 = new RegExp("rose", "g");
patt1.test(str);
document.write("rose found. index now at: " + patt1.lastIndex);
</script>
</body>
</html>
rose found. index now at: 5
rose found. index now at: 4
rose found. index now at: 8
No output
Answer
Correct Answer:
rose found. index now at: 8
Note: This Question is unanswered, help us to find answer for this one
Check Answer
569.
Which of the following are correct values of variable, and why?
<script>
VariableA = [6,8];
VariableB = [7,9];
variableC = variable + variable;
</script>
6, 7, 8 and 9. The + operator is defined for arrays, and it concatenates strings, so it converts the arrays to strings.
6, 15 and 9. The + operator is defined for arrays, and it concatenates numbers, so it converts the arrays to numbers.
6, 8, 7 and 9. The + operator is defined for arrays, and it concatenates strings, so it converts the arrays to strings.
6, 87 and 9. The + operator is not defined for arrays, and it concatenates strings, so it converts the arrays to strings.
Answer
Correct Answer:
6, 87 and 9. The + operator is not defined for arrays, and it concatenates strings, so it converts the arrays to strings.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
570.
Performance-wise, which is the fastest way of repeating a string in JavaScript?
String.prototype.repeat = function( num ) { return new Array( num + 1 ).join( this ); }
function repeat(pattern, count) { if (count < 1) return ''; var result = ''; while (count > 0) { if (count & 1) result += pattern; count >>= 1, pattern += pattern; } return result; }
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; };
String.prototype.repeat = function (n, d) { return --n ? this + (d || '') + this.repeat(n, d) : '' + this };
Answer
Correct Answer:
String.prototype.repeat = function( num ) { return new Array( num + 1 ).join( this ); }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
571.
What is the error in the statement: var charConvert = toCharCODE('X');?
toCharCode() is a non-existent method.
Nothing. The code will work fine.
toCharCode only accepts numbers.
toCharCode takes no arguments.
Answer
Correct Answer:
toCharCode() is a non-existent method.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
572.
Which of the following is the most secure and efficient way of declaring an array?
var a = []
var a = new Array()
var a = new Array(n)
var a
Answer
Correct Answer:
var a = new Array()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
573.
Which of the following is not a correct way to empty the array a?
a = new Array();
a = [];
a.splice(0,a.length);
a.clear()
Answer
Correct Answer:
a.splice(0,a.length);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
574.
Which of the following is the correct way to resize an iframe based on content?
Function resizeIframe(height)
{
Document.getElementById(‘frame_name_here’).height = parseInt (height) +60
}
<iframe id=’frame_name_here’ src=’ src.htm’></iframe>
Function resizeIframe(height)
{
Document.getElementByName(‘frame_name_here’).height = parseInt (height) +60
}
<iframe id=’frame_name_here’ src=’ src.htm’></iframe>
Function resizeIframe(height)
{
Document.getElementByDivId(‘frame_name_here’).height = parseInt (height) +60
}
<iframe id=’frame_name_here’ src=’ src.htm’></iframe>
None of these
Answer
Correct Answer:
Function resizeIframe(height)
{
Document.getElementById(‘frame_name_here’).height = parseInt (height) +60
}
<iframe id=’frame_name_here’ src=’ src.htm’></iframe>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
575.
Which of the following will detect if the browser supports a certain CSS property?
Typeof document.body.style.borderRadius == ‘string’
Typeof document.body.style.borderRadius == ‘undefined’
Typeof document.body.style.borderRadius == true
It is impossible.
Answer
Correct Answer:
Typeof document.body.style.borderRadius == ‘undefined’
Note: This Question is unanswered, help us to find answer for this one
Check Answer
576.
Which of the following will detect which DOM element has the focus?
Document.activeElement
Document.ready
Document.referrer
Document.getelementbyid
Answer
Correct Answer:
Document.activeElement
Note: This Question is unanswered, help us to find answer for this one
Check Answer
577.
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?
logo.source="companylogo2.gif"
logo.source="companylogo1.gif"
document.getElementById('logo').src="companylogo1.gif"
document.getElementById('logo').src="companylogo2.gif"
Answer
Correct Answer:
document.getElementById('logo').src="companylogo2.gif"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
578.
Consider the following scenario:
Image thumbnails are displayed on a page. Upon clicking a thumbnail, the image is displayed in its actual size. The thumbnails aren't clickable, unless they are completely downloaded.
What event can be used to prevent the user from clicking on the thumbnails until they are completely downloaded?
OnLoad
OnKeyPress
OnKeyUp
onClick
Note: This Question is unanswered, help us to find answer for this one
Check Answer
579.
How would you randomly choose an element from an array named myStuff if the number of elements changes dynamically?
randomElement = myStuff[Math.floor(Math.random() * myStuff.length)];
randomElement = myStuff[Math.ceil(Math.random() * myStuff.length)];
randomElement = myStuff[Math.random(myStuff.length)];
randomElement = Math.random(myStuff.length);
Answer
Correct Answer:
randomElement = myStuff[Math.floor(Math.random() * myStuff.length)];
Note: This Question is unanswered, help us to find answer for this one
Check Answer
580.
Which of the following is not a valid string method?
link()
italics()
str()
sup()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
581. Which of the following is not a valid HTML event?
onunload
onchange
onupdate
onkeydown
Note: This Question is unanswered, help us to find answer for this one
Check Answer
582.
What is the result of the following:
var vName="Kodak Camera"
vName.indexOf("Camera")
4
5
6
7
Note: This Question is unanswered, help us to find answer for this one
Check Answer
583. Consider the following code snippet:
var a = document.getElementById("id1");
a.onclick = function1;
a.onclick = function2;
Which function will be executed if a user clicks on id1 element?
function1
function2
both
none<br>
Answer
Correct Answer:
function2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
584. One way to add functions to an object is by ___.
adding functions to that object prototype.
declaring a new function with that object name as prefix.
There is no way to add functions to an existing object.
Answer
Correct Answer:
adding functions to that object prototype.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
585. You can map CSS properties to style properties by ___.
skipping dash characters and uppercasing the next letters of CSS properties.
removing all dash characters in CSS properties.
uppercasing all characters of CSS properties.
lowercasing all characters of CSS properties.<br>
Answer
Correct Answer:
skipping dash characters and uppercasing the next letters of CSS properties.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
586. Which of the following screen object properties returns the total width of the screen?
width
availWidth
availableWidth
There is no such property
Note: This Question is unanswered, help us to find answer for this one
Check Answer
587. What is the result of c in the following code snippet? var a = '1'; b = 2 * a; c = typeof(b);
string
number
undefined
This code snippet is invalid.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
588. Which of the following functions can be used to stop an event from propagating if you're using a W3C-compliant browser?
stopPropagation
endPropagation
finishPropagation
There are no such methods
Answer
Correct Answer:
stopPropagation
Note: This Question is unanswered, help us to find answer for this one
Check Answer
589. Assume that the header has the following code snippet:
<script>
var a = document.getElementById("id1");
alert(a);
</script>
What's wrong with this code snippet?
At the time this code snippet is executed, the element with id1 does not exist.
The function getElementById is not document's function.
It cannot alert a DOM element.
There is nothing wrong with the given code snippet.<br>
Answer
Correct Answer:
At the time this code snippet is executed, the element with id1 does not exist.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
590. What is the value of c in the following code snippet?
function a(){return a.caller;}
function b(){return a();}
c = b();
function a(){return a.caller;}
function b(){return a();}
null
undefined
Answer
Correct Answer:
function b(){return a();}
Note: This Question is unanswered, help us to find answer for this one
Check Answer
591. Which of the following methods and properties can you use to change CSS class of an element?
className
cssClass
addClass
classCSS
Answer
Correct Answer:
className
Note: This Question is unanswered, help us to find answer for this one
Check Answer
592. What is the result of the following code snippet?
var a = [1, 2, 3];
delete a[1];
alert(a[1]);
An alert box pops up displaying "1"
An alert box pops up displaying"2"
An alert box pops up displaying "3"
An alert box pops up displaying "undefined"
Answer
Correct Answer:
An alert box pops up displaying "undefined"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
593. What does the following code snippet do?
var a = document.getElementById('id1');
a.onclick = function1();
It executes function1 and returns its value to onclick attribute of id1 tag.
It attaches function1 as click handler to id1 tag.
This code snippet is invalid.
Answer
Correct Answer:
It executes function1 and returns its value to onclick attribute of id1 tag.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
594. Consider the code snippet given below:
var a = {a1: 1, a2: 2};
var b = 0;
for (i in a) {
b += a[i];
}
Which of the following statements is(are) true?
b == 0
b == 1
b == 2
b > 2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
595. What is the result of the following code snippet? var a = {f: 'object'}; var b = {f: 'object'}; var c = a == b;
true
false
null
This code snippet is invalid
Note: This Question is unanswered, help us to find answer for this one
Check Answer
596. window.frames is a collection of all of the ___ in the current page.
frames
iframes
frames and iframes
windows
Answer
Correct Answer:
frames and iframes
Note: This Question is unanswered, help us to find answer for this one
Check Answer
597. What is the value of b in the following code snippet? var a = Array(5); var b = a[0];
0
5
null
undefined
Answer
Correct Answer:
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
598. Which of the following operators is(are) valid JavaScript operator(s)?
===
!==
=+
=»
Note: This Question is unanswered, help us to find answer for this one
Check Answer
599. Which of the following functions can you use to test whether an object was created with a specific constructor or not?
instanceof
typeof
classof
classname
Answer
Correct Answer:
instanceof
Note: This Question is unanswered, help us to find answer for this one
Check Answer
600. What is the result of the following code snippet?
function a() {
var x = [];
var i = 0;
a[i] = function(){
return i;
}
i++;
alert(a[0]());
}
a();
This code snippet is invalid.
An alert box pops up showing "0".
An alert box pops up showing "1".
An alert box pops up showing "function()".
Answer
Correct Answer:
An alert box pops up showing "1".
Note: This Question is unanswered, help us to find answer for this one
Check Answer
601. In javascript, functions can be declared without names
True
False
Note: This Question is unanswered, help us to find answer for this one
Check Answer
602. screen.pixelDepth is not available in Internet Explorer 7.
True
False
Note: This Question is unanswered, help us to find answer for this one
Check Answer
603. What is the result of the following code snippet? function a() {alert(x);} function b() {var x = "function b"; a();} b();
An alert box pops up showing "undefined".
An alert box pops up showing "null".
An alert box pops up showing "function b".
This code snippet causes an error.
Answer
Correct Answer:
This code snippet causes an error.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
604. What is the result of the following code snippet?
(
function(name){
alert(name + ' programming language');
}
)(' JavaScript ');
An alert box pops up showing "JavaScript programming language".
An alert box pops up showing "programming language".
An alert box pops up showing "undefined programming language".
This code snippet is invalid.
Answer
Correct Answer:
An alert box pops up showing "JavaScript programming language".
Note: This Question is unanswered, help us to find answer for this one
Check Answer
605. What is the value of c in the following code snippet?
function a() {}
a.prototype.version = "1.8";
var b = new a();
var c = b.prototype.version;
undefined
null
1.8
This code snippet causes an error
Answer
Correct Answer:
This code snippet causes an error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
606. In the W3C model, which of the following methods can you use to prevent default behavior of an event?
preventDefault
stopDefault
cancelDefault
There is no such method
Answer
Correct Answer:
preventDefault
Note: This Question is unanswered, help us to find answer for this one
Check Answer
607. What is the result of the following comparison?
null == null
true
false
undefined
This statement is invalid.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
608. Which of the following events can fire if a user doesn't use the mouse?
click
mouseout
mouseup
dbclick
Note: This Question is unanswered, help us to find answer for this one
Check Answer
609. What is the resulting value of c in the following code snippet?
var a;
function b(){
var b = "b";
a = function(){
return b;
}
}
b();
c = a();
undefined
null
b
This code snippet is invalid.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
610. Which of the following is a good reason to avoid user agent sniffing?
User can change the user agent.
User agent is the same for all browsers.
Some browsers do not have user agent.
There is no reason to avoid user agent sniffing.
Answer
Correct Answer:
User can change the user agent.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
611. Which of the following statements can you use to reload a page?
location.reload();
location.href = location.href;
location.refresh();
Page cannot be reloaded.
Answer
Correct Answer:
location.reload();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
612. Which of the following functions can you use to test whether an element has any children or not?
hasChildNodes()
containChildNodes
hasAnyChildren()
There is no such function.
Answer
Correct Answer:
hasChildNodes()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
613. What is important difference between mouseenter and mouseleave event?
mouseleave only catches event bubble, mouseenter only catches event capture.
mouseleave only catches event capture, mouseenter only catches event bubble.
There are no difference between mouseenter and mouseleave.
Answer
Correct Answer:
mouseleave only catches event bubble, mouseenter only catches event capture.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
614. Which of the following regular expression methods can you use to check whether there exists a pattern within the given string or not?
check
match
test
There are no such methods.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
615. What is the result of the following statement? self == window;
true
false
This statement causes an error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
616. Which of the following comparison will return false in equal comparison (==)?
'' == '0'
0 == ''
false == 'false'
false == '0'
Answer
Correct Answer:
'' == '0'
Note: This Question is unanswered, help us to find answer for this one
Check Answer
617. Consider the code snippet given below:
function a(a1) {this.a1 = a1;}
a.prototype.a2 = "Prototype property";
var c = new a();
Which of the following statements returns true?
c.hasOwnProperty("a1");
c.hasOwnProperty("a2");
c.hasOwnProperty("prototype");
c.hasOwnProperty("a");
Answer
Correct Answer:
c.hasOwnProperty("a1");
Note: This Question is unanswered, help us to find answer for this one
Check Answer
618. What is the result of the following code snippet?
function test() {
return "Hello";
}
alert(test());
alert dialog with Hello text
function
null
undefined
Answer
Correct Answer:
alert dialog with Hello text
Note: This Question is unanswered, help us to find answer for this one
Check Answer
619. What is the value of document.referrer if a user opens the page from a bookmark?
undefined
empty string
The current address
The previous address
Answer
Correct Answer:
The current address
Note: This Question is unanswered, help us to find answer for this one
Check Answer
620. What is the result of the following code snippet?
function a() {
alert('Outer function!');
return function(){
alert('Inner function!');
};
}
var a = a();
a();
An alert box pops up showing "Outer function!".
An alert box pops up showing "Inner function!".
Two alert boxes pop up, the first one displaying "Outer function!", and the second one displaying "Inner function!"
This code snippet is invalid.
Answer
Correct Answer:
Two alert boxes pop up, the first one displaying "Outer function!", and the second one displaying "Inner function!"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
621. What is the result of type of(Infinity); statement?
undefined
Infinity
number
object
Note: This Question is unanswered, help us to find answer for this one
Check Answer
622. Which of the following event object properties can you use to check whether that event is allowed to prevent default behavior or not?
cancelable
stoppable
preventable
There is no such property
Answer
Correct Answer:
cancelable
Note: This Question is unanswered, help us to find answer for this one
Check Answer
623. Which of the following ways can you use to prevent default action when a user clicks on a link on any browser?
Use preventDefault method of event object on click event handler.
Set returnValue of event object to false on click event handler.
Return false value on click event handler.
There is no way to prevent default action.
Answer
Correct Answer:
Return false value on click event handler.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
624. What is the result of a in the following code snippet?
function f(a, b, c){return true;}
var a = f.length;
undefined
null
3
This code snippet is invalid
Note: This Question is unanswered, help us to find answer for this one
Check Answer
625. In the W3C model, if you attach an anonymous function as an event handler of an element using addEventListener, how can you remove that anonymous function?
By adding a named function as event hander, then using removeEventListener to remove it.
By passing null argument to removeEventListener.
The anonymous function cannot be removed.
Answer
Correct Answer:
The anonymous function cannot be removed.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
626. What is the value of c in the following code snippet? function a() {} var b = a(); var c = typeof(b);
undefined
a
function
object
Answer
Correct Answer:
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
627. In the web browser, global objects are properties of window object.
True
False
Note: This Question is unanswered, help us to find answer for this one
Check Answer
628. Consider the code snippet given below:
function a() {}
function b() {}
Which of the following statements makes "a" object inherit from "b" object?
a.prototype = new b();
a.prototype = b;
a.extend(b);
a.extend(new b());
Answer
Correct Answer:
a.prototype = new b();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
629. What is the result of c in the following code snippet?
function a(name) {this.name = name;}
var b = new a();
var c = typeof(b.name);
undefined
null
string
object
Answer
Correct Answer:
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
630. Which of the following ways can you use to attach click event handler to id1 div tag on all browsers?
<div onclick="function1();" id="id1">
var div1 = document.getElementById('id1');<br>div1.onclick = function1;
var div1 = document.getElementById('id1');<br>div1.addEventListener("click", function1, false);
var div1 = document.getElementById('id1');<br>div1.attachEvent("click", function1, false);
Answer
Correct Answer:
<div onclick="function1();" id="id1">
Note: This Question is unanswered, help us to find answer for this one
Check Answer
631. Create the XMLHttpRequest is the same in all Internet Explorer browser versions.
True
False
Note: This Question is unanswered, help us to find answer for this one
Check Answer
632. Which of the following method can you use to convert JSON data in responseText to JavaScript object?
eval
parseJSON
convertToObject
toJSON
Note: This Question is unanswered, help us to find answer for this one
Check Answer
633. ___ property refers to the window that opens another window.
window.opener
window.parent
window.main
Answer
Correct Answer:
window.opener
Note: This Question is unanswered, help us to find answer for this one
Check Answer
634. What is the result of the following code snippet var somevar; alert(typeof(somevar));
An alert box pops up displaying "string"
An alert box pops up displaying "number"
An alert box pops up displaying "null"
An alert box pops up displaying "undefined"
Answer
Correct Answer:
An alert box pops up displaying "undefined"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
635. Which of the following statements is true?
JavaScript does not support try/catch statements.
JavaScript supports try statement, but does not support catch statement.
JavaScript supports try/catch statement but not the finally statement.
JavaScript supports try/catch/finally statements.
Answer
Correct Answer:
JavaScript supports try statement, but does not support catch statement.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
636. Which of the following properties contains user agent string of web browser?
window.navigator.userAgent
document.Agent
window.User_Agent
window.clientType
Answer
Correct Answer:
window.navigator.userAgent
Note: This Question is unanswered, help us to find answer for this one
Check Answer
637. Which of the following statement(s) define(s) a regular expression?
var a = /a-z/;
var a = new RegExp("a-z");
var a = new RegExp(/a-z/);
JavaScript does not support regular expression.
Answer
Correct Answer:
var a = new RegExp("a-z");
Note: This Question is unanswered, help us to find answer for this one
Check Answer
638. What is the value of c in the following code snippet?
function a(version) {
this.version = version;
}
a.prototype.version = '1.8';
var b = new a('1.8.1');
delete b.version;
var c = b.version;
undefined
null
1.8
Note: This Question is unanswered, help us to find answer for this one
Check Answer
639. What is the result of c in the following code snippet?
var a = '1';
b = 2 * a;
c = typeof(b);
char
string
number
None of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
640. Which of the following is correct in order to send a HTML form post request using XMLHttpRequest?
set Content-Type header to application/x-www-form-urlencoded.
use postRequest method.
There are no way to post a request using XMLHttpRequest.
Answer
Correct Answer:
set Content-Type header to application/x-www-form-urlencoded.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
641. What does the following statement do? document.title = "JavaScript";
It changes the title of the current window to "JavaScript" but does not change the text of the title tag.
It changes the text of «title» tag to "JavaScript".
It changes the global title variable value to "JavaScript".
This statement is invalid.
Answer
Correct Answer:
It changes the text of «title» tag to "JavaScript".
Note: This Question is unanswered, help us to find answer for this one
Check Answer
642. Consider the following JavaScript alert: <script type="text/JavaScript"> function message() { alert("Welcome to ExpertRating!!!") } </script> You want the user to see the above message upon opening the page. How will you implement this?
<body onload="message()">
<body onunload="message()">
<body onsubmit="message()">
<body onreset="message()">
Answer
Correct Answer:
<body onload="message()">
Note: This Question is unanswered, help us to find answer for this one
Check Answer
643. You've embedded the document.write() method to write some text within a pair of <TD></TD> table tags.
Upon loading the file, however, you get some garbled junk on the page where that text should be. What could be the reason for this?
The browser does not support JavaScript
You are using an older version of the browser
The browser does not support cookies
Answer
Correct Answer:
The browser does not support JavaScript
Note: This Question is unanswered, help us to find answer for this one
Check Answer
644. What is the difference between calling a JavaScript function directly like onclick = "a()" and onclick="JavaScript:a()" where a() is a function written in JavaScript?
There is no difference
The first technique is correct, only the second is incorrect
The second statement is more efficient than the first
The first statement looks for a function a() written in any language, whether it is JavaScript or vbscript, and the second technique looks for a function a() specifically written in JavaScript
None of the above
Answer
Correct Answer:
The first statement looks for a function a() written in any language, whether it is JavaScript or vbscript, and the second technique looks for a function a() specifically written in JavaScript
Note: This Question is unanswered, help us to find answer for this one
Check Answer
645. You are allowing the user to upload image files. You want to be able to capture the attributes of the image such as width and height using JavaScript. How would this be possible?
It is not possible using JavaScript
You would use the Image object such as var img = new Image
You would use the Img object
This is possible only on the server side using a component
None of the above
Answer
Correct Answer:
You would use the Image object such as var img = new Image
Note: This Question is unanswered, help us to find answer for this one
Check Answer
646. Which of the following are valid JavaScript methods?
scrollBy(dx, dy)
moveBy(dx, dy)
moveTo(x, y)
scrollTo(x, y)
All of the above are valid
Answer
Correct Answer:
All of the above are valid
Note: This Question is unanswered, help us to find answer for this one
Check Answer
647. Are the following two statements the same? object.property object[''property'']
Yes
No
Note: This Question is unanswered, help us to find answer for this one
Check Answer
648. Which of the following could you do using JavaScript?
Form validation
Display a popup window
Change the color of the page
Display an alert
Prompt the user to enter a value
All of the Above
Answer
Correct Answer:
All of the Above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
649. Which of the following is not the part of JavaScript errors handling?
try
catch
throw
throws
Note: This Question is unanswered, help us to find answer for this one
Check Answer
650. Which of the following statements are correct about the Prototype Pattern? 1. It always returns non-initialized objects. 2. It is also referred to as the Properties pattern. 3. It is accessible by methods using this keyword.
All 1, 2, and 3
Only 1 and 2
Only 1 and 3
Only 2 and 3
Answer
Correct Answer:
Only 2 and 3
Note: This Question is unanswered, help us to find answer for this one
Check Answer
651. Which of the following is not a JS window method?
modify()
resizeTo()
moveTo()
open()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
652. Timer value can be cleared using which of the following functions in JavaScript?
clearTimervalue()
clearTimeout()
clear()
flush(timer)
Answer
Correct Answer:
clearTimeout()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
653. What will be the result of the following code snippet?
console.log(null == undefind);
True
False
Error on code
No output
Note: This Question is unanswered, help us to find answer for this one
Check Answer
654. What will be the correct output of the following JavaScript code?
var x=1; function f(x) { if (x === 0) { return 1; } return x * f(x-1)+2; } console.log(f(8));
40320
22360
57000
178882
Note: This Question is unanswered, help us to find answer for this one
Check Answer
655. Determine the output of the given code snippet. var a = /xy/i, b = new RegExp(a, "g"); console.log(a.test("xy")); console.log(b.test("xy")); console.log(a.test("XY")); console.log(b.test("XY"));
true<br>true<br>true<br>true
true<br>true<br>true<br>false
true<br>true<br>false<br>false
false<br>false<br>false<br>false
true<br>false<br>true<br>false
Answer
Correct Answer:
true<br>true<br>true<br>false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
656. What will be the output of the following code snippet?
var test = function test(){
console.log(window.location === document.location);
};
test();
False
True
0
1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
657. Which of the following is/ are invalid usage(s) for a web worker in JavaScript? 1. Making use of the window shortcut to get the current global scope in a web worker. 2. Trying to access data in DOM directly with a web worker.
Only 1
Only 2
Both 1 and 2
None of the above.
Answer
Correct Answer:
Both 1 and 2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
658. What will be the output of the following code snippet?
var test = function test(){
console.log("2" - - "2");
};
test();
22
2
4
0
Note: This Question is unanswered, help us to find answer for this one
Check Answer
659. What will be the output of the following code snippet?
var str = /u/.exec("I am the best friend!");
console.log(str);
true
false
undefined
null
Note: This Question is unanswered, help us to find answer for this one
Check Answer
660. Consider the given code snippet.
var a = [2, 5, 12, 16, 23, 35]; XXXX function abc( YYYY ) { return val > 20; }
Which of the following options will replace XXXX and YYYY in order to generate 4 as an output?
XXXX will be replaced by var b = a.find(abc)<br>YYYY will be replaced by val, index, array
XXXX will be replaced by var b = a.findIndex(abc) <br>YYYY will be replaced by index, array
XXXX will be replaced by var b = a.findIndex(abc) <br>YYYY will be replaced by val, index, array
XXXX will be replaced by var b = a.find(index) <br>YYYY will be replaced by val, index, array<br>Answer Choice 5<br>XXXX will be replaced by var b = a.findIndex(a);<br>YYYY will be replaced by val, index
Answer
Correct Answer:
XXXX will be replaced by var b = a.findIndex(abc) <br>YYYY will be replaced by val, index, array
Note: This Question is unanswered, help us to find answer for this one
Check Answer
661. Using DATE object which of the following you to call a function based on elapsed time?
setElapsedTime()
timeout()
setTimeout()
setTime()
Answer
Correct Answer:
setTime()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
662. In relation to sealing an object globally, which of the following methods returns true if adding, removing, and changing properties is forbidden and all the current properties are configurable: false, writable: false?
Object.freeze(obj)
Object.isFrozen(obj)
Object.isSealed(obj)
Object.preventExtensions(obj)
Answer
Correct Answer:
Object.isFrozen(obj)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
663. In relation to object oriented JavaScript, which of the following options can be used as the value of F.prototype?
An object
Null
0
1
Answer
Correct Answer:
An object
Note: This Question is unanswered, help us to find answer for this one
Check Answer
664. Which function of the Object constructor with regard to JavaScript 1.8 returns the array of names of only enumerable properties of the given object?
Object.keys()
Object.getOwnPropertyNames()
Object.getOwnPropertyDescriptor()
Object.getPrototypeOf()
Answer
Correct Answer:
Object.keys()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
665. Which of the following methods is used to add and/or remove elements from an array and modify them in place?
push
slice
join
splice
Note: This Question is unanswered, help us to find answer for this one
Check Answer
666. Which of the following results is returned by the JavaScript operator "typeof" for the keyword "null"?
function
object
string
number
Note: This Question is unanswered, help us to find answer for this one
Check Answer
667. Consider the following snippet code: function test(){ return { test:1 }; } alert(typeof test()); What will be the above alert ?
number
function
undefind
null
Note: This Question is unanswered, help us to find answer for this one
Check Answer
668. Find the output of the following JavaScript code. var main = function() { var i=2,j=0,k=0,m=1.5,s=0; while(i<=3) { j=1; while(j<=4) { k=1; while(k<=4) { if(k%2!==0) { s=s+i+j+m; k++; } else { k++; m++; } } j=j+2; m++; } i++; m++; } console.log(s); } main();
92
94
96
98
Note: This Question is unanswered, help us to find answer for this one
Check Answer
669. What is the output of the following JavaScript code? s2 = new String("2 + 2") document.write(eval(s2));
4
2+2
Error
None of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
670. What will be the output of the following JavaScript code? var str1 = "Hi world"; var str = "Apples are round, and apples are juicy"; var sliced = str.slice(5, -2); var text =`Apple \nJuice` var raw_text = String.raw`Apple \nJuice` console.log(str1.valueOf()); console.log(raw_text) console.log(sliced); console.log(text)
Hi world<br>Apple<br>Juice<br>s are round, and apples are jui<br>Apple<br>Juice
Hi world<br>Apple \nJuice<br>s are round, and apples are jui<br>Apple<br>Juice
Hi world<br>Apple \nJuice<br>les<br>Apple<br>Juice
8<br>Apple \nJuice<br>les<br>Apple<br>Juice
Answer
Correct Answer:
Hi world<br>Apple \nJuice<br>s are round, and apples are jui<br>Apple<br>Juice
Note: This Question is unanswered, help us to find answer for this one
Check Answer
671. In relation to object oriented JavaScript, which of the following options are the correct attributes of the object properties?
readable
writable
enumerable
configurable
Note: This Question is unanswered, help us to find answer for this one
Check Answer
672. While working with JavaScript Page Redirection, which of the following options is an invalid method of the window.location object?
location.reload()
location.replace()
location.reassign()
window.navigate()
Answer
Correct Answer:
location.reassign()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
673. Which javascript method can be used to create or modify the attribute properties
defineProperty()
defineProperties()
Both defineProperty() and defineProperties()
None of the mentioned
Answer
Correct Answer:
Both defineProperty() and defineProperties()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
674. Which of the following is not a valid JavaScript operator?
*=
/=
%=
^+
Note: This Question is unanswered, help us to find answer for this one
Check Answer
675. Name the different primitive data types of JavaScript ?
Boolean.Number.String.Null.Undefined.Symbol.
Boolean.Number.String.Undefined.Symbol.
String, Undefined, Number, Void Boolean,Function
String, Undefined, Integer, Void Boolean,Function
Answer
Correct Answer:
Boolean.Number.String.Null.Undefined.Symbol.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
676. Which of the following is the correct method for getting the date of February 1 of the current year into a variable called "newDate"?
var d = new Date();<br>newDate=new Date(d.getFullYear(), 1, 2);
var d = new Date();<br>newDate=new Date(d.getFullYear(), 2, 1);
var d = new Date();<br>newDate=new Date(d.getFullYear(), 1, 1);
var d = new Date();<br>newDate= (d.getFullYear(), 1, 1);
Answer
Correct Answer:
var d = new Date();<br>newDate=new Date(d.getFullYear(), 1, 1);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
677. What will be the correct output of the following JavaScript code? <html> <head> <title>Object oriented Javascript()</title> </head> <body> <script type="text/javascript"> 'use strict' class Art{ succ() { var i=3,j,k=0; for(j=i;j<=7;j++) { k=j+i; if(k>=7) { k=k+3; } else { k=k-2; } } document.write(k-2 +"<br>"); } } var waj = new Art(); waj.succ(); </script> </body> </html>
8
9
10
11
Note: This Question is unanswered, help us to find answer for this one
Check Answer
678. What will be the output of the following JavaScript code? 'use strict' class Abc{ constructor(t, p) { this.t = t; this.p = p; } test() { var x; var c = 0; for(x=7; x!==0; x&=(x-1)) c++; console.log(c++ + this.t + this. p); } } var Obj1 = new Abc(10.5,20.5); Obj1.test();
33
34
35
36
The code will generate an error.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
679. Find the correct output of the following JavaScript code. <html> <head> <title>objects</title> <script type="text/javascript"> var pk = new Object(); pk.su = 32; pk.au = 63; </script> </head> <body> <script type="text/javascript"> var as=pk.su + pk.au; var num,i=1,j,k; num=as+266; while(i<=num) { k=0; if(num%i==0) { j=1; while(j<=i) { if(i%j==0) k++; j++; } if(k==2) document.write(i); } i++; } </script> </body> </html>
19
21
23
25
Note: This Question is unanswered, help us to find answer for this one
Check Answer
680. Which of the following modifiers must be set if we use the Javascript lastIndex Object Property during pattern matching?
i
m
g
s
Note: This Question is unanswered, help us to find answer for this one
Check Answer
681. What will be the output of the following JavaScript code? var n=1; var a=33; var b; b = a<<4; b = a>>3; b = b + 2; while(b>=1){ n = n + b; b = b - 1; } function ab(n) { if (n < 2) { return n; } else { return ab(n - 1) + ab(n - 2); } } console.log(n + ab(9));
52
53
54
56
Note: This Question is unanswered, help us to find answer for this one
Check Answer
682. Which of the following Javascript Regular Expression Character Classes finds any non-digit character in a given string?
\W
\S
\B
\D
Note: This Question is unanswered, help us to find answer for this one
Check Answer
683. What we can use to restart the inner most loop in java script.
Using about.
Using brackloop
Using stop
Using continue lable
Answer
Correct Answer:
Using continue lable
Note: This Question is unanswered, help us to find answer for this one
Check Answer
684. Which of the following methods can accept negative indexes?
substring()
slice()
Both options a and b.
Neither option a nor b.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
685. Which of the following is the correct syntax of DataView view of JavaScript?
new DataView( byteOffset, [byteLength])
new DataView(buffer, length [, byteOffset [, byteLength]])
new DataView(buffer [, byteOffset [, byteLength]])
new DataView(object, buffer [, byteOffset ])
Answer
Correct Answer:
new DataView(buffer [, byteOffset [, byteLength]])
Note: This Question is unanswered, help us to find answer for this one
Check Answer
686. Which of the following method of Int8Array object is used for testing if all array elements pass the test given by a function or not?
Int8Array.prototype.entries()
Int8Array.prototype.every()
Int8Array.prototype.find()
Int8Array.prototype.map()
Answer
Correct Answer:
Int8Array.prototype.every()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
687. Which of the following JavaScript methods is used to return the primitive value of a Boolean object?
toSource()
toFixed()
ValueOf()
map()
Answer
Correct Answer:
ValueOf()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
688. What will be printed on the standard output console on the execution of the following JavaScript code? var var1 = 10; document.write("First Value: " + var1 + " and Second Value: " + var2); var var2 = 20;
First Value: 10 and Second Value: undefined
First Value: 10 and Second Value: 20
First Value: undefined and Second Value: undefined
The code will generate an error.
Answer
Correct Answer:
First Value: 10 and Second Value: undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
689. What is the purpose of the assign() method?
Only loading
Unloading of window
Displays already present window
Loading of window and display
Answer
Correct Answer:
Only loading
Note: This Question is unanswered, help us to find answer for this one
Check Answer
690. With regard to Math object in JavaScript 1.8, which of the following statements are true?
All properties of the Math object are non-static.
All methods of the Math object are static.
Math.trunc() method always returns integral part of the given number.
Math is a constructor object.
Answer
Correct Answer:
All methods of the Math object are static.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
691. Which of the following JavaScript objects is used to store unique values of any type?
Object
Set
String
Map
Note: This Question is unanswered, help us to find answer for this one
Check Answer
692. While using JavaScript, which of the following options can be used to return a number between 0 and 50?
Math.floor(Math.random() & 50);
Math.floor(Math.random() * 51);
Math.floor(Math.random() * 51) + 1;
Math.floor(Math.random() @ 50)
Answer
Correct Answer:
Math.floor(Math.random() * 51);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
693. Which of the following properties of a JavaScript Array object is only present in the arrays that are created by regular expression matches?
length
prototype
index
input
Note: This Question is unanswered, help us to find answer for this one
Check Answer
694. In relation to object oriented JavaScript [[Prototype]] property, which of the following statements is/are correct?
The prototype is only used for reading properties.
The write/delete operations cannot work directly with the object for data properties.
Both statements a and b are correct.
Neither statement a nor b is correct.
Answer
Correct Answer:
The prototype is only used for reading properties.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
695. What will be the correct output of the following JavaScript code? 'use strict' class Sf{ success_failure() { var a = 28, s=0, i ; for(i=1;i<=a;i++) { if(a%i==0) s=s+i; } if(s!=a*2) document.write("failure") ; else document.write("success"); } } var pj = new Sf(); pj.success_failure();
success
failure
Code will execute but will not give any output.
Code will give a compilation error.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
696. Analyze the following code using the source property of Regular Expressions. What will be the output of the below code snippet?
<html>
<body>
<script type="text/javascript">
var str = "Visit Garden\Showcase";
var patt1 = new RegExp("en\S","g");
document.write("The regular expression is: " + patt1.source);
</script>
</body>
</html>
The regular expression is: en\S
The regular expression is: 11
The regular expression is: enS
The regular expression is: 10
Answer
Correct Answer:
The regular expression is: enS
Note: This Question is unanswered, help us to find answer for this one
Check Answer
697. In relation to JavaScript prototype, which of the following methods is used for returning an array of all own property names?
Object.getPrototypeOf(obj)
Object.getOwnPropertyNames(obj)
Object.keys(obj)
Reflect.ownKeys(obj)
Answer
Correct Answer:
Reflect.ownKeys(obj)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
698. Which of the following statements regarding let in JavaScript is not correct?
The let definition defines variables whose scope is constrained to the block in which they're defined. This syntax is very much like the syntax used for var.
The let expression lets you establish variables scoped only to a single expression.
The let keyword provides a way to associate values with variables within the scope of a block, and affects the values of like-named variables outside the block.
You can use let to establish variables that exist only within the context of a for loop.
Answer
Correct Answer:
The let keyword provides a way to associate values with variables within the scope of a block, and affects the values of like-named variables outside the block.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
699. What does the following JavaScript code do?
<head id="Head1" runat="server">
<title></title>
<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>
</head>
<body>
<form id="form1" runat="server">
<input type="text" id="t1" onkeyup="validate()" onkeypress ="validate()"/>
</form>
</body>
The code will cause an error alert to be displayed if a non alphabet character is entered.
The code will cause an error alert to be displayed if ALPHABET character is entered.
The code will cause NO error alert to be displayed if a numeric character is entered.
The code will cause NO error alert to be displayed if a NON ALPHABET character is entered.
Answer
Correct Answer:
The code will cause an error alert to be displayed if a non alphabet character is entered.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
700. What will the function NaN return for the condition NaN == NaN?
true
false
error
0
Note: This Question is unanswered, help us to find answer for this one
Check Answer
701. Find the output of the following JavaScript code. var str = "Example, JavaScript, Test"; var res = str.substring(6,15); document.write(res);
le, JavaSc
l, c
e, JavaSc
No output will be displayed.
The code will give an error.
Answer
Correct Answer:
e, JavaSc
Note: This Question is unanswered, help us to find answer for this one
Check Answer
702. Which of the following methods is not a valid Array object method in JavaScript?
reverse
shift
unshift
splice
All of the above are valid
Answer
Correct Answer:
All of the above are valid
Note: This Question is unanswered, help us to find answer for this one
Check Answer
703. What will be the output of the following JavaScript code? var a = 5; var b = 2; var c = a / b; var c = a * b var c = a % b var c = a + b * a; document.write(c);
2.5
15
35
Note: This Question is unanswered, help us to find answer for this one
Check Answer
704. What will be the correct output of the following JavaScript code? 'use strict' class Xw{ constructor(a, b){ this.a = a; this.b = b; } tt() { var x; var c = 3; for(x=37; x!==0; x&=(x-1)) c++; document.write(c++ + this.a + this. b + 2 *2); } } var Obj1 = new Xw(23.5,26.5); Obj1.tt();
58
60
62
68
Note: This Question is unanswered, help us to find answer for this one
Check Answer
705. What will be the output of the following code? function* as( limit = Infinity ) { let a = 0, b = 1; while( a < limit ) { yield a; [a, b] = [b, a + b]; } } var pp=3 let iterator = as( 10 ); for(var prop of iterator){ pp=pp+23 } var f = (x)=>10+x console.log(f(10) + pp)
170
178
184
190
Note: This Question is unanswered, help us to find answer for this one
Check Answer
706. Which of the following is the correct syntactical representation of a generator expression in JavaScript?
var doubles = [i * 2 for (i in it)];
var doubles = [i * 2 for [i in it]];
var doubles = (i * 2 for (i in it));
var doubles = {i * 2 for (i in it)};
Answer
Correct Answer:
var doubles = (i * 2 for (i in it));
Note: This Question is unanswered, help us to find answer for this one
Check Answer
707. 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>
1
ain
7,29
7
ain,ain
Note: This Question is unanswered, help us to find answer for this one
Check Answer
708. Is the following statement true or false? A function becomes a generator if it contains one or more yield statements.
True
False
Note: This Question is unanswered, help us to find answer for this one
Check Answer
709. What will be the correct output of the following JavaScript code? 'use strict' class Xw{ constructor(t, p) { this.t = t; this.p = p; } pp() { var x=49; var c = 21; if(x=7) c++; else if(x>6) c=c+8; else c=c*4; document.write(c++ + this.t + this. p*2); } } var Obj1 = new Xw(19,29); Obj1.pp();
77
88
99
111
Note: This Question is unanswered, help us to find answer for this one
Check Answer
710. Which of the given options is the correct output of the following JavaScript code? var a = 20 + "Example" + 10 + "Test"; var b= 20 + 10 + "Test" + "Example" ; document.write(a, "<br>"); document.write(b);
30ExampleTest<br>30TestExample
20Example10Test<br>2010TestExample
20Example10Test<br>30TestExample
No output will be displayed.
Answer
Correct Answer:
20Example10Test<br>30TestExample
Note: This Question is unanswered, help us to find answer for this one
Check Answer
711. Which of the following objects is the top-level object in the JavaScript hierarchy?
Navigator
Screen
Window
Document
Note: This Question is unanswered, help us to find answer for this one
Check Answer
712. Which of the following DOM objects can be used to determine the resolution of the screen?
It is not possible to determine the resolution of the screen.
Screen object
Document object
Window object
None of the above
Answer
Correct Answer:
Screen object
Note: This Question is unanswered, help us to find answer for this one
Check Answer
713. In relation to object oriented JavaScript, for which of the following options no wrapper objects are provided?
Null
Undefined
Both options a and b.
Answer
Correct Answer:
Both options a and b.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
714. What will be the output of the following code?
var x = 5;
var y = 0;
document.write( let(x = x + 10, y = 12) x+y + ",");
document.write(x+y);
27,5
22,5
27,22
None of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
715. Which of the following options is the correct syntax of the Object.getOwnPropertyDescriptor method that is used for querying the full information about a property?
let d = Object.getOwnPropertyDescriptor(propertyName, obj);
let d = Object.getOwnPropertyDescriptor(obj, propertyName, descriptor);
let d = Object.getOwnPropertyDescriptor(obj, propertyName);
let d = Object.getOwnPropertyDescriptor(obj, descriptor);
Answer
Correct Answer:
let d = Object.getOwnPropertyDescriptor(obj, propertyName);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
716. Which of the following statements about JavaScript REFLECT object is NOT correct?
The Reflect.preventExtensions() method returns a string.
Reflect.get() method is used for returning the value of properties.
The Reflect object cannot be used with a new operator.
The Reflect.isExtensible() method provides the same functionality as that of Object.isExtensible() method.
Answer
Correct Answer:
The Reflect.preventExtensions() method returns a string.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
717. Which character combination is used to alter the order of operations by grouping expressions?
< >
[ ]
( )
{ }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
718. What is the result of the following code? (function () { 'use strict'; var x = "hello"; })(); x = 0; console.log(x);
Reference error
Scope error
Zero is written to the console
Answer
Correct Answer:
Zero is written to the console
Note: This Question is unanswered, help us to find answer for this one
Check Answer
719. What is the following construct generally used for in JavaScript? (function () { // ... })();
To create a scope to protect code from the global scope
This has no effect
To force code to parse in a particular order
To enforce strict compilation of JavaScript
Answer
Correct Answer:
To create a scope to protect code from the global scope
Note: This Question is unanswered, help us to find answer for this one
Check Answer
720. Are the parameters of a function checked?
No
Yes
Note: This Question is unanswered, help us to find answer for this one
Check Answer
721. What kind of standard pattern is the following code? var x = function () { var y = 0; this.getCurrentCount = function () { return y; } }
Class Pattern
Module Pattern
Revealing Module Pattern
Answer
Correct Answer:
Class Pattern
Note: This Question is unanswered, help us to find answer for this one
Check Answer
722. How would you iterate over the following object? var my_data = {a: 'Ape', b: 'Banana', c: 'Citronella'};
foreach (my_data as key => value) {}
None of these because you can only iterate over arrays, not objects
for (var i = 0; i < my_data.length; i++) {}
for (var key in my_data) {}
Answer
Correct Answer:
for (var key in my_data) {}
Note: This Question is unanswered, help us to find answer for this one
Check Answer
723. What does the following code evaluate to? var arr = [1, 2, 3, 4]; arr.indexOf(2);
4
2
1
3
Note: This Question is unanswered, help us to find answer for this one
Check Answer
724. Which of the following is a method of a RegExp object?
ignoreCase
eval()
exec()
makeMultiline()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
725. Assuming that each code is called with: "var say = sayHello("Mary Jane");", which of the following is a closure?
function sayHello(name) { var text = 'Hello ' + name; return text; }
function sayHello(name) { alert( 'Hello ' + name) }
function sayHello(name) { var text = 'Hello ' + name; var sayAlert = function() { alert(text); } return sayAlert; }
function sayHello(name) { console.log('Hello ' + name;) }
Answer
Correct Answer:
function sayHello(name) { var text = 'Hello ' + name; var sayAlert = function() { alert(text); } return sayAlert; }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
726. How do you construct a RegExp object?
var re = new RegExp('ab+c', 'i');
var re = RegExp('ab+c', 'i');
var re; re.RegExp('ab+c', 'i');
var re = new RegExp(/ab+c/i);
Answer
Correct Answer:
var re = new RegExp('ab+c', 'i');
Note: This Question is unanswered, help us to find answer for this one
Check Answer
727. Which statement lets you create custom exceptions?
throw
createException
try
catch
Note: This Question is unanswered, help us to find answer for this one
Check Answer
728. What kind of standard pattern is this code? var x = (function () { var y = 0; return { count: y }; })();
Class Pattern
Module Pattern
Revealing Module Pattern
Answer
Correct Answer:
Revealing Module Pattern
Note: This Question is unanswered, help us to find answer for this one
Check Answer
729. What does the following code generate? var x = new Date();
x is equal to a zero date.
x is the current date and time.
x is equal to a minimum date.
Answer
Correct Answer:
x is the current date and time.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
730. How could you read the first character in a string?
data.substr(0);
data.charAt(0);
data.substring(1);
data.charAt(1);
Answer
Correct Answer:
data.charAt(0);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
731. What is the result of the following code? var my = { name: "Hello", count: 0 }; my.isValid = true; console.log(my.isValid);
true
Syntax error occurs
Runtime error occurs
Note: This Question is unanswered, help us to find answer for this one
Check Answer
732. What happens when you throw an exception in the catch block, using nested try-catch blocks? For example: try { try { throw "Inside Exception"; } catch (ex) { throw "exception in inner finally"; } } catch (ex) { console.log("Outer Catch: " + ex) }
Runtime error
Syntax error
Exception isn't caught
Exception is caught by outer catch block
Answer
Correct Answer:
Exception is caught by outer catch block
Note: This Question is unanswered, help us to find answer for this one
Check Answer
733. How do you access a property of an object?
objectName.propertyName();
objectName.getProperty('propertyName')
objectName.propertyName
objectName('propertyName')
Answer
Correct Answer:
objectName.propertyName
Note: This Question is unanswered, help us to find answer for this one
Check Answer
734. What is the result of the following code? var someCode = "Math.ceil(5.5)"; var o = eval(someCode); console.log(o);
Math.ceil(5.5)
6
undefined
object
Note: This Question is unanswered, help us to find answer for this one
Check Answer
735. Which of the following is a correct method for creating an empty array?
var myArray = array();
var myArray = [];
var myArray = ();
var myArray = new Array[];
Answer
Correct Answer:
var myArray = [];
Note: This Question is unanswered, help us to find answer for this one
Check Answer
736. What defines a local scope?
Any JavaScript block
function
function and while
function and if
Note: This Question is unanswered, help us to find answer for this one
Check Answer
737. Which of these is NOT a type of Error?
InternalError
EvalError
ControlFlowError
RangeError
Answer
Correct Answer:
ControlFlowError
Note: This Question is unanswered, help us to find answer for this one
Check Answer
738. Which enforces strictness to a scope?
"strict";
'use strict';
'do strict';
use-strict;
Answer
Correct Answer:
'use strict';
Note: This Question is unanswered, help us to find answer for this one
Check Answer
739. How do you specify code that will be executed whether an exception is thrown or not?
finally block
write code outside the try-catch block
all block
catch block
Answer
Correct Answer:
finally block
Note: This Question is unanswered, help us to find answer for this one
Check Answer
740. What does the try statement do?
It attempts an HTTP request to the given URL.
It attempts to call a function.
It allows you test a block of code for errors.
It asynchronously attempt to call a function.
Answer
Correct Answer:
It allows you test a block of code for errors.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
741. Is this a valid multidimensional array? var myArray = [[1,2,3], "Hello", [6,7,8]];
No
Yes`
Note: This Question is unanswered, help us to find answer for this one
Check Answer
742. Based on the following, what is the value of x? var obj = {}; obj["function"] = 123; x = obj.function;
native Function constructor
123
undefined. SyntaxError due to illegal position of a reserved word
undefined. Silent failure.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
743. What is the logical not operator in JavaScript?
|
~
-
!
Note: This Question is unanswered, help us to find answer for this one
Check Answer
744. Which of the following is NOT a valid arithmetic operator?
^
+
-
*
/
Note: This Question is unanswered, help us to find answer for this one
Check Answer
745. What is the var statement used for?
To create a variable in the current scope
To declare a member of a class
To retrieve a variable descriptor
To change a constant
Answer
Correct Answer:
To create a variable in the current scope
Note: This Question is unanswered, help us to find answer for this one
Check Answer
746. What is string concatenation?
The combination of two or more text strings
The splitting of a string into two or more strings
An elemental string
A complex string
Answer
Correct Answer:
The combination of two or more text strings
Note: This Question is unanswered, help us to find answer for this one
Check Answer
747. Which character ends a JavaScript statement?
A period "."
A colon ":"
An exclamation mark "!"
A semicolon ";"
Answer
Correct Answer:
A semicolon ";"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
748. Which keyword is used to begin a conditional statement?
condition
if
when
how
Note: This Question is unanswered, help us to find answer for this one
Check Answer
749. Which character represents the assignment operator?
!
#
?
=
Note: This Question is unanswered, help us to find answer for this one
Check Answer
750. Which character combination is used to create a single line comment?
$$
--
//
!!
Note: This Question is unanswered, help us to find answer for this one
Check Answer
751. Based on the following, what is the value of x? var a = "A"; var x = a.concat("B");
["A", " B"];
"AB"
"A"
"B"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
752. What is the "if" statement is used for?
It deals with logic that should execute only when a condition is false.
It creates a loop that runs as long as a condition is true.
It deals with logic that should execute only when a condition is true.
It converts an integer value to a boolean.
Answer
Correct Answer:
It deals with logic that should execute only when a condition is true.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
753. How do you create an empty array using literal notation?
var x = [];
var x = Array();
var x = [1, 2, 3];
var x = [Array()];
Answer
Correct Answer:
var x = [];
Note: This Question is unanswered, help us to find answer for this one
Check Answer
754. Which is not a way to construct an array in JavaScript?
var x = new Array(1,2,3);
var x = [];
var x = array();
var x = [1,2,3];
Answer
Correct Answer:
var x = array();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
755. What does the following code write to the console? var x = false; if (x && console.log("hello")) { console.log("done"); }
'hello' and 'done' are both written
Only 'hello' is written
Nothing
Note: This Question is unanswered, help us to find answer for this one
Check Answer
756. Which keyword is used to define the alternative path to take in a conditional statement?
alternative
next
or
else
Note: This Question is unanswered, help us to find answer for this one
Check Answer
757. function aaa() { return { test: 1 }; } alert(typeof aaa()); what does the above alert?
undefined
number
function
object
Answer
Correct Answer:
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
758. What is the outcome of the two alerts below? var foo = "Hello"; (function() { var bar = " World"; alert(foo + bar); })(); alert(foo + bar);
A message box "Hello World" and next a ReferenceError: "Can't find variable: bar"
A message box "Hello World" and next a message box "Hello"
A message box "Hello World"
Answer
Correct Answer:
A message box "Hello World" and next a ReferenceError: "Can't find variable: bar"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
759. JavaScript is a language that is
Weakly typed
Strongly typed
Answer
Correct Answer:
Weakly typed
Note: This Question is unanswered, help us to find answer for this one
Check Answer
760. How do you get the current date in JS?
var date = Date();
var date = new Date().getDay();
var date = new Date();
Answer
Correct Answer:
var date = new Date();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
761. Math.floor(4.94291481249124); returns
2.47145740624562
3.14
5
4
TypeError: Object #<Object> has no method...
Note: This Question is unanswered, help us to find answer for this one
Check Answer
762. What calls the debug function?
debug();
debugger.start();
debugger();
debug.activate();
debugger;
Answer
Correct Answer:
debugger;
Note: This Question is unanswered, help us to find answer for this one
Check Answer
763. What will the code below output to the console? console.log( "A" - "B" + 2);
NaN2
null
NaN
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
764. What return the html element of a document?
window.document
document.head
document.baseURI
document.body
document.documentElement
Answer
Correct Answer:
document.documentElement
Note: This Question is unanswered, help us to find answer for this one
Check Answer
765. What will the code below output to the console? (function(){ var a = b = 3; })(); console.log(" a defined? " + (typeof a !== 'undefined'));)) console.log(" b defined? " + (typeof b !== 'undefined'));))
runtime error of referenceError : a and b are not defined
runtime error of referenceError : b is not defined
runtime error of referenceError : a is not defined
a defined ? false b defined ? true
Answer
Correct Answer:
a defined ? false b defined ? true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
766. Which dialog box can be very useful when you want to pop-up a text box to get user input?
alert()
confirm()
prompt()
resp prompt()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
767. What are the results of the following equality operations? '' == '0' 0 == '' 0 == '0'
false, true, true
false, false, true
false, false, false
true, true, true
true, true, false
Answer
Correct Answer:
false, true, true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
768. What will .append() do in vanilla JavaScript?
Nothing, .append() is a jQuery function.
Throw an error, .append() is a jQuery function.
Add content to the selected element(s).
Answer
Correct Answer:
Throw an error, .append() is a jQuery function.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
769. Javascript primitives are literal objects.
False
True
Note: This Question is unanswered, help us to find answer for this one
Check Answer
770. What the value will be returned as a result of this function call? function foo () { return true ? false : null; };
null
undefined
true
false
Answer
Correct Answer:
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
771. Which of these is not a JavaScript object?
var x = [1, 2, 3];
var x = null;
var x = {name:"John", age:30};
var x = 1;
Answer
Correct Answer:
var x = 1;
Note: This Question is unanswered, help us to find answer for this one
Check Answer
772. Which is equivalent to: rowCount = rowCount + 1;
rowCount+=1;
rowCount++;
Both are equivalent.
Answer
Correct Answer:
Both are equivalent.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
773. What is logged? var x = (1 + "1") !== "11" || ("1" + 1) === 2; console.log(x);
true
11
undefined
false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
774. var colors=[{name:"red"}], car={name:"toyota"}; car.color=colors[0]; car.color.name="yellow"; Which is the value of colors[0].name?
red
yellow
toyota
Note: This Question is unanswered, help us to find answer for this one
Check Answer
775. for the following code: var baz = 0; function foo() { alert(bar(baz)); var baz = 1; function bar(message) { return message + ' is ' + message + '!'; } baz = 2 alert(bar(baz)); } foo(); What gets alerted?
0 is 0! 2 is 2!
undefined is undefined! 2 is 2!
throws an error, bar is invoked before it is defined
1 is 1! 2 is 2!
0 is 0! 1 is 1!
Answer
Correct Answer:
undefined is undefined! 2 is 2!
Note: This Question is unanswered, help us to find answer for this one
Check Answer
776. given the following code: var baz = 0; function foo() { alert(bar(baz)); var baz = 1; var bar = function(message) { return message + ' is ' + message + '!'; } baz = 2 alert(bar(baz)); } foo(); what is the output?
throws an error, bar is invoked before it is declared
undefined is undefined! 2 is 2!
0 is 0! 2 is 2!
throws an error, you can't assign a function to a variable in JavaScript
throws an error, bar is invoked before it is assigned a function
Answer
Correct Answer:
throws an error, bar is invoked before it is assigned a function
Note: This Question is unanswered, help us to find answer for this one
Check Answer
777. How can you delete a variable in Javascript?
delete variable
variable = null
Answer
Correct Answer:
delete variable
Note: This Question is unanswered, help us to find answer for this one
Check Answer
778. Which of these is the optimal method of executing a for-loop?
for (var i="lower limit"; i <= "upper limit"; i+"difference") { // code }
for (var i="upper limit"; i >= "lower limit"; i-"difference") { // code };
Answer
Correct Answer:
for (var i="upper limit"; i >= "lower limit"; i-"difference") { // code };
Note: This Question is unanswered, help us to find answer for this one
Check Answer
779. what will be the VALUE and TYPE of i? var i = -Infinity;
NaN & Infinity
NULL & Undefined
NaN & NaN
Number & -Infinity
Answer
Correct Answer:
Number & -Infinity
Note: This Question is unanswered, help us to find answer for this one
Check Answer
780. Which of the following return current millisecond count?
both
Date.now()
none
new Date().getTime()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
781. To define var1 = 'AAAAAAAAAAAAAAAAAAAA'; //20 times A Which of the following could be used
var var1 = 'A' * 20;
var var1 = Array(21).join("A");
var var1 = for (i=0; i<20; i++){ var1 += 'A';}
Answer
Correct Answer:
var var1 = Array(21).join("A");
Note: This Question is unanswered, help us to find answer for this one
Check Answer
782. In the HTML code a div is present
. What will the following code alert ? var div = document.getElementById("test"); div.addEventListener("click",function(){ alert("The value of : "+ this.id); }.bind(this),false);;
The value is : undefined
The value is : test
Answer
Correct Answer:
The value is : undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
783. When iterating through an objects properties, which function should be used to check each property?
obj.propertyExists(p)
isProperty(p, obj)
hasProperty(object, p)
obj.hasOwnProperty(p)
Answer
Correct Answer:
obj.hasOwnProperty(p)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
784. The output for the following code snippet would most appropriately be var a=5 , b=1 var obj = { a : 10 } with(obj) { alert(b) }
5
10
Error
1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
785. Consider the code snippet below. What will the console output be? (function(x) { return (function(y) { console.log(x); })(2) })(1);
2
-1
1
0
Note: This Question is unanswered, help us to find answer for this one
Check Answer
786. Evaluate the result of c: var a = (NaN == NaN) ; var b = 0; var c = (a === b);
variable NaN undefined
false
type error ===
true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
787. Javascript is designed for the following purpose__________
To perform server side scripting operation
To add interactivity to HTML pages.
To style HTML pages
Answer
Correct Answer:
To add interactivity to HTML pages.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
788. In the expression y = "5" + 5;
'y' have a value of 10
'y' have a null value
'y' have a value of 55
'y' have an undefined value
Answer
Correct Answer:
'y' have a value of 55
Note: This Question is unanswered, help us to find answer for this one
Check Answer
789. Suppose we have: var array = new Array(); var x = "Value"; How can you add a value to an array in Vanilla Javascript?
array.push(x);
array[x]
array[] = x;
Answer
Correct Answer:
array.push(x);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
790. What is the index of "horse" in the array below? [23, false, "cat", "horse", 0]
4
3
5
2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
791. What will the following statement evaluate to? 12 === "12"
12
NaN
true
false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
792. What does this line do? x = new Array(4,8);
Creates an array of two elements with values 4 and 8
Shows a syntax error
Creates a bi-dimensional array with value undefined for all elements
Creates a bi-dimensional array with value 0 for all elements
Answer
Correct Answer:
Creates an array of two elements with values 4 and 8
Note: This Question is unanswered, help us to find answer for this one
Check Answer
793. What is the principle of debouncing?
It's creating a function that can be fired only once
It's limiting the changes of a variable
It's limiting the rate at which a function can be fired
Answer
Correct Answer:
It's limiting the rate at which a function can be fired
Note: This Question is unanswered, help us to find answer for this one
Check Answer
794. var a = 11 + "11"; var b = a + 22; var c = a + b; c = ?
2222
55
111122
1111111122
Answer
Correct Answer:
1111111122
Note: This Question is unanswered, help us to find answer for this one
Check Answer
795. How do you check if a variable todos is an Array?
typeOf todos
todos.isArray
typeof todos
Answer
Correct Answer:
todos.isArray
Note: This Question is unanswered, help us to find answer for this one
Check Answer
796. What does document.createElement do?
Create New Attribute
Create New Div
Create New Tag
Create New Table
Create New Element
Answer
Correct Answer:
Create New Element
Note: This Question is unanswered, help us to find answer for this one
Check Answer
797. What is the significance, and what are the benefits, of including 'use strict' at the beginning of a JavaScript source file?
Enforce the use of lowercase variable names.
Force the use of double quotes instead of single quotes.
Enforce stricter parsing and error handling on your JavaScript code at runtime.
Enable console debugging at runtime.
Answer
Correct Answer:
Enforce stricter parsing and error handling on your JavaScript code at runtime.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
798. What would the output be? var fruits = ["Banana", "Orange", "Apple", "Mango"]; fruits.shift();
Banana, Orange, Apple, Mango
Orange,Apple,Mango
Banana, Orange, Apple
Answer
Correct Answer:
Orange,Apple,Mango
Note: This Question is unanswered, help us to find answer for this one
Check Answer
799. what is the return of this function? var a = 0, b = 1; function test(value) { return value; } test(a || b);
undefined
null
1
0
Note: This Question is unanswered, help us to find answer for this one
Check Answer
800. What is logged? if ("10" + 1 == 101) { var a = "yes"; } console.log(a);
null
undefined
"yes"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
801. What is the value of foo? var foo = 10 + '20';
"1020"
11
undefined
30
Note: This Question is unanswered, help us to find answer for this one
Check Answer
802. What methods, other than if-else/switch, can be used to execute conditional statements?
Do-While
Ternary Operators
Answer
Correct Answer:
Ternary Operators
Note: This Question is unanswered, help us to find answer for this one
Check Answer
803. In the following example, what will be logged into the console? var animals = ['moose', 'giraffe', 'unicorn']; animals.forEach(function(animal, index) { if (index === 2) { console.log(animal); } });
giraffe
unicorn
null
undefined
moose
Note: This Question is unanswered, help us to find answer for this one
Check Answer
804. Which is the correct syntax for declaring an object literal?
var person = ["firstName", "lastName", "age", "eyeColor"];
var person = [firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"];
var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};
var person = [firstName, lastName, age, eyeColor];
Answer
Correct Answer:
var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};
Note: This Question is unanswered, help us to find answer for this one
Check Answer
805. What's the meaning of IIFE in Javascript ?
Immediately-Invoked Function Execution
Immediately-Invoked Function Expression
Answer
Correct Answer:
Immediately-Invoked Function Expression
Note: This Question is unanswered, help us to find answer for this one
Check Answer
806. Which is NOT a JavaScript Type?
String
Boolean
Function
Number
Empty
Note: This Question is unanswered, help us to find answer for this one
Check Answer
807. Choose from the following which is true about Javascript
All of these
None of these
Compiled
Interpreted
Answer
Correct Answer:
Interpreted
Note: This Question is unanswered, help us to find answer for this one
Check Answer
808. What does Object.keys(x) return given the following x object. var x = { 'a': 1, 'b': 2 };
[ { 'a': 1}, { 'b', 2} ]
[ 1, 2 ]
[ a, b ]
[ 'a', 'b' ]
[ [ 'a', 'b' ], [ 1, 2 ] ]
Answer
Correct Answer:
[ 'a', 'b' ]
Note: This Question is unanswered, help us to find answer for this one
Check Answer
809. What is the use of isNaN function
isNan function returns true if the argument is not a number otherwise it is array.
isNan function returns true if the argument is not a number otherwise it is boolean.
isNan function returns true if the argument is not a number otherwise it is false.
isNan function returns true if the argument is not a number otherwise it is string.
isNan function returns true if the argument is not a number otherwise it is true.
Answer
Correct Answer:
isNan function returns true if the argument is not a number otherwise it is false.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
810. Choose correct answer for the following statement: 'If you delete an object prototype property, it will..........'
.......do nothing
.......ensure that this object will not be instantiated further in the code
.......affect all objects inherited from the prototype
.......throw a JavascriptDeleteException
Answer
Correct Answer:
.......affect all objects inherited from the prototype
Note: This Question is unanswered, help us to find answer for this one
Check Answer
811. function base(callback){ callback.call({msg:"hi"}) } function message(){ alert(this.msg) }; base(message); which is the value of alert?
undefined
null
""
hi
Note: This Question is unanswered, help us to find answer for this one
Check Answer
812. What would be result of the following expression? console.log({} + {});
undefined
{}
''[object Object]"
NaN
"[object Object][object Object]"
Answer
Correct Answer:
"[object Object][object Object]"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
813. What does Date() for example return ?
99,5,24,11,33,30,0
86400000
"October 13, 2014 11:13:00"
Sun Oct 13 2014 11:13:00 GMT+0100 (CET)
Answer
Correct Answer:
Sun Oct 13 2014 11:13:00 GMT+0100 (CET)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
814. What the problem with the code ? function runner() { this.run = function() {} }; var runnerCollection = new Array(); for(var i = 0 ; i < 1000 ; i ++) { runnerCollection.push(new runner()); }
function run is duplicated in memory
push method is not corectly called
Answer
Correct Answer:
function run is duplicated in memory
Note: This Question is unanswered, help us to find answer for this one
Check Answer
815. What will the code below output to the console and why? (function(){ var a = b = 3; })(); console.log("a defined? " + (typeof a !== 'undefined')); console.log("b defined? " + (typeof b !== 'undefined'));
a undefined? true b undefined? false
a undefined? false b undefined? true
a defined? false b defined? true
Answer
Correct Answer:
a defined? false b defined? true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
816. Which one of these is a valid syntax for a self-invokink fucntion?
function myFunction() { // code... } myFunction();
(function(window,document,undefined) { // code... })(this,this.document);
var myFunction = function() { // code... };
function myFunction() { // code... myFunction(); }
Answer
Correct Answer:
(function(window,document,undefined) { // code... })(this,this.document);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
817. What is newRay equal to at the end of the following code? var ray = []; ray["0"] = 1; ray["x"] = 2; var newRay = [] for( var i in ray ) { newRay.push( ray[ i ] ); }
[ 1, 2 ]
[ ]
[ 1 ]
[ 0 ]
Note: This Question is unanswered, help us to find answer for this one
Check Answer
818. What will the following code return? function myFunction(param) { return arguments[1] || param; } myFunction(123, false, "test")
false
"test"
undefined
true
123
Note: This Question is unanswered, help us to find answer for this one
Check Answer
819. If var a = 10, what will the result be of b with following syntax var b = a === 10 ? 'Sheldon' : 'Moonpie';
Moonpie
Howard
Sheldon
sheldon
Note: This Question is unanswered, help us to find answer for this one
Check Answer
820. Output of the code: var a = 90100; function someFunc(){ if(false){ var a = 1; } else { var b = 2; } console.log(b); console.log(a); //(1) } someFunc();
undefined undefined
undefined 1
2 undefined
2 1
Answer
Correct Answer:
2 undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
821. What are the primitive data types in Javascript?
string, number, boolean, null, undefined
string, boolean, null, undefined, object
string, integer, float, boolean, null, undefined
string, integer, boolean, null
Answer
Correct Answer:
string, number, boolean, null, undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
822. How can you add a property to an Object that is not enumerable in a for...in loop?
Object.defineProperty
It is not possible. All keys get enumerated in a for...in loop
Object["propertyKey"] = propertyValue
Object.addProperty
Answer
Correct Answer:
Object.defineProperty
Note: This Question is unanswered, help us to find answer for this one
Check Answer
823. What is the original or first name of javascript?
LiveScript
WebScript
EndSript
WebScript
Answer
Correct Answer:
LiveScript
Note: This Question is unanswered, help us to find answer for this one
Check Answer
824. var self=this; self.color="red"; self.getColor=function(){ return this.color; } self.getColor.call({color:"white"})); What is the return value?
white
red
""
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
825. How it will be evaluated ? null == undefined
True
ReferenceError: undefined is not defined
ReferenceError: null is not defined
False
Note: This Question is unanswered, help us to find answer for this one
Check Answer
826. The term "javascript closure" refers to:
The scope chain that defines the variables that an inner function has access to
The local scope of an anonymous function
The local scope of a function plus the global scope and nothing else.
The properties added to an object prototype
Answer
Correct Answer:
The scope chain that defines the variables that an inner function has access to
Note: This Question is unanswered, help us to find answer for this one
Check Answer
827. console.log([] == true)
False
True
Note: This Question is unanswered, help us to find answer for this one
Check Answer
828. Javascript is an________ language
compiled
interpreted
Answer
Correct Answer:
interpreted
Note: This Question is unanswered, help us to find answer for this one
Check Answer
829. Which one is NOT the attribute of the property of object?
writable
removable
enumerable
configurable
Answer
Correct Answer:
removable
Note: This Question is unanswered, help us to find answer for this one
Check Answer
830. What is a potential pitfall with using typeof bar === "object" to determine if bar is an object?
If object is not set an error will occur.
null is also considered an object.
All variables in JavaScript are objects.
Answer
Correct Answer:
null is also considered an object.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
831. Which of the following statements about hoisted declarations in Javascript is true? If a value is assigned to a variable during the declaration (example: var x = 10;) then ...
the declaration and the initialization will never be moved to the top of the current scope.
the declaration and initializaltion are moved together to the top of the current scope.
the declaration with the initialization have to be put at the top of the current scope or we get a syntax error.
the declaration will be moved to the top of the current scope, but the value assignment will be not.
Answer
Correct Answer:
the declaration will be moved to the top of the current scope, but the value assignment will be not.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
832. What is the type of n? var n = 1121212.233333333; typeof n;
number
float
long
double
Note: This Question is unanswered, help us to find answer for this one
Check Answer
833. var myObject = { foo: "bar", func: function() { var self = this; console.log("outer func: this.foo = " + this.foo); console.log("outer func: self.foo = " + self.foo); (function() { console.log("inner func: this.foo = " + this.foo); console.log("inner func: self.foo = " + self.foo); }()); } }; myObject.func();
outer func: this.foo = bar outer func: self.foo = bar inner func: this.foo = undefined inner func: self.foo = bar
outer func: this.foo = bar outer func: self.foo = undefined inner func: this.foo = undefined inner func: self.foo = bar
outer func: this.foo = bar outer func: self.foo = bar inner func: this.foo = null inner func: self.foo = bar
outer func: this.foo = bar outer func: self.foo = bar inner func: this.foo =
Answer
Correct Answer:
outer func: this.foo = bar outer func: self.foo = bar inner func: this.foo = undefined inner func: self.foo = bar
Note: This Question is unanswered, help us to find answer for this one
Check Answer
834. var x = 1.0; typeof x;
"decimal"
"float"
"integer"
"number"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
835. What would be printed to the console? function foo(arg) { console.log(Math.pow(this, arg)) } setTimeout(foo.bind(5, 2), 0); console.log('Done');
Error
10 'Done'
'Done' 25
NaN 'Done'
32 'Done'
Answer
Correct Answer:
'Done' 25
Note: This Question is unanswered, help us to find answer for this one
Check Answer
836. What will the below operation give you? var a = 14 var b = 9 console.log(a & b)
10
8
23
5
Note: This Question is unanswered, help us to find answer for this one
Check Answer
837. for the following code: function foo() { var funcs = []; for (var i = 0; i < 10; i++) { funcs.push(function () { alert('value of i is ' + i); }); } return funcs; } var funcs = foo(); funcs[0](); what will be alerted?
throws an error: you can't push functions into an array like that
value of i is 0
value of i is 10
value of i is 9
throws an error, i is no longer available when funcs[0] is called
Answer
Correct Answer:
value of i is 10
Note: This Question is unanswered, help us to find answer for this one
Check Answer
838. Which of the following can have a different value depending on who invoked the function accessing it?
this
var
scope
window
Note: This Question is unanswered, help us to find answer for this one
Check Answer
839. What will be the output when the following code is executed? console.log(false == '0', false === '0')
0 0
true true
true false
false false
Answer
Correct Answer:
true false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
840. function locald() { var d = 6; console.log("d inside function: " + d); } locald(); console.log("d outside function: " + d); What will be value of d in or out of the function;
6 and not defined
6
null
not defined
Answer
Correct Answer:
6 and not defined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
841. What will be the output of the following code: for (var i = 0; i < 5; i++) { (function(x) { setTimeout(function() { console.log(x); }, x * 1000 ); })(i); }
1 2 3 4 5
0 1 2 3 4
5 5 5 5 5
Answer
Correct Answer:
0 1 2 3 4
Note: This Question is unanswered, help us to find answer for this one
Check Answer
842. Between JavaScript and an ASP script, which is faster
ASP is faster
Javascript is faster
Answer
Correct Answer:
Javascript is faster
Note: This Question is unanswered, help us to find answer for this one
Check Answer
843. How do you write "Hello World" in an alert box?
msg("Hello World");
alert("Hello World");
Answer
Correct Answer:
alert("Hello World");
Note: This Question is unanswered, help us to find answer for this one
Check Answer
844. What return this function : function myFunction(p1, p2) { return p1 * p2; }
Nan
The function returns p2
The function returns the product of p1 and p2
Undefined
The function returns p1
Answer
Correct Answer:
The function returns the product of p1 and p2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
845. JavaScript Code can be called by using
Triggering Event
RMI
Preprocessor
Function/Method
Answer
Correct Answer:
Function/Method
Note: This Question is unanswered, help us to find answer for this one
Check Answer
846. var data = ["A", "B", "C", "D"]; data.unshift("X"); data.push("Y"); What does data look like?
["X", "A", "B", "C", "D", "Y"]
["Y", "A", "B", "C", "D", "X"]
["X", "Y", "A", "B", "C", "D"]
["A", "B", "C", "D", "X", "Y"]
Answer
Correct Answer:
["X", "A", "B", "C", "D", "Y"]
Note: This Question is unanswered, help us to find answer for this one
Check Answer
847. var total = 0; var it = { "1":2, "3":1, "4":3 }; for (i in it) total += it[i]; What is 'total' value?
14
6
8
Note: This Question is unanswered, help us to find answer for this one
Check Answer
848. In JavaScript, functions are considered to be just another value. Why ?
Considered to be third-class objects
Considered to be second-class objects
Considered to be fourth-class objects
Considered to be first-class objects
Answer
Correct Answer:
Considered to be first-class objects
Note: This Question is unanswered, help us to find answer for this one
Check Answer
849. Why does JavaScript subset disallow == and !=?
It uses === and !== instead
It uses equals() and notequals() instead
It uses bitwise checking
None of the mentioned
Answer
Correct Answer:
It uses === and !== instead
Note: This Question is unanswered, help us to find answer for this one
Check Answer
850. var a = {a:1}; var b = {b:1}; var c = a; console.log(c==a);
true
false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
851. The catch statement ...
lets you handle the error
is like else
is like else if
lets you create custom errors
lets you to use another statement
Answer
Correct Answer:
lets you handle the error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
852. What does the following statement declares? var myArray = [[[]]];
returns undefined
It declares a three dimensional array
Not a valid declaration
Answer
Correct Answer:
It declares a three dimensional array
Note: This Question is unanswered, help us to find answer for this one
Check Answer
853. What is result of 1+1+typeof(typeof(null))?
2string
string
1string
Note: This Question is unanswered, help us to find answer for this one
Check Answer
854. What is the use of void(0) ?
It is used to call another method without refreshing the page
Call function with no arguments
Specifies the return type
Answer
Correct Answer:
It is used to call another method without refreshing the page
Note: This Question is unanswered, help us to find answer for this one
Check Answer
855. On https://www.google.com/?gws_rd=ssl#q=test. What does "window.location.hash" return
"#q=test"
"q=test"
"/"
"test"
Answer
Correct Answer:
"#q=test"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
856. var s = ~function(d) { return d+s; }(10); What is 's' value?
-1
undefined
10
null
Note: This Question is unanswered, help us to find answer for this one
Check Answer
857. How many types of arguments are passed to an error handler:
three
one
four
two
Note: This Question is unanswered, help us to find answer for this one
Check Answer
858. How can you get the square root of 2 in JavaScript?
Math.SQRT2
None of the Above
Math.Sqrt(2)
All of the above
Answer
Correct Answer:
Math.SQRT2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
859. Which of the following JavaScript operators would be most helpful in writing code to force a choice between seven options:
% as in x %7
/ as in x / 7
+ as in x + 7
++ as in x++7
Answer
Correct Answer:
% as in x %7
Note: This Question is unanswered, help us to find answer for this one
Check Answer
860. Consider the following statements var count = 0; while (count < 10) { console.log(count); count++; } In the above code snippet, what happens?
The values of count is logged or stored in a particular location or storage.
The value of count from 0 to 9 is displayed in the console.
An error is displayed
An exception is thrown
Answer
Correct Answer:
The value of count from 0 to 9 is displayed in the console.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
861. Which company developed JavaScript?
Google
Netscape
Microsoft
Note: This Question is unanswered, help us to find answer for this one
Check Answer
862. The keyword or the property that you use to refer to an object through which they were invoked is
this
from
object
to
Note: This Question is unanswered, help us to find answer for this one
Check Answer
863. In HTML, JavaScript code must be inserted between <script> and </script> t
False
True
Note: This Question is unanswered, help us to find answer for this one
Check Answer
864. What does return do?
Set input parameter
Returns some values of given function
Return true/false
Break the function operation
Answer
Correct Answer:
Returns some values of given function
Note: This Question is unanswered, help us to find answer for this one
Check Answer
865. How can I get sum to be the sum of this array, var arr = [0,1,2,3]?
var sum = arr.sum()
var sum = arr.reduce(function(a,b){ return a + b });
var sum = Math.sum(arr)
var sum = arr.walk(function(a,b){ return a + b});
var sum = 0 + 1 + '2' + 3;
Answer
Correct Answer:
var sum = arr.reduce(function(a,b){ return a + b });
Note: This Question is unanswered, help us to find answer for this one
Check Answer
866. The “var” and “function” are
Datatypes
Declaration statements
Keywords
Prototypes
Answer
Correct Answer:
Declaration statements
Note: This Question is unanswered, help us to find answer for this one
Check Answer
867. JavaScript only hoists declarations, not initializations.
False
True
Note: This Question is unanswered, help us to find answer for this one
Check Answer
868. var x = 3 && 4; What is x?
NaN
4
3
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
869. If we don’t want the script to write page content, under which HTML tag should the JS tag be placed?
Both b and c above
< body>
< head>
Any of a and b above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
870. What will the following JavaScript output to console? var x = 8 + 8 + "8" + 8 + 8; console.log(x);
40
16888
88888
16816
Note: This Question is unanswered, help us to find answer for this one
Check Answer
871. The enumeration order becomes implementation dependent and non-interoperable if :
The delete keyword is never used
If the object inherits enumerable properties
The object does not have the properties present in the integer array indices
Object.defineProperty() is not used
Answer
Correct Answer:
If the object inherits enumerable properties
Note: This Question is unanswered, help us to find answer for this one
Check Answer
872. What is the output of: console.log("papa".replace("p", "m"));
papa
mapa
mama
Note: This Question is unanswered, help us to find answer for this one
Check Answer
873. What does this line display? alert(typeof(Array));
prototype
function
object
undefined
Array
Note: This Question is unanswered, help us to find answer for this one
Check Answer
874. what is the type of i? var i = NaN;
NaN
number
null
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
875. What does this is the value of the variable `c` at the end of this script? var a = 1; var b = 2; var c = a || b;
true
1
2
false
3
Note: This Question is unanswered, help us to find answer for this one
Check Answer
876. What will the code below output? Explain your answer. console.log(0.1 + 0.2); console.log(0.1 + 0.2 == 0.3);
true false
0.30000000000000004 false
false 0.30000000000000004
true true
Answer
Correct Answer:
0.30000000000000004 false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
877. What value is assigned to x: var x = (1, 2, 3);
2
3
undefined
1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
878. What values are assigned to x and y: var x = (0.1 + 0.2) == 0.3; var y = (0.1 + 0.1) == 0.2;
x == false y == false
x == false y == true
x == true y == true
x == true y == false
Answer
Correct Answer:
x == false y == true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
879. What is output to the console: (function() { var a = b = 1; })(); console.log (typeof b);
null
number
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
880. The following one line function will return true if str is a palindrome; otherwise, it returns false. function isPalindrome(str) { str = str.replace(/\W/g, '').toLowerCase(); return (str == str.split('').reverse().join('')); }
false
true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
881. You want a dictionary-like data object such that you can give it the word to look up and it gives you the definition. Which of the following would create such an object and log a look-up to the console?
var dictionary = array("cat" => "domestic pet known for attitude", "dog" => "domestic pet known for loyalty", "fish" => "aquatic animal sometimes made a domestic pet"); console.log( diction
var dictionary = {"cat" : "domestic pet known for attitude", "dog" : "domestic pet known for loyalty", "fish" : "aquatic animal sometimes made a domestic pet"}; console.log( dictionary.dog );
var dictionary = new Array("cat" : "domestic pet known for attitude", "dog" : "domestic pet known for loyalty", "fish" : "aquatic animal sometimes made a domestic pet"); console.log( dictionary["
var dictionary = ["cat" : "domestic pet known for attitude", "dog" : "domestic pet known for loyalty", "fish" : "aquatic animal sometimes made a domestic pet"]; console.log( dictionary["dog"
Answer
Correct Answer:
var dictionary = {"cat" : "domestic pet known for attitude", "dog" : "domestic pet known for loyalty", "fish" : "aquatic animal sometimes made a domestic pet"}; console.log( dictionary.dog );
Note: This Question is unanswered, help us to find answer for this one
Check Answer
882. What will be the output when the following code executed console.log(flase === '0')
true
false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
883. When automatic conversion of primitive values to objects (autoboxing) works in Javascript?
When you are trying to access a "property" of a primitive value
All of these are correct
When you pass a primitive value as the 'this' value to .call in non-strict mode
When you pass a primitive value as the 'this' value to .apply in non-strict mode
Answer
Correct Answer:
All of these are correct
Note: This Question is unanswered, help us to find answer for this one
Check Answer
884. Which one is a construct function ?
function Person(firstname,lastname){ $this.firstname = firstname;$this.lastname = lastname; }
var Person = function(firstname,lastname){ this.firstname = firstname; this.lastname = lastname; }
Answer
Correct Answer:
var Person = function(firstname,lastname){ this.firstname = firstname; this.lastname = lastname; }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
885. var a = ['a','b','c']; console.log(a[2]);
a
c
b
Note: This Question is unanswered, help us to find answer for this one
Check Answer
886. The difference between == and ===
Both are the same.
equality and type equality.
The first one checks for value equality and the second checks for value
Answer
Correct Answer:
equality and type equality.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
887. What does the following function return when called? functionmyFunction() { varnum = 2; return innerFunction(num); varinnerFunction = function(x) { return x*3; } }
Error
5
error
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
888. How many datatypes are there in javascript according to ECMAScript 6 specifications?
7
5
error
8
Note: This Question is unanswered, help us to find answer for this one
Check Answer
889. functionmyFunction() { varnum = 2; return innerFunction(num); function innerFunction(x) { return x*3; } }
6
Undefined
error
8
Note: This Question is unanswered, help us to find answer for this one
Check Answer
890. Which of the following is not a datatype in javascript according to ECMAScript 6?
Character
Undefined
Number
Symbol
Answer
Correct Answer:
Character
Note: This Question is unanswered, help us to find answer for this one
Check Answer
891. True or false? 'hello'.charAt(-1) === 'hello'[-1]
false
error occurs
true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
892. What is Math.max(5, [1, 4]);?
NaN
5
4
AVPlayer
Note: This Question is unanswered, help us to find answer for this one
Check Answer
893. If Math.max(3, []); = 3, What is Math.max(3, {}); ?
NaN
3
AVPlayer
Note: This Question is unanswered, help us to find answer for this one
Check Answer
894. Consider the following code: var bar = (function(){ function Bar(){}; return new Bar(); })(); How will you make another instance of Bar?
new bar()
new bar
Object.create(bar)
new bar.constructor()
Answer
Correct Answer:
new bar.constructor()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
895. What will the log display after executing the following? var book = { page1: "Once upon a time...", page2: "And thus they traveled north...", page3: "The rock golem hoisted...", printPages: function() { return book.page1 + book.page2 + book.page3; } } for (page in book) { console.log(page); }
page1 page2 page3
Once upon a time... And thus they traveled north... The rock golem hoisted...
page1 page2 page3 printPages
Once upon a time... And thus they traveled north... The rock golem hoisted... function () { return book.page1 + book.page2 + book.page3; }
Answer
Correct Answer:
page1 page2 page3 printPages
Note: This Question is unanswered, help us to find answer for this one
Check Answer
896. Unlike C and C++, Javascript executes all statements ________________________.
On a line by line basis, so an operator is necessary to continue a statement on the next line.
From left to right, so the expression var x = 6 + 14 + " is my favorite number"; would say your favorite number was 20.
From right to left, so the expression var x = 6 + 14 + " is my favorite number"; would say your favorite number was 614.
Irrespective of white space, so a semi-colon is necessary at the end of each statement.
Trick question... Javascript is EXACTLY like C and C++
Answer
Correct Answer:
From left to right, so the expression var x = 6 + 14 + " is my favorite number"; would say your favorite number was 20.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
897. JavaScript is a[n] ______-scoped programming language.
file
function
expression
block
Note: This Question is unanswered, help us to find answer for this one
Check Answer
898. What will be the Function length in this case: function zeroFunc(name, value)
2
0
1
4
3
Note: This Question is unanswered, help us to find answer for this one
Check Answer
899. What is the value of myArray at the end of the following lines : var myArray = ["a", "b"]; myArray.concat(["b", "c"])
["a", "b", ["b", "c"]]
["a", "b", "b", "c"]
["a", "b", "c"]
["a", "b"]
Answer
Correct Answer:
["a", "b"]
Note: This Question is unanswered, help us to find answer for this one
Check Answer
900. What does the nodeValue property return for an HTML element node?
null
The tag name of that element.
A number corresponding to the node type.
The innerHTML of that element.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
901. When using JavaScript to access the DOM, what will document.querySelector('*') return?
All HTML node elements with defined id or class selectors
The first HTML element node found.
null
All HTML element nodes.
All attribute nodes.
Answer
Correct Answer:
The first HTML element node found.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
902. Consider the function f: var f = function(a,b,c) { console.log(a,b,c); } Out of the options below, what is the right way of calling the function in order for the console to output nothing else than "1 2 3"?
f.apply(f, [1,2,3])
f.apply(f,1,2,3);
f.call(f, [1,2,3])
f("1 2 3");
f.call(1,2,3);
Answer
Correct Answer:
f.apply(f, [1,2,3])
Note: This Question is unanswered, help us to find answer for this one
Check Answer
903. Be it a = 500 a >> 5 is the same as
a / 11111
a / 0x5
a * Math.pow(2,5)
a / Math.pow(2,5)
a >>> 5
Note: This Question is unanswered, help us to find answer for this one
Check Answer
904. Evaluate: ![]+[]
Syntax Error
undefined
false
'false'
true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
905. What will be printed in console? !function(){ console.log('!') }();
true
!
SyntaxError
false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
906. Be it a = 101 and p = 3 The operation a << p yields the same result as:
a * 2 * 2 * 2
Math.floor(Math.floor(Math.floor(a/2)/2)/2)
a * 9
a - 3
Answer
Correct Answer:
a * 2 * 2 * 2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
907. var x = ~1001 + "123" << 2; What is the value of x?
-4008492
-4008482
-1002
"-4008492"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
908. What is the last value of the variable named "i" ? var i = 5; for(i = 0; i < 11; i += 2){ i += 3; }
5
11
10
15
13
Note: This Question is unanswered, help us to find answer for this one
Check Answer
909. Be it variable "s", holding a number. The operation 1 + (~s) yields the same result as:
-s
Math.ceil(s)
s++
Math.round(s)
Math.abs(s)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
910. What is the value of x? var x = ~1001;
-1002
-1001
false
true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
911. Consider the following variable assignments: var a = 1; var b = 2; For the values set above the operation (a & b) returns the same result as:
a - b
((a%2)&&(b%2))&&((Math.floor(a/2)%2) && (Math.floor(a/2)%2))
a + b
(a + b) % 2
a % b
Answer
Correct Answer:
((a%2)&&(b%2))&&((Math.floor(a/2)%2) && (Math.floor(a/2)%2))
Note: This Question is unanswered, help us to find answer for this one
Check Answer
912. Consider the following variable assignment: var s = Math.random(9,100); the variable s is:
Any integer in the [10, 99] interval
Any real number in the [0,1) interval
NaN because the Math.random function doesn't take two input variables
Any integer in the [9, 100] interval
undefined
Answer
Correct Answer:
Any real number in the [0,1) interval
Note: This Question is unanswered, help us to find answer for this one
Check Answer
913. Consider the following variable assignments: var a = 144; var p = 3; The operation a >> p yields the same result as:
Math.pow(a,p)
Math.pos(a, 1/p)
Math.floor(Math.floor(Math.floor(a / 2) / 2) / 2)
a * 2 * 2 * 2
0
Answer
Correct Answer:
Math.floor(Math.floor(Math.floor(a / 2) / 2) / 2)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
914. What will be printed in console? var i = function(){ return 10; }(); console.log(i());
'function()...'
Throw error
undefined
10
Answer
Correct Answer:
Throw error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
915. Which of the following Array prototype method actually modifies the array it's been called on?
slice()
concat()
splice()
all of them
Note: This Question is unanswered, help us to find answer for this one
Check Answer
916. What will be printed to console? function Foo(){ var foo = 1; bar = 'hello' } var f = new Foo; console.log(f.foo,bar);
undefined "hello"
1 "hello"
undefined undefined
1 undefined
Answer
Correct Answer:
undefined "hello"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
917. What is the value of "x" after the following code runs? var x; x++;
NaN
undefined
1
Throws a TypeError on the "x++;" statement
0
Note: This Question is unanswered, help us to find answer for this one
Check Answer
918. What is the value of c? var a = function(){ this.b = 1; } var b = function(){ this.b = new a().b; return 5; } var c = b() + new b();
5
6
1
[object]
Error thrown when running the code
Answer
Correct Answer:
Error thrown when running the code
Note: This Question is unanswered, help us to find answer for this one
Check Answer
919. What is the output of the following JavaScript? var test = function (firstName, surname) { this.Name.FirstName = firstName; this.Name.Surname = surname; } test.prototype = { Name: { FirstName: undefined, Surname: undefined } } var b = new test('john', 'doe'); var c = new test('bob', 'templeton'); console.log(b.Name.FirstName + ' ' + b.Name.Surname + ', ' + c.Name.FirstName + ' ' + c.Name.Surname);
john doe, john doe
john doe, bob templeton
bob templeton, john doe
bob templeton, bob templeton
Answer
Correct Answer:
bob templeton, bob templeton
Note: This Question is unanswered, help us to find answer for this one
Check Answer
920. What does the following return? Math.max();
0
null
Infinity
-Infinity
Answer
Correct Answer:
-Infinity
Note: This Question is unanswered, help us to find answer for this one
Check Answer
921. Consider the following variable assignments: var a = 1; var b = 2; var c = 3; var r = a & b & c; The value of r is:
2
6
123
0
Note: This Question is unanswered, help us to find answer for this one
Check Answer
922. What's the correct syntax for creating a Date object for January 10, 1998?
new Date(0, 10, 1998);
new Date(1, 10, 1998);
new Date(1998, 0, 10);
new Date(1998, 1, 10);
Answer
Correct Answer:
new Date(1998, 0, 10);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
923. What is the value of mike after this code is run? function Person(name, age) { this.name = name; this.age = parseInt(age, 10); } var mike = Person('Mike', '25');
{ name: 'Mike', age: '25' }
null
This code won't run. It throws a SyntaxError.
{ name: 'Mike', age: 25 }
undefined
Answer
Correct Answer:
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
924. String values have a "length" property. Why is this property not included in a for-in loop over a string object? var prop, str; str = 'example'; /* str.length === 7 */ for ( prop in str) {}
Because the "length" property isn't a real property (defined and set through get/set accessors). Properties with accessors are not included in for-in loops.
Because the "length" property is only in the String prototype, it is not an own property of string objects, and as such is not included in a for-in loop.
Because the "length" property has internal [[Enumerable]] set to false.
Answer
Correct Answer:
Because the "length" property has internal [[Enumerable]] set to false.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
925. What does Math.random() do?
Returns a random number more than 0 up to and including 1.
Returns a random number from and including 0 to less than 1.
Returns a random number more than 0 and less than 1.
Randomly selects a number 1-10.
Randomly put numbers in descending and ascending order
Answer
Correct Answer:
Returns a random number from and including 0 to less than 1.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
926. Which of these will create a copy of an array such that changes to the old array will not be reflected in the new array?
var newArray = oldArray;
var newArray = new Array(oldArray);
var newArray = [oldArray];
var newArray = oldArray.slice(0);
Answer
Correct Answer:
var newArray = oldArray.slice(0);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
927. Math.log(x) returns:
Logarithm base 2 of x.
Logarithm base 10 of x.
Logarithm base 8 of x.
Logarithm base e (Euler's number) of x.
Answer
Correct Answer:
Logarithm base e (Euler's number) of x.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
928. What is the value of x? var a = "abc"; var x = a instanceof String;
true
false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
929. What will this code produce: +new Date()
Unix timestamp in milliseconds (UTC timezone)
A SyntaxError
The Unix epoch (1970-01-01 00:00:00)
Unix timestamp in milliseconds (Local timezone)
Answer
Correct Answer:
Unix timestamp in milliseconds (UTC timezone)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
930. What are the values of x and y after the invocation of `foo` in following? var x = "I am global x"; var y = "I am global y"; function foo() { var y = x = "Hello from foo"; } foo();
x = "I am global x"; y = "I am global y";
x = "Hello from foo"; y = "I am global y";
x = "Hello from foo"; y = "Hello from foo";
The function throws a SyntaxError
Answer
Correct Answer:
x = "Hello from foo"; y = "I am global y";
Note: This Question is unanswered, help us to find answer for this one
Check Answer
931. function foo() { this = "foo"; } var a = foo(); What will the preceding code produce?
ReferenceError: Invalid left-hand side in assignment
undefined
"foo"
SyntaxError: Unexpected token
"undefined"
Answer
Correct Answer:
ReferenceError: Invalid left-hand side in assignment
Note: This Question is unanswered, help us to find answer for this one
Check Answer
932. What will the following code will output? var Apple = function() { var color = "green"; var apple = { picked:false, pick: function() { this.picked = true; console.log (color); color = "yellow"; }, change: function() { this.color = Math.random() > 0.5 ? "yellow":"red"; } }; return apple; } var a = Apple(); a.pick(); console.log (a.color);
"green" and then "undefined"
"undefined" and "orange"
"undefined" and "yellow" or "red"
"undefined" and "undefined"
"green" and "orange"
Answer
Correct Answer:
"green" and then "undefined"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
933. What will be the value of result? function foo(bar) { return bar ? bar == foo : foo(foo); } var result = foo();
true
Function will end up in infinite loop
Value will be null
Function won't work due to incorrect syntax
false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
934. What is the value of a after executing the following: var a = [1, 2, 3]; a.splice(1, 2, 3);
[ ]
[1, 2, 3]
[1, 2, 3, 1, 2, 3]
[1, 2, 3, 2, 3]
[1, 3]
Note: This Question is unanswered, help us to find answer for this one
Check Answer
935. What is the value of x after the following code is run? var obj = { 0: 'who', 1: 'what', 2: 'idontknow'}; var x = 1 in obj;
"who"
"what"
undefined
Nothing, the code throws a syntax error
true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
936. What will be the result of this expression: void 0
SyntaxError
TypeError
undefined
null
Answer
Correct Answer:
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
937. var x = { foo: "A" }; x.constructor.prototype.foo = "B"; var y = {}; console.log(x.foo); console.log(y.foo); Which two values will be logged?
"A" "A"
"B" undefined
"A" "B"
"A" undefined
"B" "B"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
938. var q = null; q++; What is q?
NaN
1
Type Error
null
Note: This Question is unanswered, help us to find answer for this one
Check Answer
939. After the following code: var a = function(){ this.b = 1; this.deleteMe = function(){ delete this; } }; var c = new a(); c.deleteMe(); What is the value of (String(c))?
(empty)
null
[object Object]
Error thrown
undefined
Answer
Correct Answer:
[object Object]
Note: This Question is unanswered, help us to find answer for this one
Check Answer
940. Math.min() < Math.max(); will return
null
false
true
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
941. "bar".split().length returns:
3
2
1
throws an error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
942. function Question() { this.answered = false; } Question.prototype.rightAnswer = 5; console.log( new Question().rightAnswer, Question.rightAnswer ); What gets printed to the console?
undefined 5
5 undefined
5 5
undefined undefined
Answer
Correct Answer:
5 undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
943. What will the following code, when evaluated, do? var void = function () {};
Throw a SyntaxError
Create a local variable named "void" but stays undefined due to a SyntaxError.
Assign an anonymous function to variable named "void"
Answer
Correct Answer:
Throw a SyntaxError
Note: This Question is unanswered, help us to find answer for this one
Check Answer
944. console.log( typeof [1,2] ) will print out:
string
number
undefined
object
array
Note: This Question is unanswered, help us to find answer for this one
Check Answer
945. Consider: var x = ['a', 'b', 'c']; Which line of code will remove the first element of the array, resulting in x being equal to ['b', 'c']?
x.unshift(0);
x.pop();
x.splice(0);
x.splice(0, 1);
Answer
Correct Answer:
x.splice(0, 1);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
946. Evaluate: new Boolean(new Boolean(false)).valueOf()
Type Error
(Instance of object Boolean with valueOf false)
false
true
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
947. var a = isNaN(null); is a true or false?
false
true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
948. What will we see in the console after the following code run: var a = 'Bolt'; function f() { if (!a) { var a = 'Nut'; } console.log(a); } f(); console.log(a);
'Bolt' then 'Nut'
'Nut' and 'Nut'
'Bolt' and 'Bolt'
'Nut' then 'Bolt'
Answer
Correct Answer:
'Nut' then 'Bolt'
Note: This Question is unanswered, help us to find answer for this one
Check Answer
949. Object.keys(x)
returns a key that can be used to unlock the object after Object.freeze(x).
returns the keys for enumerable properties of x as an array of strings.
returns all keys of properties of x as an array of strings, including non-enumerable properties.
Incorrect syntax for using Object.keys.
Answer
Correct Answer:
returns the keys for enumerable properties of x as an array of strings.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
950. What will be printed to console? function sayHi(person) { "use strict"; message = "Hi, " + person; console.log(message); } person = "Jim"; sayHi(person);
Hi,
Hi, Jim
Hi, undefined
ReferenceError: message is not defined
Answer
Correct Answer:
ReferenceError: message is not defined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
951. Which two values are logged by the following code? var x = 5; (function () { console.log(x); var x = 10; console.log(x); }());
10 10
nothing. Throws ReferenceError: x is not defined
5 10
undefined 10
Answer
Correct Answer:
undefined 10
Note: This Question is unanswered, help us to find answer for this one
Check Answer
952. How can you remove an element from an array and replace it with a new one ?
array.replace(...)
array.split(...)
array.switch(...)
array.overwrite(...)
array.splice(...)
Answer
Correct Answer:
array.splice(...)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
953. Assuming alert displays a string of its argument: var a = 10; function example(){ alert(a); var a = 5; } example(); What will be shown if the preceding code is executed?
10
null
5
undefined
Answer
Correct Answer:
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
954. What will be printed to the console as a result of this code? var printName = function() { console.log('Matt'); printName = function() { console.log('James'); }; }; var copy = printName; printName(); copy();
Matt Matt
Matt James
James James
James Matt
Answer
Correct Answer:
Matt Matt
Note: This Question is unanswered, help us to find answer for this one
Check Answer
955. What does the >>> operator do?
Shifts a in binary representation x bits to the right, discarding bits shifted off, and shifting in zeros from the left.
Shifts the value in binary representation by x bits to the right, discarding bits shifted off.
doesn't exist
Answer
Correct Answer:
Shifts a in binary representation x bits to the right, discarding bits shifted off, and shifting in zeros from the left.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
956. Which of the following expressions evaluates to false?
new Boolean(0) == 0
new Boolean('true') == true
new Boolean('false') == false
new Boolean(1) == 1
Answer
Correct Answer:
new Boolean('false') == false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
957. What value is passed to function "foo" as first argument? foo( +"5" );
NaN
"5"
"05"
0
5
Note: This Question is unanswered, help us to find answer for this one
Check Answer
958. What is the value of x? var z = [typeof z, typeof y][0]; var x = typeof typeof z;
"object"
"array"
"string"
"undefined"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
959. console.log(1 + +"2" + "2")
"122"
32
Error
122
Note: This Question is unanswered, help us to find answer for this one
Check Answer
960. What is the value of x.length after running this code? x = ["foo"]; x.quux = "Hello"; x[1] = "bar";
Error on middle line: cannot add properties to Array
1
Error on last line: index out of bounds
3
2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
961. Evaluate: undefined + 2
2
Type Error
NaN
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
962. What will: typeof typeof(null) return?
string
null
error
Number
empty
Note: This Question is unanswered, help us to find answer for this one
Check Answer
963. True or false ? typeof(null) == typeof(undefined)
ReferenceError: undefined is not defined
true
ReferenceError: null is not defined
false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
964. Evaluate: "10" - (17).toString()
-7
3
Throws Javascript error
10125
Note: This Question is unanswered, help us to find answer for this one
Check Answer
965. What will be in console after executing this code: console.log(1 + '1' - 1);
'111'
10
1
'1'
Note: This Question is unanswered, help us to find answer for this one
Check Answer
966. Which of the following String prototype method takes a regular expression?
All of these
indexOf()
search()
charCodeAt()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
967. what is the value of x? var y = "100"; var x = + y + 10;
"10010"
undefined
NaN
110
Note: This Question is unanswered, help us to find answer for this one
Check Answer
968. var x = {}; var foo = function () { this.hello = "Hi"; return this; }; x.bar = foo; What is the value of the following code: x.bar().bar().hello;
"function () { this.hello = "Hi"; return this; }"
"Hi"
undefined
TypeError: Object -- has no method 'bar'
TypeError: Cannot call method 'bar' of undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
969. Which of the following is not a reserved word in the language?
debugger
while
and
instanceof
Note: This Question is unanswered, help us to find answer for this one
Check Answer
970. How does JavaScript interpret numeric constants outside of strict mode?
As octal if they are preceded by a zero, and as hexadecimal if they are preceded by a zero and "x"
As hexadecimal if they are preceded by a zero only
As octal if they are preceded by an underscore
None of these are correct
Answer
Correct Answer:
As octal if they are preceded by a zero, and as hexadecimal if they are preceded by a zero and "x"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
971. What is the value of x? var x = typeof NaN;
"number"
"object"
"integer"
"nan"
"double"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
972. The expression (typeof NaN === "number") evaluates to:
true
Throws an Error
false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
973. (function() { 'use strict'; foo = "bar"; })();
It kills your browser
It enables the JavaScript strict mode and creates a variable named "foo" in the global object (window)
It doesn't do anything
It throws an error : foo is not defined
It creates a variable named "foo" in the global object (window)
Answer
Correct Answer:
It throws an error : foo is not defined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
974. An (inner) function enjoys access to the parameters and variables of all the functions it is nested in. This is called:
Lexical scoping
Prototypal inheritance
Answer
Correct Answer:
Lexical scoping
Note: This Question is unanswered, help us to find answer for this one
Check Answer
975. Which of the following is NOT a valid way to write a loop that will iterate over the values in the array in variable "myArray"?
for (var i = 0, len = myArray.length; i < len; i++) {}
None of these, they are all valid
var i = 0; for (; i < myArray.length; i++) {}
for (var i = 0; i < myArray.length; i += 1) {}
for (var i = 0; i < myArray.length; i++) {}
Answer
Correct Answer:
None of these, they are all valid
Note: This Question is unanswered, help us to find answer for this one
Check Answer
976. What is the output? var one; var two = null; console.log(one == two, one === two);
true true
false false
false true
Error: one is not defined
true false
Answer
Correct Answer:
true false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
977. What is the difference between the two declaration methods below? var functionOne = function() { /* some code */ } function functionTwo() { /* some code */ }
functionOne is defined in-place (until that line, functionOne is undefined), whereas functionTwo is hoisted to the top of the scope and is available as a function throughout the scope.
functionOne is not a correct way to define functions
functionTwo is defined in-place (until that line, functionTwo is undefined), whereas functionOne is hosted to the top of the scope and is available as a function throughout the scope.
No difference, they are treated the same way by the javascript engine. Different syntax to do the same.
Answer
Correct Answer:
functionOne is defined in-place (until that line, functionOne is undefined), whereas functionTwo is hoisted to the top of the scope and is available as a function throughout the scope.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
978. Given the following code: var myVar = '5'; var myAddedVar = myVar + 10; What is the value of (myAddedVar.constructor === Number)?
true
NaN
Type Error
false
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
979. What does the following return? Number(null);
0
undefined
null
1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
980. When reserved words are used as keys in object literals they must be ______?
This is not possible in javascript
escaped
Prefixed with the @ operator
quoted
Note: This Question is unanswered, help us to find answer for this one
Check Answer
981. [] === [] evaluates to
null
undefined
false
0
true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
982. Which of the following assigned values of x will cause (x == x) to return false?
All of the answers
0/0
Number("foo")
NaN
Answer
Correct Answer:
All of the answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
983. true + true will return :
undefined
2
true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
984. Which operator has highest precedence?
+
^
-
*
Note: This Question is unanswered, help us to find answer for this one
Check Answer
985. What is the result of: function foo() { output( "biz " + bar() ); } bar(); var bar = function() { return "baz"; }
baz biz
biz bar
TypeError: Undefined is not a function
biz baz
foo baz
Answer
Correct Answer:
TypeError: Undefined is not a function
Note: This Question is unanswered, help us to find answer for this one
Check Answer
986. Infinity * null will return :
NaN
null
Infinity
Note: This Question is unanswered, help us to find answer for this one
Check Answer
987. What would this code print out? if (new Boolean(false)) console.log("True"); else console.log("False");
True
False
Note: This Question is unanswered, help us to find answer for this one
Check Answer
988. Read the following function : function custom_indexOf( array, value ){ for(var i = 0; i < array.length; i++){ if(array[i] == value) return i; } } The property "length" of array is calculated at every loop beginning (true or false)
True
False
Note: This Question is unanswered, help us to find answer for this one
Check Answer
989. Consider the following variable assignments: var a = 1; var b = 2; var r = a | b; The value of r is:
12
2
3
0
1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
990. console.log(3%2&1); The console displays:
0
1
2
3
NaN
Note: This Question is unanswered, help us to find answer for this one
Check Answer
991. A javascript variable prefixed with a $ is:
valid javascript syntax as any other character
invalid, a common bug introduced by developers coming from PHP or Perl
still valid, but deprecated since Javascript 1.6
only valid within certain javascript libraries
Answer
Correct Answer:
valid javascript syntax as any other character
Note: This Question is unanswered, help us to find answer for this one
Check Answer
992. function b(x, y, a) { arguments[2] = 10; alert(a); } b(1, 2, 3); What is alerted?
2
3
10
1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
993. What is the right way to combine two arrays into a new array? var a = ["a", "b", "c"]; var b = ["d", "e", "f"];
var c = a.push() + b.push();
var c = a.join(b);
None of these
var c = a.concat(b);
Answer
Correct Answer:
var c = a.concat(b);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
994. What will happen in the console after executing this code? if ("foo") { console.log("foo" === false); console.log("foo" === true); }
false false
TypeError : Cannot convert to boolean
(nothing)
NaN NaN
false true
Answer
Correct Answer:
false false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
995. What is the difference between using call() and apply() to invoke a function with multiple arguments?
apply() is identical to call(), except apply() requires an array as the second parameter
apply() is exactly identical to call()
apply() is deprecated in favor of call()
apply() is identical to call(), except call() requires an array as the second parameter
Answer
Correct Answer:
apply() is identical to call(), except apply() requires an array as the second parameter
Note: This Question is unanswered, help us to find answer for this one
Check Answer
996. Which Object method takes a `propertyName` parameter and returns `true` if the object contains an uninherited property with that key?
obj.exists('propertyName');
obj.hasOwnProperty('propertyName');
obj.contains('propertyName');
obj.doesPropertyExist('propertyName');
obj.hasProperty('propertyName');
Answer
Correct Answer:
obj.hasOwnProperty('propertyName');
Note: This Question is unanswered, help us to find answer for this one
Check Answer
997. Which of these will invoke a function?
function.Apply(...)
function.Execute(...)
function.apply(...)
function.invoke(...)
function.exec(...)
Answer
Correct Answer:
function.apply(...)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
998. Which of the following statements is not a bitwise operator
^
>>
>>>
%
<<
Note: This Question is unanswered, help us to find answer for this one
Check Answer
999. What this code prints to console? (function(a){ return function(b){ return function(c){ console.log(a + b, c); } } })(1)(2)(3)
9
1 2 3
6
Throw error
3 3
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1000. var obj1 = {}; var obj2 = {}; What is the value of (obj1 === obj2)
true
false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1001. Which of these is not a built-in object constructor?
Array
RegExp
Time
Date
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1002. What will the expression a === b return after the following? var a = { "foo": "bar" }; var b = { "foo": "bar" };
undefined
An exception is thrown.
false
true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1003. What is the result? "" ? "a" : "b"
"a"
"b"
Error: "" is not a boolean
""
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1004. You use the Math.tan( ) method to:
Return the tangent of an angle (in gradients)
Return the tangent of an angle (in radians)
Does not exist in JavaScript
Return the tangent of an angle (in degrees)
Answer
Correct Answer:
Return the tangent of an angle (in radians)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1005. What is the end value of myAddedVar with the following code: var myVar = '5'; var myAddedVar = myVar + 10;
NaN
'510'
510
15
Nothing, the code will result in an error.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1006. What is the value of x after the following code is executed? var x = 0; x = x++;
0
1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1007. Does NaN equal itself?
No, when trying to compare it against itself, an exception is thrown.
No, NaN does not equal itself (== comparison would return false).
Yes, just like 123 is equal to (==) 123, NaN is equal to NaN.
Answer
Correct Answer:
No, NaN does not equal itself (== comparison would return false).
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1008. var x = Math.ceil(10.126); What is the value of x?
11
10.13
An error, because it was called incorrectly
10
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1009. What does null, undefined, "string", 20, true and false have in common?
they are primitive values
they are functions
they are objects
they have the same instance properties
Answer
Correct Answer:
they are primitive values
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1010. Which fact is true about the keyword "default"?
It catches any case clauses not caught by case statements within a switch statement
It branches program logic based on the value of a condition
It does not exist in JavaScript
It sets up one variable to check against multiple values
Answer
Correct Answer:
It catches any case clauses not caught by case statements within a switch statement
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1011. What does the following expression return? 1 + 5 + " bottles of milk";
"5 bottles of milk"
"15 bottles of milk"
undefined. An exception is thrown
"6 bottles of milk"
Answer
Correct Answer:
"6 bottles of milk"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1012. Which of the following types does NOT exist in javascript?
object
string
number
boolean
integer
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1013. Which are the different ways to affect the "this" reference in a function?
Direct attribution, e.g. this = x;
the
Invoking a function with the
Answer
Correct Answer:
Invoking a function with the
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1014. Which String prototype method is capable of removing a character from a string?
replace()
remove()
delete()
destroy()
Answer
Correct Answer:
replace()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1015. var a = new Boolean(false); What is (typeof a)?
'false'
'object'
'number'
'primitive'
'boolean'
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1016. var data = [1, 2, 3, 4, 5, 6]; data.shift(); What does data look like?
[2, 3, 4, 5, 6]
[undefined, 1, 2, 3, 4, 5]
[undefined, 2, 3, 4, 5, 6]
[1, 2, 3, 4, 5]
[6, 1, 2, 3, 4, 5]
Answer
Correct Answer:
[2, 3, 4, 5, 6]
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1017. What's the difference between the "var" keyword and the new "let" keyword which appears in ECMAScript 6 ?
The "let" allows programmers to do variables assignment by "destructuring"
The "let" is the new "var". It's faster to create and initialize variables in the computer
The "let" was introduced only to deal with for() loops because it's faster than a "var" in that case
The "let" declares a local value to a block scope whereas the "var" defines a variable more globally
Answer
Correct Answer:
The "let" declares a local value to a block scope whereas the "var" defines a variable more globally
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1018. What is the value of x? var x = typeof new String("abc");
string
undefined
object
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1019. What is the value of x? var x = typeof null;
null
"null"
"object"
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1020. What is this? (function() { /* code */ })()
Immediately-invoked function expression
function variable
Mistype error
Anonymous function
Answer
Correct Answer:
Immediately-invoked function expression
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1021. var y = 3, x = y++; What is the value of x?
5
3
6
2
4
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1022. '&' Operator is _____
a bitwise operator
an assignment operator
a displacement bit operator
an operator used in conditionals
Answer
Correct Answer:
a bitwise operator
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1023. What does this line do? variable++;
Increments the value of "variable" and returns the new value
Returns an error to the browser
Adds the value of "variable" to itself
Returns a value 1 greater than "variable" without changing its value
Increments the value of "variable" but returns the previous value
Answer
Correct Answer:
Increments the value of "variable" but returns the previous value
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1024. What is the value of x? var x = 10/0;
0
Infinity
Runtime exception
NaN
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1025. What is the value of x? var x = 1/0;
throws an exception
1
Infinity
0
NaN
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1026. What is the type of `null`, according to the `typeof` operator?
"null"
"object"
"undefined"
"array"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1027. What is the result of the following statement: typeof "x";
"character"
Throws error "ReferenceError: x is not defined"
"string"
"[object String]"
"undefined"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1028. Which is not a primitive data type in JavaScript?
number
character
boolean
string
Answer
Correct Answer:
character
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1029. What will be logged to console? function foo(a){ console.log(a); }( 1+'1' );
11
Nothing
2
undefined
Throw Error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1030. Every object is linked to a _________ object from which it can inherit properties.
prototype
argument
sibling
parent
Answer
Correct Answer:
prototype
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1031. Primitive types are passed by :
Reference
Value
Pointer
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1032. What is the result of the following expression? ({"foo": true}).foo;
false
undefined
true
4
SyntaxError
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1033. What is the value of x after the following statement? var x = 1 == '1';
false
undefined
true
1
'1'
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1034. What is the value of `x` after the following? var x = "hello"; (function() { x = "goodbye"; }());
"hello"
"goodbye"
undefined. A SyntaxError is thrown
Answer
Correct Answer:
"goodbye"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1035. Is there a value type for individual string characters?
No, there is only type "string" for characters.
Yes, accessing a character offset from a (non-empty) string will yield a value of type "char".
Answer
Correct Answer:
No, there is only type "string" for characters.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1036. The length property of an Array object is always:
equal to the highest index of that object
equal to the number of properties in that object
equal to the highest index of that object + 1
Answer
Correct Answer:
equal to the highest index of that object + 1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1037. The "this" keyword refers to ...
parent object that hosts the current function.
current execution context (could be any value).
function currently being executed.
Answer
Correct Answer:
current execution context (could be any value).
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1038. Which is an example of (only) an object literal in Javascript?
var obj = new Object() { this.prop1 = 'property 1'; this.prop2 = 'property 2'; }
var obj = [ "property 1", "property 2" ]
var obj = [ {prop1: 'property 1', prop2: 'property2'} ]
var obj = { prop1: 'property 1', prop2: 'property 2' };
Answer
Correct Answer:
var obj = { prop1: 'property 1', prop2: 'property 2' };
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1039. Given the following code, what is the value of x? var x = ['foo', 'bar']; x.length = 1;
[
[]
[
[
[
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1040. How can you get the number of characters in a string ?
"1234567".length
"1234567".length()
"1234567".getLength()
"1234567".Length
"1234567".Length()
Answer
Correct Answer:
"1234567".length
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1041. What will invoking `foo` return? function foo() { var x = 10; x = 7; };
null
10
undefined
foo
7
Answer
Correct Answer:
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1042. Given a variable named stringVar with a string value, what does the following do? stringVar.toUpperCase();
Alters stringVar, changes all letters to uppercase
Return the number of characters in the stringVar variable
Evaluate any string expression in stringVar
Return a copy of stringVar with all letters in uppercase
Answer
Correct Answer:
Return a copy of stringVar with all letters in uppercase
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1043. Given the next statement, what is the value of 'x' ? var a = true, b = false, x = !(a===b) ? !a : b;
true
false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1044. Which of the following is not a method in the "JSON" object according to the ECMAScript specification?
JSON.parse
JSON.fromString
JSON.stringify
Answer
Correct Answer:
JSON.fromString
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1045. Functions in javascript are always ..
operators
loops
objects
in the global scope
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1046. Which of the following is the syntax for an object literal (with no properties)?
{};
[];
nil;
object;
();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1047. What are curly braces ("{" and "}") used for?
Setting attributes
Block declarations and object literals
Invoking a function
Parsing JSON
Defining a class
Answer
Correct Answer:
Block declarations and object literals
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1048. In the loop, "for (first clause; second clause; third clause) { statements; }" What does the second clause represent?
Code to execute once, after the loop has ended
A condition to check at the end of each loop cycle
Code to execute once, before the loop starts
A condition to check at the beginning of each loop cycle
Answer
Correct Answer:
A condition to check at the beginning of each loop cycle
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1049. What is the value of x? function foo(y) { var z = 10; z = 7; }; var x = foo("bar");
null
10
"bar"
7
undefined
Answer
Correct Answer:
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1050. How do you write a conditional statement that will only execute the contained code if variable x has a value 5 of type number?
if (x === 5) { ... }
if (x == 5) { ... }
if x = 5 then ...
if x = 5 ...
Answer
Correct Answer:
if (x === 5) { ... }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1051. If a function doesn't explicitly use the "return" operator, what will the return value be when the function is invoked?
undefined
null
NaN
closure
false
Answer
Correct Answer:
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1052. The loop isn't working. What's the problem? var foos = ['a', 'b', 'c' , 'd', 'e']; var bars = ['x', 'y', 'z']; for (var i = 0; i < foos.length; i++) { var foo = foos[i]; for (var i = 0; i < bars.length; i++) { var bar = bars[i]; /* some code using `bar` */ } }
The inner loop resets the outer for-loop, leaving it a fixed position each time, causing an infinite loop (hint: no block scope).
The outer-loop finishes after the first iteration due to a "bug" that unfortunately is part of the ECMAScript specification.
Uncaught SyntaxError.
There is no bug. The loop will run correctly.
Answer
Correct Answer:
The inner loop resets the outer for-loop, leaving it a fixed position each time, causing an infinite loop (hint: no block scope).
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1053. What is result of the following expression: var a = "test"; console.log(!!a);
SyntaxError
false
undefined
true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1054. Consider this code: var x = ['Hello']; What value will 'x[1]' return?
null
undefined
['Hello']
"Hello"
NULL
Answer
Correct Answer:
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1055. Which has the correct syntax of a ternary operation?
var x = y === true : "true" ? "false";
var x = ( y === true ) : "true" ? "false";
var x = y === true ? "true" : "false";
var x = ( y === true ) { "true" : "false" };
Answer
Correct Answer:
var x = y === true ? "true" : "false";
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1056. What does "2" + 3 + 4 evaluate to?
'234'
9
'27'
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1057. To what type are values converted internally when evaluating a conditional statement?
integer
tinyint
negative
positive
boolean
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1058. Which of these is a correct method to create a new array?
var myArray = ();
var myArray = [];
var myArray = array();
var myArray = new Array[];
var myArray = {};
Answer
Correct Answer:
var myArray = [];
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1059. How can you concatenate multiple strings?
'One' + 'Two' + 'Three'
'One'.concat('Two', 'Three')
Both of these
Answer
Correct Answer:
Both of these
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1060. What does Math.sqrt(-1) return?
1
-1
i
1.0
NaN
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1061. Which of the following variable types does not exist in JavaScript?
double
string
number
object
boolean
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1062. What is the value of x? var x = 2 + "2";
"4"
"22"
22
4
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1063. The _______ operator returns a string that identifies the type of its operand.
typeof
Type
typename
getType
TypeOf
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1064. What is the name of the String prototype that appends the given string to the base string and returns the new string?
None of these does that and/or such method doesn't exist in javascript!
"x".add("foo")
"x".match("foo")
"x".combine("foo")
"x".concat("foo")
Answer
Correct Answer:
"x".concat("foo")
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1065. Which of the following is a way to add a new value to the end of an array?
arr[arr.length()] = value;
arr[value] = length;
arr[arr.length] = value;
arr.length = value;
Answer
Correct Answer:
arr[arr.length] = value;
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1066. split() is a method of which constructors' prototype?
None of these
Number.prototype
String.prototype
Array.prototype
Answer
Correct Answer:
String.prototype
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1067. Which of these is not a JavaScript statement?
throw
None, these are all valid statements.
continue
break
Answer
Correct Answer:
None, these are all valid statements.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1068. What is the RegExp object constructor used for?
Provides access to Windows registry express values
Regulates the expression of variables
Match text against regular expressions
Switches numerical notation to exponential
Registers experienced functions with the DOM
Answer
Correct Answer:
Match text against regular expressions
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1069. How do you assign an anonymous function to a variable?
var anon = new Function () { };
var anon = function() { };
var anon = func() { };
var anon = func({});
Answer
Correct Answer:
var anon = function() { };
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1070. The function call Math.ceil(3.5) returns:
0
4
3
Throws a MathError exception.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1071. JavaScript is an implementation of the ______ language standard.
HTML
ActionScript
ECMAScript
VBScript
Answer
Correct Answer:
ECMAScript
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1072. Which is the correct syntax to write array literals in JavaScript?
var x = array("blank", "blank", "blank”);
var x = {"blank","blank","blank"};
var x = new Array(1:"blank",2:"blank",3:"blank")
var x = ["blank","blank","blank"];
Answer
Correct Answer:
var x = ["blank","blank","blank"];
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1073. How do you declare a function?
function doSomething() {}
all of these
function:doSomething() {}
function=doSomething() {}
Answer
Correct Answer:
function doSomething() {}
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1074. Which of the following operators can assign a value to a variable?
All of these
+=
%=
=
Answer
Correct Answer:
All of these
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1075. Which of the following is the equivalent of the following. if (a) { x = b; } else { x = c; }
x = a ? b : c;
x = a : b ? c;
x = a ? b , c;
Answer
Correct Answer:
x = a ? b : c;
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1076. The "exploit" property:
Represents a variable
Does not exist in JavaScript
Is obsolete
Is a very important property
Answer
Correct Answer:
Does not exist in JavaScript
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1077. Which of the following is an Error object constructor?
RangeError
Error
EvalError
All of these
Answer
Correct Answer:
All of these
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1078. Which of the following invokes a user-defined object constructor function?
myConstructor x = create myConstructor();
myConstructor x = new myConstructor();
var x = create myConstructor();
var x = new myConstructor();
Answer
Correct Answer:
var x = new myConstructor();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1079. When an array index goes out of bounds, what is returned?
the first or last value in the array
Moderate
An error to the browser
undefined
A default value, like 0
Answer
Correct Answer:
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1080. null === undefined
false
true
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1081. Which of the following orders can be performed with the Array prototype "sort()" callback?
ASCII ordering
Ascending alphabetical
Descending alphabetical
All of these
Answer
Correct Answer:
All of these
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1082. What is the value of x? var x = '1'+2+3;
15
"123"
The statement generates an error.
6
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1083. var a = {1:'one',2:'two',3:'three'}; var b = Object.keys(a); What's the value of b?
An array with all of the distinct keys from the obj a
An obj with autowired getters and setters for it's key/values
A serialized copy of the obj a
Answer
Correct Answer:
An array with all of the distinct keys from the obj a
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1084. (function( ) { var x = foo( ); function foo( ){ return "foobar" }; return x; })( ); What does this function return?
"foobar"
foo( )
TypeError: undefined is not a function
undefined
ReferenceError: foo is not defined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1085. Which event fires whenever a control loses focus?
onclick
onblur
onchange
onmove
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1086. In JavaScript, to call a function directly, you use:
arguments_if_any ( function_expression )
function_expression ( arguments_if_any )
( arguments_if_any ) -> function_expression
function_expression { arguments_if_any }
function_expression -> ( arguments_if_any )
Answer
Correct Answer:
function_expression ( arguments_if_any )
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1087. A for loop is written as such: "for (first property; second property; third property) {...}" What does the third property represent?
An action to take at the beginning of the loop cycle
An action to take at the end of the current loop cycle
A condition to check at the beginning of a loop cycle
Answer
Correct Answer:
An action to take at the end of the current loop cycle
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1088. What is the value of the array myArr after execution of the following code: var myArr = [1,2,3,4,5]; myArr.shift();
[]
[2,3,4,5]
[1,2,3,4]
[1,2,3,4,5]
Answer
Correct Answer:
[2,3,4,5]
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1089. Which of these operators compares two variables by value AND type?
===
=
None of these
==
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1090. What is the difference between == and === ?
The == operator converts both operands to the same type, whereas === returns false for different types.
The == is used in comparison, and === is used in value assignment.
The === is deprecated, and now they are exactly the same.
Answer
Correct Answer:
The == operator converts both operands to the same type, whereas === returns false for different types.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1091. What is the value of a : var a = 3; var b = 2; var c = a; var a=b=c=1;
true
false
3
2
1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1092. What is JavaScript used for?
Manipulating Web Page Behaviors
Styling web pages
A website cannot be created without JavaScript
None of the above.
Content definition within web pages
Answer
Correct Answer:
Manipulating Web Page Behaviors
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1093. USERNAME and userName
Represent the name of different variables
Represent the name of the same constant
Represent the name of the same variable
Represent the name of different constants
Answer
Correct Answer:
Represent the name of different variables
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1094. The `else` statement is ___
used inside of an `if` statement. To specify the code that should execute if the `if` condition is no longer true.
used together with the `if` statement to specify the code that should execute when the `if` condition is false.
Does not exist, in JavaScript `or` and `then` are used to specify code to execute for the "false" case of the `if` statement.
Answer
Correct Answer:
used together with the `if` statement to specify the code that should execute when the `if` condition is false.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1095. What does isNaN() do?
Only returns true if the argument is not a number
Converts a non-numeric value to a number.
Throws an error if a conditional statement is false.
Answer
Correct Answer:
Only returns true if the argument is not a number
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1096. Properties of a RegExp object include:
lastIndex
source
All of these
ignoreCase
Answer
Correct Answer:
All of these
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1097. Properties of objects may be accessed using...
none of these
the dot notation in JavaScript.
the redirect notation in JavaScript.
Answer
Correct Answer:
the dot notation in JavaScript.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1098. Which of these descriptors applies to JavaScript?
Strongly typed, variables are declared with a type, and you can not assign another type to the variable.
Loosely typed, values of any type can be assigned to any variable.
Answer
Correct Answer:
Loosely typed, values of any type can be assigned to any variable.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1099. What operator is used for string concatenation?
+
&
All of these
.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1100. What is the value of the following expression: 8 % 3
5
2
24
Other/Error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1101. Which of these will throw a SyntaxError?
if (x = 1) { }
if (x ==== 1) { }
if (x === 1) { }
if (x == 1) { }
Answer
Correct Answer:
if (x ==== 1) { }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1102. Which of these could be a correct way to create an instance of Person?
new john = Person('John', 'Doe', 50, 'blue');
var Person john = new Person('John', 'Doe', 50, 'blue');
var john = new Person('John', 'Doe', 50, 'blue');
Person john = new Person('John', 'Doe', 50, 'blue');
Answer
Correct Answer:
var john = new Person('John', 'Doe', 50, 'blue');
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1103. Which of the following is not a reserved word?
throw
program
void
return
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1104. Which of the following declares a variable with a value of string type?
string myVar = "This is a string";
var myVar = "This is a string";
var string myVar = "This is a string";
Answer
Correct Answer:
var myVar = "This is a string";
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1105. Which symbol is not used in logical operations?
||
&&
%
!
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1106. How do you define a function called "fName"?
new fName = { }
func fName = function () {}
None of these
function fName() { }
function fName: { }
Answer
Correct Answer:
function fName() { }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1107. Which of the following is a JavaScript comment?
// comment
\\ comment
-- comment
# comment
Answer
Correct Answer:
// comment
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1108. Which is the correct way to write a JavaScript array?
var names = array("Tim", "Kim", "Jim");
var names = {1: "Tim", 2:"Kim", 3:"Jim"};
var names = {0: "Tim", 1: "Kim", 2: "Jim"};
var names = ["Tim","Kim","Jim"];
Answer
Correct Answer:
var names = ["Tim","Kim","Jim"];
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1109. Given the following code, what does myFunc() return? var foo = 'foo'; var bar = 'bar'; function myFunc() { return foo + bar; }
An error is thrown because of illegal out of scope access.
"foo + bar"
NaN
"foobar"
"undefinedundefined"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1110. What does the "break" statement do?
Cancels the current event.
Aborts the current loop or switch statement.
Aborts the current function.
Simulates a JavaScript crash.
Answer
Correct Answer:
Aborts the current loop or switch statement.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1111. How do you check what the type of a value in variable x is?
x.__type;
typeof(x);
Object.type(x);
gettype(x);
Answer
Correct Answer:
typeof(x);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1112. JavaScript supports dynamic typing, you can assign different types of values to the same variable.
true
false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1113. Which of the following is a valid function definition?
function myFunc(arg1, arg2):
func myFunc = (arg1 as string, arg2 as int) { }
function myFunc(arg1,arg2) { }
Answer
Correct Answer:
function myFunc(arg1,arg2) { }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1114. String literals are written using:
Just double quotes: "example"
Just single quotes: 'example'
Either double quotes or single quotes: "example" and 'example'
Answer
Correct Answer:
Either double quotes or single quotes: "example" and 'example'
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1115. Are variable identifiers case-sensitive?
Yes
No
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1116. How do you round the number 7.25, to the nearest whole number?
Math.round(7.25)
round(7.25)
Math.rnd(7.25)
rnd(7.25)
Answer
Correct Answer:
Math.round(7.25)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1117. What is the value of ("dog".length)?
2
3
4
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1118. You use the Math.pow() method to:
Return any number
Return a number raised to the power of a second number
Return a random value between 0 and 1
Return a variable value
Answer
Correct Answer:
Return a number raised to the power of a second number
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1119. Which statement loops through an array?
for (var i=0; i < myArray.length; i++)
for (i = 0; i <= myArray.length;)
for (i < myArray.length; i++)
Answer
Correct Answer:
for (var i=0; i < myArray.length; i++)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1120. Which of the following primitive values exist in JavaScript?
number
All of these
string
boolean
Answer
Correct Answer:
All of these
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1121. The var statement is used to:
Declare a member of a class
Change a constant
Create a new local variable
Retrieve a variable descriptor
Answer
Correct Answer:
Create a new local variable
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1122. what is the difference between x++ and ++x?
++x is depreciated and replaced with x++;
x++ will return the value of x and then increment, where as ++x will increment the variable first then return its value.
They both do the same thing, just different syntax
Answer
Correct Answer:
x++ will return the value of x and then increment, where as ++x will increment the variable first then return its value.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1123. In an array object, what is the key of the first value?
100
$
0
-1
1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1124. Where do you use the "break" statement?
To add a value to an array.
To delete a (global) variable.
To terminate an Object statement.
To divide (or "break") a mathematical value in half.
To terminate a switch statement, loop, or labeled block.
Answer
Correct Answer:
To terminate a switch statement, loop, or labeled block.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1125. What is the correct JavaScript syntax to insert a comment that can span multiple lines?
/ This comment has more than one line /
// This comment has more than one line //
/* This comment has more than one line */
// This comment has mor than one line *//
Answer
Correct Answer:
/* This comment has more than one line */
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1126. Which is NOT a way to create a loop in javascript?
while (...) { }
do { } while(...)
for (...) { }
repeat (...) { }
Answer
Correct Answer:
repeat (...) { }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1127. How to return the first value of this array? var myArr = [1, 2, 3, 4, 5]; var myVal = ...
myArr.unshift();
myArr[0];
myArr.shift();
myArr[1];
myArr.pop();
Answer
Correct Answer:
myArr[0];
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1128. What is the difference between a while loop and a do...while loop?
The code inside a while loop will always be executed at least once, even if the condition is false.
The code inside a do...while loop will always be executed at least once, even if the condition is false.
There is no difference between them.
Answer
Correct Answer:
The code inside a do...while loop will always be executed at least once, even if the condition is false.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1129. Which of the following asserts that the variables `A`, `B`, and `C` have unequal values?
A !== B
A !== B && B !== C && A !== C
A !== B & B !== C
A !== B || B !== C
Answer
Correct Answer:
A !== B && B !== C && A !== C
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1130. How do you find the number with the highest value of x and y?
Math.ceil(x, y)
max(x, y)
top(x, y)
Math.max(x, y)
ceil(x, y)
Answer
Correct Answer:
Math.max(x, y)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1131. Which of these is not a logical operator?
&
&&
||
!
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1132. What is the value of x? var a = false; var x = a ? “A” : “B”;
false
true
"B"
"A"
undefined
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1133. When writing an object literal, what is used to separate the properties from each other?
an underscore "_"
a colon ":"
a full-stop "."
a semicolon ";"
a comma ","
Answer
Correct Answer:
a comma ","
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1134. How do you create an object in JavaScript?
var obj = new Object();
var obj = {};
function Foo() {} var obj = new Foo();
All of these work.
Answer
Correct Answer:
All of these work.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1135. var x = "foo"; x = !!x; What is the value of x?
true
undefined
NaN
"!!foo"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1136. Math.random() returns..
a random number that can be any value
a random number between 0 and 100
a random number between 0 and 1
a random number between 0 and 1000
Answer
Correct Answer:
a random number between 0 and 1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1137. What is the result of the following statement: 0 == "";
true
null
false
Throws Error, invalid comparison
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1138. How do you assign object properties?
obj["age"] = 25 OR obj.age = 25
obj.age = 25 OR obj(@"age") = 25
obj(age) = 25 OR obj.age = 25
Answer
Correct Answer:
obj["age"] = 25 OR obj.age = 25
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1139. What is the result? 0 == ""
Error: type mismatch
true
false
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1140. Math.PI returns the mathematical constant π. What standard JavaScript method would return "3.14"?
Math.PI.toString("D2")
Math.PI.toFixed(2)
Math.Round(Math.PI)
Math.PI.toPrecision(2)
Answer
Correct Answer:
Math.PI.toFixed(2)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
1141. JavaScript is ...
subjective
evil
object based
objective
Answer
Correct Answer:
object based
Note: This Question is unanswered, help us to find answer for this one
Check Answer
JavaScript MCQs | Topic-wise