Kerala Plus Two Computer Science Chapter 6 Client Side Scripting Using JavaScript Questions and Answers

Download Kerala Board Solutions for Class 12 Computer Science Chapter 06 Client Side Scripting Using JavaScript

Access comprehensive textbook solutions for Chapter 06 Client Side Scripting Using JavaScript using the official curriculum guides for Class 12 Computer Science. Designed to align with the 2026-27 Kerala Board standards, these detailed answers help students reinforce core academic concepts.

Access Kerala Board Solutions and Answers

Access the complete solution PDF for Class 12 Computer Science below. Regular practice with these targeted textbook answers builds familiarity with standard question patterns and helps secure higher marks in final school evaluations.

One Mark Questions and Answers

Question 1: Which one of the following is the most correct? JavaScript is used mostly at the
a) client side
b) server side
c) client side and server side

Answer:

a) client side

Exam Tips:

a) Note the word "mostly": JavaScript is mainly a client-side scripting language that runs in the browser.

 

Question 2: Name the tag that is used to embed scripts in a web page.

Answer:

<SCRIPT>

Exam Tips:

a) Write the tag with angle brackets, and remember that it needs a closing tag </SCRIPT>.

 

Question 3: In JavaScript, a variable is declared using the keyword ______.

Answer:

var

Exam Tips:

a) Write the keyword in lowercase; JavaScript is case sensitive, so VAR is not valid.

 

Question 4: ______ are small programs embedded in HTML pages.

Answer:

Scripts

Exam Tips:

a) Scripts are written inside the <SCRIPT> tag of an HTML page.

 

Question 5: Who developed JavaScript?

Answer:

Brendan Eich

Exam Tips:

a) Spell the name correctly: Brendan Eich (he developed it at Netscape).

 

Question 6: ______ are the scripts that are executed by the browser.

Answer:

Client scripts

Exam Tips:

a) Browser = client side, so scripts run by the browser are client scripts (for example, JavaScript).

 

Question 7: ______ are the scripts that are executed by the web server.

Answer:

Server scripts

Exam Tips:

a) Examples of server scripts are ASP, JSP, PHP and Perl.

 

Question 8: ______ is a platform independent script.

Answer:

JavaScript

Exam Tips:

a) JavaScript works in almost every browser on any operating system, so it is platform independent.

 

Question 9: ______ is a platform dependent script.

Answer:

VBScript

Exam Tips:

a) VBScript (from Microsoft) works mainly with Internet Explorer on Windows, which is why it is platform dependent.

 

Question 10: ______ makes the tags meaningful.

Answer:

Attribute

Exam Tips:

a) Attributes give extra information to a tag, for example language and src in the <SCRIPT> tag.

 

Question 11: The ______ attribute specifies the name of the scripting language used.

Answer:

Language

Exam Tips:

a) Example: <SCRIPT Language="JavaScript">. The type attribute can also be used for the same purpose.

 

Question 12: State True or False: The identifiers are case sensitive.

Answer:

True

Exam Tips:

a) In JavaScript, total, Total and TOTAL are three different identifiers.

 

Question 13: Which part of the browser executes JavaScript?

Answer:

JavaScript engine

Exam Tips:

a) Every browser has its own JavaScript engine that executes the script code.

 

Question 14: Pick the odd one out.
a) Google Chrome
b) Internet Explorer
c) Mozilla Firefox
d) C++

Answer:

d) C++. It is a programming language; the others are web browsers.

Exam Tips:

a) In odd-one-out questions, always state the reason along with the answer.

 

Question 15: A group of code with a name is called ______.

Answer:

Function

Exam Tips:

a) A function is written once and can be called many times by its name.

 

Question 16: To declare a function, the keyword ______ is used.

Answer:

function

Exam Tips:

a) Write the keyword in lowercase: function show() { ... }

 

Question 17: A function contains a function ______ and function ______.

Answer:

header, body

Exam Tips:

a) The header has the keyword function, the name and the brackets; the body is the code inside the curly braces { }.

 

Question 18: State True or False: Even though a function is defined within the body section, it will not be executed if it is not called.

Answer:

True

Exam Tips:

a) Defining a function only creates it; it runs only when it is called (for example, show(); or through an event like onClick).

 

Question 19: Write down the purpose of the following code snippet.
function print()
{
  document.write("Welcome to JS");
}

Answer:

This code defines a function named print(). When the function is called, it displays the string "Welcome to JS" on the screen (in the browser window).

Exam Tips:

a) Mention that the text appears only when the function is called, since a function does not run by itself.

 

Question 20: Which one of the following is not a data type in JavaScript?
a) Number
b) String
c) Boolean
d) Time

Answer:

d) Time

Exam Tips:

a) The three basic data types in the textbook are number, string and boolean; there is also the special value undefined.

 

Question 21: The ______ keyword is used to declare a variable in JavaScript.

Answer:

var

Exam Tips:

a) No data type is written while declaring a variable; JavaScript decides the type from the value stored.

 

Question 22: The ______ function is used to return the data type.

Answer:

typeof()

Exam Tips:

a) typeof returns the type as a string, such as "number", "string", "boolean" or "undefined".

 

Question 23: ______ is a special data type to represent variables that are not defined using var.

Answer:

undefined

Exam Tips:

a) Write it in lowercase exactly as "undefined".

 

Question 24: Pick the odd one out.
a) +
b) -
c) %
d) ==

Answer:

d) ==. It is a relational operator; the others are arithmetic operators.

Exam Tips:

a) Do not confuse == (comparison) with = (assignment).

 

Question 25: Pick the odd one out.
a) &&
b) ||
c) !
d) %

Answer:

d) %. It is an arithmetic operator; the others are logical operators.

Exam Tips:

a) The three logical operators are && (AND), || (OR) and ! (NOT).

 

Question 26: Pick the odd one out.
a) <
b) >
c) ==
d) !

Answer:

d) !. It is a logical operator; the others are relational operators.

Exam Tips:

a) Relational operators compare two values; ! works on a single value, so it is a unary logical operator.

 

Question 27: Consider the following declaration:
var b;
Which of the following values can be used for the variable b as a boolean value?
a) true
b) TRUE
c) True
d) FALSE

Answer:

a) true. Boolean values are case sensitive and must be written in lowercase (true or false).

Exam Tips:

a) TRUE, True, FALSE and False are not boolean values in JavaScript; only true and false are.

 

Question 28: Predict the output of the following.
var a, b;
a = "0480";
b = 2828159;
document.write(a + b);

Answer:

The output is 04802828159.
Since a is a string ("0480"), the + operator joins (concatenates) it with the number 2828159. The result is a string, not a number.

Exam Tips:

a) If either operand of + is a string, the result is a string (concatenation), not an addition.

 

Question 29: Predict the output.
var x, y;
x = "8";
y = 3;
document.write(x + y);

Answer:

The output is the string 83, because adding a string to a number means concatenation.

Exam Tips:

a) Do not write 11; x is in quotes, so it is a string and the values are joined.

 

Question 30: Which of the following methods is used to display a message (dialog box) on the screen?
a) alert()
b) isNaN()
c) toUpperCase()
d) toLowerCase()

Answer:

a) alert()

Exam Tips:

a) alert() shows a message box with an OK button, while document.write() writes into the page itself.

 

Question 31: Raju wants to convert lowercase text to uppercase text. Which function should be used?

Answer:

toUpperCase()

Exam Tips:

a) Note the capital U and C in toUpperCase(); the function name is case sensitive.

 

Question 32: Christy wants to convert uppercase text to lowercase text. Which function should be used?

Answer:

toLowerCase()

Exam Tips:

a) Write it as one word with capital L and C: toLowerCase().

 

Question 33: Andrea wants to check whether a value is a number or not. Which of the following functions is used for that?
a) isNumb()
b) isNaN()
c) isNotNumb()
d) isNotNumber()

Answer:

b) isNaN()

Exam Tips:

