You are on page 1of 23

Course Name: Client Side Scripting Lang.

(22519)

Question Bank

Unit – I Basics of JavaScript Programming (Marks: 12)

Remember level Understand level Apply level

4 4 4
2 marks

1. State the features of Javascript

High-level language
1. JavaScript is a object-based scripting language.
2. Giving the user more control over the browser.
3. It Handling dates and time.
4. It Detecting the user's browser and OS,
5. It is light weighted.
6. Client – Side Technology
7. JavaScript is a scripting language and it is not java.
8. JavaScript is interpreter based scripting language.
9. JavaScript is case sensitive.
10. JavaScript is object based language as it provides predefined objects.
11. Every statement in javascript must be terminated with semicolon (;).
12. Most of the javascript control statements syntax is same as syntax of
control statements in C language.
13. An important part of JavaScript is the ability to create new functions
within scripts.
2. Write a javascript program to check whether entered number is prime or not.

var number = prompt("Enter a number: ");

var isPrime = true;

for (var i = 2; i * i <= number; i++) {


if (number % i == 0) {
isPrime = false;
break;
}
}

if (isPrime) {
document.write (number + " is a prime number.");
} else {
Document.write (number + " is not a prime number.");
}
3. List & explain datatypes in JavaScript

Primitive Data Types:


Number: Represents numeric values, including integers, floats, and special values.
String: Represents text data as sequences of characters.
Boolean: Represents binary values, true or false, for logical operations.
Undefined: The data type for variables that have been declared but not assigned a value.
Null: Represents an intentional absence of any object value.
Symbol (ES6): Represents unique and immutable values, often used as object property keys.
BigInt (ES11): Represents arbitrary-precision integers for extremely large numbers (introduced in
ES11).
Reference Data Types:
Object: Represents key-value pairs and structured data.
Array: An ordered list of values, specialized for storing multiple values.
Function: A callable object encapsulating a block of code.
Date: Represents date and time information.
RegExp: Represents regular expressions for pattern matching and text manipulation.
Map (ES6): A collection of key-value pairs, offering flexibility in key types (introduced in ES6).
Set (ES6): Represents a collection of unique values, eliminating duplicates (introduced in ES6).
WeakMap (ES6): Similar to Map but with differences in garbage collection, used for private data
storage (introduced in ES6).
WeakSet (ES6): A collection of objects with weak references, similar to Set (introduced in ES6).

4. Write a simple calculator program using switch case in JavaScript.

// Prompt the user for two numbers and the operation.


const num1 = parseFloat(prompt("Enter the first number:"));
const num2 = parseFloat(prompt("Enter the second number:"));
const operation = prompt("Enter the operation (+, -, *, /):");
let result;
// Use a switch statement to perform the selected operation.
switch (operation) {
case "+":
result = num1 + num2;
break;
case "-":
result = num1 - num2;
break;
case "*":
result = num1 * num2;
break;
case "/":
if (num2 === 0) {
result = "Division by zero is not allowed.";
} else {
result = num1 / num2;
}
break;
default:
result = "Invalid operation";
}

// Display the result to the user.


alert(`Result: ${result}`);
5. Describe property Getters & Setter.

Property getters and setters


1. The accessor properties. They are essentially functions that work on
getting and setting a value.
2. Accessor properties are represented by “getter” and “setter” methods. In
an object literal they are denoted by get and set.
let obj = {
get propName() {
// getter, the code executed on getting obj.propName
},
set propName(value) {
// setter, the code executed on setting obj.propName = value
}
};
3. An object property is a name, a value and a set of attributes. The value
may be replaced by one or two methods, known as setter and a getter.
4. When program queries the value of an accessor property, Javascript
invoke getter method(passing no arguments). The retuen value of this
method become the value of the property access expression.
5. When program sets the value of an accessor property. Javascript invoke
the setter method, passing the value of right-hand side of assignment. This
method is responsible for setting the property value.
 If property has both getter and a setter method, it is read/write
property.
 If property has only a getter method , it is read-only property.
 If property has only a setter method , it is a write-only property.
