In Advanced JavaScript Class 12 Exercise Solutions, students will find chapter-wise answers explained in simple and exam-oriented language. These exercise solutions are prepared strictly according to the latest MSBSHSE syllabus, making them useful for theory exams, practical exams, and viva preparation. Students can use this page for quick revision, understanding coding logic, and improving JavaScript programming skills.
Advanced Javascript Class 12 Exercise Solutions
Q.1 Fill in the blanks.
1. _ script resides on server computer.
Show Answer ⟶2. _ statement is used to jump out of loop.
3. _ defines logical structure of document.
Show Answer ⟶4. _ property of window object returns Boolean value indicating whether window is closed or not.
5. _ event occurs when an element looses its focus.
Show Answer ⟶Q.2. State whether given statement is true or false.
1. JavaScript is case sensitive language.
Show Answer ⟶2. Math.ceil() function is used to return the nearest integer less than or equal to given number.
Show Answer ⟶3. MAX_VALUE property of number object returns smallest possible value.
Show Answer ⟶4. getDay() method of Date object returns month in number.
Show Answer ⟶5. onKeydown event occurs when user moves mouse pointer.
Show Answer ⟶Q.3. Multiple choice questions. Select one correct answer.
1. JavaScript is _ language.
a) Compiled
b) Interpreted
c) Both a and b
d) None of the above
2. Select correct method name of String object _ .
a) charAt()
b) characterAt()
c) valueAt()
d) lengthAt()
3. _ method displays message box with Ok and Cancel button.
a) Confirm()
b) Alert()
c) both a and b
d) None of these
4. We can declare all types of variables using keyword _ .
a) var
b) dim
c) variable
d) declare
5. Trace ouput of following JavaScript code.
var str=”Information Technology”;
document.write(str. lastIndexOf(“o”);
a) 18
b) 19
c) 20
d) 21
Q.4. Multiple choice questions. Select two correct answer.
1. Valid two methods of Date object are _______ and _______.
a) setTime()
b) getValidTime()
c) getTime()
d) setValidTime()
2. Properties of document object are ______ and ______.
a) URL
b) title
c) name
d)status
3. ______ and _______ are event /event handler used with text object in JavaScript.
a) onBlur
b) onMove
c) onFocus
d) onAction
Q.5 Multiple choice questions. Select three correct answers.
1. Select three correct methods of window object _
a) write()
b) alert()
c) writeln()
d) close()
e) open()
f) charAt()
2. JavaScript features are , _______ and _______ .
a) supports event based facilities
b) is platform dependent language
c) case insensitive scripting language
d) provide inbuilt objects
e) can handle date and time effectively
f) requires special software to run
d) provide inbuilt objects,
e) can handle date and time effectively
3. Inbuilt objects in JavaScript are , ________ and _______ .
a) Time
b) Date
c) Inheritance
d) Array
e) Number
f) function
Q.6 Explain the following.
1. What are similarities and differences between client side scripting and server side scripting.
Answer:
| Server Side Scripting | Client Side Scripting |
|---|---|
| Runs at the backend on the web server. Source code is hidden from the user. | Runs at the frontend in the browser. Code is visible to the user. |
| More secure because the code is hidden on the client side. | Less secure because users can view/modify the script. |
| Requires communication with the server to process requests. | Executes directly in the browser without server interaction. |
| The server-side scripting language involves such as PHP, ASP.net, Ruby, ColdFusion, Python, C# etc. are server side scripting languages. | The client-side scripting language involves languages such as HTML5, JavaScript etc. |
| Customizes web pages, handles dynamic content, database operations, authentication. | Used mainly for input validation, UI interactivity, animations, reducing server load. |
| Special software (web server software) is required to execute server-side script. | Client side scripts requires web browser as an interface. |
2. Briefly explain features of JavaScript.
Answer: The features of JavaScript are:
- Interpreted language – runs directly in browser.
- Object-based – supports built-in objects like Date, Array, Math.
- Event-driven – responds to user actions (click, keypress).
- Platform-independent – runs on any browser without special software.
- Supports dynamic content – can change HTML/CSS on the fly.
- Case-sensitive – variable names and keywords must match exactly.
- Supports functions – reusable blocks of code.
3. Explain switch case conditional statement in JavaScript with example.
Answer: The switch case conditional is used to check multiple conditions depend on the same variable, the example of JavaScript are:
switch(expression) {
case value1:
// code block
break;
case value2:
// code block
break;
default:
// code block
}Q.7 Write event driven JavaScript program for the following.
1. Display Addition, multiplication, division and remainder of two numbers, which were accepted from user.
Answer:
<!DOCTYPE html>
<html>
<body>
<script>
function calculate() {
var a = parseInt(prompt("Enter first number:"));
var b = parseInt(prompt("Enter second number:"));
document.write("Addition = " + (a+b) + "<br>");
document.write("Multiplication = " + (a*b) + "<br>");
document.write("Division = " + (a/b) + "<br>");
document.write("Remainder = " + (a%b));
}
</script>
<button onclick="calculate()">Calculate</button>
</body>
</html>2. Display number sequence from 100 to 150 in following format. (100 101 102………….150)
Answer:
<!DOCTYPE html>
<html>
<body>
<script>
function showSequence() {
for(var i=100; i<=150; i++) {
document.write(i + " ");
}
}
</script>
<button onclick="showSequence()">Show Sequence</button>
</body>
</html>3. Find and display factorial of given number.
Answer:
<!DOCTYPE html>
<html>
<body>
<script>
function showSequence() {
for(var i=100; i<=150; i++) {
document.write(i + " ");
}
}
</script>
<button onclick="showSequence()">Show Sequence</button>
</body>
</html>4. Accept any string from user and count and display number of vowels occurs in it.
Answer:
<!DOCTYPE html>
<html>
<body>
<script>
function factorial() {
var n = parseInt(prompt("Enter a number:"));
var fact = 1;
for(var i=1; i<=n; i++) {
fact *= i;
}
document.write("Factorial of " + n + " = " + fact);
}
</script>
<button onclick="factorial()">Find Factorial</button>
</body>
</html>Disclaimer: We have provide you with the accurate handout of “Advanced Javascript Class 12 Exercise Solutions“. If you feel that there is any error or mistake, please contact me at anuraganand2017@gmail.com. The above study material present on our websites is for education purpose, not our copyrights.
All the above content and Screenshot are taken from Information Technology Class 12 Textbook and MSBSHSE (HSC) Support Material which is present in MSBSHSE (HSC) website, This Textbook and Support Material are legally copyright by Maharashtra State Bureau of Textbook Production and Curriculum Research, Pune. We are only providing a medium and helping the students to improve the performances in the examination.
Images and content shown above are the property of individual organisations and are used here for reference purposes only. To make it easy to understand, some of the content and images are generated by AI and cross-checked by the teachers. For more information, refer to the official website.