ICSE Computer Applications Question Paper 2019 Solved for Class 10

ICSE Computer Applications Previous Year Question Paper 2019 Solved for Class 10

General Instructions :

  • Answers to this Paper must he 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.
  • 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 Questions)

Question 1.
(a) Name any two basic principles of Object-oriented Programming.
(b) Write a difference between unary and binary operator.
(c) Name the keyword which :
(i) indicates that a method has no return type.
(ii) makes the variable as a class variable.
(d) Write the memory capacity (storage size) of short and float data type in bytes.
(e) Identify and name the following tokens :
(i) public
(ii) ‘a’
(iii) ==
(iv) {}
Solution.
(a) Abstraction and encapsulation are the basic principles of Object-oriented Programming.
(b)

Unary OperatorsBinary Operators
(i) The operators which act upon a single operand are called unary operators.(i) The operators which require two operands for their action are called binary operators.
(ii) They are pre-increment and post increment (+ +)(ii) They are mathematical operators and relational operators.

(c)
(i) void
(ii) static

(d) (i) short: 2 bytes
(ii) float: 4 bytes

(e) (i) keyword
(ii) literal
(iii) operator
(iv) separator

Question 2.
(a) Differentiate between if else if and switch-case statements. [2]
(b) Give the output of the following code : [2]
String P = “20”, Q = “19”,
int a = Integer .parselnt(P);
int b = Integer. valueOf(Q);
System.out.println(a+””+b);
(c) What are the various types of errors in Java ? [2]
(d) State the data type and value of res after the following is executed : [2]
char ch = ‘9’;
res = Character. isDigit(ch) ;
(e) What is the difference between the linear search and the binary search technique? [2]
Solution.
(a)

if else ifswitch-case
(i) It evaluates integer, character, pointer or floating-point type or boolean type.(i) It evaluates only character or integer value.
(ii) Which statement will be executed depend upon the output of the expression inside if statement.(ii) Which statement will be executed is decided by user.

(b) 2019
(c) Syntax error, Runtime error, Logical error
(d) boolean
True

(e)

Linear SearchBinary Search
(i) Linear search works both for sorted and unsorted data.(i) Binary search works on sorted data (either in ascending order or in descending order).
(ii) Linear search begins at the start of an array i.e. at 0th position.(ii) This technique divides the array in two halves, and the desired data item is searched in the halves.

