Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Sunday, December 16, 2012

ICSE SOLVED QUESTION PAPERS (2011)

ICSE PREVIOUS YEARS


QUESTION PAPERS
2011
SECTION A (40 Marks)
Question1:
a) What is the difference between an object and a class?
b) What does the token keyword refer to, in the context of java? Give an example for keyword.
c) State the difference between entry controlled loop and exit controlled loop.
d) What are the two ways of invoking functions?
e) What is the difference between / and % operator?

Question 2:

converted by W eb2PDFConvert.com
a) State the total size in bytes of the arrays a[4] of char data tytpe and p[4] of float data type.
b)
i. Name the package that contains Scanner class.
ii. Which unit of the class gets called, when the object of the class is created?
c) Give the output of the following:
String n=Computer Knowledge.;
String m=Computer Application;
System.out.println(n.substring (0,8).concat(m.substring(9)));
System.out.println(n.endsWith(e));
d) Write the output of the following:
i. System.out.println(Character.isUpperCase(R));
ii. System.out.println(Character.toUpperCase(j));
e) What is the role of keyword void in declaring functions?
Question 3:
a. Analyse the following program segment and determine how many times the loop will be executed and what will be the output of
the program segment?
Int p=200;
While(true)
{
if(p<100)
break;
p=p-20;
}
System.out.println(p);
b. What will be the output of the following code?
i. Int k=5,j=9;
K+=k++ - ++j +k;
System.out.println(k=+k);
System.out.println(j=+j);
ii. Double b==15.6;
Double a=Math.rint(Math.abs(b));
System.out.println(a=+a);
c. Explain the constructor overloading with an example.
d. Give the prototype of a function search which receives a sentence sentnc and word wrd and returns 1 or 0?
e. Write an expression in java for z=

f. Write a statement each to perform the following task on a string:


i. Find and display the position of the last space in a string s.
ii. Convert a number stored in a string variable x to double data type.
g. Name the keyword that
i. Informs that an error has occurred in an input/output operation.
ii. Distinguishes between instance variable and class variable.
h. What are library classes? Give an example.
i. Write one difference between linear search and binary search.

SECTION B (60 Marks)


Question4:

Define a class called mobike with the following description:


Instance variables/data members:
int bno -to store the bikes number
Int phno -to0 store the phone number of the customer
String name -to store the name of the customer
Int days -to store the number of days the bike is taken on rent
Int charge - to calculate and store the rental charge

Member methods:
Void input() - to input and store the detail of the customer

converted by W eb2PDFConvert.com
Void compute() -to compute the rental charge.
The rent for a mobike is charged on the following basis.
First five days Rs. 500 per day.
Next five days Rs. 400 per day.
Rest of the days Rs. 200 per day.
Void display() to display the details in the following format:
Bike No. Phone No. No. of days Charge
--------- ------------ ------------- --------

Question5:
Write a program to input and store the weight of ten people. Sort and display them in descending order using the selection sort
technique.

Question 6:
Write a program to input a number and print whether the number is a special number or not.
(A number is said to be special number. If the sum of the factorial of the digits of the number is same as the original number).
Example: 145 is a special number because 1!+4!+5!= 1+24+120=145
Where ! stands for the factorial of the number and the factorial value of a number is the product of all integers from 1 to that number,
example 5!= 1*2*3*4*5=-120).

Question 7:
Write a program to accept a word and convert it to lowercase if it is in uppercase, and display the new word by replacing only the
vowels with the character following it.
Example:
Sample input: computer
Sample output: cpmpvtfr

Question8:
Design a class to overload a function compare() as follows:
a) Void compare(int,int) - to compare two integer values and print the greater of the two integers.
b) Void compare(char,char) - to compare the numeric values of two characters and print the character with higher numeric value.
c) Void compare(String, String) - to compare the length of the two strings and print the longer of the two.

Question9:
Write a menu driven program to perform the following: (Use switch case statement)
a) To print the series 0,3,7,15,24 n terms(value of n is to be an input by the user).
b) To find the sum of the series given below:
S= 1/2 + 3/4 + 5/6 + 7/8 . 19/20.

Solution of 2011 Year:


