My Report

JavaScript Classes Test – 2


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. The four kinds of class members are ________

2. Different kinds of the object involved in a class definition are ________

3. What will be the output of the following JavaScript code?

   emp={id:102,name:"Shyam Kumar",salary:40000}  
   document.write(emp.id+" "+emp.name+" "+emp.salary);  

4. The object whose properties are inherited by all instances of the class, and properties whose values are functions behaving like instance methods of the class, is ________

5. What will be the output of the following JavaScript code?

function emp(id,name)
{  
    this.id=id;  
    this.name=name;    
}  
e=new emp(103,"Vimal Jaiswal");  
  
document.write(e.id+" "+e.name");  

6. What will be the output of the following JavaScript code?

function emp(name,salary)
{  
     this.name=name;  
     this.salary=salary;  
  
     this.changeSalary=changeSalary;  
     function changeSalary(otherSalary)
     {  
         this.salary=otherSalary;  
     }  
}  
e=new emp("Rahul",30000);  
e.changeSalary(45000);  
document.write("e.name+" "+e.salary);  

7. What will be the output of the following JavaScript code?

var emp=new Object();  
emp.name="Ravi Malik";  
emp.salary=50000;  
document.write("emp.name+" "+emp.salary);

8. Which variables are used internally in object methods and are also globally visible?

9. How can we make methods available on all objects?

10. What will be the output of the following JavaScript code?

const obj = { 10: 'arry', 21: 'barry', 23: 'carry' };  
console.log(Object.entries(obj)[2]);  

11. You can refresh the webpage in JavaScript by using ________

12. The class that represents the regular expressions is ________

13. Which is the correct code that returns a complex number that is the complex conjugate of this one?

14. The different variant of Date() constructor to create date object is/are ___________
i. new Date(date)
ii. new Date(milliseconds)
iii. new Date(date string)
iv. new Date(year, month, date[hour, minute, second, millisecond])

15. What is the procedure to add methods to HTMLElement so that they will be inherited by the objects that represent the HTML tags in the current document?


 

Start practicing “1000 MCQs on JavaScript”, and once you are ready, you can take tests on all topics by attempting our “JavaScript Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.