Icse Class 9 Hy Computer Application 2019
Icse Class 9 Hy Computer Application 2019
Icse Class 9 Hy Computer Application 2019
For the next 50 Kg Rs. 7/Km (iii) pure and mixed expression
Display the details in the following format: (v) int and double datatype
Weight Kilometer travelled Total cost 2 a) Define a function check that accepts a (2x5=10)
number.
_______ _____________ _________
b) Why is a class called an object factory?
9. Create a class named 'Numbers' having the following
functions - c) Which statement is optional in a switch block?
What is its function?
factor( ) - this function inputs a number and displays
the factors of a number given by the user. d) ln the following expression identify the operator(s)
and the operand(s):
Example : Input 6 Output : 1
x = a + b - c + d;
2
e) What is compilation? Why is it necessary?
3
3 a) Write the java expression for the following: (2)
6
X = a2 + b2
factorial() - this function inputs a number and displays
the factorial of a number given by the user b) What will be the value of c when
4 1
c) Fill in the blanks in the following code to get the h) Convert the following into an if block: (2)
following output:
f=(v==100)?0.1*v; 0.2*v;
OUTPUT: 1 2 2 3 3 34444
SECTION B (15 X 4 = 60 marks)
CODE: for(i=1; i<= ____i++)
Each program should be written using variable description /
{ for(j=___ j<=___; j++) Mnemonic codes such that the logic of the program is clearly
depicted.
{System.ou.print(___);}}
ATTEMPT ANY FOUR QUESTIONS
d) Convert the following if block to switch block
4. Write a program to input a number and check whether it
if(a==2) (3)
is a prime number or not. (A prime number is one which
System.out.println("two"); has two factors 1 and the number itself).
else
5. Write a program to input the radius of a circle, length and
if(s==3) breadth of a rectangle, side of a square and a choice.
System.out.println("three"); lf choice is 1 calculate and print the area of a circle
else (radius2), if choice is 2 calculate and print the area of a
square (side*side), if choice is 3 calculate and print the
System.out.println("it's a number');
area of a rectangle(length*breadth).
e) if a = 50 and b = 40 find the value of (2)
6. Write a program to print the following patterns using two
g if g=a++ - -a + b++ +(b/2)
functions(use loop construct)
f) Give the output of the following for loop : (2)
Pattern1()- 12345
for(i=100;i>=0;i=i/10) 1234
System.out.printlnl(i); 123
System.out.println("program over'); 12
g) State whether the following statements are true or 1
false : (3) Pattern2()
(i) The two type of values that a boolean datatype 1
returns are true and false.
11
(ii) The function Math.pow(2,2) returns 2 and the 111
function Math.sqrt(2) returns 4.
1111
(iii) The statement x=(a>10) ? 25: 45; is an example
of ternary operator;
2 3