Int a=1;
if(a>10)
{
document.write(10);
}
else
{
document.write(a);
}
10
0
1
Undefined
C. 1
function compare()
{
int num=2;
char b=2;
if(a==b)
return true;
else
return false;
}
true
false
runtime error
compilation error
maps the elements of another array into itself
passes each element of the array and returns the necessary mapped elements
passes each element of the array on which it is invoked to the function you specify, and returns an array containing the values returned by that function
pass the elements of the array into another array
var grand_Total=eval(10*10+5);
10*10+5
105 as a string
105 as an integer value
Exception is thrown
var a= 0;
var b = 0;
while (a < 3)
{
a++;
b += a;
console.log(b);
}
135
123
013
01
function tail(o)
{
for (; o.next; o = o.next) ;
return o;
}
No, this will throw an exception as only numerics can be used in a for loop
No, this will not iterate
Yes, this will work
No, this will result in a runtime error with the message Cannot use Linked List
conditional block
block that contains a single statement
both conditional block and a single statement
block that combines multiple statements into a single compound statement
var a=3.7;
var b=2;
a=ciel(a)
document.writeIn(a*b);
6
7.4
7.5
8
for(var num=10;num>=1;num--)
{
document.writeln(num);
}
var num=10;
while(num>=1)
{
document.writeln(num);
num++;
}
Code 1
Code 2
Both Code 1 and Code 2
Cannot Compare
Returns the value and continues executing rest of the statements, if any
Returns the value and stops the program
Returns the value and stops executing the function
Stops executing the function and returns the value
function constfuncs()
{
var funcs = [];
for(var i = 0; i < 10; i++)
funcs[i] = function() { return i; };
return funcs;
}
var funcs = constfuncs();
funcs[5]()
9
0
10
None of the mentioned
Ignores the statement
Prompts to complete the statement
Throws an error
Shows a warning
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);
10
0
18
17
Controlled loop constructs
Case checking constructs
Validation constructs
All of the mentioned
function range(int length)
{
int a=5;
for(int i=0;i<length;i++)
{
console.log(a);
}
}
range(3);
5
555
3
error
continue statement
break statement
goto statement
return statement
Function prototype
Function literal
Function calling
Function declaration
function info()
{
int a=1;
int b=2;
return a*b;
}
document.write(info());
1
2
3
error
if(a!=null)
if (!a)
if(a!null)
if(a!==null)
function height()
{
var height = 123.56;
var type = (height>=190) ? tall : short;
return type;
}
123.56
190
tall
short
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);
10
27
8
0
var count = [1,,3];
The omitted value takes undefined
This results in an error
This results in an exception
The omitted value takes an integer value
!!(obj1 && obj2);
(obj1 && obj2);
Both the lines result in a boolean value True
Both the lines result in a boolean value False
Both the lines checks just for the existence of the object alone
The first line results in a real boolean value whereas the second line merely checks for the existence of the objects
int sum=0;
var arr = [10,15,20,30];
arr.forEach(function myFunction(element)
{
sum= sum+element;
});
document.writeln(sum);
70
75
10
error
Class, parameters, objects extensible flag
Prototype, class, objects parameters
Prototype, class, objects extensible flag
Native object, Classes and Interfaces and Objects extensible flag
Primary Expression
Object Creation Expression
Invocation Expression
Constructor Calling Expression
isPrototypeOf() method
equals() method
=== operator
==opertor
int a==2;
int b=4;
int ans=a+b;
print(ans);
2
6
0
error
+
:
^
?:
var a1 = [,,,];
var a2 = new Array(3);
0 in a1
0 in a2
true false
false true
true true
false true
Procedures
Method
Static function
Dynamic function