ICSE Class 10 Computer Application Sample Question Paper 11 with Answers

ICSE Class 10 Computer Application Sample Question Paper 11 with Answers

Max Marks: 80
[2 Hours]

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. O 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 Question

Question 1.
(a) Give one similarity and one difference between do while and while loop.
Answer:
Similarity – Both while and do while loop is used when the no. of iterations are not specified.
Difference: while loop is entry controlled loop and while do while loop is exit controlled.

(b) Write the java statement to find largest of 3 numbers using conditional operator.
Answer:
int a = (b>c)?b:c;
int d = (a>e)?a:e;

(c) What is polymorphism?
Answer:
Polymorphism is the identity to represent an object in more than one form.

(d) Write a function to round off any fractional number? Give one example.
Answer:
Math.round()
double k = Math.round(2.9);.

(e) What is difference between infinite loop and fall through statement?
Answer:

Infinite Loop Fall Through
Occurs for iteration statement Occurs for conditional statement.
Occurs when conditions is always satisfied. Occurs when the break statement is missing in every case statement.

ICSE Class 10 Computer Application Sample Question Paper 11 with Answers

Question 2.
(a) Compare local, instance and class variables on the basis of the given criteria.
(i) identification in program
Answer:
Local variables are usually used in a block of statement. Instance variables are used by a method while class variable has only one copy throughout out the class.

(ii) Usage of access specifier with them.
Answer:
Local variable scope remains inside the compound statement. Inside the curly braces.
Instance variable scope remains inside the method. All access specifiers can be used in class variables. Scope is throughout the class.

(iii) provision of initial values.
Answer:
Local variables is initialized in its scope.
Instance variables initialized in the method where it is used in. Class variables are initialized after the class declaration.

(iv) Number of copies for each object of class.
Answer:
local variables multiple copies can exists.
Instance variables multiple copies can exists.
Class variables single copy exists.

(b) Which OOPs principle is implemented when you:
(i) use the keyword extends
Answer:
Inheritance

(ii) create an interface
Answer:
Abstraction

(iii) create various functions
Answer:
Polymorphism

(iv) use private data members?
Answer:
Encapsulation

(c) What are functions? Give one advantage using functions.
Answer:
Functions are a set of statements used to perform certain tasks. Advantage: It organizes the code into a blocks and helps in performing specific task.

(d) Differentiate between classes and objects. Why is object referred as instance of class?
Answer:
(i) Object is an identifiable entity with some characteristics and behaviour. Class is a collection of object with similar characteristics.
(ii) Object is called instance of class as object helps in accessing the class members and functions to get the required output.

(e) Differentiate between linear search and binary search.
Answer:

Linear Search Binary Search
The search element is compared with each element of the array. The array is sorted and divided into two halves and then search element is found accordingly.
Array need not be sorted. Array has to be sorted.

ICSE Class 10 Computer Application Sample Question Paper 11 with Answers

Question 3.
(a) What is other name of java interpreter? Explain it.
Answer:
JVM (Java virtual machine): It is used to convert java byte code to machine code which can be understood by the computer running on any operating system.

(b) Name the java keyword
(i) used to finish the execution of the method.
Answer:
exit or return

(ii) used to implement the concept of inheritance.
Answer:
extends

(c) Attempt the following:
(i) Assign the constant value pi as 3.14 to variable using suitable data type?
Answer:
double const pi =3.14;

(ii) Give difference between unary and binary operators.
Answer:
Unary operator is is used for one operand.
Binary operator is used for two operands.

(iii) Give examples of each
(i) Composite date type.
(ii) Escape sequence.
(iii) Comment lines
(iv) Wrapper class
Answer:
(i) Array, class
(ii) “\n”;\\’
(iii) //or/*java*/
(iv) Character, Integer

(iv) Write any two rules of naming variable
Answer:
Variables should not be keyword and it should not start with digit or special character except for the $ and & and _. It must start with alphabet.

(v) Differentiate between type conversion and coericion.
Answer:

Type conversion Coercion
Assigning one data type to another Promotion of data type
It’s called implicit type casting Also called type promotion.

(vi) State the difference between final and finally.
Answer:
Final makes a variable constant throughout the program. Finally is a block which is always executed even if exception occurred or not.

(vii) a. State the use of toStringO and valueOf().
Answer:

toString() valueOf()
Converts integer to string. Converts strings to integer.

b. Write a statement to extract the last word of the string str.
Answer:
String word = str.substring(sr.lastlndexOf(‘ ‘)+1);

(viii) a. What is called byte code?
Answer:
Byte code is an specific set of instruction to be executed by the JVM.

b. Explicit and implicit type conversion.
Answer:
Implicit type conversion: Java compiler will automatically convert one data type to another when data types are compatible.
E.g. int 1 = 10;
double b = I;

Explicit type conversion: Java compiler is to be told explicitly to do the conversion form one data type to another. E.g.
double d = 10.0;
float f = (float)d;

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 such that the logic of the program is clearly depicted.

Flow-Charts and Algorithms are not required.

Question 4.
Using switch case write a menu driven program to print the patterns.
ICSE Class 10 Computer Application Sample Question Paper 11 with Answers 1
Answer:

import java.util.*;
class Main
{
public static void main(String[ ] args)
{
Scanner sc = new Scanner(System.in);
System.out.printIn("Enter the choice:");
int a1 = sc.nextInt();
switch(al)
{
case 1: int a =0;
int b = 2;
for(int i =5;i>= 1;i—)
{
for(int j=1; j<=i;j++)
System.out.print(a+"");
a+=b;
b+=2;
System.out.printIn();
}
break;
case 2: for(int i =1 ; i<=5; i++)
{
for(intj=1;j<=i;j++)
{
if(j%2 != 0)
System.out.print("X");
else
System.out.print("Y");
}
System.out.printIn();
}
break;
default: System.out.printIn("Invalid Choice");
}
}//end of main
}//end of class