a) NaN means "Not a Number"; isNaN() returns true if the value is not a number and false if it is a number.

 

Question 34: Predict the output of the following code snippet.
var x = "HIGHER SECONDARY";
alert(x.charAt(4));

Answer:

It displays a message box with the character 'E', which is at the fifth position (index 4 + 1).

Exam Tips:

a) Character positions start from 0: H=0, I=1, G=2, H=3, E=4. Count carefully from 0.

 

Question 35: Read the following three statements regarding JavaScript.
a) JavaScript can be used at the client side for data validation.
b) JavaScript statements are case sensitive.
c) JavaScript can be used for creating web pages.
d) All the three statements are correct.

Answer:

d) All the three statements are correct.

Exam Tips:

a) Data validation at the client side is one of the most important uses of JavaScript; it saves a trip to the server.

 

Question 36: Write the output of the following web page.
<HTML>
<BODY>
<SCRIPT language="JavaScript">
document.write("welcome");
</SCRIPT>
welcome
</BODY>
</HTML>

Answer:

welcome welcome

Exam Tips:

a) The first "welcome" is written by the script and the second is plain HTML text in the body, so both appear.

 

Question 37: The following web page accepts a string from a text box, converts it into uppercase and displays it on the screen. Complete the missing portion in the page.
<HTML>
<HEAD>
<SCRIPT language="JavaScript">
function show()
{
  var x, y;
  x = ..........;
  y = x.toUpperCase();
  alert(y);
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="form1">
Enter a string
<INPUT type="text" name="text1">
<INPUT type="button" value="Show" onClick="show()">
</FORM>
</BODY>
</HTML>

Answer:

document.form1.text1.value

Exam Tips:

a) Read a text box value in the order document.formName.textboxName.value.
b) The form and text box names are case sensitive; use them exactly as given in the HTML.

 

Question 38: Name the attribute of the <SCRIPT> tag that is used to include an external JavaScript file in a web page.

Answer:

src

Exam Tips:

a) Example: <SCRIPT src="check.js"></SCRIPT>. External JavaScript files have the extension .js.

 

Two Mark Questions and Answers

Question 39: A JavaScript code has the following three variables and values.
x = "Script";
y = "3";
z = "2";
Match the following.

AB
x.lengthfalse
isNaN(x)5
isNaN(y)6
y + ztrue
32

Answer:

AB
x.length6
isNaN(x)true
isNaN(y)false
y + z32

Exam Tips:

a) "Script" has 6 characters; "3" can be converted to a number, so isNaN(y) is false.
b) y and z are strings, so y + z joins them to give "32", not 5.

 

Question 40: "Placing JavaScript in an external file has some advantages." Do you agree with this statement? Why?

Answer:

Yes, I agree.
Scripts can be written and saved as a separate file with the extension .js. The advantages are that the same file can be used in many HTML files, and it can increase the speed of page loading.

Exam Tips:

a) Begin with "Yes, I agree" and then give the reasons; a yes/no question needs a clear stand.
b) Mention the .js extension and the src attribute used to link the file.

 

Question 41: Explain the difference between the statements
document.write("welcome");
and
alert("welcome");

Answer:

document.write() is a JavaScript command used to print content in the browser window. So document.write("welcome") prints "welcome" in the browser window (on the web page).
alert() is a built-in function used to display a message in a separate dialog box. So alert("welcome") shows the message "welcome" in a separate pop-up window.

Exam Tips:

a) The key difference is where the message appears: inside the page (document.write) or in a separate message box (alert).

 

Question 42: Is it necessary to use Language="JavaScript" in the <SCRIPT> tag to specify JavaScript code? Why?

Answer:

No, it is not necessary. If the language attribute is not specified, the browser takes JavaScript as the default scripting language.

Exam Tips:

a) Give both the answer ("No") and the reason (JavaScript is the default) to get both marks.

 

Question 43: Write the output of the following web page.
<HTML>
<BODY>
<SCRIPT language="JavaScript">
function show()
{
  document.write("welcome to JavaScript");
}
</SCRIPT>
</BODY>
</HTML>