6. getter works when obj.propName is read, the setter – when it is assigned.
Example:
<html>
<head>
<title>Functions</title>
<body>
<script language="Javascript">
var myCar = {
/* Data properties */
defColor: "blue",
defMake: "Toyota",

/* Accessor properties (getters) */


get color() {
return this.defColor;
},
get make() {
return this.defMake;
},

/* Accessor properties (setters) */


set color(newColor) {
this.defColor = newColor;
},
set make(newMake) {
this.defMake = newMake;
}
};
document.write("Car color:" + myCar.color + " Car Make: "+myCar.make)
/* Calling the setter accessor properties */
myCar.color = "red";
myCar.make = "Audi";
/* Checking the new values with the getter accessor properties */
document.write("<p>Car color:" + myCar.color); // red
document.write(" Car Make: "+myCar.make); //Audi
</script>
</head>
</body>
</html>
6. Write a Java script to create person object with properties firstname, lastname, age,
eyecolor, delete eyecolor property and display remaining properties of person object

<html>
<body>
<script>
var person = {
firstname:"John",
lastname:"Doe",
age:50,
eyecolor:"blue"
};
delete person.eyecolor; //delete person eyecolor
document.write("After delete "+ person.firstname +" "+ person.lastname +" "
+person.age +" "+ person.eyecolor);
</script>
</body>
</html>
7. State the ways to display the output in JavaScript.
There are several ways to display output in JavaScript, depending on the context in
which you are working. Here are some common methods for displaying output:

1. **`console.log()`**: This is the most commonly used method for displaying output in JavaScript. It
logs messages and values to the browser's developer console. It's primarily used for debugging and
development.

```javascript
console.log("Hello, World!");
```

2. **`alert()`**: This method displays a dialog box with a message and an OK button. It's often used
for simple user notifications.

```javascript
alert("Hello, World!");
```

3. **`document.write()`**: This method writes text directly to the HTML document. It's typically used
for simple output but can overwrite the entire document if used after the document has finished
loading.

```javascript
document.write("Hello, World!");
```

4. **`innerHTML` property**: You can use the `innerHTML` property to set or change the content of
an HTML element. This is useful for updating the content of specific elements on a webpage.

```javascript
document.getElementById("outputElement").innerHTML = "Hello, World!";
```
5. **`console.info()`, `console.warn()`, `console.error()`**: These are variants of `console.log()` that
allow you to log information, warnings, and errors, respectively. They help categorize the messages in
the console.

```javascript
console.info("Informational message");
console.warn("Warning message");
console.error("Error message");
```

6. **`prompt()`**: This method displays a dialog box that prompts the user to input text. It can be
used to get input from the user.

```javascript
const userInput = prompt("Enter your name:");
console.log("User entered: " + userInput);
```

7. **`confirm()`**: This method displays a dialog box with a message and OK/Cancel buttons. It's
used to get user confirmation for an action.

```javascript
const confirmed = confirm("Are you sure you want to proceed?");
if (confirmed) {
// Proceed with the action
} else {
// Cancel the action
}
```

8. **Browser Developer Tools**: In addition to JavaScript's built-in methods, you can use browser
developer tools to inspect and log output directly from your code. This is especially useful for
debugging.
8. List the logical operators in JavaScript with description.
Logical AND (&&):
Description: Returns true if both operands are true.
Example: true && true returns true, while true && false returns false.
Logical OR (||):
Description: Returns true if at least one of the operands is true.
Example: true || false returns true, and false || false returns false.
Logical NOT (!):
Description: Returns the opposite boolean value of the operand. If the operand is true, it returns
false, and if the operand is false, it returns true.
Example: !true returns false, and !false returns true.
Logical XOR (Exclusive OR) (^):
Description: Returns true if exactly one of the operands is true, but not both.
Example: true ^ false returns true, while true ^ true and false ^ false return false.
9. Write JavaScript to create a object "student" with properties roll number name, branch,
year. Delete branch property and display remaining properties of student object.

