Page 277 - Web_Application_v2.0_C12_Fb
P. 277
6. The slice() method modifies the original array. .....................
7. The inbuilt function substring( ) returns the position of the first match. .....................
8. The join() method converts an array into a string. .....................
Section B
(Subjective Type Questions)
A. Short answer type questions.
1. Explain the pop() method in JavaScript. Give an example of using the pop() method.
[CBSE Term 2 Sample Paper 2022]
2. What is an event? How are events `handled' in JavaScript? Explain using an example.
3. Explain the Math.round(x) mehtod in JavaScript. Give an example of using the Math.round(x) method.
4. Differentiate between push() and unshift() methods in JavaScript.
5. Explain the following functions with examples:
i. Math.round(x)
ii. Math.ceil(x)
6. Explain how the onmouseover and onmouseout event handlers work in JavaScript.
7. What will be the output of the following code?
<!DOCTYPE HTML>
<HEAD>
<TITLE>Array Operations</TITLE>
</HEAD>
<BODY>
<H2>Sorted and Reversed Programming Languages</H2>
<P ID="output"></P>
<SCRIPT>
var lang1 = ['java', 'rust', 'ruby'];
var lang2 = ['haskell', 'python'];
lang1 = lang1.concat(lang2);
lang1.sort();
lang1.reverse();
document.getElementById("output").innerHTML = lang1.join(', ');
</SCRIPT>
</BODY>
</HTML>
8. Consider the following JavaScript code and predict the output:
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE>Temperature conversion</TITLE>
</HEAD>
<BODY>
<P ID="Far"></P>
JavaScript Part 2 275

