Sie sind auf Seite 1von 5



Sample Paper – 2008 - 09

Class - X
Subject – Computer Applications

Time: 2 hours Full Marks: 100

Answer to this paper must be written on the paper provided separately. You will not be
allowed to write during the first 15 minutes. This time is to be spent in reading the
question paper. The time given at the head of the paper is the time allowed for writing the

This paper is divided in to two Sections. Attempt all questions in Section A and any four
questions from Section B. The intended marks for the questions or parts thereof are given
in brackets([ ]).

Section A (40 marks)

Attempt all questions

1. (a) What are the features of Object - Oriented Programming (OOP)? [5 x 2 = 10]

(b) Which feature of OOP can be characterized by the phrase “one name many
interface”? Explain.

(c) What will be the output of the following?

String letters = “abcdefghijklmnabcdefghijklmn”;
String output = “substring method with one argument” + letters.substring(12);
output += “substring method with two arguments” + letters.substring(3, 8);

(d) Rewrite the given statement using ternary operator

if ( a > b )
p = a – b;
p = b – a;

(e) What is bytecode?

2. (a) How can a method be overloaded in Java? [5 x 2 = 10]

(b) Consider the following class:

Other Educational Portals | | |

public class IdentifyMyParts {

public static int x = 7;
public int y = 3;

(i) Identify the fields; (ii) Identify the instance variables.

(c) Create an array of arrays containing three arrays. The first array contains 4
elements, the second one has two and the third one has three elements.

(d) What are the different types of constructors used in a class?

(e) What is the difference between break and continue statements in Java?

3. (a) Given the following code what should come at the blank space so that the output is
“Outer s”? Justify your answer. [2]

class Test {
public static void main(String[] args) {
Test test = new Test(); InnerTest ( ).f ( );
final String s = “Outer s”;
class InnerTest {
Sring s = “Inner s”;
void f ( ) {
System.out.println(Test._____________ );

(b) Assume you have written some classes. Belatedly, you have decided that they
should be Package Name Class Name
split into three
packages as listed mygame.server Server
Furthermore, mygame.shared Utilities
assume that the
classes are in mygame.client Client
the default
package (they have no package statements). [5]

Other Educational Portals | | |

Package Names and Class Names

(i) Which line of code will you need to add to each source file to put each class
in the right package?

(ii) To adhere to the directory structure, you will need to create some
subdirectories in the development directory and put source files in the
correct subdirectories. What subdirectories must you create? Which
subdirectory does each source file go into?

(c) You would like to print the message “No errors.” If the String reference variable
s is neither null nor reffering to a zero length String. What would appear in the
blank space? [3]

if ( ___________ ___________ ___________ )

System.out.println (“No errors.”);

4. (a) What is the result of compiling and running the following program? Justify your
answer. [4]

class SuperBase { void print ( SuperBase a ) { System.out.print (“Super”);}}

class Base extends SuperBase { void print (Base b) { System.out.print (“Base”);}}
class Derived extends Base { static void print (Derived c) { System.out.print
class Test {
public static void main ( String [ ] args ) {
SuperBase a1 = new SuperBase ( );
SuperBase b1 = new SuperBase ( );
Base c1 = new Derived ( );
a1.print (new Base ( ));
b1.print (new Derived ( ));
c1.print (new Derived ( ));
Other Educational Portals | | |

(b) State whether the following is true or false with proper justification. [2]

In the expression below, the value of operand c is not evaluated if the value of the
operand b is false.

boolean a = b && c;

(c) What is the result of compiling and running the following program? Justify your
answer. [2]

class Test {
public static void main (String[ ] args) {
int [ ] a = new int [5];
System.out.println (a[3]);

(d) Rewrite the following code snippet making necessary correction(s), if any error
exists. [2]

float a = 3.7 + 5.8;

System.out.println (a);

Section B (60 marks)

Attempt any 4 questions from this section

The answer in this Section should consist of the programs in either BlueJ environment
any other program environment or with Java as the base. Each program should be written
using Variable Descriptions/Mnemonic Codes such that the logic of the program is clearly
depicted. Flow charts and algorithms are not required.

5. Write a program to accept a String from the user and display the longest word in the
String. e.g., input: I read in class ten.
Other Educational Portals | | |

Output: The longest word is class. [15]

6. DTDC courier service charges for the transportation of any parcel within eastern zone
as follows:
Upto 100 gm. : Rs. 30
For each additional 50 gm. Or part thereof : Rs. 10
Write a program to calculate the charge of a parcel taking the weight of a parcel as
input from the user. [15]

7. Write a program to calculate the area and the perimeter of a rectangle and square having
the method display (int, int) and display(int) using overloading technique. [15]

8. You can encode or decode a string in many ways. One of he simplest ways to replace
each letter by a letter at a fixed distance ahead or behind in the alphabet is assumed to
wrap around ( i.e. ‘A’ follows ‘Z’).
e.g., given string: JAVA and encode = 2, means each character moves 2 characters
ahead. Thus, new string: “LCXC”.
Write a program in Java to accept a string and display the new string after encoding =
- 3, means each character moves three characters behind.
Sample input: ABACUS
Sample output: XYXZRP [15]

9. Write a program to store 20 different names along with the corresponding telephone
numbers. Enter a name from the console and search whether the name is present or not.
If the name is present, display the name along with the phone number, otherwise
display an appropriate message for the name not found. [15]

10. Write a program to compute and display the sum of the following series:

S = (1)/(1!) – (1 + 2)/(1! * 2!) + (1+2 +3)/(1! * 2! * 3!) - (1 + 2 + 3 + 4)/(1! * 2! * 3! *

4!) + ………..(1 + 2 + 3 + 4 + ….+ n)/(1! * 2! * 3! * 4! * ….. * n!)

where n is any integer value taken from the user as input. [15]


Other Educational Portals | | |