M2-R5 NIELIT O Level Objective Question and Answer

M2-R5 NIELIT O Level Objective Question and Answer

91-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 ✔️

92-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

93-What will be the output of the following JavaScript code?
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);
}
}
A) Prints the numbers in the array in order ✔️
B) Prints the numbers in the array in the reverse order
C) Prints 0 to the length of the array
D) Prints “Empty Array”

94-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

95-What will the following JavaScript 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 numeric 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”

96-What will be the equivalent code of the following JavaScript code?
for(var p in o)
console.log(o[p]);
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]);

97-One of the special features of an interpreter in reference with the for loop is that
A) Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property ✔️
B) The iterations can be infinite when an interpreter is used
C) The body of the loop is executed only once
D) the iteration is finite when an interpreter is used

98-What will happen if the body of a for/in loop deletes a property that has not yet been enumerated?
A) The property will be stored in a cache
B) The loop will not run
C) That property will not be enumerated ✔️
D) The property will be enumerated View Answer

99-What will be the step of the interpreter in a jump statement when an exception is thrown?
A) The interpreter stops its work
B) The interpreter throws another exception
C) The interpreter jumps to the nearest enclosing exception handler ✔️
D) The interpreter throws an error

100-What will be the role of the continue keyword in the following JavaScript code snippet?
while (a != 0)
{
if (a == 1)
continue;
else a++;
}
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

101-What could be the task of the statement debugger in the following JavaScript code?
function f(o)
{
if (o === undefined) debugger;
}
A) It does nothing but a simple breakpoint ✔️
B) It debugs the error in that statement and restarts the statement’s 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

102-Among the keywords below, which one is not a statement?
A) debugger
B) with
C) if
D) use strict ✔️

103-What will be the output of the following JavaScript code?
function range(int length)
{
int a=5;
for(int i=0;i<length;i++)
{
console.log(A);
}
} range(3);
A) 5
B) 555 ✔️
C) 3
D) error

104-What will be the output of the following JavaScript code?
var a = 10;
do {
a += 1;
console.log(A);
} while (a < 5);
A) 11121314
B) 1112
C) 12345 ✔️
D) 11

105-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

106-What will be the output of the following JavaScript code?
<p id=”demo”></p>
<script>
function myFunction()
{
document.getElementById(“demo”).innerHTML = Math.cbrt(125);
}
</script>
A) 125
B) 25
C) 5 ✔️
D) Error

107-What will be the output of the following JavaScript code?
<p id=”demo”></p>
<script>
function myFunction()
{
document.getElementById(“demo”).innerHTML = Math.acos(0.5);
}
</script>
A) 1.01
B) 1.047 ✔️
C) 1.00
D) 1.4

108-JavaScript is a_______language.
A) Object-Oriented
B) High-level
C) Assembly-language
D) Object-Based ✔️

109-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

110-A conditional expression is also called a
A) Alternative to if-else
B) Immediate if ✔️
C) If-then-else statement
D) Switch statement

111-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

112-What is a block statement in JavaScript?
A) Conditional block
B) Block that contains a single statement
C) Both conditional block and a single statement
D) Block that combines multiple statements into a single compound statement ✔️

113-When an empty statement is encountered, a JavaScript interpreter
A) Ignores the statement ✔️
B) Prompts to complete the statement
C) Throws an error
D) Shows a warning

114-The “var” and “function” are
A) Keywords
B) Declaration statements ✔️
C) Data types
D) Prototypes

115-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) === ✔️

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

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

118.What will be the output of the following JavaScript code?
int a=1;
if(a>10)
{
document.write(10);
}
else
{
document.write(A);
}
A) 10
B) 0
C) 1 ✔️
D) Undefined

119.What will be the output of the following JavaScript code?
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);
A) 10
B) 9 ✔️
C) 8
D) 0

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

O LEVEL M2-R5 (WEB DESIGNING AND PUBLISHING) MCQs OF HTML

Related Link