// Create a student object
const student = {
rollNumber: 12345,
name: "John Doe",
branch: "Computer Science",
year: 2023
};
// Display the original student object
console.log("Original Student Object:");
console.log(student);
// Delete the 'branch' property
delete student.branch;
// Display the modified student object with the 'branch' property removed
console.log("Student Object after Deleting 'branch' Property:");
console.log(student);
Sample paper
10. State the use of dot syntax in JavaScript with the help of suitable example.

It is the most common way to interact with object properties. Here's how the dot syntax is used with
a suitable example:
const person = {
firstName: "John",
lastName: "Doe",
age: 30,
greet: function () {
console.log(`Hello, my name is ${this.firstName} ${this.lastName}, and I am ${this.age} years old.`);
}
};
console.log(person.firstName); console.log(person.age);
person.greet();
11. List and explain Logical operators in JavaScript
12. Give syntax of and explain the use of “with” statement/clause in JavaScript using suitable
example.
The with statement in JavaScript is used to simplify the process of accessing multiple properties or
methods of an object. It allows you to work with the properties and methods of an object without
explicitly referencing the object's name each time. However, it's important to note that the with
statement is considered bad practice and is not recommended for use in modern JavaScript due to
potential issues and performance concerns. It can lead to ambiguities and make code harder to
maintain.
with (object) {
// Code that uses properties or methods of the object
}
Example:
const person = {
firstName: "John",
lastName: "Doe",
age: 30
};
with (person) {
console.log(firstName);
console.log(lastName);
console.log(age);
}
console.log(person.firstName);
console.log(person.lastName);
console.log(person.age);
13. State use of getters and setters
14. Write a JavaScript that displays first 20 even numbers on the document window.
<!DOCTYPE html>
<html>
<head>
<title>Display Even Numbers</title>
</head>
<body>
<h1>First 20 Even Numbers:</h1>
<p id="evenNumbers"></p>

<script>
let evenNumbersText = '';
for (let i = 2; i <= 40; i += 2) {
evenNumbersText += i + ', ';
}
document.getElementById('evenNumbers').textContent = evenNumbersText;
</script>
</body>
</html>
4 marks
15. Write a javascript program to validate user accounts for multiple set of user ID and
password (using swith case statement).

const validUserAccounts = {
user1: 'password1',
user2: 'password2',
user3: 'password3',
};

// Prompt the user for their user ID and password


const enteredUserID = prompt('Enter your User ID:');
const enteredPassword = prompt('Enter your Password:');

// Use a switch statement to validate the user account


switch (enteredUserID) {
case 'user1':
if (enteredPassword === validUserAccounts.user1) {
alert('Login successful for User 1.');
} else {
alert('Incorrect password for User 1.');
}
break;
case 'user2':
if (enteredPassword === validUserAccounts.user2) {
alert('Login successful for User 2.');
} else {
alert('Incorrect password for User 2.');
}
break;
case 'user3':
if (enteredPassword === validUserAccounts.user3) {
alert('Login successful for User 3.');
} else {
alert('Incorrect password for User 3.');
}
break;
default:
alert('Invalid User ID. Please try again.');
}
16. Explain getter and setter properties in Java script with suitable example
17. Write a JavaScript for loop that will iterate from 1 to 15. For each iteration, it will
check if the current number is odd or even and display a message to the screen.

Sample Output:

“1 is odd"
"2 is even”

for (let i = 1; i <= 15; i++) {
if (i % 2 === 0) {
console.log(`${i} is even`);
} else {
console.log(`${i} is odd`);
}
}
18.

// Get the student names and marks from the table.


