0% found this document useful (0 votes)
2 views2 pages

Class IX-Comp. Sc.-Assignment On JavaScript (Chpater 3 and 4 Till Arithmetic Operators)

This document is an assignment for Class IX Computer Science focusing on JavaScript, covering topics such as variables, operators, and functions. It includes questions on the advantages of JavaScript, code examples, and error identification in JavaScript syntax. Additionally, it requires students to write scripts for various practical applications involving calculations and conversions.

Uploaded by

Farrah Naushein
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Class IX-Comp. Sc.-Assignment On JavaScript (Chpater 3 and 4 Till Arithmetic Operators)

This document is an assignment for Class IX Computer Science focusing on JavaScript, covering topics such as variables, operators, and functions. It includes questions on the advantages of JavaScript, code examples, and error identification in JavaScript syntax. Additionally, it requires students to write scripts for various practical applications involving calculations and conversions.

Uploaded by

Farrah Naushein
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CLASS IX

COMPUTER SCIENCE
ASSIGNMENT - JAVASCRIPT (CHAPTER 3 AND 4 TILL arithmetic operators)
1. What is Jscript?
2. Write any two advantages of JavaScript.
3. JavaScript code can be inserted within the HEAD as well as the BODY tags
4. Differentiate between internal JavaScript file and external JavaScript file.
5. Also specify the advantage of using an external JavaScript file.
6. Write the code in HTML to load an external JavaScript file “proj.css”. 3.
7. What are variables used for? Are the variables ABC and Abc same in JavaScript?
Justify your answer.
8. What is the role of comments in JavaScript?
9. Why do we use toString( ) method? Give an example.
10. Which of the following are valid/ invalid variables? If invalid, give reasons also.
a. 9class
b. result
c. first name
d. .xyz
e. first_position
11. Write the equivalent expressions for the following in JavaScript.
a) volume = 3.14 r 3 b) z = 2t + 2y c) s = b2 – 4ac
12. Why is typecasting required.? Differentiate between parseInt() and parseFloat()
conversion functions with an example.
13. Write JavaScript statements (syntax) to
a. Assign the value present in variable “X” to variable “Y”
b. Print the string “Monday”
c. Increase the value of the variable “pr” by 1.
d. Increase the value of the variable “counter” by 3
14. Predict the output
a. alert(parseFloat(34));
b. alert(parseInt(34.5));
c. alert(parseFloat(“25aa”));
d. alert(parseInt(“aa25”));
15. Predict the output
<script language="JavaScript">
var a = "534";
var b = 53;
var c = parseInt(a)+b;
var d = a+b;
document.write("parseInt(a)+b = "+c);
document.write(" a+b = "+d);
</script>

1
16. Predict the output
var a=20; var b= 40; var c=”90”; var d;

document.write(a+b);

document.write(a.toString()+b);

document.write(a.toString()+c);

document.write(parseInt(c)+b);

document.write(parseFloat(a)+parseInt(b));

document.write(a.toString()+b.toString());

document.write(a+d);
17. Identify the errors in the following code and rewrite the correct code. Also underline
the changes made.
<Script language=javascript>
var m; n
10=m;
n=M+*2;
var c=Prompt(“enter a number”);
Document.display(“the value stored in c is “+ c);
<script>

18. Write scripts for the following


a. Accept the length and breadth of a rectangle and print the area and
perimeter of the rectangle.
b. Accept the weight of a person in kilograms and convert it into grams and
milligrams.
c. Accept the marks of 5 subjects (out of 25) for a student. Calculate and print
the total marks and the percentage secured.
d. Accept the price of a book and the discount given. Calculate the discounted
price of the book.

You might also like