Quiz
Quiz - JavaScript
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (14)
1What does 500..toString()?
- A500
- BSyntaxError
- C5
- Dundefined
2(function(){
var person = user = "vinoth";
})();
console.log(user);
What will be the output?- ATypeError user is not defined
- Bvinoth
- Ctrue
- Dundefined
3var person = {
getName: function() { return this.name; },
name: "vinoth"
};
(function(){
return typeof arguments[0]();
})(person.getName);- Avinoth
- Bundefined
- Carray
- Dobject
4var f = (function person(){ return "vinoth"; }, function rollNo(){ return 200; })();
console.log(f);- Avinoth
- Bstring
- Cnumber
- D200
- ESyntax Error
5if(function(){}){
console.log(typeof f);
}- ATypeError F is not defined
- BSyntax Error
- Cfunction
- Dundefined
6var x = [typeof f, typeof g][1];
console.log(typeof typeof x);- Aundefind
- Bnumber
- Cstring
- Dfunction
7(function f(){
function user(){ return "vinoth"; }
return user();
function user(){ return "vijay"; }
})();- Avinoth
- Bvijay
- Cfunction
- Dundefined
8var user = 'vijay';
(function() {
alert(user);
alert(person);
var user = 'vinoth';
function person(){}
})();- Aundefined, undefined
- Bundefined, function person(){}
- Cvinoth, function person(){}
- Dvinoth, undefined
9function User(name){
this.name = name;
}
var usr = User("vinoth");
console.log(usr);- A[Object object]
- Bundefined
- Cvinoth
- Dstring
10window.user = "vinoth";
var person = {
user: "vijay",
getName: function(){
return this.user;
}
}
var test = person.getName;
console.log(test());- Aundefined
- Bvijay
- Cvinoth
- DType Error: User is not defined
11function Person(name, gender) {
this.name = name;
this.gender = gender;
}
Person.prototype.speak = function() {
alert('Calling from Person ' + this.name);
};
function Vinoth(name, gender){
this.name = name;
this.gender = gender;
}
Vinoth.prototype.speak = function() {
alert('Calling from Vinoth ' + this.name);
};
Vinoth.prototype = Object.create(Person.prototype);
Vinoth.prototype.constructor = Vinoth;
var vin = new Vinoth('vin', 'M');
console.log(vin);
vin.speak()- ACalling from Person vin
- BCalling from Vinoth vin
- CCalling from Person undefined
- Dundefined
12function Person(name, gender) {
this.name = name;
this.gender = gender;
}
Person.prototype.speak = function() {
alert('Calling from Person ' + this.name);
};
function Vinoth(name, gender){
this.name = name;
this.gender = gender;
}
Vinoth.prototype = Object.create(Person.prototype);
Vinoth.prototype.constructor = Vinoth;
Vinoth.prototype.speak = function() {
alert('Calling from Vinoth ' + this.name);
};
var vin = new Vinoth('vin', 'M');
console.log(vin);
vin.speak()- ACalling from Person vin
- BCalling from Vinoth undefined
- CCalling from Vinoth vin
- Dundefined
13name = "vinoth";
obj = {};
obj.name = 'test';
obj.sayHello = function() {
console.log('Hello '+ this.name);
}
obj.sayHello.call(this);- Atest
- Bvinoth
- Cundefined
- Dthis
14function inherit(C, P) {
C.prototype = Object.create(P.prototype);
}
function Person(){}
function User(){}
inherit(User, Person);
Person.prototype.say = function () {
return 20;
};
var person = new Person();
var user = new User();
alert( user.say() );- Aundefied
- B[Number number]
- C20
- D20undefined
Information
- Description
- Quiz on Quiz - JavaScript, created by Vinoth Mahadevan on 24/05/2015.
- Author
- Vinoth Mahadevan
- Language
- English
- Views
- 5
- Tags
- Rating
- No ratings yet Rate this quiz