Question 3.
(a) Write a Java expression for the following : [2]
|x2+2xy|
(b) Write the return data type of the following functions : [2]
(i) startsWith( )
(ii) random( )
(r) If the value of basic=1500, what will be the value of tax after the following statement is executed? [2]
tax = basic > 1200 ? 200 : 100;
id) Give the output of following code and mention how many times the loop will execute ? [2]
int i;
for(i=5; i> =l;i~)
{
if(i%2 ==1)
continue;
System.out.print(i+ ”
}
(e) State a difference between call by value and call by reference. [2]
(f) Give the output of the following: [2]
Math.sqrt(Math.max(9, 16))
(g) Write the output for the following: [2]
String s1 = “phoenix”; String s2 =”island”;
System.out.prindn (s1.substring(0).concat (s2.substring(2)));
System.out.println(s2.toUpperCase( ));
(h) Evaluate the following expression if the value ofx=2,y=3 and z=1. [2]
v=x+–z+y+ + +y
(i) String x[ ] = {“Artificial intelligence”, “IOT”, “Machine learning”, “Big data”}; [2]
Give the output of the following statements:
(i) System.out.prindn(x[3]);
(ii) System.out.prindn(x.length);
(j) What is meant by a package? Give an example. [2]
Solution.
(a) Math.abs((x * x) + (2 * x * y);
(b) (i) boolean
(ii) double
(c) 200
(d) 4 2
Loop will execute 5 times.

(e)

Call by ValueCall by Reference
(i) In call by value the method creates its new set of variables (formal parameters) to copy the value of actual parameters and works with them.(i) In call by reference, reference of the actual parameters is passed on to the method. No new set of variables is created.
(ii) Any change made in the formal parameter is not reflected in the actual parameter.(ii) Any change made in the formal parameter is always reflected in the actual parameters.
(iii) Primitive data types are passed by call by value.(iii) Reference types like (objects, array etc.) are passed by call by reference.

(f) 4.0
(g) phoenix land
ISLAND

(h) = 2 + 0 + 3 + 4
(i) (i) Big data
(ii) 4
(j) A package is an organized collection of classes which is included in the program as per the requirement of the program. For example java.io package is included for input and output operations in a program.

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 so that the logic of
the program is clearly depicted.
Flow-Charts and Algorithms are not required.

Question 4.
Design a class name ShowRoom with the following description :
Instance variables/ Data members :
String name – To store the name of the customer
long mobno – To store the mobile number of the customer
double cost – To store the cost of the items purchased
double dis – To store the discount amount
double amount – To store the amount to be paid after discount
Member methods: –
ShowRoom() – default constructor to initialize data members
void input() – To input customer name, mobile number, cost
void calculate() – To calculate discount on the cost of purchased items, based on following criteria

CostDiscount (in percentage)
Less than or equal to ₹ 100005%
More than ₹ 10000 and less than or equal to ₹ 2000010%
More than ₹ 20000 and less than or equal to ₹ 3500015%
More than ₹ 3500020%

void display() – To display customer name, mobile number, amount to be paid after discount
Write a main method to create an object of the class and call the above member methods.
Solution.
import java.io.*;
import java.util.*;
class ShowRoom {
String name;
long mobno;
double cost;
double dis;
double amount;
ShowRoom( ) {
name = ” “;
mobno =0;
cost = 0;
dis = 0;
amount = 0;
}
void input( ) {
Scanner sc = new Scanner(System.in);
System.out.println(“EnterName:”);
name = sc.nextLine( );
System.out.println(“Enter Mobile number:”);
mobno = sc.nextLong( );
System.out.println(“Enter cost:”);
cost = sc.nextDouble( );
}
void calculate( ) {
if (cost <= 10000){
dis cost*5/100;
amount = cost – dis;
}
else
if (cost > 10000 && cost < = 20000){
dis = cost* 10/100;
amount cost – dis;
}
else
if (cost > 20000 && cost < = 35000){
dis = cost* 15/100;
amount = cost – dis;
}
else
if (cost > 35000){
dis = cost*20/100;
amount = cost – dis;
}
}
void display( ) {
System.out.println(“Name::” +name);
System.out.println(“Mobile No.::” +mobno);
System.out.println(“Amount::” +amount);
}
public static void main(String args( )) {
ShowRoom ob = new ShowRoom( );
ob.input( );
ob.calculate( );
ob.display( );
}
}

Question 5.
Using the switch-case statement, write a menu driven program to do the following : [15]
(a) To generate and print Letters from A to Z and their Unicode Letters Unicode
ICSE Computer Applications Question Paper 2019 Solved for Class 10 - 1

(b) Display the following pattern using iteration (looping) statement: 1
ICSE Computer Applications Question Paper 2019 Solved for Class 10 - 2
Solution.
import java.io.*;
import java.util.*;
class SwitchCase {
public static void main(String args[ ]) {
Scanner sc = new Scanner (System.in);
System.out.println(” 1. Enter 1 for Unicode:”);
System.out.prindn(” 2. Enter 2 for Pattern:”);
System.out.println(“Enter your choice:”);
int choice sc.nextlntO;
switch(choice){
case 1:
char ch;
System.out.println( “Letters \t Unicode”);
for (ch = ‘A’; ch < = ‘Z’; ch+ +) {
System.out.println(ch +”\t” + (int)ch);
}
break;
case 2:
int i, j;
for (i = 1; i < = 5; i+ +) {
for (j = 1; j < = i; j + +)
{
System.out.print(j + “”);.
}
System.out.printlnO;
}
break;
default:
System.out.println(“Wrong choice entered:”);
}
}
}

Question 6.
Write a program to input 15 integer elements in an array and sort them in ascending order using the bubble sort technique. [15]
Solution.
import java.io.*;
import java.util’*;
class AscendingOrder {
public static void main(String args[]) {
int i, j, temp;
Scanner sc = new Scanner(System.in);
int arr[] = new int[15];
System.out.println(“Enter 15 integers:”);
for (i = 0; i < = 15; i+ +) {
arr[i] = sc.nextlntO;
for(i = 0; i < 14; i++){
for(j = 0; j < 14 -i; j + +){
if(arr[j] > arr[j + 1]){
temp = arr[j];
arr[j] = arr [j + 1];
arr[j + 1] = temp;
}
}
}
System.out.println(“Elements in ascending order are::”);
for (i = 0; i < 15; i+ +) {
System.out.println(arr[i]);
}
}
}
}

Question 7.
Design a class to overload a function series() as follows: [15]
(a) void series (int x, int n) – To display the sum of the series given below:
x1 + x2 + x3 + ……………. xn terms
(b) void series (int p) – To display the following series:
0, 7, 26, 63 p terms.
(c) void series () – To display the sum of the series given below:
ICSE Computer Applications Question Paper 2019 Solved for Class 10 - 3
Solution.
import java.io.*;
import java.util.*;
class OverloadSeries {
void series( int x, int n) {
int i; .
double a;
double sum = 0;
for (i = 1; i < = n; i++) {
a = Math.pow(x, i);
sum = sum + a;
}
System.out.prindn(“Sum::” +sum)r
}
void series(int p) {
int i;
for (i = 1; i < = p; i++) {
System.out.prindn((i * i * i) – 1 + ” “);
}
}
void series() {
double i;
double s = 0;
for (i =-2; i < = 10; i+ +) {
s = s + 1/i;
}
System.out.println(“Sum:” +s);
}
}

Question 8.
Write a program to input a sentence and convert it into uppercase and count and display the total number of words starting with a letter ‘A’. [15]
Example:
Sample Input: ADVANCEMENT AND APPLICATION OF INFORMATION TECHNOLOGY ARE EVER CHANGING.
Sample Output : Total number of words starting with letter A’ = 4.
Solution.
import java.io.*;
import java.util.*;
class UpperCount {
public static void main(String args[ ]) {
int i, a;
Scanner sc = new Scanner(System.in);
String str, str1, str2;
System.out.prindn(“Enter sentence::”);
str = sc.nextLine();
strl = str.toUpperCaseO; ‘
str2 = “” + strl;
a = 0; ,
for (i = 0; i < = str2.1ength(); i+ +) {
if(str2.charAt(i) == ‘ ‘)
if(str2.charAt(i + 1) == ‘A’);
a+ +;
}
System.out.println(“Total number of words starting with letter ‘A’::” +a);
}
}

Question 9.
A tech number has even number of digits. If the number is split in two equal halves, then the square of sum of these halves is equal to the number itself. Write a program to generate and print all four digit tech numbers. [15]
Example :
Consider the number 3025
Square of sum of the halves of 3025 = (30+25)2
= (55)2
= 3025 is a tech number.
Solution.
import java.io.*;
import java.util.*;
class TechNumber {
public static void main(String args[ ]) {
int i, a, b, sum;
String n;
System.out.println(“Four Digits Tech Numbers are::”);
for(i = 1000; i < 1000; i+ +) {
n = i +””;
a = lnteger,parselnt(n.substring(0, 2));
b = Integer.parselnt(n.substring(2));
sum = (int)Math.pow((a + b), 2);
if (sum == i)
System.out.println(i);
}
}
}

ICSE Class 10 Computer Applications Previous Years Question Papers