Home
Current Affairs January 2024

What is the correct answer?

4

What will happen if the body of a for/in loop deletes a property that has not yet been enumerated?

A. The property will be stored in a cache

B. The loop will not run

C. That property will not be enumerated

D. The property will be enumerated

Correct Answer :

C. That property will not be enumerated


Explanation: If the body of a for/in loop deletes a property that has not yet been enumerated, that property will not be enumerated. If the body of the loop defines new properties on the object, those properties will generally not be enumerated.

Related Questions

What is the correct answer?

4

What will be the output of the following JavaScript code?
function printprops(o)
{
for(var p in o)
console.log(p + : + o[p] +
);
}

A. Prints the contents of each property of o

B. Returns undefined

C. Prints only one property

D. Prints the address of elements

What is the correct answer?

4

What will be the output of the following JavaScript code?
var values=[1,2,3,4]
var ans=values.slice(1);
document.writeln(ans);

A. 1, 2, 3, 4

B. 2, 3, 4

C. 1, 3, 4

D. error

What is the correct answer?

4

Which of the following is not considered as an error in JavaScript?

A. Syntax error

B. Missing of semicolons

C. Division by zero

D. Missing of Bracket

What is the correct answer?

4

The reduce and reduceRight methods follow a common operation called __________

A. filter and fold

B. inject and fold

C. finger and fold

D. fold

What is the correct answer?

4

What will be the output of the following Javascript code?
var a = 10;
do {
a += 1;
console.log(a);
} while (a < 5);

A. 11121314

B. 1112

C. 12345

D. 11

What is the correct answer?

4

JavaScript can be written __________

A. directly into JS file and included into HTML

B. directly on the server page

C. directly into HTML pages

D. directly into the css file

What is the correct answer?

4

In the following switch syntax, the expression is compared with the case labels using which of the following operator(s)?
switch(expression)
{
statements
}

A. ==

B. equals

C. equal

D. ===

What is the correct answer?

4

What will be the equivalent output of the following JavaScript code snippet?
x = ~-y;
w = x = y = z;
q = a?b:c?d:e?f:g;

A.

x = ~(-y); w = (x = (y = z));
q = a?b:(c?d:(e?f:g));

B.

x = a?b:(c?d:(e?f:g));
q = ~(-y); w = (x = (y = z));

C.

x = (x = (y = z));w = ~(-y);
q = a?b:(c?d:(e?f:g));

D.

x = ~(-y); w = (x = (y = z));
q = (c?d:(e?f:g));

What is the correct answer?

4

JavaScript _________ when there is an indefinite or an infinite value during an arithmetic computation.

A. Prints an exception error

B. Prints an overflow error

C. Displays Infinity

D. Prints the value as such

What is the correct answer?

4

Consider the following code snippet.
for(var p in o)
console.log(o[p]);

The above code is equivalent to which code?

A.

for (var i = 0;i < a.length;i++)
console.log(a[i]);

B.

for (int i = 0;i < a.length;i++)
console.log(a[i]);

C.

for (var i = 0;i <= a.length;i++)
console.log(a[i]);

D.

for (var i = 1;i < a.length;i++)
console.log(a[i]);

What is the correct answer?

4

What will happen if a return statement does not have an associated expression?

A. It returns the value 0

B. It will throw an exception

C. It returns the undefined value

D. It will throw an error

What is the correct answer?

4

What will be the output of the following JavaScript code?
var grade='A';
var result;
switch(grade)
{
case 'A':
result+=10;
case 'B':
result+= 9;
case 'C':
result+= 8;
default:
result+= 0;
}
document.write(result);

A. 10

B. 27

C. 8

D. 0

What is the correct answer?

4

The generalised syntax for a real number representation is __________

A. [digits][.digits][(E|e)[(+|-)]digits]

B. [digits][+digits][(E|e)[(+|-)]digits]

C. [digits][(E|e)[(+|-)]digits]

D. [.digits][digits][(E|e)[(+|-)]digits]

What is the correct answer?

4

The pop() method of the array does which of the following task?

