Oswal 61 Sample Question Papers ICSE Class 10 Computer Applications Solutions
Section-A
Answer 1.
(i) (a) ()
Order of precedence is (highest to lowest) a –> b –> c –> d.
(ii) (d) Any number
We can define any number of classes with different names in a single program of OOPS.
(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
(xv) (c) Both (a) and (b)
(xiv) (d) Any number
(ix) (c) An instance method can access both static and non static data members.
(x) (c) method is not defined properly
(xi) (a) delete obj;
(xii) (c) anywhere
(xiii) (a) Static data members
(xvi) (a) Quadratic(10)
The HCl gas present inside the flask, when mixed with water, lowers the pressure inside the flask as some gas molecules dissolve in water.
(xvii) (a) Polymorphism
Overloading of constructors requires you to specify the same name to all constructors. So, is the polymorphism principle of OOPS.
(xviii) (a) dot operator(.)
Instance variables and methods are accessed via objects with the help of a dot (.) operator. The dot
operator creates a link between the name of the instance variable and the name of the class with which it is used.
(xix) (d) garbage value
(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) 4 2
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 compute( )
{
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.
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 5.
Class Bubble
{
public static void sorting()
{
int arr[] = {19, 21, 39, 31, 45, 65, 49, 68, 62, 10};
int n = 10;
int i = 0;
int k, temp;
k = temp = 0;
System.out.println(“Array List is =”);
for(i = 0; i < n; i++)
{
System.out.println(“ ” + arr[i]);
}
for (k = 0; k < n – 1; k++)
{
for (int j = 0; j < n – k – 1; j++)
{
if (arr [j] > arr[j + 1])
{
temp = arr[j];
arr [j] = arr [j + 1];
arr [j + 1] = temp;
}
}
}
System.out.print(“/n”);
System.out.println(“Bubble Sorted Array is =”);
for (i = 0; i < n, i++)
{
System.out.println(arr[i] + “ ”);
}
}
}
OUTPUT
Array List is = 19, 21, 39, 31, 45, 65, 49, 68, 62, 10
Bubble Sorted Array is = 10, 19, 21, 31, 39, 45, 49, 62, 65, 68
(iii) (a) Hydration
(b) Pyrolysis
(c) Polymerisation
Answer 6.
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 7.
import java.io.*;
Class Reverse
public static void main (String args[]) throws IO Exception
{
int a[] = new int [10];
n = 10
int i, j;
i = j = 0;
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
System.out.println(“Enter Elements of Array =”);
for (i = 0; i < 10; i++)
{
String x = input.readLine();
a[i] = Integer.parseInt (x);
}
System.out.println(“Elements of the Array are =”);
System.out.println(“\n”);
for (i = 0; i < n/ i++);
{
System.out.print (“ ” + a [i]);
System.out.print (“\n”);
}
for (i = 0, j = n - 1; i < n/2; i + +, j – –)
{
a{i} = a[i] + a[j];
a[j] = a[i] – a[j];
a[i] = a[i] – a[j];
}
System.out.println(“Reverse Array is =”);
for (i = 0; i < n; i++);
{
System.out.println(“” + a[i]);
}
}
Answer 8.
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. |
The dot mark ◉ field are mandatory, So please fill them in carefully
To download the Sample Paper (PDF File), Please fill & submit the form below.