Oswal 61 Sample Question Papers ICSE Class 10 Computer Applications Solutions
Section-A
Answer 1.
(i) (d) Polymorphism
(ii) (a) * , + , > , =
(iii) (c) passed by function
Object can’t be passed as function as it is an instance of some class, it’s not a function. Object can be passed by reference, value or copy.
(iv) (d) 4 Bytes
The size of integer in Java Programming is 4 Bytes.
(v) (a) Infinity
Whenever we divide any number (double, float, and long except integer) by zero, it results in infinity.
(vi) (b) for(i=3;i<=30;i=i+3)
for (i = 3; i < = 30; i = i + 3)Will generate numbers in the set:
{3 ,6 ,9 ,12 ,15 ,18 ,21 ,24 ,27,30}
(vii) (a) 13
Perform modulus operation first.as it has got a higher priority.
= 6-2+2+7
= 4+2+7
= 13
(viii) (b) class
(ix) (c) An instance method can access both static and non static data members.
(x) (d) 36 bytes
(xi) (a) delete obj;
(xii) (c) anywhere
(xiii) (a) Static data members
(xiv) (d) Any number
(xv) (c) Both (a) and (b)
(xvi) (a) Quadratic(10)
The function Quadratic 0 receives a single integer parameter, so the correct calling statement is (a).
(xvii) (b) Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion (A)
(xviii) (c) Operator Associativity
(xix) (a) Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A)
(xx) (c) 6
Logically by doing floor operation the values will be rounded to -6, then by applying absolute operator the value will be converted to 6, which is represented as 6.0 in double.
Answer 2.
(i) int z = (++y * (y++ + 5));
= (11 * (11 + 5));
= 176
(ii) (a * a + b * b)/(2 * a * b)
(iii) System.out.print(x % 2 = = 0? “EVEN”: “ODD”);
(iv) int m = 5, n;
for(n = 10; n >= 1; n –-)
{
System.out.println(m * n);
}
(v) 42
The loop will get executed 5 times.
(vi) incurpuratiun
(vii) Boolean Compare(String s, String t)
(viii) In bubble sort technique, adjacent and if they are not in proper order, they swap their positions. This process is repeated until entire array get sorted.
(ix) (a) The subclass just use the items inherited from its superclass as it is, or the subclass can modify or override it, this process is known as inheritance. In inheritance, superclass is called as parent class and subclass is called as child class.
(b) Abstraction.
(x) (a) p = 6
(b) q = 37
Section-B
Answer 3.
import java.util.*;
class Faculty
{
int fCode;
String Name;
String Category;
int YOE;
double basicSal;
double gradePay;
double grossSal;
public void accept()
{
Scanner sc = new Scanner(System.in);
System.out.println(“Enter Faculty Code: ”);
fCode = sc.nextInt();
System.out.println(“Enter name: ”);
Name = sc.nextLine();
System.out.println(“Enter category as PRT / TGT / PGT: ”);
Category = sc.next();
System.out.println(“Enter year of experience: ”);
YOE = sc.nextInt();
}
public void display()
{
System.out.println(“Faculty Code” + fCode + “\n Names” + Name + “\n Category” + Category +
“\n Year of Experience” + YOE + ‘‘\n Basic salary” + basicSal + ‘‘\n Grade Pay” + gradePay + ”\n Gross salary” +
grossSal);
}
public void computer()
{
if (Category.equals(“PRT”))
{
if (YOE < 10)
basicSal = 15000;
else
basicSal = 17500;
}
else if (Category.equals(“TGT”))
{
if (YOE < 10)
basicSal = 20000;
else
basicSal = 35000;
}
else if (Category.equals(“PGT”))
{
if (YOE < 10)
basicSal = 30000;
else
basicSal = 45000;
}
else
System.out.println(“Invalid category”);
gradePay = basicSal * .5;
grossSal = basicSal + gradePay;
}
public static void main()
{
Faculty ob = new Faculty();
ob.accept();
ob.compute();
ob.display();
}
}
Answer 4.
Class Position
{
public void main( )
{
int n[] = new int [100];
double S = 0.0;
System.out.println(“Enter 100 numbers :”);
for (int i = 0; i < 100; i++)
{
System.out.println(+n[i]);
S = S + n[i];
}
double m;
m = S/100;
System.out.println(“Mean is =” + m);
int p = 0;
double d = n[0] – m;
for (int y = 1; y < 100; y++)
{
if (d > n [y] – m)
}
d = d;
p = p;
}
else
{
d = n[y] – m;
p = y;
}
System.out.println(“The.maximum deviation of mean is from” + p + “element”);
}
Answer 5.
import java.util.”’;
class Count
{
String s;
int I, i, c = O;
void display()
{
Scanner sc = new Scanner(System.in);
System.out.println(“Enter a sentence”);
s = sc.nextLine();
s = s.toUpperCase();
s = “ “+ s;
1= s.length();
for(i = O;i < l;i++)
{
if(s.charAt(i) == ‘’&& s.charAt(i + 1) =’A’)
{
c++;
}
}
System.out.println(“Total number of words starting with letter A = “ + c);
}
}
Name | Type | Description |
s | String | To store a sentence. |
l | int | To store the length. |
i | int | for loop variable |
c | int | Counter vairable. |
Answer 6.
import java.util.Scanner;
class ColumnSum
{
public static void main(String ar[])
{
Scanner sc=new Scanner(System.in);
int A[][]=new int[3][3];
int i,j;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
System.out.print(“Enter a number”);
A[i][j]=sc.nextInt();
}
}
int sum=0;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
sum+=A[j][i]
}
System.out.print(sum+”\t”);
sum=0;
}
}
}
Answer 7.
import java.io.*;
class HappyNum
{
public static void main()throws IOException
{
int n,m,sum=0;
BufferedReader br=new
BufferedReader(new InputStreamReader (System.in));
System.out.println(“Enter a number”);
n=Integer.parseInt(br.readLine());
m=n;
while(m>0)
{
sum+=(int)Math.pow(m%10,2);
m=m/10;
if(m= =0&&sum>9)
{
System.out.println(sum);
m=sum;
sum=0;
}
}
if(sum= =1)
System.out.println(“Happy num.”);
else
System.out.println(“Not a happy num.”);
}
}
Answer 8.
class OverloadMat
{
void display()
{
int i, j, k = 9;
for (i = 1; i <= 5; i++)
{
for (j = i; j <= k; j++)
{
System.out.print(j);
}
k--;
System.out.println();
}
}
void display(int a, int b)
{
for (int i = 1; i <= a; i++)
{
for (int j = 1; j <= b; j++)
System.out.print(“ * ”);
System.out.println();
}
}
}
Please Click on Download Now