Read the questions as text
ICSE Class 10 Sample Paper 5
Standard: X
Subject: Computer
Max Marks: 100
Max. Time 2 hours
__________________________________________________________________
This paper is divided into two sections. You are to answer all the questions from section A,
and any four from section B.
Section A(40 marks)
Attempt all questions
Question 1.
a. Explain the concept of constructor overloading
[2X5=10]
b. Define encapsulation
c. Give the output of the following if n=3.5
1. Math.floor(n);
2. Math.Ceil(n);
3. Math.round(n);
d. What is the difference between a static member functions & function
which are not static?
e. Write statement for each of the following
1. Store a number 238 as string
2. Convert the above string to integer
Question 2.
a. Write statements for the following
[2X5=10]
1. To create an object of class student with default constructor.
2. To invoke a method of class student i.e Grade_calculation(int x)
b. What is the difference between literals and identifiers
c. What are data type, name any two with example
d. Write any two differences in implicit & explicit type casting
e. Write a main difference between while loop & do while loop
Question 3.
a. State the data type and value of y after the following is executed: [2]
char x=’7’;
y=Character.isLetter(x);
b. What is the value stored in variable res given below:
double res= Math.pow(“345”.indexOf(‘5’),3);
[2]
c. Write the Java expressions for:
[2]
a2 +b2
--------
2ab
d. Read the following program and answer the questions a. class demo{ public void main(){ int a,b,i,j; for(i=1;i<5;i=i+1){ for(j=1;j<=i;j=j+1){ System.out.print(“”+j); } System.out.println(); }}}
I. how many times the first loop of “i” will perform? II. what will be the output of the program?
Question 4.
1. What is byte code? 2. int a=15,b-21,c=0;
c=++a + b ++ *a++ -b 3. Differentiate between binary search & linear search 4. What is the purpose of default in switch case 5. What are wrapper classes?
[1] [3]
[2X5=10]
Section B Attempt any 4 questions from this section Each program should be written using a
variable list so that the logic of the program is clearly depicted.
Question 5. Write two separate programs to generate the following patterns using iteration (loop)
statements:
a) * *# *#* *#*# *#*#*
b)
54321
5432
543
54
5
[15]
Question 6. Design a class to overload a function polygon( ) as follows: i) void polygon(int n, char ch) with one integer argument and one character type argument that draws a filled square of side n using the character stored in ch. ii) void polygon(int x, int y)
with two integer arguments that draws a filled rectangle of length x and breadth y,
using the symbol @
iii) void polygon() with no argument that draws a filled triangle below.
Example :
i) Input value of n=2. Ch=’O’ Output: OO OO
ii) Input value of x=2, y=5 Output: @@@@@ @@@@@
iii) Output: * ** *** [15]
Question 7. Write a program to accept the names of 10 cities in a single dimension string array
and their STD( Subscriber Trunk Dialing) codes in another single dimension string
array. Search for a name of a city input by the user in the list, if found, display
“Search Successful “ and print the name of the city along with the STD code, or else
display the message “ Search unsuccessful, No such city in the list “.
[15]
Question 8.
a. using switch case create class which take day number 1-7 & prints the
corresponding day in words [3- Wednesday, 5- friday]
[7]
b. write a class to input a number and print its odd factors[6 has odd factors
1,3]
[8]
Question 9.
a. write a class to print the following series
[8]
S=a/1+a/2+a/3+a/4--------- a/n
b. write a class Fibo10 to display the first 10 terms of Fibonacci series [7]
Question 10.
Given below is a hypothetical table showing the rates of income tax for male
citizens below the age of 65 years:
Taxable Income ( TI) in Rs.
Income Tax in Rs.
Does not exceed Rs.1,60,000
Nil
Is greater than Rs. 1,60,000 & less than or equal (TI- 1,60,000) x 10%
to Rs. 5,00,000
Is greater than Rs. 5,00,000 & less than or equal [(TI-5,00,000) x 20%] + 34,000 to Rs. 8,00,000
Is greater than Rs. 5,00,000 & less than or equal [(TI-5,00,000) x 20%] + 34,000 to Rs. 8,00,000
Write a program to input the age, gender(male or female) and Taxable Income
of a person. If the age is less than 65 years and the gender is male, compute and
display the income tax payable as per the table given above.
[15]
――――――――――
ICSE Class 10 Sample Paper 6
Standard: X
Subject: Computer
Max Marks: 100
Max. Time 2 hours
__________________________________________________________________
This paper is divided into two sections. You are to answer all the questions from section A,
and any four from section B.
Section A (40 marks)
1.
a. What is the difference between local variable and instance variable?
[2]
b. Write an expression in java for Cos x +
.
[2]
c. What is the difference between a static member function and a member function which
is not static?
[2]
d. What is a Wrapper class? Give 2 examples.
[2]
e. How many times does the loop iterate? Also give the output for the following code
snippet.
int x;
for(x = 1; x< =10; x + +)
{
x + +;
System.out.println(x + +);
}
[2]
2.
a. Rewrite the following if-else statement in terms of switch-case statements?
[2]
char code;
if(code=='A')
System.out.println("Excellent");
else if(code =='B' || code =='C')
System.out.println("Good");
else if(code =='D')
System.out.println("Poor");
b. What is the difference between ‘= =’ and ‘equalsIgnoreCase( )’
[2]
c. Write the output of the following code.
[2]
String str=”International”;
System.out.println(str.charAt(4));
System.out.println(str.lastIndexOf(‘a’));
d. Write the output of the following.
[4]
String s1 = “INFORMATION”;
String s2 = “TECHNOLOGY”;
i. System.out.println(s1.substring(0,4).concat(s2.substring(6,10))
ii. System.out.println(s1.substring(2));
iii. System.out.println(s1.charAt(s1.indexOf(‘R’) + s2.indexOf(‘C’)));
iv. System.out.println(s2.replace(‘T’ , ‘F’));
3.
a. What will be the output for the following program segment?
[2]
int a = 10,b=30,c=40;
a= --b + c * a / 2;
System.out.print("a" + a);
System.out.print("b " +b );
b. Give the difference between actual parameter and formal parameter.
[2]
c. Differentiate between equals() and compareTo() functions.
[2]
d. State the purpose and return data type of the following String functions :-
[2]
i) trim()
ii) charAt( )
e. What is the value stored in variable val given below:
[2]
double val= Math.pow(“137”.indexOf(‘7’),3);
4.
a. Define the integer data members numl and num2 in the class. Initialize them with the
values in a default constructor and parameterized constructor.
[2]
b. State the difference between method and constructor.
[2]
c. Differentiate between isUpperCase(char) and toLowerCase(char)
[2]
d. What will be the output of the following program segments?
[2]
String s = “application”; int p = s.indexOf(‘a’); System.out.println(p); System.out.println(p+s); e. Write a statement to create an object of a class Student that invokes a parameterized
constructor that accepts one String and one int type values.
[2]
Section B (60 marks) Attempt any 4 questions out of 6
5. Write a program to generate the following pattern
[15]
a) C CL CLA CLAS CLASS
b) & ## &&& #### &&&&&
6. Write a program in java to accept a string and find
[15]
a. number of blank spaces in the string
b. number of words in the string
c. number of consonants present in the string
d. number of vowels present in the string
7. Write a program to accept a sentence and print only the first letter of each word of the [15]
sentence in capital letters separated by a full stop.
Example :
INPUT SENTENCE: “Kapil Kumar Thakur”
OUTPUT: K.K.T
8. Write a Menu driven Program to do the following
a) Write a class to print the following series:
S=a/x1+a/x2+a/x3+a/x4……. a/xn
[8]
b) Write a class to display prime numbers between 1 to 100
[7]
9. Define a class BILL that calculates telephone bill of a consumer having the following description: Data members/instance variables int billno - bill number String name - name of consumer int unit - no. of units consumed in a month double amount – bill amount to be paid by the person Member functions: BILL () - constructor to initialize data members with default initial value BILL(…) - parameterized constructor to accept billno, name and no. of units consumed . calculate() - to calculate the monthly telephone bill for a consumer as per following condition
No. of Units consumed First 100 Units Next 100 units
Rate in Rs. Only monthly rental (Rs. 200) Rs. 0.60/ Unit
Next 100 units Above 300
Rs. 1.0/Unit Rs 1.5/Unit
display()- To display the details. Create an object in the main() method and invoke the above function to perform the desired task.
[15]
10. Overload a function check() to perform the following task
[15]
i) check(int a)→ to check if a number is Armstrong. A number is said to be Armstrong if the sum of
cubes of its digits is equal to the number.
ii) check(String str)→To check if given string is palindrome
――――――――――
ICSE Class 10 Sample Paper 7
Standard: X Max Marks: 100
Subject: Computer Max. Time 2 hours
__________________________________________________________________
This paper is divided into two sections. You are to answer all the questions from section A, and any four
from section B.
Section A (40 marks)
Attempt all questions
Question 1.
[2X5=10]
a.What is function overloading? Explain with example.
b. Name the primitive data type in Java that is:
1. A 64 bit integer used when you need a range of values wider than those provided by int.
2. A single 16-bit Unicode character whose default value is ‘\u0000’.
c. Define Polymorphism.
d. double b=-65.3;
double a= Math.rint(Math.abs(b));
System.out.println(" a = "+ a);
e. What is the difference between a static member functions & function which are not static?
Question 2. a. Write statements for the following
[2X5=10]
1. To create an object of class Teacher with default constructor.
2. To invoke a method of class Teacher i.e Make_Result(int x)
b. What is the difference between a constant and a variable?
c. What is a package? Give name of any two packages.
d. What do you mean by type conversion? How is implicit conversion different fromexplicit
conversion?
e. State the difference between while loop and do while loop.
Question 3. a. What will be the output when the following code segments are executed?
[2X5=10]
1. String s=”1001”; i. Int x=Integer.valueOf(s); double y=Double.valueOf(s); System.out.println(“x=”+x); System.out.println(“y=”+y);
2 . System.out.println(“The king said \” Begin at the beginning ! \” to me.”);
b. Consider the following co d e .
Public class Student { Public static int x=3,y=4;
Public int a=2,b=3; } 1. Name the variables for which each object of the class will have its own distinct copy.
2. Name the variables that are common to all objects of the class.
c. In the program given below, state the name and value of the
1. Method argument or argument variable
2. class variable
3. local variable
4. instance variable class myClass
{ static int x= 7; int y=2;
public static void main(String args[])
{
myClassobj = new myClass();
System.out.println(x);
obj.sampleMethod(5);
int a=6;
System.out.println(a);
}
void sampleMethod(int n)
{
System.out.println(n);
System.out.println(y); } }
d. What will be the result stored in x after evaluating the following expression?
int x=12;
x+=(x++) + 4 + ( --x);
e. Give one example each of a primitive data type and a composite data type.
Question 4. a) Whatisthedatatypereturnedbythelibraryfunctions: 1. compareTo() 2. equals() b) Write the Java expressions for: A2 + B3 c) 1. Name the package that contains Scanner class. 2. Which unit of the class gets called, when the object of the class is created? d) What is the role of keyword void in declaring functions? e) What is a token? Name any two of them.
[2X5=10]
Section B
Attempt any 4 questions from this section. Each program should be written using a variable list so that the logic of the program is clearlydepicted.
Question 5.
a. Write a class fact which takes integer number and check whether it is Automorphic number or not.
An automorphic number is the number which is contained in the last digit(s) of its square.
Example 25 is an automorphic number as its square is 625 and 25 is present as thelast two digits. [7]
b. Create a class to take an integer number and check if it is a palindrome number of not.
A palindrome number is a number when reversed also the number remains the same.
Example: 121 is a palindrome number.
[8]
Question 6.
[15]
Define a class student as described below:
Datamembers/instancevariables:
Name,age,m1, m2,m3 (marks in 3 subjects), maximum, average
Membermethods:
i) A parameterized constructor to initialize the data members
ii) To accept the details of a student.
iii) To compute the average and the maximum out of three marks
iv) To display the name, age, marks in three subjects, maximum and average.
Question 7.
[15]
Write a program to input any given string to calculate the total number of characters and vowels
present in the string and also reverse the string.
Example :
INPUT
Enter String
: SNOWY
OUTPUT
Total number of characters
: O5
Number of Vowels
: 01
Reverse string
: YWONS
Question 8.
[15]
Design a class to overload a function polygon( ) as follows:
i) void polygon(int n, char ch) with one integer argument and one character type argument that draws a
filled square of side n using the character stored in ch.
ii) void polygon(int x, int y) with two integer arguments that draws a filled rectangle of length x and
breadth y, using the symbol @
iii) void polygon() with no argument that draws a filled triangle below.
Example :
i)
Input value of n=2. Ch=’O’
Output:
OO
OO
ii) Input value of x=2, y=5 Output: @@@@@ @@@@@
iii) Output:
* ** ***
Question 9.
[15]
Write a menu driven program to find the sum of the following series depending on the user choosing
1 or 2
1. S=1/4+1/8+1/12.........+1/n (value of n will be given by the user)
2. S=1/x1+2/x2+3/x3.......+n/xn(value of x and n will be given by the user)
Question 10.
[15]
Write a program to input and store any ten numbers given by the user in an integer array. Sort and display them in ascending order using any sorting technique (Bubble sort or selection sort).
――――――――――
ICSE Class 10 Sample Paper 8
SUB: COMPUTER MARKS: 100
CLASS X TIME: 2 hrs
This paper is divided into two sections. You are to answer all the questions from Part I, and any four
from Part II.
SECTION A (40 Marks)
Attempt all questions from this Section
Question 1.
[5*2=10]
1. What is abstraction?
2. Classify the following in primitive and non primitive data type.
a. Class
c. float
b. Array
d. String
3. What are the rules to name an identifier?
4. What is function overloading?
5. Give the output of the following program segment and also mention the number of
times the loop is executed:
int a, b;
for(a=6,b=4;a<=24;a=a+6)
{
if(a%b==O)
break;
}
Question 2. 1. Differentiate between implicit and explicit type conversion. 2. What is WORA? Explain.
[5*2=10]
3. What is a keyword? Give two examples. 4. Name the following.
a. A keyword used to call a package in the program.
b. A keyword used to declare a constant.
5. Convert the following segment into equivalent for loop
public void display()
{
int i=10;
while ( i !=0)
{
System.out.print(i +" ");
i-- ;
}
}
Question 3. 1. Write a java expression for the following. P=A3+B5/c3
[5*2=10]
2. What are the final values stored in x and y below?
double x=Math.abs(Math.min(-2.53,-5.75));
double y=Math.sqrt(Math.floor(12.2));
3. Differentiate primitive data type and a composite data type.
4. What is the use of default in a switch?
5. Explain the term class with example?
Question 4.
[5*2=10]
1. Write the syntax of switch statement. 2. What are jump statements? Explain any one. 3. If the value of p = 3, what does the expression below evaluate to,
p + = + + p - p++ + - -p; System.out.println (p);
4. What is the difference between the Scanner class functions next() and nextine()?
5. Convert the following do-while loop in to for loop. int i=1; int d=5; do { d=d*2; System.out.println(d); i++; } while(i<=5);
SECTION B (60 Marks)
Attempt any four programs from this section.
Question 5
[15]
Write a program to generate the following pattern.
a. 11111 2222 333 44 5
b. $$$$ #### $$$$ #### $$$$
Question 6
[15]
Make a menu driven program for the following.
a. Find the sum of the following series
Sum=a2 /2+a4/4+a6/6+.............an/n
b. Print the following series
3
6
11 18 27
Question 7.
[15]
Make a menu driven program for the following.
a. To take a number and prints whether it’s sum of the digits. For example if the number is 132 the sum
of the digits will be 1+3+2=6.
b. To input a number and print whether it is a perfect number or not.
(A perfect number is a
number if its factor’s (excluding the number) sum is equal to the number.)
Question 8.
[15]
Write a program to accept a number and display whether it is a spy number or not. A spy number is a
number of its sum of the digits and product of the digits is same.
For example 1124
Sum of the digits: 1+1+2+4=8
Product of the digit : 1*1*2*4=8
Question 9.
[15]
Create overloaded methods named void calc_Area ( ), that has been overloaded to perform the following functions
• Area of circle • Area of Triangle • Area of Rectangle Write a menu driven program in Java to display the above 2 menus and execute the overloaded methods and display the Area in the respective functions,
calc_Area (double) for Circle,
calc_Area (double, double) for Triangle, calc_Area (double, double) for Rectangle [Area of circle=πr2, , Area of Triangle =length*breadth/2, Area of rectangle=width * height]
Question 10.
[15]
Define a class ElectricBill with the following specifications.
Class : Electricbill
Data Members:
String n: to store the name of the customer
int units: to store the n of units consumed
double bill: to store the amount to be paid
Member Methods:
void accept(): to accept the name of the customer and number of units consumed.
void calculate(); to calculate the bill as per the following tariff:
Number of units
Rate per unit
First 100 units
Rs. 2.0
Next 200 units
Rs. 3.0
Above 300 units
Rs. 5.0
A surcharge of 2.5% is charges if the no of units consumed are more than 300 units.
void print(): To print the details as follows
Name of the customer.......................................
Number of units consumed.....................................
Bill Amount.......................................
Write a main method to create an object of the class and call the above methods.