0% found this document useful (0 votes)
117 views

9 Computer Applications (Theory)

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)
117 views

9 Computer Applications (Theory)

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/ 5

GARDEN HIGH SCHOOL

CLASS IX

Annual Examination, 2018–19

Computer Applications (Theory)

Time: 2 hours Full Marks: 100

This Question Paper has five printed pages.


Answers must be written in the script/s provided. You will not be allowed to write for the
first 15 minutes. This time must be spent in reading the Question Paper.
The time given at the head of this Paper is the time allowed for writing answers.

This Paper is divided into two sections.


Answer all the questions of Section A, and any four of Section B.
Maximum marks for a question or part of a question are given in brackets [ ].

SECTION A (40 marks)


Answer all the questions.

Question No 1

(a) Discuss any one feature of OOP. [2]

(b) Define JIT. [2]

(c) Write any two characteristics of Java. [2]

(d) Differentiate between an object and a class. [2]

(e) Write the Java expression for the following: [2]


xy
z = x 3 + y3 −
3

Question No 2

(a) Write the output of the following: [3]

System.out.println(Math.round(–8.5));

System.out.println(Math.ceil(–8.5));

System.out.println(Math.floor(8.91));

(b) Evaluate the following:

(i) int y = 8;
y+ = ++y + y– – + – –y; [2]
(2)

(ii) int y = 10; [2]

int z = ++y * (y++ + 5);

(c) Convert the following to if-else construct and find the output if m = 4: [3]

switch(m)

case 1:

case 3:

case 5: days = 31; break;

case 4: days = 30;

case 6: System.out.println(days); break;

default: System.out.println(“Wrong month”);


}

Question No 3

(a) Differentiate between:

(i) break and continue when used in a loop [2]

(ii) static and non-static variables [2]

(b) What is the significance of the return statement? [2]

(c) Rewrite the following using a for loop: [2]

int i = 1, d = 5;
do
{
d = d*2;
System.out.println(d);
i++;
} while(i<=5);

(d) Rewrite the following using an if-else construct: [2]

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.

(ii) a single 16-bit Unicode character whose default value is ‘\u0000’.

(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)

SECTION B (60 marks)

Answer any four questions.

Answers should consist of programs in either Blue J environment or any program


environment with Java as the base. Variable Descriptions/Mnemonic Codes should be used
to write each program so that the logic of the program is clearly demonstrated.
Flow charts and algorithms are not required.

Question No 5

Using the switch statement, write a menu-driven program to: [15]

(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]

(a) Sum = 2 + 5 + 10 + ……… + 65


p3 p5 p11
(b) Sum = p + 3! + 5! + ....... + 11!

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.)

Eg: 153 is an Armstrong number because 13 + 53 + 33 = 153

(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]

Area of a parallelogram = base × height

Area of a rhombus = ½ × d1 × d2 ( d1 and d2 are the diagonals )

Area of a trapezium = ½ × (a + b) × h (a and b are the parallel sides and h is the


perpendicular distance between parallel sides)

Question No 9

Write a menu-driven program to print the following patterns: [15]

(a) 54321 (b) 11111


4321 22222
321 33333
21 44444
1 55555

Question No 10

Define a class ElecBill with the following specifications: [15]


Data members/Instance variables:
String n: name of consumer
int units: no of units consumed
double bill: to store the amount to be paid
Member functions:

(a) void accept(): to accept name and no of units consumed

(b) void calculate(): to calculate bill as per the following tariff:

No of units Rate/unit(`)
first 100 2.00
next 200 3.00
above 300 5.00

(c) void print(): to print the bill in the following manner:


Name:
Units Consumed:
Bill Amount:
Write a main() method to create an object of the class and call the above methods.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy