Balbharati Maharashtra State Board Class 11 Information Technology Solutions Practicals Skill Set 3 Client Side Scripting (JavaScript) Textbook Exercise Questions and Answers.

Maharashtra State Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript)

SOP 1: Create a JavaScript program for the following using appropriate variables, JavaScript inbuilt functions, and control structures.

  • To accept an integer and display the result by multiplying it with 3.
  • To accept two integers and display a larger number of them.
  • To check whether the user entered number is positive or negative.

Answer:
To accept integer and display the result by multiplying it with 3.
<!DOCTYPE html>
<head>
<title>To accept integer and display the result by multiplying it with 3.</title>
</head>
<body>
<script language=”javascript”> var a,no,ans;
a=prompt(Enter any value’);
no=parseInt(a);
ans=no*3;
document.
write(“The answer is :”+ans);
</script>
</body>
</html>

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 1

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 1.1

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript)

To accept two integers and display larger number of them.
<!DOCTYPE html>
<head>
<title>To accept two integers and display larger number of them.</title>
</head>
<body>
<script language=”javascript”>
var a,b;
a=prompt(‘Enter first value’);
b=prompt(‘Enter second value’);
if(a>b)
document.write(“a is large number than b “);
else
document. write(“b is large number than a”);
</script>
</body>
</html>

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 1.2

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 1.3

To check whether, user entered number is positive or negative.
<!DOCTYPE html>
<head>
<title>To check whether, user entered number is positive or negative</title>
</head>
<body>
<script language=”javascript”>
var a,no;
a=prompt(‘Enter any number’);
no=parseInt(a);
if(no>0)
document.write(“Number is Positive”);
else
document.write(“Number is Negative”);
</script>
</body>
</html>

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 1.4

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 1.5

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 1.6

SOP 2: Create a JavaScript program for the following using appropriate variables, JavaScript inbuilt functions, and control structures.

  • To accept two positive or negative numbers and check whether they are equal or not.
  • To accept a number and display the square of it.
  • To check whether the accepted integer is multiple of 3 or multiple of 7.

Answer:
To accept two positive or negative numbers and check whether they are equal or not.
<!DOCTYPE html>
<head>
<title>program3</title>
</head>
<body>
<script language=”javascript”> var no1,no2;
no1=prompt(‘Enter first number’);
no2=prompt(‘Enter Second number’);
if(no1==no2)
document.write(“Both are equal”);
else
document.write(“Given numbers are not equal”);
</script>
</body>
</html>

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript)

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 2

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 2.1

To accept number and display square of it.
<!DOCTYPE html>
<head>
<title>To accept number and display square of it</title>
</head>
<body>
<script language-’j avascript”>
var no,sqr;
no=prompt(‘Enter Any number’);
sqr=no*no;
document, write (“The Square is=”+sqr);
</script>
</body>
</html>

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 2.2

To check whether the accepted integer is multiple of 3 or multiple of 7.
<!DOCTYPE html>
<html>
<head>
<title>To check whether the accepted integer is multiple of 3 or multiple of 7.</title>
</head>
<body>
<script language=JavaScript>
var a;
a=prompt(“Enter your first interger / number”);
if(a%3==0 | | a%7==0)
alert(“multiple of 3 or 7”);
else
alert(“not a multiple of 3 or 7”);
</script>
</body>
</html>

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 2.3

SOP 3: Create a JavaScript program for the following using appropriate variables, JavaScript inbuilt string functions, and control structures.

  • To accept a string and calculate its length.
  • To accept a string and display it in lowercase and uppercase.
  • To check whether the length of the string is 4 or greater.

Answer:
To accept a string and calculate its length.
<!DOCTYPE html>
<head>
<title>program8</title>
</head>
<body>
<script language=”javascript”>
var a;
a=prompt(‘Enter string’);
document.write(“The length is=”+a.length);
</script>
</body>
</html>

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript)

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 3

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 3.1

To accept string and display it into lowercase and uppercase.
<!DOCTYPE html>
<head>
<title> To accept string and display it into lowercase and uppercase</title>
</head>
<body>
<script language=”javascript”>
var a;
a=prompt(‘Enter any string’);
document.write(“<br>Entering Strings “+a);
document.write(“<br>Lowercase=”+a.toLowerCase());
document.writeln(“<br>Uppercase=”+a.toUpperCase());
</script>
</body>
</html>

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 3.2
To check whether the length of string is 4 or greater.
<!DOCTYPE html>
<html>
<head>
<title> JavaScript</title>
</head>
<body>
<script language=JavaScript>
var a,b;
a=prompt(“Enter your text”);
b=a.length;
if(b=4 || b>=4)
alert(‘‘your length is 4 or greater”);
else
alert(“your text length is below 4”);
</script>
</body>
</html>

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 3.3

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 3.4

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript)

SOP 4: Create event-driven JavaScript programs for the following using appropriate variables, JavaScript inbuilt functions, and control structures.
To accept numbers and validate if the given value is a number or not by clicking on the button.
Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 4.4
To calculate the addition and division of two numbers.
Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 4.5
Answer:
To accept number and validate if the given value is a number or not by click
<!DOCTYPE html>
<html>
<head>
<title> To accept number and validate if the given value is a number or not by clicking on the button.
</title>
</head>
<script language-’JavaScript”>
function display()
{
var a,b;
a=form1.t1;value;
if(a>=0)
alert(“Value is a number”+” “+a);
else
alert(“Value is a string”+” “+a);
}
</script>
</head>
</body>
<form name=form1>
Enter Value: <Input type=text name=t1><br><br>
<Input type=button value=Check onClick=”display()”>
</form>
</body>
</html>

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 4

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 4.1

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 4.2

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript)

To calculate addition and division of two numbers.
<!DOCTYPE html>
<head>
<title>To calculate addition and division of two numbers.</title>
<script langauge=”javascript”>
function add()
{
var a,b,result;
a=f1.t1.value;
b=f1.t2.value;
result=parselnt(a)+parselnt(b);
document.write(“The Addition is =”+result);
}
function div()
{
var a,b,d;
a=f1.t1.value;
b=f1.t2.value;
d=parselnt(a)/parselnt(b);
document.write(“The Divide is =”+d);
}
</script>
</head>
<body>
<form name=”f1”>
1st Number : <input type=”text” name=”t1”><br>
2nd Number : <input type=”text” name=”t2”><br>
<input type=”button” value=”Addition” name=”b1” onClick=”add()”>
<input type=”button” value=”Division” name=”b2” onClick=”div()”>
</form>
</body>
</html>

Maharashtra Board Class 11 Information Technology Practicals Skill Set 3 Client Side Scripting (JavaScript) SOP 4.3