ICSE Class 10 Computer Applications Sample Question Paper 3 with Answers

ICSE Class 10 Computer Applications Sample Question Paper 3 with Answers

Section -I (40 Marks)
Attempt all questions

Question 1.
(a) What does the default constructor provided by the compiler do?
Answer:
Default constructor is helpful in creation of objects of the class.
E.g. ABC obj = new ABC( );

ICSE Class 10 Computer Applications Sample Question Paper 3 with Answers

(b) Name the operators listed below
(i) >=
(ii) –
(iii) !
(iv) ?
Answer:
(i) Greater than
(ii) predecrement
(iii) logical not
(iv) Ternary operator.

(c) Name
(i) A keyword used to call a package in the program.
(ii) Any reference data types
(iii) Why is an object called an instance of a class?
(iv) What are identifiers? Give example of each identifier.
Answer:
(i) import
(ii) class and arrays

ICSE Class 10 Computer Applications Sample Question Paper 3 with Answers

(d) Why is an object called an instance of a class?
Answer:
An object is called instance of class because object gets the copy of all variables defined in the class.

(e) What are identifiers? Give example of each identifier.
Answer:
Identifiers are the variables, methods classes etc. which are not independent keywords.
E.g. int a;
a is identifier.

Question 2
(A) What is the function of catch block in exception handling? Where does it appear it in a program?
Answer:
The catch block is used to find an exception and handle it. It appears after try block.

(b) Find the output:
String a = “Sidharthissmartguy”,b= “MathsMarks”;
String h = a.substring(2,5);
String k = b.substring(8).toUpperCase( );
System.out.println(h);
System.out.println(k.equalslgnoreCase(h));
Answer:
dha
false

ICSE Class 10 Computer Applications Sample Question Paper 3 with Answers

(c) (i) Name the mathematical function which is used to find sine of an angle in radians.
(ii) Name a string function which removes the blank spaces provided in the prefix and suffix of a string.
Answer:
(i) math.sin( )
(ii) trim( )

(d) Name the keyword which will be used to resolve the conflict between method parameter and instance variables/fields. Explain with example.
Answer:
this eg. void assign(inta)
{
this.b = a;
}

(e) int y = 10 ;
y+ = (++y * (y++ +5));
System.out.println(y);
What will be the output of the above code?
Answer:
186

ICSE Class 10 Computer Applications Sample Question Paper 3 with Answers

Question 3
(a) The arguments of the function given in the function definition are called_________
(b) Why JVM is required in running Java program. Justify your answer.
(c) Attempt the following
(i) Explain with example the possible loss of precision.
(ii) Explain the term type casting in java. How is it useful?
(iii) State the difference between keyword and reserved word.
(iv) What do you mean by convention and rules in java? Explain the difference between compiler and interpreter.
(v) State the purpose and return data type of the following string functions.
1. indexOf( )
2. compareTo( ).
(d) Explain the use of continue statement in looping in java.
(e) State the output of the code:
int m = 10;
int n = 10;
for(int i =1;i<5 ;i++)
m++;-n;
System.out.println(“m=”+m);
System.out.println(“n=”+n);
(f) What do you understand by Java application and java applet. Explain with example
Answer:
(a) formal parameter

(b) The JVM converts the Java program into machine code. The computer reads it and displays the output accordingly

(c) (i) float h = 3.45;
int k = (int)h;
Here k value assigned is 3.
When higher size data type is assigned to the lower size data type there is loss of data which takes place. It’s called loss of precision.

ICSE Class 10 Computer Applications Sample Question Paper 3 with Answers

(ii) Type conversion is method by which one type of data is converted into other type. It’s useful in the expression when calculation is to be done in float type.

(iii) keywords are all reserved words in java example null, true, false are reserved words.
Keywords are like return, continue, break etc.

(iv) Rules are for naming the identifiers. Example identifier name must begin with alphabet or underscore. No special character to be part of the name. Convention is the use the letter of the alphabet.

Compiler compiles the program at once and displays the error for whole program. Interpreter compiles the program line by line whenever it finds error it stops. At any time it can show only one error.

(v) An application is the program executed on the computer independently. Applet is small program uses another application program for its execution.

ICSE Class 10 Computer Applications Sample Question Paper 3 with Answers

(vi) The continue statement makes the next iteration of the loop to be executed.

(vii) a. int – return the index of a character b. int – compares two strings.

(viii) 119

Section – B (60 Marks)
Attempt any four questions from this Section

The answers in this Section should consist of the Programs in either Blue. J environment or any program environment 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.

ICSE Class 10 Computer Applications Sample Question Paper 3 with Answers

Question 4
Digital world announces seasonal discount on the laptops in the given order.
Cost of the laptop         Discount
Rs. 20,000 – Rs. 30,000   10%
Rs. 30,000 – Rs. 40,000   15%
Rs. 40,000 – Rs. 50,000   18%
>= Rs. 50,000                 20%
An additional discount of 5%  on all types of laptops is given. Sales tax is calculated at 12% on the price after the discounts. Define a class to accept the cost of the laptop and print the amount payable by the customer on purchase (use constructor).
Answer:

