Home JavaScript MCQs JavaScript MCQs IV

JavaScript MCQs IV

by anupmaurya
16 minutes read

Wonderful JavaScript MCQs Series for Beginner. Practice these MCQs to enhance and test the knowledge of JavaScript, In this series this test is based on JavaScript Objects.

1.In JavaScript, an object is a container of properties and functions. Properties are identified by ____ and behavior is identified by _____.

  1. variables, functions
  2. functions, variables
  3. attributes, variables
  4. attributes, functions

1) variables, functions

2.In a multidimensional array mySubject, which of the following option will allow assigning the value 100 in position 5 of the third mySubject array?

  1. mySubject[5][3] = 100
  2. mySubject[2][4] = 100
  3. mySubject[4][2] = 100
  4. mySubject[3][4] = 100
  5. mySubject[3][5] = 100

2) mySubject[2][4] = 100

3.To retrieve the day of the month from the Date object, which is the code to select?

  1. var date_obj = new Date(2016,1,1);
  2. month_date = date_obj.getMonth();
  3. month_day = date_obj.getDay();
  4. month_date = date_obj.toDateString();
  5. var month_day = date_obj.getDate();

5) var month_day = date_obj.getDate();

4.Which is the correct way to create an array in JavaScript? I) var myProg = []; II) var myArray = [“C”,”Java”,”C++”,”Python”]; III) var myProg = new Array();

  1. I, II & III
  2. I, II
  3. I, III
  4. II, III

1) I, II & III

5. 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));

1. [5,5,5,5]
2. [5]{4}
3. [5]
4. Both A and B

1) [5,5,5,5]

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

1. 2019-05-09T09:29:53.181Z
2. 2019-5-9
3. 15:00:34
4. 2019-5-9 15:02:35

4) 2019-5-9 15:02:35

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

1. JSON.Parse()
2. JSON.Stringify()
3. JSON.Null()
4. JSON.Objectify()

2) JSON.Stringify()

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

1. prototype
2. class
3. serialization
4. extensible

3) serialization

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

1. “New Text”?
2. para1.value=”New Text”;
3. para1.firstChild.nodeValue= “New Text”;
4. para1.nodeValue=”New Text”;

2) para1.value=”New Text”;

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

1. TRUE
2. FALSE
3. Can be true or false
4. Can not say

3)Can be true or false

You may also like

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.