Question
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
Posted under JavaScript
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. Which is a more efficient code snippet ?
Similar Questions
Discover Related MCQs
Q. A statement block is a
View solution
Q. When an empty statement is encountered, a JavaScript interpreter
View solution
Q. The "var" and "function" are
View solution
Q. Consider the following statement:
switch(expression)
{
statements
}
In the above switch syntax, the expression is compared with the case labels using which of the following operator(s) ?
View solution
Q. Consider the following statement:
var count = 0;
while (count < 10)
{
console.log(count);
count++;
}
In the above code snippet, what happens?
View solution
Q. The enumeration order becomes implementation dependent and non-interoperable if :
View solution
Q. What are the three important manipulations done in a for loop on a loop variable?
View solution
Q. Consider the following code snippet
function tail(o)
{
for (; o.next; o = o.next) ;
return o;
}
Will the above code snippet work? If not, what will be the error?
View solution
Q. One of the special feature of an interpreter in reference with the for loop is that
View solution
Q. What will happen if the body of a for/in loop deletes a property that has not yet been enumerated?
View solution
Q. What will be the step of the interpreter in a jump statement when an exception is thrown?
View solution
Q. Consider the following code snippet
function f(o)
{
if (o === undefined) debugger;
}
What could be the task of the statement debugger?
View solution
Q. Among the keywords below, which one is not a statement?
View solution
Q. The unordered collection of properties, each of which has a name and a value is called
View solution
Q. The object has three object attributes namely
View solution
Q. A linkage of series of prototype objects is called as :
View solution
Q. Consider the below given syntax:
book[datatype]=assignment_value;
In the above syntax, the datatype within the square brackets must be
View solution
Q. To determine whether one object is the prototype of (or is part of the prototype chain of) another object, one should use the
View solution
Q. Consider the following code snippet
function f() {};
The above prototype represents a
View solution
Q. The purpose of extensible attribute is to
View solution
Suggested Topics
Are you eager to expand your knowledge beyond JavaScript? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!