0% found this document useful (0 votes)
56 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)
56 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, 2019–20

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) What is a literal? [2]

(b) Differentiate between operators and expressions. [2]

(c) What is coercion? [2]

(d) Differentiate between function prototype and function signature. [2]

(e) Classify the following as primitive or non-primitive data types: [2]


(i) char (iii) int
(ii) interface (iv) class

Question No 2
(a) Rewrite the following loop using the ‘for’ loop: [2]
while(true)
System.out.print(“*”);

(b) Mention the number of bytes occupied by short and float data types. [2]

(c) Name the following: [2]


(i) A keyword used to call a package in the program

(ii) Any one reference data type


(2)

(d) Evaluate the value of n if the value of p = 5, q = 19: [2]

int n = (q-p)>(p-q)? (q-p) : (p-q);

(e) What is a time delay loop? [2]

Question No 3

(a) Differentiate between formal parameter and actual parameter. [2]

(b) Write the Java expression for: [2]

2
m = 3 (a2 – b2)h

(c) Give the output of the following program segment: [2]


double x = 2.9, a = –99.51, y = 2.5;
System.out.println(Math.min(Math.floor(x),y));
System.out.println(Math.abs(Math.floor(a)));

(d) Give the output of the following method: [2]

public static void main(String[] args)


{ int a = 5;
a++;
System.out.println(a);
a – = (a– –) – (– –a);
System.out.println(a);
}

(e) Rewrite the following statements using ternary operators: [2]

if(amount >= 2000.0)


comm = amount * 0.4;
else
comm = amount * 0.2;

(f) Write the equivalent ‘do-while’ loop for the following program segment: [2]

int n = 40;
for( int y = 10; y>=2; y– –)
n++;

(g) Write the Java statement to create an object emp of class Organization. [2]
(3)

(h) How many times will the following loop execute and what will be the final output? [2]

int k=1, i=2;


while(++i<6)
k* = i;
System.out.println(k);

(i) Give the prototype of a function search() which receives an integer in variable num
and a double value in variable cal and returns 1 or 0. [2]

(j) What will be the output of following program segment? [2]

int y = 5;
for (;y<=19; y+=2)
System.out.println(y);

SECTION B (60 MARKS)

Answer any four questions.

The answers in this section should consist of the program


in Blue J environment with Java as the base.
Each program should be written using Variable descriptions/Mnemonics Codes
such that the logic of the program is clearly depicted. Flow charts and
Algorithms are not required.

Question No 4

Design a class to overload a function area() as follows: [15]

(a) double area(double a, double b, double c) with three double arguments, returns the
area of a scalene triangle using the formula:

area = s ( s − a )( s − b )( s − c )

a+b+c
where s =
2

(b) double area(int a, int b, int height) with three integer arguments, returns the area of a
trapezium using the formula:

1
area = height ( a + b )
2
(4)

(c) double area(double diagonal1, double diagonal2) with two double arguments, returns
the area of a rhombus using the formula:
1
area = height (diagonal1 × diagonal2)
2
Write a main() method to call the overloaded methods.

Question No 5

Write a menu-driven program to perform the following as per the user's choice: [15]

(a) Generate and display the first 10 terms of the Fibonacci series 0,1,1,2,3,5….The
first two Fibonacci numbers are 0 and 1, and each subsequent number is the sum of
the previous two.

(b) Find the sum of the digits of an integer that is input.

Sample Input: 15390

Sample Output: Sum of the digits = 18

For an incorrect choice, an appropriate error message should be displayed.

Question No 6

Design a class Student with the following specifications: [15]


Data members/instance variables:

String name,

int age,

double m1, double m2, double m3 (marks in 3 subjects),


double maximum,

double average

Member functions:

(i) void accept() : to accept the details of a student including name, age and
marks in 3 subjects
(ii) void compute() : to calculate the average and the maximum out of the 3 marks

(iii) void display() : to display the name, age, marks in 3 subjects, maximum and
average

Write a main method to create an object of the class Student and call the above member
methods.
(5)

Question No 7

Write a menu-driven program to perform the following as per the user’s choice: [15]

(a) Find the sum of the following series:

a2 a3 a 4
s = a− + − + ..... upto n terms
2 3 4

(b) Find the sum of the following series:

s = 1 + 2 + 4 + 7 + 11 + 16 + …. + n

For an incorrect choice, an appropriate error message should be displayed.

Question No 8 [15]

Write a program to input a number and check and print whether it is a Pronic number or
not. Pronic number is a number which is the product of two consecutive integers.

Examples: 12 = 3 × 4
20 = 4 × 5
42 = 6 × 7

Question No 9 [15]

Write a program to print the following pattern based on the number of terms input by the
user:

21

321

4321

54321

654321

7654321

In the above pattern number of terms input by the user is 7.

You might also like