It is mandatory
Not necessary
Few functions return values by default
some functions do not return any value
C. Few functions return values by default
while (a != 0)
{
if (a == 1)
continue;
else
a++;
}
The continue keyword restarts the loop
The continue keyword skips the next iteration
The continue keyword skips the rest of the statements in that iteration
The continue keyword breaks out of the loop
Updation, Incrementation, Initialization
Initialization,Testing, Updation
Testing, Updation, Testing
Initialization,Testing, Incrementation
Primary expression
Functional expression
Invocation expression
Property Access Expression
if (!a[i]) continue;
Skips the defined elements
Skips the existent elements
Skips the null elements
Skips the defined & existent elements
the head tag
the head or body
the title or head
after the body tag
function printArray(a)
{
var len = a.length, i = 0;
if (len == 0)
console.log(Empty Array);
else
{
do
{
console.log(a[i]);
} while (++i < len);
}
}
Prints the numbers in the array in order
Prints the numbers in the array in the reverse order
Prints 0 to the length of the array
Prints Empty Array
var string1 = 123;
var intvalue = 123;
alert( string1 + intvalue );
123246
246
123123
Exception
Procedures
Method
Static function
Dynamic function
will throw errors and exceptions
must be restricted to a Unix Machine only
will work perfectly well on a Windows Machine
will be displayed as a JavaScript text on the browser
int size=5;
int a=5;
int size=4;
for(int j=size;j>=0;j--)
{
console.log(a);
a=a-2;
}
5555
5321
531-1
531
<script>
var x = 10;
x *= 5;
document.getElementById("demo").innerHTML = x;
</script>
5
10
50
Error
function compare()
{
int a=1;
char b=1;
if(a.tostring()===b)
return true;
else
return false;
}
true
false
runtime error
logical error
1.01
1.047
1.00
1.4
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
var text = testing: 1, 2, 3; // Sample text
var pattern = /d+/g // Matches all instances of one or more digits
text==pattern
text.equals(pattern)
text.test(pattern)
pattern.test(text)
var grade='B';
var result;
switch(grade)
{
case 'A':
{
result+=10;
break;
}
case 'B':
{
result+= 9;
break;
}
case 'C':
{
result+= 8;
break;
}
default:
result+= 0;
}
document.write(result);
10
9
8
0
Properties
Prototypes
Lvalue
Definition
make all of the own properties of that object non configurable
to configure and bring a writable property
lock down objects into a known state and prevent outside tampering
to include new properties into the object
var o = new Object();
var o = Object();
var o;
var o= new Object;
Object o=new Object();
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
function info()
{
int a=1;
int b=2;
return a*b;
}
document.write(info());
1
2
3
error
var add=new Function(num1,num2,return num1+num2);
document.writeln(add(2,5));
2
5
Error
7
x = ~-y;
w = x = y = z;
q = a?b:c?d:e?f:g;
x = ~(-y); w = (x = (y = z));
q = a?b:(c?d:(e?f:g));
x = a?b:(c?d:(e?f:g));
q = ~(-y); w = (x = (y = z));
x = (x = (y = z));w = ~(-y);
q = a?b:(c?d:(e?f:g));
x = ~(-y); w = (x = (y = z));
q = (c?d:(e?f:g));
<script>
document.getElementById("demo").innerHTML = typeof "John"
</script>
integer
number
string
error
var txt1 = good;
var txt2 = day;
document.getElementById(demo).innerHTML = txt1 + txt2;
good day
goodday
error
undefined
make computations in HTML simpler
minimize storage requirements on the web server
increase the download time for the client
increase the loading time of the website
var string2Num=parseInt(123xyz);
123
123xyz
Exception
NaN
Int a=1;
if(a>10)
{
document.write(10);
}
else
{
document.write(a);
}
10
0
1
Undefined
stand-alone expressions
basic expressions containing all necessary functions
contains variable references alone
contains only keywords
var pow=new Function(num1,num2,return Math.pow(num1,num2));
document.writeln(pow(2,3));
2
3
8
error