Guess Paper - 2008
Class – X
Subject – Computer Applications

Total : 100 Marks

(Two Hours)

This paper is divided into two sections. Attempt all questions from Section A and any four from Section B. The intended marks for questions or parts of questions are given in brackets [].

Group – A ( Compulsory )

1.a) What output will the following code fragment produce ?

int c=900, x, n =2000;

x = n+ c >2550? 1350 : 1500 ;

System.out.println(x);

b)Suppose x1 and x2 are two type double variables that you want to add as integers and assign to an integer variable. Construct a single line java statement for doing so.

c)Given the following set of identifiers:

long longval ; char ch ; int intval ; float fl ; short sh ;

Identify the datatype of the following expressions:

a) ‘a’-3 b) intval*longval-ch c) fl+ longval/sh d) longval * 3

d )Construct an expression that is equal to the absolute value of a variable. That is , if a variable p is positive, the value of the expression is just p, but if p is negative, the value of the expression is –p, which would be positive.

  1. a) Define wrapper class with example.

b) Diff between Private and public access specifier.

c) Short notes on replace(), lastIndexOf().

d) What is the difference between literals and identifiers ?

e)Write down the difference between prefix and postfix operators.

3.

a) Write a statement to import a class “Nano” under the package “car” which is

under the package “Tata” which is under the package “Indian”.

b) State how can you declare a variable.

c) Define scope of variable.

d) Explain Call by reference.

e )Given :

double x=”45.9856”;

Define a java function that will round up x to it’s higher value i.e 46.

4.a) Define vector class.

b) output:

String s=”JAVA”;

String s1=”Platform”;

System.out.println( s1.subString( 0,s1.length() –5));

System.out.println( s.charAt(s.length() - 2 )+toLowercase(s));

c) Find and correct errors(both logical and syntactic)

i=9;

while(i>0);

--i

++i

}

d) Find the value of x when ?

int x=20;

x *=--x+ ++x +--x

System.out.print( x );

}

e) Convert to while loop

for(; ;)

Group – B

( Attempt any 4 questions from this section )

  1. a) WAP to calculate the sum of the following series.

S = x/(x+1)! x2/(x+2)!+x3/(x+3) ……..n terms

b) WAP to design a class that will find the hcf and lcm of two values.

Data members : int a, b

Member Functions hcf() : to find the hcf of two numbers.

lcm() : To find the lcm of two values when lcm = a*b/hcf. Use function hcf to find lcm.

[ 8 + 7 ]

  1. Wap to find the sum of the elements stored in the left diagonal and right diagonal of a 4x4 matrix.
  2. WAP to design a class by using following criteria.

Data Members : String s – Stores a string.

Member Function :

accept () – accept a sentence through console.

long() finds the longest word in the sentence.

4. . Design a class to search an element in an integer array.

Class name mysearch :-

Void bubble () to sort an integer array.

Void bsearch () search the item in the array using binary search technique. [15]

5. Write a program for the given class ( An automorphic number is the number which is at the end of the number’s square. Examples are : 1) 6 because 6 square is 36. 2) 25 because 25 square is 625. ) [10]

Class Name: Automorphic

Member Data: numb ( integer )

Member Function:

Automorphic()// non parameterized constructor

Automorphic(int n)// constructor to initialize numb with given value

void read()// to read numb from user

6. Question 7

Write a program to enter two matrices of any order and find its product. The program should also check whether the multiplication is possible or not. [15]

.

[ 15*4 = 60 ]