Javascript (JS) Object MCQ

This section focuses on the "Javascript Object" of the Javascript. These Multiple Choice Questions (mcq) should be practiced to improve the Javascript skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

1. What will be printed in the console on execution of the following JS code:
var array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
var myArr= array.filter(v => v % 3 === 0);

console.log(myArr);

A. myArr
B. [3, 6, 9, 12, 15]
C. [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
D. [1, 2, 4, 5, 7, 8, 10, 11, 13, 14]

View Answer


2. What will be printed in the console on execution of the following JS code:
var array = [2, 4, 6, 7, 8, 10];
var myArr= array.filter(v => v / 2 === 0);

console.log(myArr);

A. myArr
B. [2, 4, 6, 7, 8, 10]
C. [2, 4, 6, 8, 10]
D. [7]

View Answer


3. What will be printed in the console on execution of the below code?
var materials = [
'Hydrogen',
'Helium',
'Lithium',
'Beryllium'
];

console.log(materials.map (material => material.length));

A. [8, 6, 7, 9]
B. 4
C. [4]
D. 8, 6, 7, 9

View Answer


4. What will be printed in the console on execution of the below code?
var materials = [
'Table',
'Chair',
'Boxes',
'Press'
];

console.log(materials.map (material => material.length));

A. [5,5,5,5]
B. [5]{4}
C. [5]
D. Both A and B

View Answer


5. what will be the output of below code?
var val = "JavaScript String"
splittedVal = val.split('a',2)
console.log(splittedVal);

A. [ 'J', 'v' ]
B. [ 'J' ,'v','Script']
C. [ 'J', 'v', 'Script String' ]
D. [ 'JavaScript String' ]

View Answer


6. what will be the output of below code?
NOTE: The code is executed on 2019-5-9
var todaysDate = new Date()
console.log( todaysDate.toLocaleString() );

A. 2019-05-09T09:29:53.181Z
B. 2019-5-9
C. 15:00:34
D. 2019-5-9 15:02:35

View Answer


7. ........ serializes only the enumerable own properties of an object.

A. JSON.Parse()
B. JSON.Stringify()
C. JSON.Null()
D. JSON.Objectify()

View Answer


8. Object ......... is the process of converting an objects state to a string from which it can later be restored.

A. prototype
B. class
C. serialization
D. extensible

View Answer


9.  If para1 is the DOM object for a paragraph, what is the correct syntax to change the text within the paragraph?

A. "New Text"?
B. para1.value="New Text";
C. para1.firstChild.nodeValue= "New Text";
D. para1.nodeValue="New Text";

View Answer


10. what will be the output of below code?
const event = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
console.log (event.toLocaleString('en-IN', { timeZone: 'UTC' }));

A. 20/12/2012, 3:00:00
B. 12/20/2012, 3:00:00
C. 20/12/2012, 3:00:00 am
D. 2012/12/20, 3:00:00 am

View Answer


11. A programming language can be called object-oriented if it provides ________ basic capabilities to developers

A. 1
B. 2
C. 3
D. 4

View Answer


12. The capability to store one object inside another object known as?

A. Encapsulation
B. Aggregation
C. Inheritance
D. Polymorphism

View Answer


13. The syntax for adding a property to an object is?

A. objectProperty == propertyValue;
B. objectProperty = propertyValue;
C. objectName.objectProperty = propertyValue;
D. objectName.objectProperty == propertyValue;

View Answer


14. The ________ operator is used to create an instance of an object.

A. this
B. self
C. find
D. new

View Answer


15. JavaScript provides a special constructor function called Object() to build the object.

A. TRUE
B. FALSE
C. Can be true or false
D. Can not say

View Answer






Also check :


Discussion



* You must be logged in to add comment.