Guess Paper – 2008
Class – X
Subject – Computer Applications
SECTION A (40 MARKS)
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 is the time allowed for writing the answer.
This paper is divided into two Sections. Answer all Questions from Section a and any four questions from Section B.
The intended marks for questions or parts of questions are given in.
SECTION A [40 Marks]
Attempt all the questions.
While answering questions from this part, indicate briefly your working, and reasoning, wherever required.
Q1. a) Give the difference between the following ( any two) [2x2]
i) = operator and = = operator
ii)‘/’ sign and ‘%’ sign
iii) unary operator and binary operator
iv) prefix notation and postfix notation
b) Give the value of the variable tot, after the following code is executed : [2+2]
i)tot = 10;
ctr = 5;
tot = tot+(++ctr);
ii)tot = 10;
ctr = 5;
tot = tot+(ctr++);
c) Identify the errors in the following codes : [2]
i) int new = 5;
ii) char c = “ab”;
Q 2. a) Define operators. State one function of operators. 5x2 = 10
b) What is meant by inheritance? Give an example.
c) What is data type? Give an example.
d) Name any two packages of java that contain Library classes.
e) Mention any two attributes required for class declaration.
Q3. a) What will be the output of the following codes:-
x is a positive integer
void fun( int x )
{
while(x > 0)
{
x/=10;
System.out.println(“x will be=”+x);
}
b) Give the output of the following statements : [ 6 ]
S.no STATEMENT
1 Math.ceil ( - 28.25)
2 Math.rint ( 38.96)
3 Math.floor ( 144.99)
4 Math.abs ( 3489.45)
Q4. a) 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. 3 b) What will be the result of following two expressions if I =10 initially ? 2
i) ++ I <=10 II ) I++ <=10
c) Write a program to convert the given temperature in Fahrenheit to Celsius using the formula c = (f-32) /1.8 5
SECTION-B [60 Marks]
Attempt any four questions from this Section. The answers in this Section should consist of the Program in BlueJ environment with Java. Each program should be written in using Variable descriptions/Mnemonic Codes such that the logic of the program is clearly depicted. Flow charts and Algorithms are not required.
Q5. Write a class to print the twin primes between 2 to 400. use the following functions.
a) Prime (Check whether a number is prime).
b) Twinprime(to print the twin primes).
Main method is required.
Q6.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.
sumfact(): Returns the sum of factors of a number.
amicable (): Checks if a number is amicable. Amicable numbers are two different numbers so related that the sum of the proper divisors of the one is equal to the other, one being considered as a proper divisor but not the number itself. Such a pair is (220, 284); for the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110, of which the sum is 284; and the proper divisors of 284 are 1, 2, 4, 71, and 142, of which the sum is 220.
Main function in the program. is required
Q 7. AWap to accept any sentence and print the words in ascending order.
INPUT :- here we go round the mulberry bush
OUTPUT :- bush go here mulberry round the we
Q 8. 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.
Q 9. a) Define a class 'numMagic' with two methods revNum(int n) and digitSum(int n). The method revNum(int n) reverses the number passed as an argument for e.g. if then number is 346 it returns 643. digitSum(int n) returns the sum of the digits.
(b) Using the concept of 'function overloading' write a class with functions 'fact(int)' and ‘fact(int,int)’ which will calculate the value of n!/r!(n-r)! where n and r are given by the user.
Q 10. Computer keeps information of 10 persons with their phone no., Name and addresses. Write a program using Binary search technique in which user enters any phone number and computer prints the phone no. , name and address of the person if found.In case information is not traced out print the message "Information does not exist". [7]
SECTION A
A1. [20]
(a) ‘=’ operator assigns the values to the variable whereas ‘= =’ operator is used to compare the values of the variable with the value on the left hand side.
(b) ‘/’ sign is used to perform the division operation whereas ‘%’ operator I known as modulus which is used to get the remainder values of the calculation.
(c) charAt( ) is used to extract the character from the string one at a time in order to check its identity. Whereas substring( ) is used to extract the given string from the main string i.e. to extract the small string form the main big string.
(d) Unary operator uses only one operand such as +,-,*,/ etc and acts on one operand whereas binary operator acts upon two operands which are on its either side.
(e) Operators are used to perform math calculations using arithmetical signs whereas separators are used to make the specific groups of code and define the shape of function.
(f) Byte stream classes is used to accept support for handling i/o operations on bytes. Whereas character stream classes provide i/o support on character handling.
(g) ‘&&’ operator is a Boolean operator which is used for AND operation whereas ‘? :’ operator is a conditional or ternary operator which returns a value of exp 2 if exp 1 is true and if the exp 1 is false it returns a value of exp 3.
(h) Public class is available to the entire class in which it is defined , private class is available only within their own class.
(i) Source code is the program written by the programmer for the machine and byte code is the compiled program in java which is in machine language.
(j) Prefix notation is first incremented and then the value is added ++a, whereas postfix notation is used first and then the increment takes place a++.
A2. public void check( ) [5]
{
if ( character.isDigit(ch))
System.out.println(“it is a digit”);
If ( character.isLetter(ch))
System.out.println(“it is a letter”);
}
A3. (a) the value will be tot=16 s first the ctr will be incremented. [2+2]
(b) the value will be tot= 15 as first the ctr will be added as it is.
A4. [5]
(a) new is reserve word in java and cannot be used as a variable.
(b) Num must be initialized before using it as a variable.
(c) Char type value must be within single quotes.
(d) readLine( ) is the right form of syntax with L capital.
(e) Parameters are given in the single quotes.
A5. (a ), (b ) and ( c) are all different characters as they will occopy16 bit width for storage purpose because java identifies each character following the rules of upper case and lower case. [3]
A6. [3]
(a) Java Development Kit
(b) Applet Programming Interface
(c) Hyper Text Mark-up Language
SECTION B
A7.
class Arrange
{
public static void sort (String [ ] str )
{
for ( int i= 0; I < str.length –1; i++)
{
for (int j=i +1; j<str.length; j++)
{
if ( str[ i].compareTo (a[j]>0)
{
String a1=str [j];
Str [j]=str [i ];
Str [i ]= a1;
}}}}}
A8. import java.io.*; [15] class convert
psvm
{
int a[ ]= {5,3,8,4,9,2,1,12,98,16};
int t;
for (int I=0;I<a.length-1;I++)
{
for (int j=0;j<a.length-I;j++)
{
if (a[j]<a[j+1])
{
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}
}
System.out.println(“sorted array is”);
For (int k=0;k<a.lenth;k++)
{
System.out.println(a[k]);}}}
A9.
import java.io.*;
class vowel{
psvm( ){
string s =br.readlLine ( );
int l = s.length ( );
for (int x=0; x<l ; x++){
char z = s.charAt(x);
if ( x ==’a’ 11z==’e’11z==’i’z==’o’z==’u’)
int vow++;}
System.out.println ( “Total no. of vowels in the string are =” +vow);}}
A10.
import java.io.*;
class correct{
public static void main ( String args [ ] ) throws IOExecption{
BufferedReader br = new BufferedReader ( new InputStreamReader(System.in);
String a [ ] = new string [10];
String str;
for ( int j=0;j<a.length;j++){
if (a.charAt(j) ==’p’)
a.charAt(j)=’t’;
if (a[j]!=null)}
System.out.println(“a[j].toUppercase( ));
System.out.println(“a[j].toLowercase( ));}}
A11. import java.io.*;
class fact
{
public static void main ( String args [ ] ) throws IOExecption
{
BufferedReader br = new BufferedReader ( new InputStreamReader(System.in);
System.out.println( “enter the no. whose factorial is to be generated”);
int a = Interger.parseInt( br.readLine( ));
double fact=1;
for ( int i =1; i<=a; i++)
{
fact=fact*i ;
}
System.out.println(+fact);}}
A12. public class pattern
{
public static void main ( String args [ ] )
{
for (int i=1; i<=5; i++ )
{
for (int j=1; j<=i; j++)
{
System.out.pint(iI);
}
System.out.pintln ( );
}}}
Download ICSE Computer Applications Guess Paper Class X - 2008 (3)- CIC-2 : The Technology-December,2006
(415 downloads)