const studentNames = ["Sumit", "Kalpesh", "Amit", "Tejas", "Abhishek"];
const studentMarks = [80, 77, 88, 93, 65];
let totalMarks = 0;
for (let i = 0; i < studentMarks.length; i++) {
totalMarks += studentMarks[i];
}
const averageMarks = totalMarks / studentMarks.length;
const grade = (averageMarks >= 90) ? "A" :
(averageMarks >= 80) ? "B" :
(averageMarks >= 70) ? "C" :
(averageMarks >= 60) ? "D" :
"E";
for (let i = 0; i < studentNames.length; i++) {
console.log(`Student name: ${studentNames[i]}`);
console.log(`Average marks: ${averageMarks}`);
console.log(`Grade: ${grade}`);
}
Write a JavaScript that displays first 20 even numbers on the document window.

<html>
<head>
<title>Even Numbers</title>
</head>
<body>
<script>
var i = 0;
while (i < 20) {
document.write(i + "<br>");
i += 2;
}
</script>

</body>
</html>

Differentiate between For-loop and For-in loop.

Sample paper
19. Write a JavaScript program which compute, the average marks of the following students
Then, this average is used to determine the corresponding grade.

The grades are computed as follows:


20. Write a JavaScript program that will display list of student in ascending order
according to the marks & calculate the average performance of the class.

Student Marks
Name
Amit 70
Sumit 78
Abhishek 71

<script>
// Create an array of students
var students = [
{ name: "Amit", marks: 70 },
{ name: "Sumit", marks: 78 },
{ name: "Abhishek", marks: 71 },
];

// Sort the students by marks


students.sort((a, b) => a.marks - b.marks);

// Calculate the average performance of the class


var avgPerformance =
students.reduce((acc, student) => acc + student.marks, 0) / students.length;

// Print the list of students and the average performance


document.write("List of students in ascending order according to the marks:");
for (var student of students) {
document.write(`${student.name} ${student.marks}`);
}
document.write("Average performance of the class:", avgPerformance);
</script>

21. Explain Object creation in JavaScript using 'new' keyword with adding properties and
methods with example.
<html>
<head>
<title>HTML Form</title>
<script language="javascript" type="text/javascript">
function selection()
{
var x ="You selected: ";
with(document.forms.myform)
{
if(a.checked == true)
{
x+= a.value+ " ";
}
if(b.checked == true)
{
x+= b.value+ " ";
}
if(o.checked == true)
{
x+= o.value+ " ";
}
if(p.checked == true)
{
x+= p.value+ " ";
}
if(g.checked == true)
{
x+= g.value+ " ";
}
document.write(x);
}
}
</script>
</head>
<body>
<form name="myform" action="" method="post">
Select Your Favourite Fruits: <br>
<input type="checkbox" name="a" value="Apple">Apple
<input type="checkbox" name="b" value="Banana">Banana
<input type="checkbox" name="o" value="Orange">Orange
<input type="checkbox" name="p" value="Pear">Pear
<input type="checkbox" name="g" value="Grapes">Grapes
<input type="reset" value="Show" onclick="selection()">
</form>
</body>
</html>
</form>
</body>
</html>

22. Write a program to print sum of even numbers between 1 to 100 using for loop
// Initialize the sum variable to 0.
let sum = 0;
// Iterate from 2 to 100, adding each even number to the sum variable.
for (let i = 2; i <= 100; i += 2) {
sum += i;
}
// Print the sum of even numbers.
console.log(`The sum of even numbers between 1 to 100 is: ${sum}`);
23. Write a javascript to checks whether a passed string is palindrome or not. 6 Marks.
<script language="javascript" type="text/javascript">
function isPalindrome(str) {
// Remove non-alphanumeric characters and convert the string to lowercase
str = str.replace(/[^A-Za-z0-9]/g, '').toLowerCase();
return str === str.split('').reverse().join('');
}
// Test the function with some examples
const input1 = "racecar";
const input2 = "hello";
document.write(`"${input1}" is a palindrome: ${isPalindrome(input1)}`);
document.write(`"${input2}" is a palindrome: ${isPalindrome(input2)}`);

</script>
Unit – II Array, Function and String (Marks :14)

Remember level Understand level Apply level

2 4 8

2marks
1. Write a JavaScript that initializes an array called “Fruits” with names of five fruits. The script
then displays the array in a message box.

