ICSE Class 10 Computer Application Sample Question Paper 10 with Answers

ICSE Class 10 Computer Application Sample Question Paper 10 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) What do you mean by abstraction.
Answer:
Abstraction is the act of representing the essential features of the program without involving in its complexity.
Eg. While using computer user is not concerned about the different parts of the computer only needs to know about usage.

(b) Using an example explain the term object.
Answer:
Characteristics (big, small, flat etc)

(c) What is wrapper class.
Answer:
Wrapper class is a class which helps to convert a primitive data type to object type. E.g. Integer, Short etc

(d) State the use of new operator.
Answer:
New operator supports instantiations. It is used to allocate memory space to the newly created object.
E.g. Scanner sc = new Scanner(System.in)

(e) Write a java expression for square root of sinx.
Answer:
double d = Math.sin(x*3.14/180);

Question 2
(a) Differentiate between local variable and global variable.
Answer:

Local Variable Global Variable
Scope remains only inside a block or a function. Scope remains throughout the class.
Multiple copies of the variable are used throughout the class. Only a single copy of the variable is used throughout the class.

(b) What is the purpose of default in switch statement?
Answer:
When none of the cases of the switch statement are satisfied, the default case is used and executed in the program.

(c) Define an impure function.
Answer:
An impure function is a function where values of the arguments keep changing during the execution of the program.

(d) What is called default constructor?
Answer:
A default constructor is a constructor without any parameters. It is used to assign a default value to the class variables.

(e) Explain the concept of constructor overloading using an example.
Answer:
class lol
{
int a; int n;
lol()
{
a=0;
}
lol(int c)
{
a=1;
}
public static void main()
{
lol obj = new lol();
lol obj1=new lol(2);
}
}

ICSE Class 10 Computer Application Sample Question Paper 10 with Answers

Question 3.
(a) How java make use of formal and actual parameter?
Answer:
Formal parameters are used in the function defin ition of the program while actual parameters are used in the function call statement.

(b) State the java concept that is implemented into smaller groups
(i) Dividing a long set of instruction into smaller groups and modules.
Answer:
object oriented programming

(ii) Wrapping up of data and its associated function into a class.
Answer:
Encapsulation

(c) Attempt the following:
(i) What is role of access specifier?
Answer:
Access specifiers are used to moderate the accessibility of the data according to user’s choice.

(ii) Why is java platform independent?
Answer:
Java is platform independent because the JVM can interpret the byte code which can run on any platform.

(iii) Differentiate between public and private visibility label.
Answer:
Public: It can be accessed anywhere.
Private: It can be accessed only inside the class.

(iv) Int a = 7,b = 6; b = a>b?a!=0?3:b<10?9:4:8; System.out.printIn(b);
Answer:
3

(v) Int a = 7,b = 6; b=++a+ ++a/ ++a; System.out.printIn(b);
Answer:
b=8+9/10=8+0=8

(vi) What are functions? Give one advantage of using functions.
Answer:
A function is block of statements in a java program used to perform certain tasks. It organizes the data into segments and helps in performing tasks easily.

(vii) How do objects communicate with each other?
Answer:
Objects communicate with each other using methods.

(viii) What are two types of methods? Give two concrete differences between them and include example of each type of function from java.lang.Math class.
Answer:

Pure Function Impure Function
Functions where the value of variables don’t change Function where the values of the variables changes.
Depends on the actual parameters passed in the function call. Depends on where created object calls the functions.
E.g. Math.sqrtO E.g. Math.random(i)

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.
A Smith number is a composite number, the sum of whose digits is the sum of the digits of its prime factors obtained as a result of prime factorization(excluding 1).
The first few such numbers are 4, 22, 27, 58, 85, 94, 121 …………..
eg.666
Prime factors are 2,3,3 and 37
Sum of the digits are (6+6+6) = 18
Sum of the digits of the factors (2+3+3+3+7)=18
Write a program to input a number and display whether the number is a Smith number or not.
Answer:

import java.util.*;
class Main
{
int sumDig(int n)
{
int sum=0; while(n>0)
{
sum+=n%10;
n=n/10;
}
return sum;
}
int sumPrimeFact(int n)
{
int i=2, sum=0;
while(n>1)
{
if(n%i-=0)
{
sum=sum+sumDig(i);
n=n/i;
}
else
i++;
}
return sum;
}
public static void main(String[ ] args)
{
Main ob=new Main();
Scanner sc = new Scanner(System.in);
System.out.print("Enter a Number:");
int n=sc.nextInt();
int a=ob.sumDig(n);
int b=ob.sumPrimeFact(n);
if(a==b)
System.out.print("lt is a Smith Number");
else
System.out.print("It is Not a Smith Number");
}//end of main
}//end of class

ICSE Class 10 Computer Application Sample Question Paper 10 with Answers

