Home
Current Affairs January 2024

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

Correct Answer :

D. ===


Explanation: A strict comparison (e.g., ===) is only true if the operands are of the same type and the contents match. When a switch executes, it computes the value of the expression and then looks for a case label whose expression evaluates to the same value (where sameness is determined by the === operator).

Related Questions

What is the correct answer?

4

Consider the following code snippet.
while (a != 0)
{
if (a == 1)
continue;
else
a++;
}

What will be the role of the continue keyword in the above code snippet?

A. The continue keyword restarts the loop

B. The continue keyword skips the next iteration

C. The continue keyword skips the rest of the statements in that iteration

D. The continue keyword breaks out of the loop

What is the correct answer?

4

What is the observation made in the following JavaScript code?
if (!a[i]) continue;

A. Skips the defined elements

B. Skips the existent elements

C. Skips the null elements

D. Skips the defined & existent elements

What is the correct answer?

4

What will be the output of the following JavaScript code?
var grade='E';
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. 0

C. 18

D. 17

What is the correct answer?

4

A conditional expression is also called a _______________

A. Alternative to if-else

B. Immediate if

C. If-then-else statement

D. Switch statement

What is the correct answer?

4

What will be the output of the following JavaScript code?
const obj1 =
{
property1: 21
}
const descriptor1 = Object.getOwnPropertyDescriptor(obj1, 'property1');
console.log(descriptor1.configurable);
console.log(descriptor1.enumerable);

A. true 21

B. true false

C. true true

D. false false

What is the correct answer?

4

In the following syntax, the data type within the square brackets must be ___________
book[datatype]=assignment_value;

A. An integer

B. A String

C. An object

D. Floating point

What is the correct answer?

4

What will happen if reverse() and join() methods are used simultaneously?

A. Reverses and stores in the same array

B. Reverses and concatenates the elements of the array

C. Reverses

D. Stores the elements of an array in normal order

What is the correct answer?

4

The type of a variable that is volatile is _______________

A. Volatile variable

B. Mutable variable

C. Immutable variable

D. Dynamic variable

What is the correct answer?

4

Consider the following code snippet
function f(o)
{
if (o === undefined) debugger;
}

What could be the task of the statement debugger?

A. It does nothing but a simple breakpoint

B. It debugs the error in that statement and restarts the statements execution

C. It is used as a keyword that debugs the entire program at once

D. It is used to find error in the statement

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 happens in the following javaScript code snippet?
var count = 0;
while (count < 10)
{
console.log(count);
count++;
}

A. The values of count are logged or stored in a particular location or storage

B. The value of count from 0 to 9 is displayed in the console

C. An error is displayed

D. An exception is thrown

What is the correct answer?

4

What will be the output of the following JavaScript code?
var string1 = 123;
var intvalue = 123;
alert( string1 + intvalue );

A. 123246

B. 246

C. 123123

D. Exception

What is the correct answer?

4

What will be the output of the following JavaScript code?
var person =
{
name: Rahul,
getName: function()
{
nreturn this.name;
}
}
var unboundName = person.getName;
var boundName = unboundName.bind(person);
document.writeln(boundName());

A. runtime error;

B. compilation error

C. Rahul

D. undefined

What is the correct answer?

4

What will be the output of the following JavaScript code?
var grade='E';
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. 0

C. 18

D. 17

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

The purpose of extensible attribute is to __________

A. make all of the own properties of that object non configurable

B. to configure and bring a writable property

C. lock down objects into a known state and prevent outside tampering

D. to include new properties into the object

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 be the output of the following JavaScript code?
var obj=
{
length:20,
height:35,
}
if (breadth' in obj === false)
{
obj.breadth = 12;
}
console.log(obj.breadth);

A. 20

B. 12

C. undefined

D. error

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=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?
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

Which attribute is used to specify that the script is executed when the page has finished parsing? (only for external scripts)

A. parse

B. a sync

C. defer

D. type

What is the correct answer?

4

Consider the following code snippet :
var grand_Total=eval(10*10+5);

The output for the above statement would be :

A. 10*10+5

B. 105 as a string

C. 105 as an integer value

D. Exception is thrown

What is the correct answer?

4

What will be the output of the following JavaScript code?

A. 1.01

B. 1.047

C. 1.00

D. 1.4

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 output of the following JavaScript code?
var values=[one,two,Three];
var ans=values.shift();
document.writeln(ans);

A. one

B. two

C. three

D. error

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 possible output of the following JavaScript code?
var a = [1,2,3,4,5];
a.slice(0,3);

A. Returns [1,2,3]

B. Returns [4,5]

C. Returns [1,2,3,4]

D. Returns [1,2,3,4,5]

What is the correct answer?

4

What will be the output of the following Javascript code?
<script>
var x = 5;
var y = 2;
var z = x % y;
document.getElementById("demo").innerHTML = z;
</script>


A. 0

B. 1

C. 2

D. 5

What is the correct answer?

4

A function with no return value is called ___________

A. Procedures

B. Method

C. Static function

D. Dynamic function