Help shape GoConqr. What should we add next?

Quiz

Quiz - Object Oriented Javascript

arunram.krish 15 questions 6,093 views 3.2 (4 ratings)

Take the quiz

Questions in this quiz (15)

  1. 1What are the different ways in which you can create a javascript object? Choose ALL the right options
    1. Avar object = { prop1: "value1", prop2 : "value2"};
    2. Bvar object = new Object();
    3. Cvar object = {};
    4. Dvar object = Object.create({});
  2. 2How to create a constructor function?
    1. AAny function when prefixed with "new" keyword at the time of invocation acts like a constructor function.
    2. BName of the function should be "constructor"
    3. CYou have to assign a property named "constructor" and assign a function to it
    4. DConstructor function cannot be created in javascript
  3. 3How do you demonstrate inheritance in Javascript? Consider "BaseClass" is the name of the parent class and "SubClass" is the name of the sub-class.
    1. Aclass SubClass extends BaseClass { }
    2. Bfunction SubClass() {
      BaseClass.apply(this, Array.prototype.slice.call(arguments, 0);
      }
      SubClass.prototype = Object.create(BaseClass.prototype);
    3. Cfunction SubClass() {
      BaseClass.apply(this, Array.prototype.slice.call(arguments, 0);
      }
    4. Dfunction SubClass() {
      super(Array.prototype.slice.call(arguments, 0));
      }
      SubClass.prototype = Object.create(BaseClass.prototype);
  4. 4When does a Closure scope gets created?
    1. AEvery function has a Closure scope associated with it
    2. BEvery time a inner function is defined within another function
    3. CWhen an inner function is defined within another function and that refers to variables that are available at the defining function (local variables of enclosing functions and its parent right until global)
    4. DA closure keyword is available. When a variable is declared with that modifier, closure scope is created
  5. 5How can I create a constant in Javascript 5?
    1. Aconst myConstant = 3.414;
    2. Bvar myConstant = { value : "3.414";}
    3. Cvar myConstant = new Object(3.414)
    4. Dvar myConstant = Object.create(null, { value: {
      configurable : false,
      writable : false,
      enumerable : false,
      value : 3.414
      }
      });
  6. 6How does Javascript achieve Inheritance?
    1. AInheritance using extends keyword
    2. BInheritance through Constructor chaining
    3. CInheritance through Prototype chaining
    4. DInheritance achieved programmatically
  7. 7Javascript does not support overriding?
    1. ATrue
    2. BFalse
  8. 8It is a better practice (in terms of performance) to create deep inheritance and access methods in the ancestor classes.
    1. ATrue
    2. BFalse
  9. 9It is possible to create namespaces in Javascript.
    1. ATrue
    2. BFalse
  10. 10It is possible to implement Singleton pattern in javascript.
    1. ATrue
    2. BFalse

Information

Description
Quiz on Object Oriented Javascript
Language
English
Views
6,093
Tags
object oriented javascriptoo javascriptjavascriptobject oriented javascript - jun 2016intermediate
Rating
3.2 out of 5 · 4 ratings
Rate this quiz
Rate this quiz

Feedback

What is it about?

What should we add next?