O Level M2-R5 MCQ JavaScript Question and Answer

O Level M2-R5 MCQ JavaScript Question and Answer

61-What will be the output of the following JavaScript code?
var string1 = “123”;
var intvalue = 123;
alert( string1 + intvalue );

A) 123246
B) 246
C) 123123 ✔️
D) Exception

62- A function definition expression can be called as
A) Function prototype
B) Function literal ✔️
C) Function calling
D) Function declaration

63-The property of a primary expression is
A) stand-alone expressions ✔️
B) basic expressions containing all necessary functions
C) contains variable references alone
D) contains only keywords

64-Consider the following JavaScript statements.
var text = “testing: 1, 2, 3”; // Sample text
var pattern = /\d+/g // Matches all instances of one or more digits
In order to check if the pattern matches with the string “text”, the statement is

A) text==pattern
B) text.equals(pattern)
C) text.test(pattern)
D) pattern.test(text) View Answer ✔️

65-The expression of calling (or executing) a function or method in JavaScript is called
A) Primary expression
B) Functional expression
C) Invocation expression ✔️
D) Property Access Expression

66-What kind of expression is “new Point(2,3)”?
A) Primary Expression
B) Object Creation Expression ✔️
C) Invocation Expression
D) Constructor Calling Expression

67-Which of the operator is used to test if a particular property exists or not?
A) in ✔️
B) exist
C) within
D) exists

68-Among the following, which one is a ternary operator?
A) +
B) :
C) –
D) ?: ✔️

69-“An expression that can legally appear on the left side of an assignment expression” is a well known explanation for
variables, properties of objects, and elements of arrays. They are called
A) Properties
B) Prototypes
C) Lvalue ✔️
D) Definition

70-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));

71-What will be the output of the following JavaScript code?
function output(option)
{
return (option ? “yes” : “no”);
}
bool ans=true; console.log(output(ans));
A) Yes ✔️
B) No
C) Runtime error
D) Compilation error

72-What will be the output of the following JavaScript code?
var obj=
length:20,
height:35,
}
if (‘breadth’ in obj === false)
{
obj.breadth = 12;
}
console.log(obj.breadth);
A) 20
B) 12 ✔️
C) undefined
D) error

73-What will be the output of the following JavaScript code?
function height()
{
var height = 123.56;
var type = (height>=190) ? “tall” : “short”;
return type;
}
A) 123.56
B) 190
C) tall
D) short ✔️

74-What will be the output of the following JavaScript code?
function output(object)
{
var place=object ? object.place : “Italy”;
return “clean:”+ place;
}
console.log(output({place:India}));
A) clean:India ✔️
B) clean:Italy
C) error
D) undefined

75-What will be the output of the following JavaScript code?
<p id=”demo”></p>
<script>
function myFunction()
{
document.getElementById(“demo”).innerHTML = Math.abs(-7.25);
}
</script>
A) 7.25 ✔️
B) -7.25
C) 7
D) -7

76-JavaScript Code can be called by using
A) RMI
B) Triggering Event
C) Preprocessor
D) Function/Method ✔️

77.The type of a variable that is volatile is
A) Volatile variable
B) Mutable variable ✔️
C) Immutable variable
D) Dynamic variable

78-A hexadecimal literal begins with
A) 00
B) 0x
C) 0X
D) Both 0x and 0X ✔️

79-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]

80-JavaScript____when there is an indefinite or an infinite value during an arithmetic computation.
A) Prints an exception error
B) Prints an overflow error
C) Displays “Infinity” ✔️
D) Prints the value as such

81-Which of the following is not considered as an error in JavaScript?
A) Syntax error
B) Missing of semicolons
C) Division by zero ✔️
D) Missing of Bracket

82-The escape sequence ‘\f’ stands for
A) Floating numbers
B) Representation of functions that returns a value
C) \f is not present in JavaScript ✔️
D) Form feed

83-The snippet that has to be used to check if “a” is not equal to “null” is
A) if(a!=null)
B) if (!A)
C) if(a!null)
D) if(a!==null) ✔️

84-The statement a===b refers to
A) Both a and b are equal in value, type and reference address
B) Both a and b are equal in value
C) Both a and b are equal in value and type ✔️
D) There is no such statement

85-Assume that we have to convert “false” that is a non-string to string. The command that we use is (without invoking
the “new” operator).
A) false.toString()
B) String(false)
C) String newvariable=”false”
D) Both false.toString() and String(false) ✔️

86-What will be the output of the following JavaScript code?
function compare()
{
int num=2; char b=2; if(a==B)
return true;
else
return false;
}
A) true ✔️
B) false
C) runtime error
D) compilation error

87-What will be the output of the following JavaScript code?
function equalto()
{
int num=10;
if(num===”10″)
return true;
else
return false;
}
A) true ✔️
B) false
C) runtime error
D) compilation error

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

89-What will be the output of the following JavaScript code?
int a==2;
int b=4;
int ans=a+b;
print(ans);
A) 2
B) 6
C) 0
D) Error ✔️

90-What will be the output of the following JavaScript code?
int a=1;
if(a!=null)
return 1;
else
return 0;
A) 1 ✔️
B) 0
C) Runtime error
D) Compiler error

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

Related Link