JavaScript Questions & Answers – Object Attributes and Serialization | JavaScript MCQs

Sports GK Questions and Answers 2024 (Latest Updated)

Awards & Honours GK Questions 2024 (Latest Updated)

Questions
1 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

Answer: Object
2 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

Answer: Prototype, class, object’s extensible flag
Advertisement
Article and Schedule Quiz Start Test!
DOWNLOAD CURRENT AFFAIRS PDF FROM APP
3 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
B objects

Answer: property names
4 A linkage of series of prototype objects is called as ________
A prototype stack
B prototype chain
C prototype class
D prototypes

Answer: prototype chain
5 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
B Floating point

Answer: A String
6 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

Answer: isPrototypeOf() method
7 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

Answer: A custom constructor
8 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

Answer: “lock down” objects into a known state and prevent outside tampering
9 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

Answer: Object Serialization
10 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

Answer: return a localized string representation of the object
11 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
B error

Answer: 2
12 What will be the output of the following JavaScript code?
const obj1 =
{ 
    property1: 21
	} 
const descriptor1 = Object.getOwnPropertyDescriptor(obj1, 'property1');  
console.log(descriptor1.configurable);
console.log(descriptor1.enumerable);
A true 21
B true false
C true true
D false false

Answer: true true
13 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

Answer: 10
14 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

Answer: false
15 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

Answer: false

Random GK Questions

Assam Direct Recruitment Test Series

Teacher Eligibility Test

Assam Direct Recruitment Test Series