You are on page 1of 2

CLASS IX

COMPUTER SCIENCE

CHAPTER 4 - WORKSHEET

1. What is the difference between / and % operator?


2. What is concatenation operator? How is it used?
3. Differentiate between relational and logical operators.
4. Explain ternary operator with an example.
5. What is the difference between = and = =?
6. Which operator is used to join or add string variables or text values together?
7. Give an example of ternary operator.
8. If a=5 and b=10, then predict the output of the following(each statement is
independent of each other)-

1. a<b
2. a==b
3. a+=b
4. a - -
5. b%a
6. ++b
7. a*=b
8. a<2 &&b<8
9. !(a==b)
10. a>=10

9. Evaluate the following expressions-

1. X= 3*4/2+5/5+9-1
2. Y= 2+3*5-1
3. 8<3 && 7>1
4. !(7= =7)
5. Z= 5/2+3

10. Write a program to accept four numbers from the user, find its product and display
the result.

11. Write a program to find the remainder when 10 is divided by 3.

12.Write a program to input the side of a square and display its area and perimeter.

a. Accept a number and display if it is even or odd.(using ternary conditional operator).

1. Write the equivalent expressions for the following :


a) volume = 3.14 r 3 b) z = 2t + 2y c) s = b2 – 4ac
2. 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
3.
1. Predict the output 2. Predict the output
k=50; var j=5;
var j = - - k + 2  k ; var x=6;
k=k+60; document.write(5 * ++j +x);
document.write(“the value of k is”+k); document.write(5 * j++ %6);
document.write(“<pre>”+”\n the value of j
is”+j +”</pre>”);

3. Predict the output 4. What will be displayed after

var a=20; var b= 40; var c=”90”; executing the following code
var d; document.write(“<pre>”+”O

document.write(a+b); bject \n Oriented \n \t Programming


“+”</pre>”);
document.write(a.toString()+b);

document.write(a.toString()+c); 5. Predict the values of i, j , k , z


var i=60,j=20, k= -5;
document.write(parseInt(c)+b); i=k+i;
i - -;
document.write(parseFloat(a)+parseIn j=j+25;
t(b)); z=i*j+k;
document.write(a.toString()+b.toStrin
g());

document.write(a+d);

You might also like