// Initialize an array called "Fruits" with names of five fruits
const Fruits = ["Apple", "Banana", "Orange", "Grapes", "Strawberry"];

// Display the array in a message box


alert("Fruits Array: " + Fruits);
2. Write a JavaScript function that checks whether a passed string is palindrome or not
 function isPalindrome(str) {
str = str.replace(/[^A-Za-z0-9]/g, '').toLowerCase();
return str === str.split('').reverse().join('');
}
// Test the function
console.log(isPalindrome("racecar")); // true
console.log(isPalindrome("hello")); // false
3. Write a JavaScript function to count the number of vowels in a given string.
 function countVowels(str) {
const vowels = str.match(/[aeiouAEIOU]/g);
return vowels ? vowels.length : 0;
}
// Test the function
console.log(countVowels("Hello, World!")); // 3 (e, o, o)
4. Write a function that prompts the user for a color and uses what they select to set the
background color of the new webpage opened.
 function setBackgroundColor() {
const color = prompt("Enter a color:");
document.body.style.backgroundColor = color;
}
5. Develop JavaScript to convert the given character to Unicode and vice versa.
//Char to unicode
const char = 'A';
const unicode = char.charCodeAt(0);
console.log(`Unicode of ${char}: ${unicode}`);
//Unicode to char
const unicode = 65;
const char = String.fromCharCode(unicode);
console.log(`Character of Unicode ${unicode}: ${char}`);

6. State and explain any two properties of array object


length: Property that indicates the number of elements in an array.
constructor: Property that specifies the function that creates an array object.

7. Write a JavaScript function to insert a string within a string at a particular position
 function insertString(str, toInsert, pos) {
// Check if the position is valid.
if (pos < 0 || pos > str.length) {
return str;
}

// Split the string into two parts at the specified position.


const parts = str.split("");
parts.splice(pos, 0, toInsert);

// Join the parts back together.


return parts.join("");
}
8. Write a Java script that initializes an array called flowers with the names of 3 flowers. The
script then displays array elements.’

const flowers = ["Rose", "Tulip", "Lily"];
console.log(flowers);
9. Write Javascript to call function from HTML.
<head>
<script>
function greet() {
alert("Hello, world!");
}
</script>
</head>
<body>
<button onclick="greet()">Greet me!</button>
</body>
10. Write the use of chatAt() and indexof() with syntax and example.
charAt(index): Returns the character at the specified index in a string.
const str = "Hello";
const char = str.charAt(1); // Returns 'e'
indexOf(substring): Returns the index of the first occurrence of a substring in a string.

const str = "Hello, world!";


const index = str.indexOf("world"); // Returns 7
11. Write a Java Script code to display 5 elements of array in sorted order.
const numbers = [3, 1, 5, 2, 4];
numbers.sort((a, b) => a - b);
const sortedFirst5 = numbers.slice(0, 5);
console.log(sortedFirst5);
12. State the use of method in JavaScript with the help of suitable example.
13. Write a program using sort method of array object.
14. Write a JavaScript that initializes an array called Colors with the names of Colors and
display the array elements.
15. Explain calling a function with arguments in JavaScript with example.

Sample paper
16. Describe all the tokens of the following statements :
i. document.bgColor
ii. document.write()
17. State the use of following methods.
i. charCodeAt()
ii. fromCharCode()

18. Differentiate between prompt() and alert() methods.


