ICSE Class 10 Computer Application Sample Question Paper 3 with Answers

ICSE Class 10 Computer Application Sample Question Paper 3 with Answers

Max Marks: 80
[2 Hours]

General Instructions

  • Answers 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 of this Paper is the time allowed for writing the answers. O This Paper is divided into two Sections.
  • Attempt all questions from Section A and any four questions from Section B.
  • The intended marks for questions or parts of questions are given in brackets [ ].

SECTION – A [40 Marks]
Attempt All Question

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();

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

(c) Why is an object called an instance of a class?
Answer:
(i) import
(ii) class and arrays

(d) What are identifiers? Give example of each identifier.
Answer:
An object is called instance of class because object gets the copy of all variables defined in the class.

(e) Name
(i) A keyword used to call a package in the program.
(ii) Any reference data types
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

(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 Application Sample Question Paper 3 with Answers

Question 3.
(a) The arguments of the function given in the function definition are called ________
Answer:
formal parameter

(b) Why JVM is required in running Java program. Justify your answer.
Answer:
The JVM converts the Java program into machine code. The computer reads it and displays the output accordingly.

(c) Attempt the following
(i) Explain with example the possible loss of precision.
Answer:
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.

(ii) Explain the term type casting in java. How is it useful?
Answer:
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) State the difference between keyword and reserved word.
Answer:
keywords are all reserved words in java example null, true, false are reserved words.
Keywords are like return, continue, break etc.

(iv) What do you mean by convention and rules in java? Explain the difference between compiler and interpreter.
Answer:
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) State the purpose and return data type of the following string functions.
a. indexOf().
b. compareTo().
Answer:
a. int – return the index of a character
b. int – compares two strings.

(d) Explain the use of continue statement in looping in java.
Answer:
The continue statement makes the next iteration of the loop to be executed.

(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); Answer: 11 9 (f) What do you understand by Java application and java applet. Explain with example Answer: An application is the program executed on the computer independently. Applet is small program uses another application program for its execution.

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 i 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.

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.printIn("Enter the cost of laptop");
obj.Ic = sc.nextDouble();
double ds = 5;
double fa = 0.0, fa 1 = 0;
if(obj.Ic >=20000 && obj.Ic < 30000)
{
obj.rate = 10;
}
else if(obj.Ic >= 30000 && obj.Ic < 40000)
{
obj.rate = 15;
}
else ifCobj.Ic >= 40000 && obj.Ic < 50000)
{
obj.rate = 18;
}
else if (obj.Ic >= 50000)
{
obj.rate = 20;
}
else
{
System.out.printIn("invalid");
}
fa = obj.Ic-(obj.Ic*(obj.rate + ds)/100);
fa 1 = fa + ((12.0/100.0)*fa);
System.out.printIn("Amount payable:"+fa 1 );
}

ICSE Class 10 Computer Application 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.printInC'Enter 10 integers:");
for(int i =0;i <a.length; i++)
{
a[i] = sc.nextIntO;
}
for(int j = 0; jo.length; j++)
{
for(int k=0; k<=a[j]/2; k++)
{
if(k*k == a[j])
System.out.printIn(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.printIn("Enter 10 integers:");
for(int i =0;i <a.length; i++)
{
a[i] = sc.nextInt();
}
for(int j = 0; j {
for(int k=0; k {
if(a[k]<0 &&a[k+1]>0)

{
temp = a[k];
a[k] = a[k+1];
a[k+1] = temp;
}
System.out.printIn(a[j]);
}
}
}
}

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.printIn("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.printIn(word);
}
}

ICSE Class 10 Computer Application Sample Question Paper 3 with Answers

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.printIn("Enter 1 for number addition and 2 for factorial summation");
int ch = sc.nextInt();
switch(ch)
{
case '1': int 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.printIn(sum);
break;
case '2': int k = 2;
System.out.printIn("Enter number of terms:");
int n = sc.nextIntO;
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.printIn(sum);
break;
default: System.out.printIn("Error"); break;
}
}//end of main
}//end of class

ICSE Class 10 Computer Application Sample Question Paper 3 with Answers

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

import java.util.*;
class lol
{
static int fact(int n)
{
int fact=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.printInQ;
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.printIn();
}
}
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
a be int store consecutive integers.
k int store the multiples of 2
fact int Store the factorial.

ICSE Class 10 Computer Application Question Papers with Answers

Leave a Comment