M2-R5 O Level Objective Question and Answer

M2-R5 O Level Objective Question and Answer

221-What will be the output of the following JavaScript code?
const obj = {prop: 12}; Object.preventExtensions(obj); console.log( Object.isExtensible(obj));
A) 12
B) False ✔️
C) True
D) Error

222-The web development environment (JavaScript) offers which standard construct for data validation of the input entered by the user.
A) Controlled loop constructs ✔️
B) Server page access
C) Client side Event
D) Permit server-side

223-The script tag must be placed in
A) The head tag
B) The head or body ✔️
C) The title or head
D) After the body tag

224-.A JavaScript program developed on a Unix Machine
A) Will throw errors and exceptions
B) Must be restricted to a Unix Machine only
C) Will work perfectly well on a Windows Machine ✔️
D) Will be displayed as a JavaScript text on the browser

225-JavaScript is ideal to
A) Make computations in HTML simpler
B) Minimize storage requirements on the web server ✔️
C) Increase the download time for the client
D) Increase the loading time of the website

226-Which attribute is used to specify that the script is executed when the page has finished parsing? (only for external scripts)
A) Parse
B) A sync
C) Defer ✔️
D) Type

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

228-JavaScript can be written
A) Directly into JS file and included into HTML ✔️
B) Directly on the server page
C) Directly into HTML pages
D) Directly into the CSS file

229-Which of the following Attribute is used to include External JS code inside your HTML Document?
A) src ✔️
B) ext
C) script
D) link

230-A proper scripting language is a
A) High level programming language ✔️
B) Assembly level programming language
C) Machine level programming language
D) Low level programming language

231-What will be the output of the following JavaScript code?
<p id=”demo”></p> var txt1 = “good”; var txt2 = “day”;
document.getElementById(“demo”).innerHTML = txt1 + txt2;
A) good day
B) goodday ✔️
C) error
D) undefined

232-What will be the output of the following JavaScript code?
<p id=”demo”></p>
<script> var x = 5; var y = 2;
var z = x % y;
document.getElementById(“demo”).innerHTML = z;
</script>
A) 0
B) 1 ✔️
C) 2
D) 5

233-What will be the output of the following JavaScript code?
<p id=”demo”></p>
<script> var x = 10; x *= 5;
document.getElementById(“demo”).innerHTML = x;
</script>
A) 5
B) 10
C) 50 ✔️
D) Error

234-What will be the output of the following JavaScript code?
<p id=”demo”></p>
<script>
txt1 = “ one”; txt1 += “two”; document.getElementById(“demo”).innerHTML = txt1;
</script>
A) onetwo ✔️
B) one two
C) error
D) undefined

235-What will be the output of the following JavaScript code?
<p id=”demo”></p>
<script>
document.getElementById(“demo”).innerHTML = typeof “John”
</script>
A) integer
B) number
C) string ✔️
D) error

236-What will be the output of the following JavaScript code?
int size=5;
int a=5;
int size=4;
for(int j=size;j>=0;j–)
{
console.log(A);
a=a-2;
}
A) 5555
B) 5321
C) 531-1 ✔️
D) 531

237-What will be the output of the following JavaScript code?
int a=0; for(a;a<5;a++); console.log(A);
A) 0
B) error
C) 4
D) 5 ✔️

238-The unordered collection of properties, each of which has a name and a value is called
A) String
B) Object ✔️
C) Serialized Object
D) Array

239-The object has three object attributes namely
A) Class, parameters, object’s extensible flag
B) Prototype, class, objects’ parameters
C) Prototype, class, object’s extensible flag ✔️
D) Native object, Classes and Interfaces and Object’s extensible flag

240-What will be the firstname and surname of the following JavaScript code?
var book = {
“main title”: “JavaScript”,
‘sub-title’: “The Definitive Guide”, “for”: “all audiences”,
author: {
firstname: “David”, surname: “Flanagan”
}
};
A) Properties
B) Property values
C) Property names ✔️
D) Objects

241-A linkage of series of prototype objects is called as
A) Prototype stack
B) Prototype chain ✔️
C) Prototype class
D) Prototypes

242-In the following syntax, the data type within the square brackets must be
book[datatype]=assignment_value;
A) An integer
B) A String
C) An object
D) Floating point ✔️

243-To determine whether one object is the prototype of (or is part of the prototype chain of) another object, one should use the
A) isPrototypeOf() method ✔️
B) equals() method
C) === operator
D) ==opertor

244-What is the prototype represents in the following JavaScript code snippet?
function f() {};
A) Function f
B) A custom constructor ✔️
C) Prototype of a function
D) Not valid

245-The purpose of extensible attribute is to
A) Make all of the own properties of that object non configurable
B) To configure and bring a writable property
C) “lock down” objects into a known state and prevent outside tampering ✔️
D) To include new properties into the object

246-Identify the process done in the following JavaScript code snippet?
o = {x:1, y:{z:[false,null,””]}};
s = JSON.stringify(o);
p = JSON.parse(s);
A) Object Encapsulation
B) Object Serialization ✔️
C) Object Abstraction
D) Object Encoding

247-The basic purpose of the toLocaleString() is to
A) return a localised object representation
B) return a parsed string
C) return a local time in the string format
D) return a localized string representation of the object ✔️

248-What will be the output of the following JavaScript code?
const object1 = {};
a = Symbol(‘a’);
b = Symbol.for(‘b’); object1[a] = ‘harry’; object1[b] = ‘derry’;
const objectSymbols = Object.getOwnPropertySymbols(object1);
console.log(objectSymbols.length);
A) 0
B) 2 ✔️
C) 1
D) Error

249-What will be the output of the following JavaScript code?
const obj1 = { property1: ’10’};
const obj2 = Object.freeze(obj1);
obj2.property1 = ’20’; console.log(obj2.property1);
A) 10 ✔️
B) 20
C) Runtime error
D) Compilation error

250-What will be the output of the following JavaScript code?
const object1 = {
property1: 20
}; console.log(Object.is(object1));
A) 20
B) true
C) false ✔️
D) error

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

Related Link