19. State and explain any two properties of array object.
20. Write a JavaScript that initializes an array called “Fruits” with names of five fruits. The script
then displays the array in a message box.
21. Enlist and explain the use of any two Intrinsic JavaScript functions.
22. Write syntax of and explain prompt method in JavaScript with the help of suitable example
23. Write a JavaScript function to insert a string within a string at a particular position
24. Write a JavaScript function that checks whether a passed string is palindrome or not.
4 marks
25. Differentiate between concat() and join() methods of array object.
26. Write a javascript program to demonstrate java intrinsic function.
27. Write and explain a string functions for converting string to number and number to
string.
28. Differentiate between concat( ) & join( ) methods of array object.
29. Write a JavaScript function to check the first character of a string is uppercase or not.
30. Write a JavaScript function to merge two array & removes all duplicate values.
31. Write a JavaScript program that will remove the duplicate element from an array.
32. Write a javascript function that accepts a string as a parameter and find the length of
the string. Write the use of chatAt() and indexof() with syntax and example
33. Differentiate between concat() and join() methods of array object
34. Write a JavaScript that will replace following specified value with another value in
string.
a. String = “I will fail” Replace “fail” by “pass”
35. Write a Java Script code to display 5 elements of array in sorted order
36. Write the use of charCodeAt() and from CharCode() method with syntax and example.
37. Write JavaScript code to perform following operations on string. (Use split() method)
Input String: "Sudha Narayana Murthy"
Display output as
First Name: Sudha
Middle Name: Narayana
Last Name: Murthy
38. Explain splice() method of array object with syntax and example.
39. Differentiate between push() and join() method of array object with respect to use,
syntax, return value and example.
40. Differentiate between concat() and join() methods of array object.

Sample paper
41. Write a JavaScript function to count the number of vowels in a given string
42. Write a JavaScript that find and displays number of duplicate values in an array.
43. Write a function that prompts the user for a color and uses what they select to set the
background color of the new webpage opened .
44. Develop JavaScript to convert the given character to Unicode and vice versa.

6 marks
45. Write a javascript function to generate Fibonacci series till user defined limit.
46. Develop javascript to convert the given character to unicode and vice-versa.

Unit -III Form and Event Handling (Marks: 10)

Remember level Understand level Apply level

2 4 4
2 marks

1. Explain following form events : (i) onmouseup (ii) onblur


2. Enlist any four mouse events with their use.
3. Write a Java script to design a form to accept values for user ID & password.
4 marks
4. Write a javascript program to calculate add, sub, multiplication and division of two
number (input from user). Form should contain two text boxes to input numbers of
four buttons for addition, subtraction, multiplication and division.
5. Write a JavaScript function that will open new window when the user will clicks on
the button.
.
6. Write a Java script to modify the status bar using on MouseOver and on MouseOut
with links. When the user moves his mouse over the links, it will display “MSBTE” in
the status bar. When the user moves his mouse away from the link the status bar will
display nothing.

6 marks

7. Write HTML code to design a form that displays two textboxes for accepting two
numbers, one textbox for accepting result and two buttons as ADDITION and
SUBTRACTION. Write proper JavaScript such that when the user clicks on any one
of the button, respective operation will be performed on two numbers and result will
be displayed in result textbox.
8. Write a javascript to create option list containing list of images and then display
images in new window as per selection.
9. Explain how to evaluate Radiobutton in JavaScript with suitable example
10. Write a HTML script which displays 2 radiobuttons to the users for fruits and
vegetable and 1 option list. When user select fruits radio button option list should
present only fruits names to the user & when user select vegetable radio button option
list should present only vegetable names to the user.

11. Describe how to evaluate checkbox selection. Explain with suitable example.
12. Write a HTML script which displays 2 radio buttons to the users for fruits and vegetables
and 1 option list. When user select fruits radio button option list should present only fruits
names to the user & when user select vegetable radio button option list should present only
vegetable names to the user
13. Write HTML script that will display dropdown list containing options such as Red, Green,
Blue & Yellow. Write a JavaScript program such that when the user selects any options. It
will change the background colour of webpage.
Sample paper
14. Write HTML Script that displays textboxes for accepting Name, middlename, Surname of the user
and a Submit button. Write proper JavaScript such that when the user clicks on submit button i) all
texboxes must get disabled and change the color to “RED”. and with respective labels. 3 ii) Constructs
the mailID as .@msbte.com and displays mail ID as message. (Ex. If user enters Rajni as name and
Pathak as surname mailID will be constructed as rajni.pathak@msbte.com)
UNIT-IV Cookies and Browser Data (Marks: 08)

Remember level Understand level Apply level

2 2 4

2 marks

1. Differentiate between between session cookies and persistent cookies.