import java.util.*; 
class dw 
{
double Ic, rate, stl, dst; public dw()
{
double Ic = 0.0; double rate = 0.0; 
double stl = 0.0; double dst = 0.0;
}
public static void main()
{
dw obj new dw();
Scanner sc = new Scanner(System.in);
System.out.println("Enter the cost of laptop");
obj.lc = sc.nextDouble( );
double ds = 5;
double fa = 0.0, fa 1 = 0;
if(obj.lc >=20000 && obj.lc < 30000)
{
obj.rate = 10;
}
else if(obj.lc >= 30000 && obj.lc < 40000)
{
obj.rate = 15;
}
else ifCobj.lc >= 40000 && obj.lc < 50000)
{
obj.rate = 18;
}
else if (obj.lc >= 50000)
{
obj.rate = 20;
}
else
{
System.out.println("invalid");
}
fa = obj.lc-(obj.lc*(obj.rate + ds)/100); 
fa 1 = fa + ((12.0/100.0)*fa); 
System.out.println("Amount payable:"+fa 1 ); 
}
}

ICSE Class 10 Computer Applications Sample Question Paper 3 with Answers

Question 5
Write a program in java to accept 10 integers in an array. Now display only those numbers having complete square root
Sample input: 12,45,49, 78,64, 77,81, 99,45, 33
Sample output: 49,64,81
Answer:

import java.util.*; 
class lol 
{
public static void main( )
{
Scanner sc = new Scanner(System.in); 
inta[] = new int[10]; 
System.out.println( )'Enter 10 integers:");
for(int i =0;i <a.length; i++)
{
a[i] = sc.nextlnt( );
}
for(int j = 0; jo.length; j++)
{
for(int k=0; k<=a[j]/2; k++)
{
if(k*k == a[j])
System.out.println(a[j]);
}
}
}
}

Question 6
Write a function to suppress negative elements of an array to bottom without altering the original sequence i.e if array contains 5, -4, 3, -2, 6, -11,12,-8,9Then the return array will be 5, 3,6, 12, 9,-4, -2,-11,-8.
Answer:

import java.util.*; 
class lol 
{
public static void supress( )
{
Scanner sc = new Scanner(System.in); 
int a[ ] = new int[10]; int temp;
System.out.println( )'Enter 10 integers:");
for(int i =0;i <a.length; i++)
{
a[i] = sc.nextlnt( );
}
for(int j = 0; j<a. length; j++)
{
for(int k=0; k<a.length-1 -j; k++)
{
if(a[k]<0 &&a[k+1]>0) 
{
temp = a[k]; a[k] = a[k+1]; 
a[k+1] = temp;
}
System.out.println(a[j]);
}
}
}
}

ICSE Class 10 Computer Applications Sample Question Paper 3 with Answers

Question 7
Write a program to input a sentence. Create a function convert(int n). where n is an integer value in positive or negative. This function is used to encode or decode the given by shifting each character of a string the number of times as specified by user.
Ex. input – Sid Bowler
Shift value 3
Output -Vig Erzohu
Answer:

import java.util.*; 
class lol
 {
public static void convert( ) 
{
Scanner sc = new Scanner(System.in); 
System.out.println("Enter a sentence:"); 
String str = sc.nextLine( );
String word = int n = 3; 
//shift value
for(int i =0;i <str.length( ); i++)
{
char ch = str.charAt(i); if(ch !=1')
word = word + (ch + n); else
word = word + ch;
}
System.out.println(word);
}
}

Question 8
Write a program using menu driven mode to find the value of s, where
S = 2 + 3 + 4 + 4 + 6 + 8 + 6 + 9 + 12… 100 terms S = 2! -4! +6!-8!  n
Answer:

import java.util.*; 
class lol
{
public static void main()
{
Scanner sc = new Scanner(System.in); 
double sum = 0;
System.out.println("Enter 1 for number addition and 2 for factorial summation");
int ch = sc.nextlnt( );
switch(ch)
{
case ’1int a = 2, b = 3, c = 4; 
for(int i = 3; i<=99; i+=3)
{
sum = sum + a + b + c; a = a + 2; b = b + 3; c = c + 4;
}
sum+=a;
System.out.println(sum);
break;
case '2': int k = 2;
System.out.println("Enter number of terms:"); 
int n = sc.nextlnt( ); 
for(int i = 1;i<=n;i++)
{
int fact = 1;
for(int j = 1; j<=k; j++)
{
fact = fact*j;
if(i%2 == 0) sum = sum - fact; else
sum = sum + fact; k = k + 2;
}
System.out.println(sum);
break;
default: System.out.println("Error"); break;
}
}//end of main
 }//end of class

ICSE Class 10 Computer Applications Sample Question Paper 3 with Answers

Question 9
Write a program in java to print the Pascalane triangle as follows.
ICSE Class 10 Computer Applications Sample Question Paper 3 with Answers 1
Answer:

import java.util.*; 
class lol 
{
static int fact(int n)
{
intfact=1;
for(int i = 1; i <=n; i++)
{
fact*=i;
}
return fact;
}
static int ncr(int n,int r)
{
return fact(n) / (fact(n-r) * fact(r));
}
public static void main(String args[ ])
{
System.out.println( );
int n, i,j; n = 4;
for(i = 0; i <= n; i++)
{
for(j = 0; j <= n-i; j++)
{
System.out.print(" ");
}
for(j = 0; j <= i;j++)
{
System.out.printC "+ncr(i, j));
}
System.out.println( );
}
}

ICSE Class 10 Computer Applications Sample Question Paper 3 with Answers

Variable Data Type Description
ds double Additional discount
fa 1 double Amount payable
a[ ] int Array of 10 integers
i,j,k int For looping
temp int For swapping the numbers
str String store the word
ch char store character
word String store new changed string
sum double store sum of series
abc int store consecutive integers.
k int store the multiples of 2
fact int Store the factorial.

ICSE Class 10 Computer Applications Question Papers with Answers

Leave a Comment