Answer:

It will not display anything on the screen. The code only defines a function, and a function does nothing unless it is invoked (called).

Exam Tips:

a) Always check whether the function is actually called before predicting the output.

 

Question 44: Write the output of the following web page.
<HTML>
<BODY>
<SCRIPT language="JavaScript">
function show()
{
  document.write("welcome to JavaScript<br>");
}
show();
show();
</SCRIPT>
</BODY>
</HTML>

Answer:

The output is:
welcome to JavaScript
welcome to JavaScript
The function is called twice, so the message is displayed 2 times, each on a new line because of the <br> tag.

Exam Tips:

a) Count the number of function calls; each call runs the function body once.
b) The <br> inside the string makes each message start on a new line.

 

Question 45: Among the following, identify the data types used in JavaScript.
int, float, number, char, boolean, long

Answer:

Only two of them, number and boolean, are data types used in JavaScript.

Exam Tips:

a) int, float, char and long are C++ data types; JavaScript uses a single type, number, for all numbers.

 

Question 46: Write the output of the following web page and justify your answer.
<HTML>
<BODY>
<SCRIPT language="JavaScript">
var x, y, z;
x = "10";
y = "20";
z = x + y;
document.write(z);
</SCRIPT>
</BODY>
</HTML>

Answer:

Output: 1020
Justification: x = "10" and y = "20" are both string variables because the values are in quotes. So x + y joins (concatenates) the two strings, and it displays 1020.

Exam Tips:

a) Values in quotes are strings even if they look like numbers; the output is not 30.
b) The question says "justify", so explain the string concatenation along with the output.

 

Question 47: What do you mean by scripts? Explain.

Answer:

Scripts are small programs embedded in HTML pages. The <SCRIPT> tag is used to write scripts.
The attributes used with it are:
Type - to specify the scripting language
Src - to specify the source (external) file
There are two types of scripts:
1. Client scripts - These are scripts executed by the browser. Examples: VBScript, JavaScript, etc.
2. Server scripts - These are scripts executed by the web server. Examples: ASP, JSP, PHP, Perl, etc.
The languages used to write scripts are known as scripting languages.

Exam Tips:

a) Include the definition, the <SCRIPT> tag and the two types of scripts with examples.
b) Keep client (browser) and server (web server) examples in the correct groups.

 

Question 48: Suppose you have written a JavaScript function named checkData(). You want to execute the function when the mouse pointer is just moved over the button. How will you complete the following to do this?
<INPUT Type="button" ______ = "checkData()">

Answer:

<INPUT Type="button" onMouseEnter="checkData()">

Exam Tips:

a) onMouseEnter runs when the pointer moves onto an object; onClick needs a click, so it is not correct here.

 

Three Mark Questions and Answers

Question 49: Categorise the following as UpperCamelCase or lowerCamelCase and explain.
a) DateOfBirth
b) dateOfJoining
c) timeOfJoining
d) PlaceOfBirth

Answer:

CamelCase:
An identifier cannot contain special characters such as a space, so a single word is formed by joining multiple words, with the first letter of the joined words in capitals. This naming method is called CamelCase.
It is of two types:
1. UpperCamelCase: The first character of each word is capitalised.
2. lowerCamelCase: The first character of each word, except the first word, is capitalised.
UpperCamelCase: DateOfBirth, PlaceOfBirth
lowerCamelCase: dateOfJoining, timeOfJoining

Exam Tips:

a) Look only at the first letter: capital means UpperCamelCase, small means lowerCamelCase.
b) Write the definition of both types before classifying, as the question also asks you to explain.

 

Question 50: Explain how JavaScript works.

Answer:

Every browser has a JavaScript engine. When a web page contains JavaScript code, the code is passed to the JavaScript engine, which executes it. If there is no script, the page is processed without the help of the script engine. Hence an HTML file without JavaScript loads faster than one with JavaScript code.

Exam Tips:

a) Use the term "JavaScript engine" in your answer; it is the key point.
b) Add the conclusion that pages without scripts are processed faster.

 