A. decrements the total length by 1

B. increments the total length by 1

C. prints the first element but no effect on the length

D. updates the element

What is the correct answer?

4

What is a block statement in JavaScript?

A. conditional block

B. block that contains a single statement

C. both conditional block and a single statement

D. block that combines multiple statements into a single compound statement

What is the correct answer?

4

Consider the following code snippet :
function constfuncs()
{
var funcs = [];
for(var i = 0; i < 10; i++)
funcs[i] = function() { return i; };
return funcs;
}
var funcs = constfuncs();
funcs[5]()

What does the last statement return ?

A. 9

B. 0

C. 10

D. None of the mentioned

What is the correct answer?

4

The one-liner code that concatenates all strings passed into a function is

A.

function concatenate()
{
return String.prototype.concat('', arguments);
}

B.

function concatenate()
{
return String.prototype.apply('', arguments);
}

C.

function concatenate()
{
return String.concat.apply('', arguments);
}

D.

function concatenate()
{
return String.prototype.concat.apply('', arguments);
}

What is the correct answer?

4

What will be the equivalent code of the following JavaScript code?
o.m(x,y);

A. o.m(x) && o.m(y);

B. o[m](x,y);

C. o(m)[x,y];

D. o.m(x && y);

What is the correct answer?

4

What will be the output of the following Javascript code?
int size=5;
int a=5;
int size=4;
for(int j=size;j>=0;j--)
{
console.log(a);
a=a-2;
}

A. 5555

B. 5321

C. 531-1

D. 531

What is the correct answer?

4

What will be the output of the following JavaScript code?
int a=4;
int b=1;
int c=0;
If(a==b)
document.write(a);
else if(a==c)
document.write(a);
else
document.write(c);

A. 4

B. 1

C. Error

D. 0

What is the correct answer?

4

One of the special feature of an interpreter in reference with the for loop is that ___________

A. Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property

B. The iterations can be infinite when an interpreter is used

C. The body of the loop is executed only once

D. the iteration is finite when an interpreter is used

What is the correct answer?

4

The script tag must be placed in __________

A. the head tag

B. the head or body

C. the title or head

D. after the body tag

What is the correct answer?

4

What will be the output of the following JavaScript code?
int a=4;
int b=1;
int c=0;
If(a==b)
document.write(a);
else if(a==c)
document.write(a);
else
document.write(c);

A. 4

B. 1

C. Error

D. 0

What is the correct answer?

4

Identify the process done in the following JavaScript code snippet?
o = {x:1, y:{z:[false,null,]}};
s = JSON.stringify(o);
p = JSON.parse(s);

A. Object Encapsulation

B. Object Serialization

C. Object Abstraction

D. Object Encoding

What is the correct answer?

4

What will be the output of the following Javascript code?
var add=new Function(num1,num2,return num1+num2);
document.writeln(add(2,5));

A. 2

B. 5

C. Error

D. 7

What is the correct answer?

4

What will be the output of the following JavaScript code?
int a=1;
if(a!=null)
return 1;
else
return 0;

A. 1

B. 0

C. runtime error

D. compiler error

What is the correct answer?

4

What will be the output of the following Javascript code?
function range(int length)
{
int a=5;
for(int i=0;i<length;i++)
{
console.log(a);
}
}
range(3);

A. 5

B. 555

C. 3

D. error

What is the correct answer?

4

What will be the output of the following JavaScript code?
var pow=new Function(num1,num2,return Math.pow(num1,num2));
document.writeln(pow(2,3));

A. 2

B. 3

C. 8

D. error

What is the correct answer?

4

What will be the shift() output of the following JavaScript code?
var a = [];
a.unshift(1);
a.unshift(22);
a.shift();
a.unshift(3,[4,5]);
a.shift();
a.shift();
a.shift();

A. 1

B. [4,5]

C. [3,4,5]

D. Exception is thrown

What is the correct answer?

4

If you have a function f and an object o, you can define a method named m of o with

A. o.m=m.f;

B. o.m=f;

C. o=f.m;

D. o=f;