Page 349 - Web Applications (803) Class 11
P. 349
for (i = 1; i <= 5; i++)
{
if( i==3)
continue
document.write("The number is " + i+ "<br>");
}
</script>
C. Competency-based/Application-based questions: Critical Thinking
1. Chirag created a website using HTML and formatted it using CSS. He now wishes to add some interactive elements to the
website for the site visitors. How can he achieve this?
2. Shweta is creating a website in HTML. She wants to add a functionality to accept the roll no of a student online. Which
method of JavaScript helps her to do?
3. Aakash finds errors in the following code and now wants to rewrite the code using a for loop without affecting the output.
Rewrite the correct program using a for loop.
<script language = JavaScript>
var prod, counter
prod = 2;
ctr = 2;
do
{
prod = prod*ctr;
ctr = ctr+2;
document.write(prod+”, “+ctr+”<BR>”);
}
while (ctr<=9);
4. Observe the code snippet given below and answer the questions that follow:
<script language = JavaScript>
A = (5**3) % 4/2;
B = 50%3;
if (!(B>=A))
C = 10;
else
C = 7;
</script>
I. Heena wants to know the names of one relational and logical operator used in the above code segment. Name them.
II. Also, she wants to rewrite the statement: if (! (B > = A)) without using the ! operator. Write the statement for Heena.
Introduction to Dynamic Websites Using JavaScript 347

