GuessPaper – 2010
Class – X
Subject –COMPUTER APPLICATIONS

TIME : 2 HRS MARKS : 100

SECTION A [ ANSWER ALL THE QUESTIONS ]
[WORKING SHOULD BE SHOWN CLEARLY WHEREVER NECESSARY]

1.
(a) Explain the do-while loop with an example. [2]
(b) Explain the difference between rvalue and lvalue, with examples. [2]
(c) Which package contains the Math class? Explain Math.ceil() function with examples. [2]
(d) Name any two types of errors, except Syntax error with an example each. [2]
(e) Define the 'this' keyword. How is it useful? [2]

2. Evaluate:
(a) If a=3, b=5, c=-5
i. a++ + b/2 - ++c%2;
ii. ++a - b-- +c/2;
iii. (double)(b/a);
iv. b/(double)a; [4]

(b)
i. Math.abs(-9.99);
ii. Math.sqrt(9.0);
iii. Math.pow(9,2); [3]

(c)
a="computers" b="applications"
i. a.substring(4);
ii. a.compareTo(b);
iii. b.equals(a);
iv. b.indexOf(3); [4]

3.
(a) Illustrate Selection Sort: 219, 291, 129, 921 [2]
(b) Explain 'out of bounce subscript' [2]
(c) What is meant by an infinite loop? Give an example of an infinite for loop. [2]
(d) Explain the difference between ++a, a++, and a+1. [2]
(e) Explain the difference between a=3 and a==3. [2]

4.
(a) if array[]={1,9,8,5,2};
What is array.length?
What is array.length()?
What is array[2]?
What is array[3]/0? [4]
(b) Write a function to accept a number 'n' and return true if it is prime, and false otherwise. [3]
(c) Define a class 'Numbers' to accept two numbers n1 and n2, using a parameterized constructor. Write a function print() to print the smaller number. [4]


SECTION B
ANSWER ANY FOUR QUESTIONS

FOR EVERY PROGRAM YOU NEED TO WRITE THE STATEMENT OF SOLUTION, LIST OF VARIABLES AND APPROPRIATE COMMENT STATEMENTS WHEREVER NECESSARY. USE PROPER LOGIC AND BE NEAT.

5. Write a program to input ten numbers, and count how many are krishnamutry. (145=1!+4!+5!)
Use the following functions:
inputs(): Inputs ten numbers from the user using InputStreamReader.
factorial(): Returns the factorial of a number.
iskrishnamutry(): Checks if a number is krishnamutry.
mainmenu(): Main function in the program. [15]

6. Initialise a String name to "Mohan Das Karam Chand Gandhi". Print it in the following format "M. D. K. C. Gandhi". [15]

7. Accept the names of 'n' animals in a one dimentional array. Sort these animals alphabetically using the Bubble Sort technique only.
[Eg: If inputs= Cow, Cockroach, Crow, Cat, Camel, Calf, Centipede.
outputs= Calf, Camel, Cat, Centipede, Cockroach, Cow, Crow.] [15]

8. Use a constructor to accept a,b,c of the quadratic equation ax2+bx+c=0. Print whether the roots are imaginary, real or zero. Also print the value(s) of x. [15]

9. Write a function print() that accepts two numbers and prints all the numbers between them, except those two numbers.
Using this function, write a program to print all the non-fibonacci numbers from 1-100. [15]

10. Accept a two dimentional array from the user. Check if this array is symmetric. [A symmetric array has the elements equal if row and column are interchanged]
This 2D array is symmetric:
1 2 3
2 3 4
3 4 3 [15]