Question 51: Write down the various data types used in JavaScript.

Answer:

1. Number: Any number (whole or fractional), with or without a sign.
Examples: +1977, -38.0003, -100, 3.14157, etc.
2. String: A combination of characters enclosed within double quotes.
Examples: "BVM", "student@example.com", etc.
3. Boolean: It can have only the value true or false. It is case sensitive, which means TRUE or FALSE cannot be used.

Exam Tips:

a) Give one example for each data type.
b) For boolean, mention that the values are lowercase true and false.

 

Question 52: Explain how a variable is declared in JavaScript.

Answer:

To store values, a variable must be declared using the keyword var. There is no need to specify the data type.
Syntax:
var <variable name1> [, <variable name2>, <variable name3>, ...];
Here the square brackets show the optional part.
Example:
var x, y, z;
x = 11;
y = "BVM";
z = false;
Here x is of number type, y is of string type and z is of boolean type.

Exam Tips:

a) Write the syntax and an example; both are expected in a three-mark answer.
b) Point out that the data type is decided by the value assigned, not at declaration.

 

Question 53: What are the different ways to add scripts to a web page?

Answer:

There are three different ways to add scripts:
1. Inside the <BODY> section: Scripts can be placed inside the <BODY> section.
2. Inside the <HEAD> section: Scripts can be placed inside the <HEAD> section. This is the most widely accepted method.
3. External JavaScript file: Scripts can be written and saved as a separate file with the extension .js. The advantage is that the same file can be used in many HTML files, and it can increase the speed of page loading.

Exam Tips:

a) Name all three places (BODY, HEAD, external .js file) with one line each.
b) Mention that an external file is linked using the src attribute of the <SCRIPT> tag.

 

Question 54: Create a web page that checks whether a student has passed or not.

Answer:

<HTML>
<HEAD>
<TITLE>JavaScript - Passed or not</TITLE>
<SCRIPT Language="JavaScript">
function check()
{
  var score;
  score = document.frmCheck.txtscore.value;
  if (score < 30)
    alert("The student is failed");
  else
    alert("The student is passed");
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="frmCheck">
Enter the score
<INPUT type="text" name="txtscore">
<BR>
<INPUT type="button" value="Check" onClick="check()">
</FORM>
</BODY>
</HTML>

Exam Tips:

a) Never put a semicolon right after if (...) or else; it ends the statement and breaks the logic.
b) Take care to match the form name and text box name in document.frmCheck.txtscore.value with the HTML.

 

Question 55: Create a web page to display the squares of the first 10 numbers.

Answer:

<HTML>
<HEAD>
<TITLE>JavaScript - Squares</TITLE>
</HEAD>
<BODY>
<SCRIPT Language="JavaScript">
var i, s;
for (i = 1; i <= 10; i++)
{
  s = i * i;
  document.write(s);
  document.write("<br>");
}
</SCRIPT>
</BODY>
</HTML>

Exam Tips:

a) The loop runs from 1 to 10, and the output will be 1, 4, 9, ... 100, each on a new line.
b) Write "<br>" inside quotes in document.write() to move to the next line.

 

Question 56: Create a web page to display even numbers up to 10.

Answer:

<HTML>
<HEAD>
<TITLE>JavaScript - Even numbers</TITLE>
</HEAD>
<BODY>
<SCRIPT Language="JavaScript">
var i;
i = 2;
while (i <= 10)
{
  document.write(i);
  document.write("<br>");
  i += 2;
}
</SCRIPT>
</BODY>
</HTML>

Exam Tips:

a) Start from 2 and increase by 2 (i += 2) so that only even numbers are printed: 2, 4, 6, 8, 10.
b) In a while loop, the update statement must be inside the loop body, or the loop will never end.

 

Question 57: The following web page is used to show "Passed" or "Failed" based on a mark. A mark less than 30 is considered as failed. There are some errors in the code. Correct them.
<HTML>
<BODY>
<SCRIPT src="JavaScript">
var m;
m = 55;
if(m<30)
document.print("Passed");
document.print("Failed");
<SCRIPT>
</BODY>
</HTML>

