My Report

JavaScript Mock Test 1


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

Question 1 of 10

1. The main purpose of a "Live Wire" in NetScape is to ________

Question 1 of 10

Question 2 of 10

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

var B = 65; // ASCII value of A
var grade = B;
var result = 0; // Initialize result here
switch(grade) {
    case 'A': {
        result += 10; 
        break;
    } 
    case 'B': {
        result += 9;
        break;
    }  
    case 'C': {
        result += 8;
        break;
    }  
    default:  
        result += 0;  
}  
document.write(result);

Question 2 of 10

Question 3 of 10

3. To determine whether one object is the prototype of (or is part of the prototype chain of) another object, one should use the ____________

Question 3 of 10

Question 4 of 10

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

function compare()
{
    let a=1;
    let b='1';
    if(a.toString()===b)
        return true;
    else 
        return false;
}

Question 4 of 10

Question 5 of 10

5. The purpose of extensible attribute is to __________

Question 5 of 10

Question 6 of 10

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

const obj1 =
{  
    property1: 21  
}  
const descriptor1 = Object.getOwnPropertyDescriptor(obj1, 'property1');  
console.log(descriptor1.configurable);  
console.log(descriptor1.enumerable);  

Question 6 of 10

Question 7 of 10

7. What are the three important manipulations done in a for loop on a loop variable?

Question 7 of 10

Question 8 of 10

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

function range(int length)
{
	var a=5;
	for(var i=0;i<length;i++)
	{
		console.log(a);
	} 
}
range(3);

Question 8 of 10

Question 9 of 10

9. What will be the equivalent code of the following JavaScript code?

for(var p in o)
   console.log(o[p]);

Question 9 of 10

Question 10 of 10

10. When an empty statement is encountered, a JavaScript interpreter __________

Question 10 of 10


 

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.