9 Computer Applications (Theory)
9 Computer Applications (Theory)
CLASS IX
Question No 1
Question No 2
System.out.println(Math.round(–8.5));
System.out.println(Math.ceil(–8.5));
System.out.println(Math.floor(8.91));
(i) int y = 8;
y+ = ++y + y– – + – –y; [2]
(2)
(c) Convert the following to if-else construct and find the output if m = 4: [3]
switch(m)
case 1:
case 3:
Question No 3
int i = 1, d = 5;
do
{
d = d*2;
System.out.println(d);
i++;
} while(i<=5);
String s = (a > 0)? (a%2==0)? “Positive even” : “Positive odd” : “Negative no.”;
(3)
Question No 4
(a) Name the primitive data type in Java that is: [2]
(i) a 64-bit integer and is used when we need a range of values wider than those
provided by int.
(b) Predict the return data type of r and n from the following code snippet: [2]
int p; float m;
r = p + m;
n = m/3.0* (Math.pow(4,3));
(c) Predict the output of the following and how many times the following loops will be
executed: [3 + 3 = 6]
(i) int a = 0;
while (a>–5)
System.out.print(a+ “ ”);
System.out.print((– –a*2));
System.out.println();
– –a;
(ii) int a, b;
for (a = 6, b = 4; a < = 4; a = a + 6)
if(a% b = = 0)
break;
System.out.println(a);
(4)
Question No 5
(a) find and display all the factors of a number input by the user (including 1 and
excluding the number itself).
Sample input: 15
Sample output: 1, 3, 5
(b) find and display the factorial of a number input by the user.
Sample input: 5
Sample output: 120
Question No 6
Write a menu-driven program to perform the following as per the user's choice: [15]
Question No 7
Write a menu-driven program to perform the following as per the user’s choice: [15]
(a) Input a three-digit number and check whether it is an Armstrong number or not.
(A number is said to be an Armstrong number if the sum of the cubes of its digits is
equal to the original number.)
(b) Input a number and print the largest digit of the number.
Sample input: 8765
Sample output: 8
(5)
Question No 8
Write a class with the name Area. Use function overloading, to compute the area of a
parallelogram, a rhombus and a trapezium. [15]
Question No 9
Question No 10
No of units Rate/unit(`)
first 100 2.00
next 200 3.00
above 300 5.00