Answer:

<HTML>
<BODY>
<SCRIPT language="JavaScript">
var m;
m = 55;
if (m < 30)
  document.write("Failed");
else
  document.write("Passed");
</SCRIPT>
</BODY>
</HTML>
Corrections made:
1. src="JavaScript" is changed to language="JavaScript".
2. document.print() is changed to document.write().
3. The else keyword is added, and the messages are placed correctly: a mark less than 30 shows "Failed", otherwise "Passed".
4. The closing tag <SCRIPT> is corrected to </SCRIPT>.

Exam Tips:

a) List each correction separately after the corrected code; examiners award marks per error found.
b) Check the logic too: marks below 30 must give "Failed", not "Passed".

 

Five Mark Questions and Answers

Question 58: Consider the following declarations.
var a, b, c, d;
a = "BVM";
b = 100;
c = true;
d = 3.14157;
Predict the output of the following.
1. document.write(typeof(a));
2. document.write(typeof(b));
3. document.write(typeof(c));
4. document.write(typeof(d));
5. document.write(typeof(e));

Answer:

1. string
2. number
3. boolean
4. number
5. undefined

Exam Tips:

a) Both whole numbers (100) and fractional numbers (3.14157) are of type number in JavaScript.
b) e was never declared, so typeof(e) gives undefined.

 

Question 59: Create a web page to print the day of a week.

Answer:

<HTML>
<HEAD>
<TITLE>JavaScript - Day</TITLE>
<SCRIPT Language="JavaScript">
function checkData()
{
  var n, ans;
  n = Number(document.frmCheck.txtday.value);
  switch (n)
  {
    case 1: ans = "Sunday"; break;
    case 2: ans = "Monday"; break;
    case 3: ans = "Tuesday"; break;
    case 4: ans = "Wednesday"; break;
    case 5: ans = "Thursday"; break;
    case 6: ans = "Friday"; break;
    case 7: ans = "Saturday"; break;
    default: ans = "Invalid";
  }
  alert(ans);
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="frmCheck">
Enter a number (1-7)
<INPUT type="text" name="txtday">
<BR>
<INPUT type="button" value="Test" onClick="checkData()">
</FORM>
</BODY>
</HTML>

Exam Tips:

a) Each case label ends with a colon (:), and each case needs break; or the next cases will also run.
b) Number() converts the text box value (a string) into a number so that it matches the case values.
c) Include a default case to handle numbers outside 1 to 7.

 

Question 60: What is an operator? Explain in detail.

Answer:

Operators are symbols used to perform operations.
1. Arithmetic operators:
They are used to perform addition (+), subtraction (-), multiplication (*), division (/), modulus (% - gives the remainder), increment (++) and decrement (--). +, -, *, / and % are binary operators, while ++ and -- are unary operators.
Example: If x = 10 and y = 3, then

x + yx - yx * yx / yx % y
137303.333 (approx.)1

If x = 10, document.write(++x); prints 10 + 1 = 11.
If x = 10, document.write(x++); prints 10 itself (x becomes 11 afterwards).
If x = 10, document.write(--x); prints 10 - 1 = 9.
If x = 10, document.write(x--); prints 10 itself (x becomes 9 afterwards).
2. Assignment operators:
If a = 10 and b = 3, then the statement a = b sets the value of a to that of b, i.e. it sets a to 3.
Arithmetic assignment operators are also called short hands. If X = 10 and Y = 3, then

Arithmetic Assignment ExpressionEquivalent Arithmetic ExpressionThe value of X becomes
X += YX = X + Y13
X -= YX = X - Y7
X *= YX = X * Y30
X /= YX = X / Y3.333 (approx.)
X %= YX = X % Y1

3. Relational (comparison) operators:
They are used to compare two values and return either true or false.
Example: If X = 10 and Y = 3, then

X < YX <= YX > YX >= YX == YX != Y
falsefalsetruetruefalsetrue

