logo
  • Home
  • Rank
  • Tests
  • About
  • Training
  • Programming
  • CS
  • IT
  • IS
  • ECE
  • EEE
  • EE
  • Civil
  • Mechanical
  • Chemical
  • Metallurgy
  • Instrumentation
  • Aeronautical
  • Aerospace
  • Biotechnology
  • Agriculture
  • MCA
  • BCA
  • Internship
  • Contact

JavaScript Multiple Choice Questions | MCQs | Quiz

Javascript Interview Questions and Answers
Practice Javascript questions and answers for interviews, campus placements, online tests, aptitude tests, quizzes and competitive exams.

Get Started

•   Lexical Structure
•   Types, Values & Variables
•   Expressions & Operators
•   Statements
•   JavaScript Loops
•   Object Attributes
•   Array & Related Methods
•   Invoking Functions
•   Functional Programming
•   Closures
•   JavaScript Classes
•   Augmentation of Classes
•   JavaScript Modules
•   Pattern Matching
•   JavaScript Subsets
•   JavaScript Extentions
•   Shorthand Functions
•   Server-Side JavaScript
•   Scripting Java - Rhino
•   Asynchronous I/O - Rhino
•   Client-Side JavaScript
•   Embedding JavaScript
•   JavaScript-Web Browsers-1
•   JavaScript-Web Browsers-2
•   Client-Side Frameworks
•   Document Object Model
•   Window Object
•   Error Handling - 1
•   Error Handling - 2
•   Scripting Documents
•   Scripting CSS
•   Handling Events
•   Mouse Events
•   Text Events
•   Drag & Drop Events
•   Keyboard Events
•   Node Operations - 1
•   Node Operations - 2
•   Cookies
•   Scripted HTTP
•   The jQuery Library
•   Client-Side Storage
•   Client-Side Databases
•   Scripted Media
•   Graphics
•   Browser Rendering - 1
•   Browser Rendering - 2
•   JavaScript Performance - 1
•   JavaScript Performance - 2
•   JavaScript - FireBug
•   JavaScript - YSlow
•   JavaScript - WebPagetest
•   JavaScript Minification - 1
•   JavaScript Minification - 2
•   Web Sockets
•   JavaScript History
•   Getting Started with R - 1
•   Getting Started with R - 2
•   Getting Started with R - 3
•   Enhanced JavaScript with R
•   WebPagetest API Access
•   Configuration File Creation
•   Parsing Values - 1
•   Parsing Values - 2
•   JavaScript Benchmarking-1
•   JavaScript Benchmarking-2
•   Public API Crafting
•   Remote Logging
•   Object Invocation
•   PerfLogger Performance
•   Navigation & Memory - 1
•   Navigation & Memory - 2
•   BottleNecks Optimization
•   Script Loading - 1
•   Script Loading - 2
•   Lazy Loading - 1
•   Lazy Loading - 2
•   Cache Variable & Properties
•   Closure Compiler
•   Web Workers
•   JavaScript Blobs
•   JavaScript & Memory Leak
•   External JavaScript & PHP
•   HTML APIs
•   HTML DOM
•   Animation
•   Validation
•   Image Map
•   Debugging Forms
•   JavaScript vs Frameworks-1
•   JavaScript vs Frameworks-2

JavaScript Tests

JavaScript Tests

Best Reference Books

Javascript Books
« Prev Page
Next Page »

JavaScript Questions & Answers – Object Attributes and Serialization

Posted on August 29, 2013 by Manish

This set of Javascript Multiple Choice Questions & Answers (MCQs) focuses on “Object Attributes and Serialization”.

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
View Answer

Answer: b
Explanation: Objects in JavaScript may be defined as an unordered collection of related data, of primitive or reference types, in the form of “key:value” pairs. Hence each of the property has a name and value.

advertisement

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
View Answer

Answer: c
Explanation: Every object has three associated object attributes :

  1. An object’s prototype is a reference to another object from which properties are inherited.
  2. An object’s class is a string that categorizes the type of an object.
  3. An object’s extensible flag specifies whether new properties may be added to the object.

3. Consider the following code snippet :

var book = {
              "main title": "JavaScript", 
              'sub-title': "The Definitive Guide", 
              "for": "all audiences", 
              author: { 
                         firstname: "David", 
                         surname: "Flanagan" 
                      }
           };

In the above snippet, firstname and surname are
a) properties
b) property values
c) property names
d) objects
View Answer

Answer: c
Explanation: The above code snippet contains an object inside another object. firstname and surname are the property names. The value of that particular property is itself an object.

4. A linkage of series of prototype objects is called as ________
a) prototype stack
b) prototype chain
c) prototype class
d) prototypes
View Answer

Answer: b
Explanation: Consider an example, Date.prototype inherits properties from Object.prototype, so a Date object created by new Date() inherits properties from both Date.prototype and Object.prototype. This linked series of prototype objects is known as prototype chain.
advertisement

