Sample paper 7 for ICSE computer Application
SUB: COMPUTER FOR CLASS X MARKS: 100
__________________________________________________________________
Section A(40 marks)
Attempt
all questions
Question 1. [2X5=10]
a) What is the purpose of this
keyword?
b) Write an expression in
Java for
C=A5
+ sin B
c) What are library classes?
Give an example.
d) What is an exception?
Name 2 exception handling blocks.
e) What is a constructor and
what is its use?
Question 2. [2X5=10]
a) Write a java statement to check if the fourth
element of an array arr[10] is divisible by 2.
b) State the output when number=123 and also
state what the method is doing?
void main(int number)
{
int a, b=number, c=0, d, s=0;
while (b!=0)
{
d=b%10;
a=(int)Math.pow(10,c++);
System.out.println(d*a);
b=b/10;
}
}
c) Differentiate between
Binary Search and Linear Search
d) Name the search or
sort algorithm that:
i) Makes several passes
through the array, selecting the next smallest item in the array 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) What do you understand
by bitwise operator? Give example.
Question 3. [2X5=10]
a) Differentiate between Instance variable and
Local variable.
b) What are the final values stored in x and y
below?
double a= -46.55;
double b= 15.94;
double
x=Math.abs(Math.floor(a));
double
y=Math.rint(Math.min(a,b));
c)String s = “Mechanical”;
int p
= s.indexOf(‘h’);
System.out.println(p);
System.out.println(p+s);
d)State the total size in bytes, of the arrays
a[8] of int data type and p[2] of float
datatype.
e) Name 2 OOP’s principles
Question 4. [2X5=10]
a)What is the result stored in x, after
evaluating the following expression
int x=3; x=++x + 3 * x--
b)Write
the difference between length and .length() function.
c)
Differentiate between user defined and primitive data type
d) If intn[ ] = { 6,4,3,2,7,9,15,19}, what are
the values of x and y?
x
= Math.pow(n[4], n[2]);
y= Math.sqrt(n[5]+n[7]);
e)
What is the difference between public and private access modifier.
Section
B (60 marks)
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. [15]
Writetwoseparate programstogeneratethefollowing patternsusing
iteration(loop)statements:
a)
b)
& 54321
&#
5432
&#& 543
&#&#
54
&#&#& 5
Question 6.
A company has employees,
who are divided into four grades depending on their Basic pay per month as
follows,
Basic(Rs./month) Grade DA
HRA
10,001 or more 1 40%
30%
5,001 to 10,000 2 40% 25%
2001 to 5,000 3 30% 20%
2,000 or less 4 30% 15%
5,001 to 10,000 2 40% 25%
2001 to 5,000 3 30% 20%
2,000 or less 4 30% 15%
If the Net salary which
is the total of Basic, DA, and HRA, is above Rs.50, 000 per month then Income
Tax at the rate of 30% of the annual salary exceeding 50,000 is deducted on
monthly basis.
Taking name of the
employee and the Basic (monthly) pay as inputs, prepare & print a pay slip,
which contains Name, Grade, Basic monthly pay, DA, HRA, Monthly Income Tax and
Net Monthly Salary, for employee.
[15]
Question 7.
Write a program to
perform linear search on a list of integers given below, to search for an
element input by the user, if it is found display the element along with its
position, otherwise display the message “Search element not found”
5,
7,9,11,15,20,30,45,89,97
[15]
Question 8.
Write a program to input
a number and print whether the number is a special number or not. (A number is said to be a special number, if
the sum of the factorial of the digits of the number is same as the original
number).
Example:
145 is a special number, because 1! + 4! + 5! = 1 + 24 + 120 =145
(where
! stands for the factorial of the number and the factorial value of a number is
the product of all integers from 1 to that number, example 5! = 1*2*3*4*5 =
120).
[15]
Question
9.
Using the switch
statement, write a menu driven program to :
i) Generate and display the first 10 terms of
the Fibonacci series 0,1,1,2,3,5….The first two Fibonacci numbers are 0 and 1, and each subsequent number is the sum of the previous two.
ii) Find the sum of the digits of an integer that
is input.
Sample
Input : 15390
Sample Output: Sum of the digits = 18
For an
incorrect choice, an appropriate error message should be displayed.
[15]
Question
10.
Write a program that
encodes a word into Piglatin. To translate word into piglatin word, convert the
word into uppercase and then place the first vowel of the original word as the
start of the new word along with the remaining alphabets. The alphabets present
before the vowel ebing shifted towards the end followed by “AY”.
Sample Input (1) : London, Sample Output (1) : ONDONLAY
Sample Input (2) : Olympics, Sample Output (1) : OLYMPICSAY
No comments:
Post a Comment