4. Logical operators:
AND (&&) and OR (||) are binary operators and NOT (!) is a unary operator. They are used to combine relational operations, and they give either true or false.
Both operands must be true to get a true value in the case of the AND (&&) operation. If X = true and Y = false, then

X && XX && YY && XY && Y
truefalsefalsefalse

At least one of the operands must be true to get a true value in the case of the OR (||) operation. If X = true and Y = false, then

X || XX || YY || XY || Y
truetruetruefalse

NOT (!) reverses the value. If X = true and Y = false, then

!X!Y
falsetrue

5. String addition operator (+):
This is also called the concatenation operator. It joins (concatenates) two strings to form one string.
Example:
var x, y, z;
x = "BVM HSS ";
y = "Kalparamba";
z = x + y;
Here the variable z becomes "BVM HSS Kalparamba".
Note: If both operands are numbers, the + operator gives a number as the result; otherwise it gives a string. See the table below.

Operand 1 data typeOperand 2 data typeOperationResultant data type
numbernumber+ (addition)number
numberstring+ (addition)string
stringnumber+ (addition)string
stringstring+ (addition)string

Exam Tips:

a) For a five-mark answer, cover all five groups of operators with one example or table each.
b) Know the difference between prefix (++x: change first, then use) and postfix (x++: use first, then change).
c) In JavaScript, 10 / 3 gives a fractional answer (3.333...), not 3 as in C++ integer division.

 

Question 61: Write down the control structures used in JavaScript.

Answer:

In general, a program is executed sequentially. The normal order of execution can be changed by using control structures.
1. if statement
Simple if - Syntax:
if (test expression)
{
  statements;
}
First the test expression is evaluated. If it is true, the statement block is executed; otherwise it is not.
if-else - Syntax:
if (test expression)
{
  statement block1;
}
else
{
  statement block2;
}
First the test expression is evaluated. If it is true, statement block1 is executed; otherwise statement block2 is executed.
2. switch
It is a multiple branch statement. Its syntax is:
switch (expression)
{
  case value1: statements; break;
  case value2: statements; break;
  case value3: statements; break;
  ...
  default: statements;
}
First the expression is evaluated, and the statements of the matching case value are selected.
Example:
switch (n)
{
  case 1: document.write("Sunday"); break;
  case 2: document.write("Monday"); break;
  case 3: document.write("Tuesday"); break;
  case 4: document.write("Wednesday"); break;
  case 5: document.write("Thursday"); break;
  case 6: document.write("Friday"); break;
  case 7: document.write("Saturday"); break;
  default: document.write("Invalid");
}
3. for loop
A loop is used when a statement has to be executed more than once. The for loop is an entry-controlled loop. Its syntax is:
for (initialisation; test expression; update)
{
  body of the for loop;
}
4. while loop
The while loop is also an entry-controlled loop. Its syntax is:
loop variable initialisation;
while (expression)
{
  body of the loop;
  update loop variable;
}
Here the loop variable must be initialised before the while loop. Then the expression is evaluated, and only if it is true is the body of the loop executed. The loop variable must be updated inside the body. The body of the loop is executed until the expression becomes false.

Exam Tips:

a) Write the syntax of each control structure; syntax carries a large share of the marks.
b) Use JavaScript statements such as document.write() in examples, not C++ cout.
c) Mention that for and while are entry-controlled loops.

 

Question 62: Write down the different mouse events used in JavaScript.

Answer:

The different events and their descriptions are given below.

EventDescription
onClickIt occurs when the user clicks on an object using the mouse.
onMouseEnterIt occurs when the mouse pointer is moved onto an object.
onMouseLeaveIt occurs when the mouse pointer is moved out of an object.
onKeyDownIt occurs when the user presses a key on the keyboard.
onKeyUpIt occurs when the user releases a key on the keyboard.

Of these, onClick, onMouseEnter and onMouseLeave are mouse events; onKeyDown and onKeyUp are keyboard events.

Exam Tips:

a) Write event names exactly (onClick, onMouseEnter, onMouseLeave), with "on" at the start.
b) Present the answer as a two-column table of event and description.

 

