Page 230 - Web Applications (803) Class 12
P. 230
Section B
(Subjective Type Questions)
A. Short answer type questions.
1. Differentiate between each of the following. Also give examples.
i. if..else and switch statements in JavaScript.
ii. ‘=’ and ‘==’ operators
2. Explain the pop() method in JavaScript. Give an example of using the pop() method.
[CBSE Term 2 Sample Paper 2022]
3. Explain any two applications of JavaScript.
4. Explain array and object with examples.
5. What is an event? How are events `handled' in JavaScript? Explain using an example.
B. Long answer type questions.
1. Explain the following functions with examples:
i. substring() ii. concat()
iii. confirm() iv. shift()
2. What is a function? Write a user defined function to display an alert box with the message “The biggest robot is
Mononofu”.
3. Write the value that will be stored in variable p after execution of following code. How many times will the loop
execute?
var y = 6;
var x = 50;
var p = 0;
while(y>0)
{
p = p + x;
y = y - 1;
}
4. Predict the output of the following code snippet when a=3. Also rewrite the code using switch case.
var a=3;
if (a==1)
document.write("Ultron");
else if (a==2)
document.write("Thor");
else
document.write("Loki");
5. Give the output of the following code snippet with justification: [CBSE SAMPLE PAPER 2020]
i. NaN % 5
ii. isFinite( -Infinity)
iii. “Early morning good morning”.replace(“morning”, “evening”)
228 Touchpad Web Applications-XII

