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

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.
  • 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) Define abstraction.
(b) Differentiate between searching and sorting.
(c) Write a difference between the functions isUpperCase( ) and toUpperCase( ).
(d) How are private members of a class different from public members ?
(e) Classify the following as primitive or non-primitive data types :
(i) char
(ii) arrays
(iii) int
(iv) classes
Solution:
(a) Abstraction is a process of hiding the implementation details and showing only functionality to the user.
(b) Searching is a technique which is used to search a particular element in an array or string. Sorting is a technique which is used to rearrange the elements of an array or string in a particular order either ascending or descending.
(c) The isUpperCase( ) method is used to check whether the given character is in upper case or not. It returns Boolean data type.
The toUpperCase( ) method is used to convert a character or string into upper case. It returns char or String type. •
(d) Scope of the private members is within the class whereas scope of the public members is global.
(e) (i) char is primitive data type.
(ii) arrays are non-primitive data type.
(iii) int is primitive data type.
(iv) classes are non-primitive data type.

Question 2.
(a) (i) int res = ‘A’; [2]
What is the value of res ?
(ii) Name the package that contains wrapper classes.
(b) State the difference between while and do while loop. [2]
(r) System.out.print(“BEST”); |2]
System.out.println(“OF LUCK”);
Choose the correct option for the output of the above statements
(i) BEST OF LUCK
(ii) BEST
OF LUCK
(d) Write the prototype of a function check which takes an integer as an argument and returns a character. [2]
(e) Write the return data type of the following function. [2]
(i) endsWith( )
(ii) log( )
Solution:
(a) (i) Value of res is 65.
(ii) Java.lang
(b)
ICSE Computer Applications Question Paper 2018 Solved for Class 10 - 1
(c) (i) BEST OF LUCK is the correct option.
(c) char check(int x)
(e) (i) Boolean
(ii) double

Question 3.
(a) Write a Java expression for the following :
ICSE Computer Applications Question Paper 2018 Solved for Class 10 - 2
(b) What is the value of y after evaluating the expression given below ?
y + = + +y+y–l –y; when int y=8
(c) Give the output of the following : [2]
(i) Math.floor (- 4.7)
(ii) Math.ceil(3.4) + Math.pow(2,3)
(d) Write two characteristics of a constructor. [2]
(e) Write the output for the following : [2]
System.out.prindn(“Incredible” + “\n” + “world”);
(f) Convert the following if else if construct into switch case [2]
if (var= = 1)
System.out .println(“good”);
else if(var= =2)
System.out.prindn(“better”);
else if(var= =3)
System.out.prindn( “best”);
else
System.out.prindn(“invalid”);

(g) Give the output of the following string functions : [2]
(i) “ACHIEVEMENT” .replaceCE’, ‘A’)
(ii) “DEDICATE”. compareTo(“DEVOTE”)
(h) Consider the following String array and give the output [2]
String arr[]= {“DELHI”, “CHENNAI”, “MUMBAI”, “LUCKNOW”, “JAIPUR”};
System.out.println(arr[0] .length( )> arr[3] .length( );
System.out.print(arr[4] ,substring(0,3));

(i) Rewrite the following using ternary operator : [2]
if(bill > 10000)
discount = bill * 10.0/100;
else
discount = bill * 5.0/100;
(i) Give the output of the following program segment and also mention how many times the loop is executed : [2]
int i;
for (i = 5; i > 10; i + +)
System.out.printin(i);
System.out.println(i*4);
Solution:
(a) Math.sqrt * (3 * x + Math.pow(x, 2)) / (a + b);
(b) 8 + (9 + 9 + 7) = 8 + 25 =33
(c) (0 – 5.0 (it) 12.0
(d) (i) Constructor has the same name as of class.
(ii) Constructor gets invoked when an object is created.
(e) Incredible
world
(f) switch ( ) {
case 1:
System.out .println( “good”);
break; .
case 2:
System.out .println( “better”);
break;
case 3:
System.out.println( “invalid”);
break;
}
(g) (i) ACHIAVAMANT
(ii) – 18
(h) false (at index 0, DELHI consists of 5 characters, at index 3, LUCKNOW consists of 7 characters. Therefore 5 > 7 is false)
JAI (at index 4, JAIPUR exists and extract its three characters)
(i) discount = bill > 100 ? bill * 10.0 /100 : bill * 5.0 /100;
(j) 20. Loop will be executed for 0 times.

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 Railway Ticket with following description : [15]
Instance variables/s data members :
String name : To store the name of the customer
String coach : To store the type of coach customer wants to travel
long mobno : To store customer’s mobile number
int amt : To store basic amount of ticket
int totalamt : To store the amount to be paid after updating the original amount

Member methods
void accept ( ) — To take input for name, coach, mobile number and amount
void update ( )— To update the amount as per the coach selected

Type of CoachesAmount
First_ AC700
Second_AC500
Third _AC250
sleeperNone

void display( ) — To display all details of a customer such as name, coach, total amount and mobile number.
Write a main method to create an object of the class and call the above member methods.
Solution:
import java.io.*;
import java.util.Scanner; class RailwayTicket {
String name, coach;
long mobno;
int amt, totalamt;
void accept( ) throws IOException {
Scanner sc = new Scanner(System.in);
System.out.print(“Enter Passenger’s Name: “);
name = sc.next( );
System.out.print(“Enter Mobile Number:”);
mobno = sc.nextlnt( );
Systein.out.print(“Enter Coach (FirstAC/SecondAC/ThirdAC/sleeper):”);
coach = sc.next( );
System.out.print(“Enter basic amount of ticket:”);
amt = sc.nexdnt( );
}
void update!) {
if (coach.equals(“First_AC”))
totalamt = amt + 700;
else
if (coach.equals(“Second_AC”))
totalamt = amt + 500; .
else
if (coach.equals!”Third_AC”))
totalamt = amt + 250;
else
totalamt = amt;
}
void display() {
System.out.println(“\n\n Name :” +name);
System.out.println(“Coach :” +coach);
System.out.prindn(”Total Amount:” +totalaint);
System.out.prindn(“Mobile No.:” +name);
}
public static void main (String args[ ]) throws IOException {
RailwayTicket t = new RailwayTicket!);
t.accept();
t.update();
t.display();
}
}

