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

Icse Class 9 Hy Computer Application 2019

This document contains questions from a half-yearly examination for Class 9 Computer Applications. It includes questions on programming concepts like functions, loops, operators, and if/else statements. It also contains programming questions that require writing code to check if a number is prime, calculate area of shapes, and print patterns using loops. Students are asked to write Java code to solve problems related to basic programming constructs.
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)
119 views2 pages

Icse Class 9 Hy Computer Application 2019

This document contains questions from a half-yearly examination for Class 9 Computer Applications. It includes questions on programming concepts like functions, loops, operators, and if/else statements. It also contains programming questions that require writing code to check if a number is prime, calculate area of shapes, and print patterns using loops. Students are asked to write Java code to solve problems related to basic programming constructs.
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

7.

a) Write a program having two functions :


SumSeries()- to find the sum of the series : Half Yearly Examination - 2018-19
s=1 +x2-x3+x4-x5.....xn where x and n are given by COMPUTER APPLICATIONS
the uer
Class : IX
HCF _LCM() - to find the hcf and Icm of two Time : 2 Hrs. + 15 min. Full Marks : 100
numbers given by the user.
8. Write a program to calculate the charge of a transport 1 a) Give one difference and one example of each of the
company according to the following criteria: following: (2x5=10)

Weight Rate (i) switch and if block

Upto first 100 Kg Rs. 10/Km (ii) break and continue

For the next 50 Kg Rs. 7/Km (iii) pure and mixed expression

Above 150 Kg Rs. 5/km (iv) empty and infinite loop

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

Example : Input : 3 Output : 6 (1 X 2 X 3 = 6) (i) a = 5.0 and b= 2.0


(ii) a = 5 and b= 2
where c =(a/b)*2;

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

You might also like