ICSE 2015 Computer Applications Solved Paper
ICSE 2015 Computer Applications Solved Paper
COMPUTER
APPLICATIONS
x 62/87,212)
x &200(1762)&281&,/(;$0,1(56
x 68**(67,216)257($&+(56
'HGLFDWHGWRDOOP\ORYHO\VWXGHQWV0D\*RGKHOS\RXDOZD\V
7KLVVPDOOERRNOHWFRQWDLQVVROXWLRQRI,&6(&RPSXWHU$SSOLFDWLRQV
7KH FRPPHQWV IURP WKH FRXQFLO H[DPLQHUV XQGHU VROXWLRQ RI HYHU\ TXHVWLRQ
PDNHV WKLV D YHU\ KDQG\ JXLGH IRU VWXGHQWV WR XQGHUVWDQG ZKDW WKH FRXQFLO
H[SHFWVDVDQVZHUIURPWKHVWXGHQWV
,KRSHWKDWWKHVWXGHQWVZLOOILQGWKLVWREHXVHIXO
Md. Zeeshan Akhtar
WK1RYHPEHU
%/$1.3$*(
COMPUTER APPLICATIONS
Question 1
(a) What are the default values of primitive data type int and float? [2]
(b) Name any two OOP’s principles. [2]
(c) What are identifiers? [2]
(e) Name the wrapper classes of char type and boolean type. [2]
Examiners’ Comments
(a) Most candidates answered correctly.
However a few were not clear about the Suggestions for teachers
default value of float. Primitive data types should be taught
(b) Most candidates answered correctly. However with its default values.
some candidates got confused with the Principles and features of OOP’s
principles of OOP’s. should be explained clearly.
(c) Most candidates answered correctly. A few Correct definitions of terms used
candidates however wrote the rules for frequently should be explained
declaring an identifier. thoroughly.
(d) Though most candidates answered correctly, Explain the different types of literals
there were some who misunderstood the with examples.
question and wrote vague and incorrect Teach all the wrapper classes with the
answers. correct syntax.
(e) Most candidates wrote the first character of
wrapper classes in lower case letters instead of uppercase character.
MARKING SCHEME
Question – 1
(a) The default value of int is 0 and that of float is 0.0f
(b) Data Abstraction/Abstraction, Inheritance, Polymorphism, Message passing, Data
encapsulation/Encapsulation
(c) An identifier is a sequence of characters used to name variables , methods, classes,
packages and interfaces OR
They represent names of different components of a Java program.
(d) (i) floating point literal
(ii) character literal..
(iii) boolean literal.
(iv) String literal
(e) Character and Boolean
www.guideforschool.com
Question 2
(a) Evaluate the value of n if value of p=5,q=19
int n = (q-p)>(p-q)?(q-p) : (p-q); [2]
(b) Arrange the following primitive data types in an ascending order of their size: [2]
(i) char (ii) byte (iii) double (iv) int
(c) What is the value stored in variable res given below : [2]
double res = Math.pow("345".indexOf('5'),3);
(e) What are the values of a and b after the following function is executed , if the values
passed are 30 and 50:
void paws(int a ,int b)
{ a=a+b;
b=a-b;
a=a-b;
System .out.println(a+","+b); } [2]
Examiners’ Comments:
(a) Most candidates answered correctly, however
Suggestions for teachers
some candidates wrote the expression (q-p) instead
Practice exercise on ternary operator.
of its final value.
(b) Candidates got confused between the size of int Order of all data types with its size
and char. Some candidates wrote the answer in should be taught thoroughly.
descending order instead of an ascending order. Stress on using important keywords.
(c) Most candidates wrote the answer as 8 instead 8.0. Practice exercises on evaluation of the
A few candidates were unable to find the index of multiple and single mathematical
the given argument. functions on the computer.
(d) Most candidates answered correctly. A few Constructor should be taught in detail
candidates were not clear about the types of along with its types.
constructor. Explain the difference between transfer
(e) Most candidates answered correctly. Some of value and interchange of value.
however were unable to interchange the value
correctly.
www.guideforschool.com
MARKING SCHEME
Question - 2
(a) n=14
(b) (i) byte (ii) char (iii) int (iv) double.
(c) 8.0
(d) (i) Non-Parameterized constructor and Parameterized constructor. [OR]
(ii) Default constructor and Parameterized constructor. [OR]
(iii) Constructor without parameters and Constructor with parameters.
(e) 50,30
Question 3
(a) State the data type and value of y after the following is executed :
char x='7';
y= Character.isLetter(x); [2]
(b) What is the function of catch block in exception handling ? Where does it appear in
a program? [2]
(c) State the output when the following program segment is executed :
String a="Smartphone", b="Graphic Art";
String h=a.substring(2,5);
String k= b.substring(8).toUpperCase();
System.out.println(h);
System.out.println(k.equalsIgnoreCase(h)) ; [2]
(d) The access specifier that gives the most accessibility is____________________ and the
least accessibility is __________________. [2]
(e) (i) Name the mathematical function which is used to find sine of an angle given
in radians.
(ii) Name a string function which removes the blank spaces provided in the prefix
and suffix of a string . [2]
www.guideforschool.com
(h) Write the output of the following program code :
char ch;
int x=97;
do
{
ch=(char)x;
System.out.print(ch+" ");
if(x%10==0)
break;
++x;
} while(x<=100); [2]
Examiners’ Comments
(a) Many candidates did not write the data type with
Suggestions for teachers
only the value being written. Some candidates
were unfamiliar with Character functions. All the character functions given in the
(b) Most candidates showed a lack of knowledge of Syllabus should be taught
this topic. However a few candidates wrote the comprehensively.
answer correctly. Teach all the String functions
(c) Many candidates answered this question mentioned in the syllabus thoroughly.
correctly. However some candidates incorrectly Access specifiers should be taught with
wrote (Art) instead of art. examples.
(d) Most candidates answered correctly. However, Emphasize on all mathematical and
there were few candidates who interchanged the String Functions.
answer. Some candidates wrote protected, friendly Attach more importance to the
and default as the answer instead of private. fundamentals of array.
(e) Most candidates answered this question Introduce the concept of packages and
correctly. A few however committed errors in the the classes contained in them.
syntax and wrote the answer as sine () instead of Practice output questions involving
sin (). loops and stress on doing dry run and
(f) Most candidates were unable to understand both writing the steps of calculation.
parts of the question and wrote incorrect answers. Explain the hierarchy of operators and
(g) Many candidates answered this question correctly. also how to evaluate the Java
A few candidates were not familiar with the expressions.
package that contains Scanner and Buffered class. Prefix and postfix of increment and
(h) A number of candidates wrote the answer correctly, decrement operator is a common topic
but a few candidates failed to take the last iteration. and sufficient practice must be done in
Some candidates wrote the integer value instead of class.
character value.
www.guideforschool.com
(i) Most candidates answered correctly. A few however lost marks due to missing
asterisk(multiplication) symbols and wrong division signs.
(j) Some candidates were not familiar in solving expressions involving pre increment and post
increment operators within a multiple parenthesis.
MARKING SCHEME
Question - 3
(a) Data type is boolean and y=false
(b) A Catch block is a group of Java statements that are used to handle a raised exception. The catch
block should be placed after try block.
(c) art
true
(d) (i) public (ii) private.
(e) (i)sin() (ii) trim()
(f) (i) garbage value
(ii) this keyword.
(g) io and util package
(h) a b c d
(i) (Math.pow(a,2)+Math.pow(b,2))/(2*a*b) [OR]
(a*a+b*b)/(2*a*b)
(j) int z=(++y*(y++ +5));
(11*(11+5));
176
Question 4
Define a class called Parking Lot with the following description :
Instance variables/data members :
int vno - To store the vehicle number
int hours - To store the number of hours the vehicle is parked in the parking lot
double bill - To store the bill amount
Member methods :
void input() - To input and store the vno and hours.
void calculate() - To compute the parking charge at the rate of 3 for the first hour or part thereof,
and 1.50 for each additional hour or part thereof.
void display() - To display the detail
Write a main method to create an object of the class and call the above methods.
[15]
www.guideforschool.com
Examiners’ Comments
(i) Function names and variables names written by Suggestions for teachers
most candidates were different from what was Instruct students to use the class name,
asked in the question. variable name and method name as
(ii) The entire program was done using only one given in the question.
method.
Teach the concept of
(iii) The value for parking charge, which is to be
classes/object/Data members with the
calculated was accepted from the user.
help of real Life examples.
(iv) There were mistakes in calculations of parking
Teach writing programs in which
charge.
multiple methods are involved.
(v) Variables were declared inside the input() method .
(vi) Object creation was not done. Explain that the parking charge/bill that
(vii) Variable description /mnemonic codes were not needs to be calculated should not be
found in most answers. accepted from the user.
MARKING SCHEME
Question - 4
import java.util.*;
class ParkingLot
{
int vno;
int hours;
double bill;
Scanner sc=new Scanner(System.in);
void input()
{
System.out.println("Enter the vehicle number and number of hours");
vno=sc.nextInt();
hours=sc.nextInt();
}
void calculate()
{
if(hours<=1)
bill= 3;
else
bill=3+(hours-1)*1.50;
}
void display()
{
System.out.println("Vechicle Number:"+vno);
System.out.println("Hours:"+hours);
System.out.println("Bill:"+bill);
}
public static void main(String args[])
{
ParkingLot pl=new ParkingLot();
www.guideforschool.com
pl.input();
pl.calculate();
pl.display();
}
}
Question 5
Write two separate programs to generate the following patterns using iteration(loop) statements:
* (b) 54321
*# 5432
*#* 543
*#*# 54
*#*#* 5 15]
Examiners’ Comments:
Suggestions for teachers
(i) Some candidates wrote the program for only one
type of triangle instead of both. Emphasize the difference between
(ii) A few candidates were confused with the print() and println() method.
pattern using two characters. Students should be made to practice and
(iii) In part (b) reverse loop was not formed execute programs to print patterns on
correctly the computer.
(iv) A few candidates answered this question by Assign program segments to students
writing 5 print statements. to find the output so that they will be
(v) Improper output, println() statement instead of able to perform the manual calculation
print() statement for printing each character. and understand how the loop works.
(vi) Blank println() statement was missing. Instruct students to dry run the program
MARKING SCHEME
Question - 5
(a) import java.io.*;
class Quest_5a
{
void patteren1()
{ for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{ if(j%2!=0)
System.out.print("*"+" ");
else
System.out.print("#"+" ");
}
www.guideforschool.com
System.out.println();
} } }
Question 6
Write a program to input and store roll numbers, names and marks in 3 subjects of n
number students in five single dimensional array and display the remark based on
average marks as given below:(the maximum marks in the subject are 100)
average marks=Total Marks
3
Average marks Remarks
85-100 EXCELLENT
75-84 DISTINCTION
60-74 FIRST CLASS
40-59 PASS
Less than 40 POOR [15]
Examiners’ comments:
(i) Many candidates attempted the question without
Suggestions for teachers
using array.
(ii) Input of data was not taken inside the loop. Array creation with different data types
(iii) Value of ‘n’ (number of students) not accepted. should be practiced.
(iv) Arrays were declared without specifying the Inputting and storing elements in an
size. array should be practiced on the
(v) Calculation average was not done inside the loop. computer.
(vi) Accepted the average marks from the user Use of relational operators should be
instead of computing. explained clearly.
(vii) Conditions for grading were not written correctly.
www.guideforschool.com
MARKING SCHEME
Question - 6
import java.util.*;
class Quest_6
{
void grade()
{
Scanner br=new Scanner(System.in);
System.out.println("Enter number of students");
int n=br.nextInt();
int roll[]=new int[n];
String name[]=new String[n];
double m1[]=new double[n];
double m2[]=new double[n];
double m3[]=new double[n];
double avg[]=new double[n];
for(int i=0;i<n;i++)
{
System.out.println("Enter roll number,name,marks in 3 Subjects
for"+(i+1)+"student");
roll[i]=br.nextInt();
name[i]=br.next();
m1[i]=br.nextDouble();
m2[i]=br.nextDouble();
m3[i]=br.nextDouble();
avg[i]=(m1[i]+m2[i]+m3[i])/3;
if(avg[i]>=85&&avg[i]<=100)
System.out.println("EXCELLENT");
else if(avg[i]>=75&&avg[i]<=84)
System.out.println("DISTINCTION");
else if(avg[i]>=60&&avg[i]<=74)
System.out.println("FIRST CLASS");
else if(avg[i]>=40&&avg[i]<=59)
System.out.println("PASS");
else
System.out.println("POOR");
}
}
}
www.guideforschool.com
Question 7
Design a class to overload a function Joystring() as follows:
(i) void Joystring (String s, char ch1, char ch2) with one string argument and two character
arguments that replaces the character argument ch1 with the character argument ch2 in
the given string s and prints the new string.
Example:
Input value of s ="TECHNALAGY"
ch1='A',
ch2='O'
Output : "TECHNOLOGY"
(ii) void Joystring (String s) with one string argument that prints the position of the first
space and the last space of the given string s.
Example:
Input value of ="Cloud computing means Internet based computing"
Output : First index : 5
Last index : 36
(iii) void Joystring ( String s1, String s2 ) with two string arguments that combines the
two strings with a space between them and prints the resultant string.
Example:
Input value of s1 ="COMMON WEALTH "
Input value of s2="GAMES "
Output : COMMON WEALTH GAMES
(use library functions) 15
www.guideforschool.com
Examiners’ Comments
Most candidates answered correctly. A few Suggestions for teachers
candidates were not clear about the concepts of - Emphasis on the function name to be the
function overloading. same.
(i) A few candidates used separate programs or - Programs using function overloading
three functions with different names. should be practiced more. Using only
(ii) Some candidates used the same name for the main functions for all programs should
class and the three methods. be avoided.
(iii) Some candidates made all the calculations in - String functions and their uses need to
the main function itself. be taught thoroughly.
(vi) Functions were called without passing - Passing arguments through function
required arguments and accepted values as must be worked out while teaching.
inputs inside the function body. - Practice lot of output questions based on
(v) In place of concat() method , + operator was all the String functions.
used. - During the given reading time, minute
(vi) String functions were not used. Instead details should be noted and underlined
candidates complicated the program by using so as not to be missed while writing the
loops and arrays. program.
MARKING SCHEME
Question - 7
import java.util.*;
class Quest_7
{
void joystring(String s,char ch1,char ch2)
{
String str=s.replace(ch1,ch2);
System.out.println(str);
}
void joystring(String s)
{
int first=s.indexOf(' ');
System.out.println("First index :"+first);
int last=s.lastIndexOf(' ');
System.out.println("Last index :"+last);
}
void joystring(String s1,String s2)
{ String s3=" ";
String str=s1.concat(s3).concat(s2);
System.out.println(str);
}
public static void main(String args[])
{
Quest_7 obj=new Quest_7();
obj.joystring("TECHNALAGY",'A','O');
www.guideforschool.com
obj.joystring("Cloud computing means Internet based computing");
obj.joystring("COMMOM WEALTH","GAMES");
}
}
Description of variables/ comments/mnemonics
Question 8
Write a program to input twenty names in an array. Arrange these names in descending order
of alphabets, using the bubble sort technique. [15]
Examiners’ comments
(i) Array elements are assigned not accepted. Suggestions for teachers
(ii) Integer array was declared instead of String Revise iteration before teaching arrays.
array. Explain the importance of the loop
(iii) Declaration of temporary variable as an integer variable.
type instead of String array. Basic technique such as searching and
(iv) Compare To() method was not used. sorting should be taught with different
(v) Other methods of sorting were used instead of data types.
bubble sort. Use of compareTo () method should be
(vi) Array elements were sorted in ascending order explained with help of examples.
instead of sorting in a descending order.
Train candidates to write the program
(vi) Printing of sorted elements was not done.
using different array length.
Difference between bubble sort and
selection sort must be discussed.
Emphasize on output requirements.
MARKING SCHEME
Question 8
import java.util.*;
class Quest_8
{ void sort()
{
Scanner br=new Scanner (System.in);
String names[]=new String[20];
System.out.println("Enter 20 names");
for(int i=0;i<20;i++)
{
names[i]=br.next();
}
for(int j=0;j<(20-1);j++)
{ for(int k=0;k<20-j-1;k++)
{
if(names[k].compareTo(names[k+1])<0)
{ String temp=names[k];
www.guideforschool.com
names[k]=names[k+1];
names[k+1]=temp;
}
}
}
System.out.println("Names in descending order");
for(int k=0;k<20;k++)
{System.out.println(names[k]);
}} }
Description of variables/ comments/mnemonics
Question 9
Examiners’ comments:
Many candidates lost marks because of the absence of
menu and input choice, break and default statement. Suggestions for teachers
Some candidates did not follow the instruction and
wrote two separate programs. Additional practice on menu driven
programs.
(a) (i) Overlooked the instruction excluding number Teach all types of logical programs.
itself . Instruct candidates to read the
(ii) For finding the factor ‘/’ operator was used question carefully and follow the given
instead of % operator. instructions.
(b) (i) Variable for finding the factorial was
initialized with value 0 . Some candidates initialized the variable with value 1 but inside the
loop.
(iii) Loop to find the factorial was formed 1 to < n.
www.guideforschool.com
MARKING SCHEME
Question 9
import java.util.*;
class question9
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("MENU");
System.out.println("1.FACTORS OF A NUMBER");
System.out.println("2.FACTORIAL OF A NUMBER");
System.out.println("ENTER A NUMBER");
int num=sc.nextInt();
System.out.println("ENTER YOUR CHOICE");
int choice=sc.nextInt();
switch (choice)
{
case 1:
System.out.print("FACTORS ARE=");
for(int i=1;i<=num/2;i++)
{
if(num%i==0)
System.out.print(i+",");
}
break;
case 2:
int f=1;
for(int i=1;i<=num;i++)
{
f=f*i;
}
System.out.println("FACTORIAL OF "+num+"="+f);
break;
default:
System.out.println("Wrong choice");
}
}}
www.guideforschool.com
Topics /Concepts found difficult
www.guideforschool.com