Solving ICSE Class 10 Computer Applications Previous Year Question Papers ICSE Class 10 Computer Applications Question Paper 2018 is the best way to boost your preparation for the board exams.

ICSE Class 10 Computer Applications Question Paper 2018 Solved

[Section – A (40 MARKS)]
(Attempt all Questions)

Question 1.
(a) Define abstraction. [2]
Answer:
Abstraction is a process of hiding the implementation details and showing only functionality to the user.

(b) Differentiate between searching and sorting. [2]
Answer:
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.

ICSE 2018 Computer Applications Question Paper Solved for Class 10

(c) Write a difference between the Junctions is UpperCase() and to UpperCase(). [2]
Answer:
The is UpperCase() method is used to check whether the given character is in upper case or not. It returns Boolean datatype.
The to UpperCase() method is used to convert a character or string into upper case. It returns char or String type.

(d) How are private members of a class different from public members ? [2]
Answer:
Scope of the private members is within the class whereas scope of the public members is global.

(e) Classify the following as primitive or non-primitive data types: [2]
(i) char
(ii) arrays
(iii) int
(iv) classes
Answer:
(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.
Answer:
(i) Value of res is 65.
(ii) java.lang

(b) State the difference between while and do while loop. [2]
Answer:

while dowhile
(i) The statements can be executed. (i) The loop executes the statement at least once.
(ii) The condition is tested before execution (ii) The condition is tested after execution.
(iii) The loop terminates if the condition becomes false. (iii) If the condition is false, the computer keeps executing the loop.

(c) 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
Answer:
BEST OF LUCK is the correct option.

(d) Write the prototype of a function check which takes an integer as an argument and returns a character. [2]
Answer:
char check (int x)

ICSE 2018 Computer Applications Question Paper Solved for Class 10

(e) Write the return data type of the following function. [2]
(i) ends With()
(ii) log()
Answer:
(i) Boolean
(ii) double

Question 3.
(a) Write a Java expression for the following: [2]
\(\frac{\sqrt{3 x+x^2}}{a+b}\)
Answer:
Math.sqrt * (3 * x + Math.pow(x, 2)) / (a + b);

(b) What is the value of y after evaluating the expression [2]
y + = + + y + y – + – y; when int y = 8
Answer:
8+ (9 + 9 + 7) = 8+ 25 =33

(c) Give the output of the following: [2]
(i) Math.floor (- 4.7)
(ii) Math.ceil(3.4) + Math.pow(2, 3)
Answer:
(i) – 5.0
(ii) 12.0

(d) Write two characteristics of a constructor. [2]
Answer:
(i) Constructor has the same name as of class.
(ii) Constructor gets invoked when an object is created.

(e) Write the output for the following: [2]
System.out.println(“Incredible ”+ “\n ”+ “world”);
Answer:
Incredible
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.println(“ better ”);
else if(var == 3)
System. out.println(“best ”);
else
System.out.println(“invalid”);
Answer:
switch () {
case 1:
System.out.println(“good”);
break;
case 2:
System,out.println(“better”);
break;
case 3:
System.out.println(“invalid”);
break;
}

ICSE 2018 Computer Applications Question Paper Solved for Class 10

(g) Give the output of the following string Junctions: [2]
(i) “ACHIEVEMENT”.replacefE ’, ‘A )
(ii) “DEDICATE”.compareToC’DEVOTE”)
Answer:
(i) ACHIAVAMANT
(ii) – 18

(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));
Answer:
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) Rewrite the following using ternary operator: [2]
if(bill > 10000)
discount = bill * 10.0/100;
else
discount = bill * 5.0/100;
Answer:
discount = bill > 100 ? bill * 10.0 /100 : bill * 5.0 /100;

(j) 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.println(i);
System.out.println(i*4);
Answer:
20. Loop will be executed for () times.

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

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
(extra amount to be added in the amount as follows)

Typeof Coaches Amount
First_AC 700
Second_AC 500
Third_AC 250
sleeper None

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.
Answer:

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();
System.out.print("Enter Coach
(First_AC/Second_AC/Third_AC/ sleeper):");
coach = sc.next();
System.out.print("Enter basic amount of ticket:");
amt = sc.nextlnt();
}
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.println("Total Amount:" +totalamt);
System.out.println("Mobile No.:" +name);
}
public static void main (String args [ ]) throws IOException {
RailwayTicket t = new Railway Ticket( );
t.accept();
t.update();
t.display();
}
}

ICSE 2018 Computer Applications Question Paper Solved for Class 10

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
Answer:

import java.io.*;
import java.util.Scanner;
class Pronic {
public static void main(String aigs[]) 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.println(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
Answer:

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(str1.charAt(i) = = ") {
str2 = str2 + " +Character.toUpperCase
(str1.charAt(i+1));
i++;
}
else
str2= str2 + str1.charAt(i);
}
}

ICSE 2018 Computer Applications Question Paper Solved for Class 10

Question 7.
Design a class to overload a junction 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.
Answer:

class Shapes Volume {
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]

Pattern 1 Pattern 2
ABCDE B
ABCD LL
ABC UUU
AB EEEE
A

For an incorrect option, an appropriate error message should be displayed.
Answer:

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.nextInt();
switch(ch) {
case 1:
for (char i = 'E'; i >= 'A'; i--){
for(char j = 'A'; j <= i; j++){
System.out.print(j);
}
System.out.println();
}
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;
}
}
}

ICSE 2018 Computer Applications Question Paper Solved for Class 10

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]
Answer:

import java.io.*;
import java.util.Scanner;
class NameMarks {
public static void main(String args[]) throws IOException
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter number of students:");
int N = sc.nextlnt();
String name[] = new String[N];
int totalmarks[] = 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.nextlnt();
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++) {
deviation[i] = totalmarks[i] - average;
System.out.println("Deviation of' + name[i] + "s
marks with the average." +deviation[i]);
}
}
}