Question 63: Create a web page that displays the capital of a state.

Answer:

<HTML>
<HEAD>
<TITLE>JavaScript</TITLE>
<SCRIPT Language="JavaScript">
function capital()
{
  var n, ans;
  n = document.frmCapital.cboState.selectedIndex;
  switch (n)
  {
    case 0: ans = "Thiruvananthapuram"; break;
    case 1: ans = "Bengaluru"; break;
    case 2: ans = "Chennai"; break;
    case 3: ans = "Mumbai"; break;
  }
  document.frmCapital.txtCapital.value = ans;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="frmCapital">
<CENTER>
State
<SELECT size=1 name="cboState">
  <OPTION>Kerala</OPTION>
  <OPTION>Karnataka</OPTION>
  <OPTION>Tamil Nadu</OPTION>
  <OPTION>Maharashtra</OPTION>
</SELECT>
<BR>
Capital
<INPUT type="text" name="txtCapital">
<BR>
<INPUT type="button" value="Show" onClick="capital()">
</CENTER>
</FORM>
</BODY>
</HTML>

Exam Tips:

a) selectedIndex starts from 0, so the first option (Kerala) is case 0.
b) Use the same spelling and case for the select box name in both the HTML and the script (cboState).

 

Computer Science Class 12 Curriculum Solutions: Chapter 06 Client Side Scripting Using JavaScript

Chapter Exercise Answers for Class 12 Computer Science

Access structured Kerala Board textbook solutions for Chapter 06 Client Side Scripting Using JavaScript. Designed in alignment with the latest academic curriculum for Class 12 Computer Science, these answers cover all end-of-chapter exercises to support daily learning and homework completion.

Detailed Answer Guides for Chapter 06 Client Side Scripting Using JavaScript

Each solution includes detailed reasoning to foster genuine comprehension of Chapter 06 Client Side Scripting Using JavaScript concepts. Reviewing these step-by-step breakdowns allows learners to master both analytical and descriptive questions expected in school evaluations.

Complete Preparation Kit for Class 12 Exams

These resources act as an effective roadmap for daily homework tasks and independent study. Supplement your review of Chapter 06 Client Side Scripting Using JavaScript with official sample papers and interactive practice tests available on our platform free of charge.

FAQs

Where can I find the latest Kerala Plus Two Computer Science Chapter 6 Client Side Scripting Using JavaScript Questions and Answers for the 2026-27 session?

The complete and updated Kerala Plus Two Computer Science Chapter 6 Client Side Scripting Using JavaScript Questions and Answers is available for free on StudiesToday.com. These solutions for Class 12 Computer Science are as per latest Kerala Board curriculum.

Are the Computer Science Kerala Board solutions for Class 12 updated for the new 50% competency-based exam pattern?

Yes, our experts have revised the Kerala Plus Two Computer Science Chapter 6 Client Side Scripting Using JavaScript Questions and Answers as per 2026 exam pattern. All textbook exercises have been solved and have added explanation about how the Computer Science concepts are applied in case-study and assertion-reasoning questions.

How do these Class 12 Kerala Board solutions help in scoring 90% plus marks?

Toppers recommend using Kerala Board language because Kerala Board marking schemes are strictly based on textbook definitions. Our Kerala Plus Two Computer Science Chapter 6 Client Side Scripting Using JavaScript Questions and Answers will help students to get full marks in the theory paper.

Do you offer Kerala Plus Two Computer Science Chapter 6 Client Side Scripting Using JavaScript Questions and Answers in multiple languages like Hindi and English?

Yes, we provide bilingual support for Class 12 Computer Science. You can access Kerala Plus Two Computer Science Chapter 6 Client Side Scripting Using JavaScript Questions and Answers in both English and Hindi medium.

Is it possible to download the Computer Science Kerala Board solutions for Class 12 as a PDF?

Yes, you can download the entire Kerala Plus Two Computer Science Chapter 6 Client Side Scripting Using JavaScript Questions and Answers in printable PDF format for offline study on any device.