Question 5.
Write a program to input a number and check and print whether it is a Pronic number [15] or not. (Pronic number is the number which is the product of two consecutive integers)
Examples : 12 = 3 × 4 .
20 = 4 × 5
42 = 6 × 7
Solution:
import java.io.*;
import java.util. Scanner;
class Pronic]
public static void main(String argsQ) throws IOException {
Scanner sc = new Scanner(System.in);
System.out.print(“Enter the number: “);
int n = sc.nextlnt();
int i = 0;
while(i * (i + 1) < n) {
i++;
}
if(i *(i + 1) = = n){
System.out.println(n + ” is a Pronic Number.”);
}
else {
System.out.prindn(n + ” is not a Pronic Number.”);
}
}
}

Question 6.
Write a program in Java to accept a string in lower case and change the first letter of every word to upper case. Display the new string. [15]
Sample input: we are in cyber world
Sample output : We Are In Cyber World
Solution:
import java.io.*;
import java.util.Scanner;
class ChangeLetter {
public static void main(String args[ ]) throws IOException {
Scanner sc = new Scanner(System.in);
System.out.print(“Enter String in lowercase:”);
String str 1 = sc.next( );
strl = “” +strl;
String str2 = ” “:
for (int i = 0; i<strl.length( ); i+ +) {
if(strl ,charAt(i) = = “) {
str2 = str2 + ” +Character. toUpperCase(strl.charAt(i+l));
i+ + ;
}.
else
str2= str2 + strl.charAt(i);
}
System.out.println(str2.trim( ));
}
}

Question 7.
Design a class to overload a function volume() as follows : [15]
(i) double volume (double R) — with radius (R) as an argument, returns the volume of sphere using the formula.
V = 4/3 × 22/7 × R3
(ii) double volume (double H, double R) – with height(H) and radius(R) as the arguments, returns the volume of a cylinder using the formula.
V = 22/7 × R2 × H
(iii) double volume (double L, double B, double H) – with length(L), breadth(B) and Height(H) as the arguments, returns the volume of a cuboid using the formula.
Solution:
class ShapesVolume {
public static double volume (double R) {
double V = 4.0 / 3, * 22.0 / 7 * Math.pow(R, 3);
return V;
}
public static double volume(double H, double R) {
double V = 22.0 / 7 * R * R * H ;
return V;
}
public static double volume (double L, double B, double H) {
double V = L * B * H;
return V;
}
}

Question 8.
Write a menu driven program to display the pattern as per user’s choice. [15]
ICSE Computer Applications Question Paper 2018 Solved for Class 10 - 3
For an incorrect option, an appropriate error message should be displayed.
Solution:
import java.io.*;
import java.util.Scanner;
class Pattern {
public static void main(String args[]) throws IOException {
Scanner sc = new Scanner(System.in);
System.out.println(“::::MENU::::”)
System.out.println(” 1. To display ABCD Pattern”);
System.out.print(” 2. To display Word Pattern”);
System.out.print(“Enter your choice:”);
int ch= sc.nextlnt();
switch(ch) {
case 1:
for (char i = ‘E’; i > = ‘A’; i- -){
for(char j = ‘A’;j <=i;j + +){
System.out.print(j);
}
System.out.prindn( );
}
break;
case 2:
String S = “BLUE”;
for (int i = 0; i < S.length(); i+ +) {
for(int j = 0; j < =i; j + +) {
System.out.print(S.charAt(i));
}
System.out.println();
}
break;
default:
System.out.println(“Invalid Input”);
break;
}
}
}

Question 9.
Write a program to accept name and total marks of N number of students in two single subscript array name[] and totalmarks[ ].   [15]
Calculate and print:
(i) The average of the total marks obtained by N Number of students.
[average = (sum of total marks of all the students)/N]
(ii) Deviation of each student’s total marks with the average.
[deviation = total marks of a student – average] ‘
Solution:
import java.io.*;
import java. util. Scanner;
class NameMarks {
public static void main(String argsO) throws IOException {
Scanner sc = new Scanner(System.in);
System.out.print(“Enter number of students:”);
int N = sc.nextlnt( );
String named = new String[N];
int totalmarksG = new int[N];
double deviation[ ] = new double[N];
double sum = 0;
for (int i = 0; i < N; i+ +) {
System.out.print(“Enter Name of the Student:”);
name[i] = sc.next( );
System.out.print(“Enter Marks:”);
totalmarks[i] = sc.nextlntO;
sum = sum + totalmarks [i];
}
double average = sum / N;
System.out.println(“The average of the total marks of ” +N+” number of students:” +average);
for (int i = 0; i < N; i+ +) {
deviadon[i] = total marks (i] – average;
System.out.println(“Deviation of” + name[i] + “s marks with the average:” +deviation[i]);
}
}
}

ICSE Class 10 Computer Applications Previous Years Question Papers 

Leave a Reply

Your email address will not be published. Required fields are marked *