Home
Current Affairs January 2024

What is the correct answer?

4

What will be the output of the following Javascript code?
var a=3.7;
var b=2;
a=ciel(a)
document.writeIn(a*b);

A. 6

B. 7.4

C. 7.5

D. 8

Correct Answer :

D. 8


Explanation: The ciel function in javascript round offs the value passed in its argument to the next higher closest value. Therefore the value of a will be converted to 4 and hence the output will be 8.

Related Questions

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 a=5 , b=1
var obj = { a : 10 }
with(obj)
{
alert(b)
}

A. 10

B. Error

C. 1

D. 5

What is the correct answer?

4

The unordered collection of properties, each of which has a name and a value is called _________

A. String

B. Object

C. Serialized Object

D. Array

What is the correct answer?

4

What will be the output of the following Javascript code?
var a= 0;
var b = 0;
while (a < 3)
{
a++;
b += a;
console.log(b);
}

A. 135

B. 123

C. 013

D. 01

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

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

Which is a more efficient JavaScript code snippet?
Code 1 :
for(var num=10;num>=1;num--)
{
document.writeln(num);
}

Code 2 :
var num=10;
while(num>=1)
{
document.writeln(num);
num++;
}

A. Code 1

B. Code 2

C. Both Code 1 and Code 2

D. Cannot Compare

What is the correct answer?

4

The method or operator used to identify the array is __________

A. isarrayType()

B. ==

C. ===

D. typeof

What is the correct answer?

4

What will the following code snippet work? If not, what will be the error?
function tail(o)
{
for (; o.next; o = o.next) ;
return o;
}

A. No, this will throw an exception as only numerics can be used in a for loop

B. No, this will not iterate

C. Yes, this will work

D. No, this will result in a runtime error with the message Cannot use Linked List

What is the correct answer?

4

Among the keywords below, which one is not a statement?

A. debugger

B. with

C. if

D. use strict

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

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

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

What will be the output of the following JavaScript code?
var val1=[1,2,3];
var val2=[6,7,8];
var result=val1.concat(val2);
document.writeln(result);

A. 1, 2, 3

B. Error

C. 1, 2, 3, 6, 7, 8

D. 123

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?
int a=0;
for(a;a<5;a++);
console.log(a);

A. 0

B. error

C. 4

D. 5

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 arr = [7, 5, 9, 1];
var value = Math.max.apply(null, arr);
document.writeln(value);

A. 7

B. 5

C. 1

D. 9

What is the correct answer?

4

What are the three important manipulations done in a for loop on a loop variable?

A. Updation, Incrementation, Initialization

B. Initialization,Testing, Updation

C. Testing, Updation, Testing

D. Initialization,Testing, Incrementation

What is the correct answer?

4

What will be the output of the following JavaScript code?
function compare()
{
int a=1;
char b=1;
if(a.tostring()===b)
return true;
else
return false;
}

A. true

B. false

C. runtime error

D. logical error

What is the correct answer?

4

What will be the output of the following JavaScript code?
function code(id,name)
{
this.id = id;
this.name = name;
}
function pcode(id,name)
{
code.call(this,id,name);
}
document.writeln(new pcode(101,vivek).id);

A. vivek

B. 101

C. Runtime error

D. Compilation error

What is the correct answer?

4

What will be the output of the following JavaScript code?
function info()
{
int a=1;
int b=2;
return a*b;
}
document.write(info());

A. 1

B. 2

C. 3

D. error

What is the correct answer?

4

The enumeration order becomes implementation dependent and non-interoperable if ___________

A. If the object inherits enumerable properties

B. The object does not have the properties present in the integer array indices

C. The delete keyword is never used

D. Object.defineProperty() is not used

What is the correct answer?

4

Which keyword is used to define the function in javascript?

A. void

B. int

C. function

D. main

What is the correct answer?

4

For the below mentioned code snippet:
var o = new Object();

The equivalent statement is:

A. var o = Object();

B. var o;

C. var o= new Object;

D. Object o=new Object();

What is the correct answer?

4

What will the following code snippet work? If not, what will be the error?
function tail(o)
{
for (; o.next; o = o.next) ;
return o;
}

A. No, this will throw an exception as only numerics can be used in a for loop

B. No, this will not iterate

C. Yes, this will work

D. No, this will result in a runtime error with the message Cannot use Linked List

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

Which is an equivalent code to invoke a function m of class o that expects two arguments x and y?

A. o(x,y);

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

C. m(x,y);

D. o.m(x,y);

What is the correct answer?

4

What will be the output of the following JavaScript code?
string a = hi;
string b =there;
alert(a+b);

A. hi

B. there

C. hithere

D. undefined

What is the correct answer?

4

Among the keywords below, which one is not a statement?

A. debugger

B. with

C. if

D. use strict