Sample paper
2. Write a JavaScript that identifies a running browser.
3. State and explain what is a session cookie?
4 marks
4. Design a webpage that displays a form that contains an input for user name and
password. User is prompted to enter the input user name and password and password
become value of the cookies. Write the javascript function for storing the cookies.
5. Write a javascript program to create read, update and delete cookies.
6. Explain how to create and read Persistent Cookies in JavaScript with example.
7. Write HTML code to design a form that displays two buttons START and STOP. Write
a JavaScript code such that when user clicks on START button, real time digital clock
will be displayed on screen. When user clicks on STOP button, clock will stop
displaying time. (Use Timer methods)

Sample paper
8. Write a JavaScript that displays all properties of window object. Explain the code .
9. Write the syntax of and explain use of following methods of JavaScript Timing Event. a.
setTimeout() b. setInterval()
10. Generate college Admission form using html form tag .
11. Write a JavaScript that creates a persistent cookies of Itemnames. Write appropriate HTML
script for the same.
6 marks
12. Describe, how to read cookie value and write a cookie value. Explain with example
13. Write a webpage that displays a form that contains an input for username & password.
User is prompted to enter the input & password & password becomes the value of the
cookie.
14. Write a JavaScript function for storing the cookie. It gets executed when the password
changes.
15. Write a webpage that diplays a form that contains an input for Username and password. User is
prompted to enter the input and password and password becomes value of the cookie. Write
The JavaScript function for storing the cookie . It gets executed when the password changes.

UNIT-V Regular Expression, Rollover and Frames (Marks :14)

Remember level Understand level Apply level

2 6 6
4 marks
1. Describe regular expression. Explain search () method used in regular expression with
suitable example.
2. Explain text rollover with suitable example.
3. Write a Java script that displays textboxes for accepting name & email ID & a submit
button. Write Java script code such that when the user clicks on submit button (1) Name
Validation (2) Email ID validation
4. Write a script for creating following frame structure

FRAME 1

FRAME 2 FRAME 3
• FRUITS
• FLOWERS
• CITIES

Write the JavaScript code for below operations:


Name, Email & Pin Code should not be blank.
Pin Code must contain 6 digits & it should not be accept any characters.
2 marks
5. Write a javascript program to changing the contents of a window.
6. Write a javascript syntax to accessing elements of another child window.
4MARKS
7. Write a JavaScript program that will display current date in DD/MM/YYYY format.
8. Describe Quantifiers with the help of example.
9. Describe text Rollover with the help of example
10. Write HTML code to design a form that displays textboxes for accepting UserID and
Aadhar No. and a SUBMIT button. UserID should contain 10 alphanumeric characters
and must start with Capital Letter. Aadhar No. should contain 12 digits in the format nnnn
nnnn nnnn. Write JavaScript code to validate the UserID and Aadhar No. when the user
clicks on SUBMIT button
11. Write a Java script that displays textboxes for accepting name & email ID & a submit
button. Write Java script code such that when the user clicks on submit button (1) Name
Validation (2) Email ID validation

Sample paper
12. Construct regular expression for validating the phone number in following format only : (nnn)-
nnnn-nnnn OR nnn.nnnn.nnnn
13. Design the frameset tag for following frame layout :

FRAME1

FRAME2

FRAME3

4 marks

Sample paper
14. State what is regular expression. Explain its meaning with the help of a suitable example.
15. Write a webpage that accepts Username and adharcard as input texts. When the user enters
adhaarcard number ,the JavaScript validates card number and diplays whether card number is valid or
not. (Assume valid adhaar card format to be nnnn.nnnn.nnnn or nnnn-nnnn-nnnn).
16 .Write a JavaScript function to check whether a given value is valid IP value or not
17.Write a JavaScript program to create rollover effect for three images.
18.Write a javascript program to validate email ID of the user using regular expression.
19.Describe regular expression. Explain search () method used in regular expression with
suitable example.
20.Explain test() and exec() method of Regular Expression object with example.
21.Explain open() method of window object with syntax and example.
22.Write a javascript program to design HTML page with books information in tabular
format, use rollovers to display the discount information
23.Explain text and image rollover with suitable example,