5. In the following syntax, the datatype within the square brackets must be ___________

book[datatype]=assignment_value;

a) An integer
b) A String
c) An object
d) Floating point
View Answer

Answer: b
Explanation: The value inside the square bracket is used to access that data element or the property of the object. When using square bracket notation, the expression inside the square brackets must evaluate to a string or a value that can be converted to 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
View Answer

Answer: a
Explanation: Prototype is a global property which is available with almost all the objects. To determine whether one object is the prototype of (or is part of the prototype chain of) another object, one should use the isPrototype() method. To find out if p is the prototype of o write p.isPrototypeOf(o).

7. What is the prototype represents in the following code snippet?

function f() {};

a) Function f
b) A custom constructor
c) Prototype of a function
d) Not valid
View Answer

Answer: b
Explanation: All object instances have a constructor property that point to the constructor function that created it. A custom constructor is a constructor which requires no arguments and is created automatically by the compiler at the time of object creation if not created by the user.
advertisement

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
View Answer

Answer: c
Explanation: Extensible attributes determines whether the object can have new properties or not. Therefore extensible attribute will allow an object to include and write properties into them.

9. Identify the process done in the below 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
View Answer

Answer: b
Explanation: Object serialization is the process of converting an object’s state to a string from which it can later be restored. The JSON.parse() method parses a JSON string, constructing the JavaScript value or object described by the string.

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
View Answer

Answer: d
Explanation: .toLocaleString is a predefined function in javascript which is used to return a localized string representation of the object. For example the date.toLocaleString() is an inbuilt function in JavaScript which is used to convert a date and time to a string.

Sanfoundry Global Education & Learning Series – Javascript Programming.

To practice all areas of Javascript, here is complete set of 1000+ Multiple Choice Questions and Answers on Javascript.
« Prev Page - JavaScript Questions & Answers – Loops in JavaScript
» Next Page - JavaScript Questions & Answers – Array and Related Methods

« JavaScript Questions & Answers – Loops in JavaScript
JavaScript Questions & Answers – Array and Related Methods »
advertisement

Deep Dive @ Sanfoundry:

  1. Java Programming Examples on String Handling
  2. Java Programming Examples
  3. PHP Questions and Answers
  4. C# Programming Examples on Strings
  5. C# Programming Examples on Functions
  6. Java Programming Examples on Utility Classes
  7. Java Programming Examples on Classes
  8. Java Programming Examples on Java.Lang
  9. Javascript Questions and Answers
  10. Object Oriented Programming Questions and Answers
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer and SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage & Cluster Administration, Advanced C Programming, SAN Storage Technologies, SCSI Internals and Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him below:
LinkedIn | Facebook | Twitter | Google+

Best Careers

Developer Tracks
SAN Developer
Linux Kernel Developer
Linux Driver Developer
Linux Network Developer

Live Training Photos
Mentoring
Software Productivity
GDB Assignment
Sanfoundry is No. 1 choice for Deep Hands-ON Trainings in SAN, Linux & C, Kernel Programming. Our Founder has trained employees of almost all Top Companies in India such as VMware, Citrix, Oracle, Motorola, Ericsson, Aricent, HP, Intuit, Microsoft, Cisco, SAP Labs, Siemens, Symantec, Redhat, Chelsio, Cavium, ST-Micro, Samsung, LG-Soft, Wipro, TCS, HCL, IBM, Accenture, HSBC, Mphasis, Tata-Elxsi, Tata VSNL, Mindtree, Cognizant and Startups.

Best Trainings

SAN I - Technology
SAN II - Admin
Linux Fundamentals
Advanced C Training
Linux-C Debugging
System Programming
Network Programming
Linux Threads
Kernel Programming
Kernel Debugging
Linux Device Drivers

Best Reference Books

Computer Science Books
Algorithm & Programming Books
Electronics Engineering Books
Electrical Engineering Books
Chemical Engineering Books
Civil Engineering Books
Mechanical Engineering Books
Industrial Engineering Books
Instrumentation Engg Books
Metallurgical Engineering Books
All Stream Best Books

Questions and Answers

1000 C Questions & Answers
1000 C++ Questions & Answers
1000 C# Questions & Answers
1000 Java Questions & Answers
1000 Linux Questions & Answers
1000 Python Questions
1000 PHP Questions & Answers
1000 Hadoop Questions
Cloud Computing Questions
Computer Science Questions
All Stream Questions & Answers

India Internships

Computer Science Internships
Instrumentation Internships
Electronics Internships
Electrical Internships
Mechanical Internships
Industrial Internships
Systems Internships
Chemical Internships
Civil Internships
IT Internships
All Stream Internships

About Sanfoundry

About Us
Copyright
Terms
Privacy Policy
Jobs
Bangalore Training
Online Training
Developers Track
Mentoring Sessions
Contact Us
Sitemap
© 2011 Sanfoundry. All Rights Reserved.