Sample
paper 4 for ICSE computer Application
SUB: COMPUTER FOR CLASS X MARKS:
100
This
paper is divided into two sections. You are to answer all the questions from
section A, and any four from section B.
Section A(40 marks)
Attempt
all questions
Question 1. [2X5=10]
a)
Differentiate between call by value or pass by value and call be reference or
pass by reference.
b)Write an expression in Java for
5x3 + 2y
z = ------------------
x + y
c)What are library classes? Give an example.
d)
What is an exception? Name 2 exception handling blocks.
e) Find the errors in the given program segment and rewrite
the statements correctly to assignvalues to an integer array:-
int a= new
int(5);
for(inti=0;i<=5;i++) a[i]=i;
Question 2. [2X5=10]
a) Operators with higher precedence are evaluated before
operators with relatively lowerprecedence. Arrange the operators given below in
order of higher precedence to lowerprecedence.
i) && ii)
% iii) >= iv) ++
b)
What is a constructor? When is it invoked?
c)Complete the code below to create an object of Scanner
class.
Scanner sc= ________ Scanner( ________________)
d) Name the search or sort algorithm that:
i) Makes several
passes through the array, selecting the next smallest item in thearray each
time and placing it where it belongs in the array.
ii) At each
stage, compares the sought key value with the key value of the middleelement of
the array.
e) State the output of the following program
segment.
String
s= "Examination";
int n=
s.length();
System.out.println(s.startsWith(s.substring(5,n)));
System.out.println(s.charAt(2)==
s.charAt(6));
Question 3. [2X5=10]
a) List the variables from those given below that are
composite data types.
i) Static int x;
ii) arr[i]=10;
iii) obj.display();
iv) Boolean b;
v) private char
chr;
vi) String str;
b) What are the final values stored in x and y below?
double a= -6.35;
double b= 14.74;
double
x=Math.abs(Math.ceil(a));
double y=Math.rint(Math.max(a,b));
c)Rewrite the following program segment using
while instead of for statement.
int f=1,i;
for(i=1;i<=5;i++)
{
f*=i;
System.out.println(f);
}
d)State the total size in bytes, of
the arrays a[4] of char data type and p[4] of float data type.
e)
What is the difference between / and % operator?
Question 4. [2X5=10]
a)What is the result stored in x, after
evaluating the following expression
int x=5; x=x++ * 2 + 3 * --x
b)Write
the difference between length and .length() function.
c) Analyse the following program segment and
determine how many times the loop will beexecuted and what will be the output
of the program segment.
int
k=1,i=2;
while(++i<6)
k*=i;
System.out.println(k);
d) If
intn[ ] = { 1,2,3,5,7,9,13,16}, what are the values of x and y?
x =
Math.pow(n[4], n[2]);
y= Math.sqrt(n[5]+n[7]);
e)
i) Name the mathematical function which is used to find
sine of an angle given in radians.
ii) Name a string function which removes the blank spaces
provided in the prefix andSuffix of a string.
Section
B
Attempt
any 4 questions from this section
Each
program should be written using a variable list so that the logic of the
program is clearlydepicted.
Question 5.
Design a class to
overload a function series( ) as follows :
i) double series(double
n) with one double argument and returns the sum of the series,
sum= 1/1 + 1/2 +1/3 + …. 1/n
ii) double
series(double a, double n) with 2 double arguments and returns the sum of
theseries, sum = 1/a2 + 4/a5 + 7/a8 + 10/a11+…… to n terms [15
]
Question 6.
Write a program to assign a full path and file name as
given below. Using library functions, extractand output the file path, file
name and file extension separately as shown.
Input C:\Users\admin\Pictures\flower.jpg
Output Path: C:\Users\admin\Pictures\
File name: flower
Extension: jpg [15]
Question 7.
Write a program to input and store the weight of ten
people. Sort and display them inascending order using the selection sort
technique. [15]
Question 8.
Using the switch write
a menu driven program to :
i) To find and display
all the factors of a number input by the user (including 1 and excluding
thenumber itself).
Example:
Sample input : n = 15
Sample output : 1, 3, 5
ii) To find and display
the factorial of a number input by the user ( the factorial of a non
negativeinteger n , denoted by n!, is the product of all integers less than or
equal to n.
Example:
Sample input : n =5
Sample output : 5!=1x2x3x4x5=120
For an incorrect choice
an appropriate error message should be displayed. [15]
Question 9.
Define a class called Library with the following
descriptions.
Instance variables/Data members:
Intacc_num
stores the accession number of the book.
String
title stores the title of the book.
String
author stores the name of the author
Member methods:
i)
void input() to input and store the accession number, title and author.
ii)
void compute() to accept the number of days late, calculate and display the
finecharged at the rate of Rs.2/- per day.
iii)
void display() to display the details in the following format.
Accession Number Title Author
Write a main method to create an object of the
class and call the above member methods. [
15 ]
Question 10.
The International Standard Book Number (ISBN) is a unique
numeric book identifier which is printedon every book. The ISBN is based upon a
10 digit code. The ISBN is legal if :
1 x digit1 + 2 x digit2 + 3 x digit4 + 4 x digit4 + 5 x
digit5 + 6 x digit6 + 7 x digit7 + 8 x digit8 + 9 x digit9 +10 x digit10 is
divisible by 11.
Example: For an ISBN 1401601499
Sum = 1 x 1 + 2 x 4 + 3 x 0 + 4 x 1 + 5 x 6+ 6 x 0+ 7 x 1+
8 x 4 + 9 x 9 + 10 x 9 = 253 which is divisible by11.
Write a program to :
i) Input the
ISBN code as a 10 – digit integer.
ii) If the ISBN
is not a 10 digit integer, output the message, “Illegal ISBN” and terminate
theprogram.
iii) If the
number is 10-digit, extract the digits of the number and compute the sum
asexplained above.
If the sum is divisible by 11, output the message, “Legal
ISBN”. If the sum is not divisibleby 11, output the message, “Illegal ISBN”. [15]
No comments:
Post a Comment