6 marks

24. Write a JavaScript for creating following frame structure :

Chapter 1 & Chapter 2 are linked to the webpage Ch1 HTML & Ch2.html respectively. When
user click on these links corresponding data appears in FRAME3.

Sample paper

25. Write a javascript to open a new window and the new window is having two frames. One
frame containing button as “click here !”, and after clicking this button an image should open
in the second frame of that child window.

26.When user clicks MUSIC button,music.html webpage will appear in Frame 3. When user
clicks DANCE button,dance.html webpage will appear in Frame 4.Write a script for creating
following frame structure Frame I contains three buttons SPORT, MUSIC and DANCE that
will perform following action: When user clicks SPORT button, sport.html webpage will
FRAME 1
appear in Frame 2.

SPORT MUSIC DANCE

FRAME 2 FRAME 3 FRAME 4


<!DOCTYPE html>
<html>
<head>
<title>Frame Structure</title>
</head>
<frameset rows="20%,80%">

<frame src="index.html" name="Frame1">


<frameset cols="33%,33%,33%">
<frame src="sport.html" name="Frame2">
<frame src="music.html" name="Frame3">
<frame src="dance.html" name="Frame4">
</frameset>
</frameset>

</html>

Unit 6: Menus, Navigation and Webpage Protection (Marks :12)

Remember level Understand level Apply level

2 4 6

1. Create a slideshow with the group of three images, also simulate next and previous
transition between slides in your Java script
2. Write a Javascript to create a pull – down menu with three options [Google,
MSBTE, Yahoo] once the user will select one of the options then user will be
redirected to that site.
3. Describe frameworks of JavaScript & its application.
4. Describe how to link banner advertisement to URL with example.
5. Develop a JavaScript program to create Rotating Banner Ads.
6. Write HTML script that will display dropdown list containing options such as
Red, Green, Blue and Yellow. Write a JavaScript program such that when the
user selects any options. It will change the background colour of webpage.
7. Write a JavaScript for the folding tree menu.
2 marks

8. State any four properties of Navigator object.


9. State the method to put message in web browser status bar?
4marks

10. Write a javascript program to link banner advertisements to different URLs.


11. Describe browser location object.
12. Write a JavaScript program that will create pull-down menu with three options. Once
the user will select the one of the options then user will redirected to that website.
13. State any two properties and methods of location object.
14. What is Status bar and how to display moving message on the status line of a window
using JavaScript?
15. Write a JavaScript program that creates a scrolling text on the status line of a window.

Sample paper

16. List ways of protecting your web page and describe any one of them.
17. Create a slideshow with the group of three images, also simulate next and previous
transition between slides in your Java Script.

18.Write a Java script to modify the status bar using on MouseOver and on MouseOut with
links. When the user moves his mouse over the link, it will display “MSBTE” in the status
bar. When the user moves his mouse away from the link the status bar will display nothing.

6marks

19. Describe how to link banner advertisement to URL with example.


20. Write a JavaScript to create a pull-down menu with four options [AICTE, DTE, MSBTE,
GOOGLE]. Once the user will select one of the options then user will be redirected to that
site.
21. Develop a JavaScript program to create Rotating Banner Ads.
22. Write a javascript to create a pull-down menu with three options [Google, MSBTE,
Yahoo] once the user will select one of the options then user will be redirected to that site
23. Write a JavaScript for the folding tree menu
24. Write a javascript program to create a silde show with the group of six images, also
simulate the next and previous transition between slides in your javascript.
6 marks

Sample paper

24. Write HTML Script that displays dropdownlist containing options NewDelhi, Mumbai,
Bangalore. Write proper JavaScript such that when the user selects any options
corresponding description of about 20 words and image of the city appear in table which
appears below on the same page.
25. Create a slideshow with the group of four images, also simulate the next and previous
transition between slides in your JavaScript.

You might also like