Q.4:
In these type of questions we dont need to make main method until told to do so. Simply declare all data members(variables) and
make functions as described.
Tip: How to recognize these type of question:
These questions have Design a class, Define a class or Make a class in beginning.
class mobike
{
int bno,phno,days,charge;
String name;
void input(int b,int p,int d,String n)
{
bno=b;
phno=p;
days=d;
name=n;
}
void compute()
{
if(days<=5)
charge=days*500;
else if(days<=10)
charge=2500+(days-5)*400;
else

converted by W eb2PDFConvert.com
charge=4500+(days-10)*200;
}
void display()
{
System.out.print("Bike No.\tPhone No.\tNo. of days\tCharge);
System.out.print("-----\t-----\t-----\t-----);
System.out.print(bno+\t+phno+\t+days+\t+charge);
}
}
Q.5:
import java.io.*;
class selectsort
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int arr[]=new int[10];
System.out.print("enter weight of ten people");
for(int i=0;i<10;i++)
arr[i]=Integer.parseInt(br.readLine());
int temp;
for(int i=0;i<10;i++)
{
for(int j=i+1;j<10;j++)
{
if(arr[i]<arr[j])
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}
for(int i=0;i<10;i++)
System.out.print(arr[i]);
}
}

Q.6:
When a number is equal to sum of its digits factorials then it is a special number. eg: 145= 1!+ 4!+ 5!
import java.io.*;
class special
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n,n2,digit,fact=1,sum=0;
System.out.print(Enter a no.);
n=Integer.parseInt(br.readLine());
n2=n;
while(n>0)
{
digit=n%10;
n=n/10;
while(digit>0)
{
fact=fact*digit;
digit--;
}
sum=sum+fact;
}
if(n2==sum)
System.out.print(Special No.);
else
System.out.print(Not Special No.);

converted by W eb2PDFConvert.com
}
}
Q.7:
import java.io.*;
class convert
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s,s2=;
int len
System.out.println(enter a string);
s=br.readLine();
len=s.length();
s=s.toLowerCase();
for(int i=0;i<len;i++)
{
if(s.charAt(i)==a|| s.charAt(i)==e|| s.charAt(i)==i|| s.charAt(i)==o|| s.charAt(i)==u)
{
s2=s2+(s.charAt(i)+1);
}
s2=s2+s.charAt(i);
}
System.out.println(s2);
}
}
Q.8:
class overload
{
void compare(int a, int b)
{
if(a>b)
System.out.println(a);
else
System.out.println(b);
}
void compare(char a, char b)
{
if(a>b)
System.out.println(a);
else
System.out.println(b);
}
void compare(String a, String b)
{
int len1,len2;
len1=a.length();
len2=b.length();
if(len1>len2)
System.out.println(a);
else
System.out.println(b);
}
}
Q.9:
import java.io.*;
class seriesmenu
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int ch, s=0, x=3,n;
double sum=0;
System.out.println(1. Print 0,3,7,15,24 n);
System.out.println(2. S=1/2+3/4+5/6+7/819/20);

converted by W eb2PDFConvert.com
System.out.println(enter you choice);
ch=Integer.parseInt(br.readLine());
switch(ch)
{
case 1:
System.out.println(enter n);
n= Integer.parseInt(br.readLine());
while(s<=n)
{
System.out.print(s+ );
s=s+(x+1);
x=s;
}
break;
case 2:
for(int i=1;i<=19;i++)
{
sum=sum+i/(i+1);
i++;
}
System.out.println(sum);
break;
default:
System.out.println(invalid choice);
}
}
}

Rajat Verma at 5:57 AM


Share 0

2 comments:

Unknown August 6, 2016 at 2:10 AM


thank you. it is of great help for ICSE students who do not have mentors at home to guide them how to answer questions in board. they will
also be of great help as they can be taken as practice questions
Reply

anonymous August 6, 2016 at 2:11 AM


thank you. it is of great help for ICSE students who do not have mentors at home to guide them how to answer questions in board. they will
also be of great help as they can be taken as practice questions
Reply

Home

converted by W eb2PDFConvert.com
View web version

About Me

Rajat Verma
IT Lecturer
View my complete profile

Powered by Blogger.

converted by W eb2PDFConvert.com

You might also like