ICSE Class 10 Computer Application Sample Question Paper 11 with Answers

Question 5.
Write a program to print the frequency of the digits occurring in number. Eg.2566773
Output:
2 1
5 1
6 2
7 2
3 1
Answer:

import java.util.*;
class Main
{
static int frequency(int number, int digit)
{
int count = 0;
while (number > 0)
{
if (number % 10 == digit)
count++;
number = number / 10;
}
return count;
}
public static void main(String args[ ])
{
Scanner sc = new Scanner(System.in);
System.out.printInC'Input the number:");
int n = sc.nextInt();
int a = n;
int search = 0;
int countdigit = 0;
int []arr = new int[10];
while(a >0)
{
search = a%10;
countdigit = frequency(n,search);
if(countdigit>0)
{
arr[search]=countdigit;
countdigit=0;
}
a=a/10;
}
for(int i =0; i<arr.length;i++)
{
if(arr[i]>0)
System.out.printIn(i+"\t"+arr[i]);
}
}//end of main
}//end of class

Question 6.
Write a class with a special member function to input a multi digit number(max 9 digit) and print the following:
(i) total number of even and odd digits
(ii) the reverse number
(iii) total number of zeros present.
Answer:

import java.util.*;
class Main
{
public static void main(String args[ ])
{
Scanner sc = new Scanner(System.in);
System.out.priintIn("Input the number:");
long a = sc.nextInt();
int sumeven =0;
int sumodd =0, sum3 = 0;
String str = " ";
long a1 = a;
while(a1 <=999999999&&a1!=0)
{
int k= (int)a1 %10;
str+=Integer.toString(k);
if(k%2 == 0)
sumeven++;
else if(k%2!=0)
sumodd++;
else if (k==0)
sum3++;
else;
a 1 =a 1/10;
}
System.out.printIn("No. even: "+sumeven+"\t"+ "odd:"+sumodd+"\ t"+"zero: "+sum3+"\t"+"Reverse no:"+str);
}//end of main
}//end of class

ICSE Class 10 Computer Application Sample Question Paper 11 with Answers

Question 7.
Write a class to input a string (combination of letters and digits) and replace the repecated characters with star(*) sign. Then display both old and newly created string.
Answer:

import java.util.*;
class Main
{
public static void main(String[ ] args)
{
Scanner sc=new Scanner(System.in);
System.out.printIn("Enter a sentence:");
String str=sc.nextLine();
for(int i=0;i<str.length();i++)
{
char ch=str.charAt(i);
if(ch!='*')
{
for(int j=str.length()-1;j>i;j—)
{
char ch 1 =str.charAt(j);
if(ch—chi)
{
StringBuffer strl =new StringBuffer(str);
str1.setCharAt(j,'*');
str=""+strl;
}
}
}
}
System.out.printIn(str);
}//end of main
}//end of class

Question 8.
Write a program to print the following pattern by taking the input n from the user.
Note: n determines number of rows.
Eg. n = 4
Output:
ICSE Class 10 Computer Application Sample Question Paper 11 with Answers 2
Answer:

import java.util.*;
class Main
{
public static void main(String args[ ])
{
Scanner sc = new Scanner(System.in);
System.out.printIn("Input the number:");
int n = sc.nextIntO;
for(int i = 1; i <=n;i++)
{
if(i%2==0)
{
for(int j =1; j<=3;j++)
System.out.print("*");
}
else
{
for(int j =1; j<=4;j++)
System.out.print("*");
}
System.out.printIn();
}
}//end of main
}//end of class

ICSE Class 10 Computer Application Sample Question Paper 11 with Answers

Question 9.
Write a java class to calculate and print the electricity bill to be paid by a customer.
Assume that the customer pays a rent of Rs.350.00

No. of units Charge per unit
Upto 100 units Rs. 1.50
For the next 100 units Rs. 2.00
For next 50 units Rs. 2.50
Beyond 250 units Rs. 4.00

Answer:

import java.util.*;
class Main
{
public static void main(String[ ] args)
{
Scanner sc=new Scanner(System.in);
double fixed_price = 350.0;
double amt = 0.0;
System.out.printIn("Enter a unit of electricity consumption: ");
int n=sc.nextInt();
if(n<=100)
amt+= amt+1.5*n;
else if(n>100&&n<=200)
amt+= 100*1,5+(n-100)*2.0;
else if(n>200&&n<=250)
amt+= 100*1.5+0 00)*2.0 + (n-200)*2.5;
else
amt+= 100*1.5+0 00)*2.0 + (50)*2.5+(n-250)*4.0;
System.out.printIn("Electricity bill amount: "+amt);
}//end of main
}//end of class
Variable Data Type Description
al int Store users choice
a b int For printing pattern
ij int For looping
number int Number in which digits to be searched
digit int Digit which is to be searched.
count int Counting number of digits
n int Users input number
arr[] int Array of 10 integers.
search, countdigit int Digit to be searched and count of that digit
sumeven,sumodd, sum3 int Sum of even digits, sum of odd digits and count of zero.
str String User input string
strl String Buffer To store modified string
ch char To store character
fixed „price, amt double For fixed price and calculating amount

ICSE Class 10 Computer Application Question Papers with Answers

Leave a Comment