Test
Quiz - Object Oriented Javascript
Crea una cuenta gratis para terminar este test
Guarda tu progreso y consulta tu resultado final.
¿Ya tienes cuenta? Inicia sesión
Preguntas del test (15)
1What are the different ways in which you can create a javascript object? Choose ALL the right options
- Avar object = { prop1: "value1", prop2 : "value2"};
- Bvar object = new Object();
- Cvar object = {};
- Dvar object = Object.create({});
2How to create a constructor function?
- AAny function when prefixed with "new" keyword at the time of invocation acts like a constructor function.
- BName of the function should be "constructor"
- CYou have to assign a property named "constructor" and assign a function to it
- DConstructor function cannot be created in javascript
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.
- Aclass SubClass extends BaseClass { }
- Bfunction SubClass() {
BaseClass.apply(this, Array.prototype.slice.call(arguments, 0);
}
SubClass.prototype = Object.create(BaseClass.prototype); - Cfunction SubClass() {
BaseClass.apply(this, Array.prototype.slice.call(arguments, 0);
} - Dfunction SubClass() {
super(Array.prototype.slice.call(arguments, 0));
}
SubClass.prototype = Object.create(BaseClass.prototype);
4When does a Closure scope gets created?
- AEvery function has a Closure scope associated with it
- BEvery time a inner function is defined within another function
- 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)
- DA closure keyword is available. When a variable is declared with that modifier, closure scope is created
5How can I create a constant in Javascript 5?
- Aconst myConstant = 3.414;
- Bvar myConstant = { value : "3.414";}
- Cvar myConstant = new Object(3.414)
- Dvar myConstant = Object.create(null, { value: {
configurable : false,
writable : false,
enumerable : false,
value : 3.414
}
});
6How does Javascript achieve Inheritance?
- AInheritance using extends keyword
- BInheritance through Constructor chaining
- CInheritance through Prototype chaining
- DInheritance achieved programmatically
7Javascript does not support overriding?
- AVerdadero
- BFalso
8It is a better practice (in terms of performance) to create deep inheritance and access methods in the ancestor classes.
- AVerdadero
- BFalso
9It is possible to create namespaces in Javascript.
- AVerdadero
- BFalso
10It is possible to implement Singleton pattern in javascript.
- AVerdadero
- BFalso
11Every Javascript function is an object with the constructor as "Function"
- AVerdadero
- BFalso
12How can I create immutable property in a javascript object?
- AUsing closure
- BUsing JSON
- CUsing Object.defineProperty and specify only get and no set function
- DBy making the property private
13How to ensure that a property in Javscript object is never removed or re-configured
- ADefine the property with private modifier
- BIt is not possible to stop removing the property from object
- CEvery property defined using "Object.defineProperty" cannot be removed
- DUsing Object.defineProperty and setting "configurable" to false
14How can I avoid creating global variables and functions used most often for initialization?
- AUsing temporary inner / anonymous function functions
- BUsing just closure
- CUsing constructor
- DUsing window object
15How can I create Block - scoped variable in ES-6?
- AUsing var
- BUsing let
- CUsing const
- DUsing def
Información
- Descripción
- Quiz on Object Oriented Javascript
- Autor
- arunram.krish
- Idioma
- English
- Visitas
- 6.093
- Etiquetas
- Valoración
- 3,2 de 5 · 4 valoraciones Valora este test