Question 5.
Write a program to assign a full path and file name as given below. Using library functions, extract and output the file path, file name and file extension separately as shown.
Input: C:\users\sid\pictures\cricket.jpg
output: C:\users\sid\pictures
File name: Cricket
Extension: jpg
Answer:

import java.util.*;
class Main
{
public static void main(String args[ ])
{
Scanner sc = new Scanner(System.in);
System.out.priintIntInput the file path:");
String str = sc.nextLine();
String strl = str.substring(0,str.lastIndexOf('\V));
String str2 = str.substring(str.lastIndexOf('\V)+1);
String str3 = str2.substring(str2.indexOf(' ')+1);
System.out.printIn("Path:"+str1);
System.out.printIn("Filename:"+str2);
System.out.printIn("Extension:"+str3);
}//end of main
}//end of class

ICSE Class 10 Computer Application Sample Question Paper 10 with Answers

Question 6.
Write a program to input a word from user and remove the consecutive repeated characters by replacing the sequence of repeated characters by its single occurrence.
input: ssiiddaarrtth
Output: sidarth
Answer:

import java.util.*;
class Main
{
public static void main(String args[ ])
{
String word =
Scanner sc = new Scanner(System.in);
System.out.printIn("Input the sentence:");
String str = sc.nextLine();
char chprev='';
for(int i =0;i<str.length();i++)
{
char ch = str.charAt(i);
if(chprev!=ch)
{
word+=ch;
chprev = ch;
}
else
continue;
}
System.out.printIn("word without successive repeated characters is:"+word);
}//end of main
}//end of class

Question 7.
Write a program in java to input a number and check whether it is Duck number or not.
Note: A Duck number is a number which has zeroes present in it, but there should be no zero present in the beginning of the number. For example 3210, 7056, 8430709 are all duck numbers whereas 08237,04309 are not.
Answer:

import java.util .*;
class Main
{
public static void main(String args[ ])
{
Scanner sc = new Scanner(System.in);
System.out.printInC'Input the number:");
int a = sc.nextInt();
int a 1 = a; int count =0;
String str = Integer.toString(a);
while(a1!=0)
{
if (str.cha rAt(0)==0)
break;
else
{
int k = a 1 %10;
if(k==0)
count++; a1/=10;
}
}
if(count>=1)
System.out.printIn("Duck no."); else
System.out.printIn("Not Duck no.");
}//end of main
}//end of class

Question 8.
Write a program in java to input a number in Decimal number system and convert it into its equivalent number in the octal number system.
Note: Octal number system is a number system which can represent a number in any other number system in terms of digits ranging from 0 to 7 only. This number system consists of only eight basic digits i.e. 0,1,2,3,4,5,6 and 7.
eg. 25 in the decimal number system can be represented as 31 in the octal number system.
Answer:

import java.util.*;
class Main
{
public static void main(String args[ ])
{
Scanner sc = new Scanner(System.in);
System.out.printIn("Input the decimal number:");
int a = sc.nextIntO;
int a1 =a%8;
int a2 = a/8;
String str="";
int a3=a2%8;
String strl = Integer.toString(al);
String str2 = Integer.toString(a3);
str=str2+str1;
int ah = Integer.parseInt(str);
System.out.print(ah);
}//end of main
}//end of class

ICSE Class 10 Computer Application Sample Question Paper 10 with Answers

Question 9.
Using Scanner class, write a program to input a string and display all those words of the strings which begins with capital letter and end with a small letter.
Sample Input: We all love Java for School Students because of its Uniqueness
Sample Output: We Java School Students Uniqueness
Answer:

import java.util.*;
class Main
{
public static void main(String args[ ])
{
String word = " ";
Scanner sc = new Scanner(System.in);
System.out.printIn("Input the sentence:");
String str = sc.nextLineO;
str+="";
for(int i =0;i<str.length();i++)
{
char ch = str.charAt(i);
if(ch!='')
word+=ch;
else
{
jf(Character.isUpperCase(word.charAt(0))&&Character.isLowerCase(word. charAt(word.lengthO-1)))
{
System.out.print(word+"");
}
word = " ";
}
}
} //end of main
}//end of class
Variable Data Type Description
sum int To store sum of digits of number
n int Number whose digits are to be added
sum int To store sum
i int To start with 2
b int Store sum of prime factors
a int Store sum of digits
str String Store the string
strl String To store the path
str2 String To store filename
str3 String Store file extension
word String To store modified word
ch char to store character
chprev char To store previous character
a al count int Users input number, modified number and count number of 0
a1 int To store octal number last digit
a2 int Quotient after dividing by 8
a3 int Quotient after dividing by 8
strl String To store a 1 as string
str2 String To store a2 as string
ah int Store converted integer from string.

ICSE Class 10 Computer Application Question Papers with Answers

Leave a Comment