0% found this document useful (0 votes)
80 views

Comp App Practise 6 Papers

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views

Comp App Practise 6 Papers

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

COMPUTER APPLICATIONS

(Theory)

(Two Hours)

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.

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 questions

Question 1.
(a) Define encapsulation. [2]

(b) Explain the purpose of using a ‘new’ keyword in a Java program. [2]

(c) What are literals? [2]

(d) Mention the types of access specifiers. [2]

(e) What is constructor overloading? [2]

Question 2.

(a) Differentiate between boxing and unboxing. [2]

(b) Rewrite the following condition without using logical operators: [2]

if ( a>b || a>c )

System.out.println(a);
(c) Rewrite the following loop using for loop: [2]

while (true)

System.out.print("*");

(d) Write the prototype of a function search which takes two arguments a string [2]
and a character and returns an integer value.

(e) Differentiate between = and == operators. [2]

Question 3.
(a) State the number of bytes and bits occupied by a character array of 10 elements. [2]

(b) Differentiate between Binary Search and Linear Search techniques. [2]

(c) What is the output of the following: [2]

String a="Java is programming language \n developed by \t\'James Gosling\'";

System. out. println(a);

(d) Differentiate between break and System. exit(0). [2]


(e) (𝑎+𝑏)3 [2]
Write a statement in Java for √
|𝑎−𝑏|

(f) What is the value of m after evaluating the following expression: [2]
m - = 9%++n + ++n/2; when int m=10,n=6

(g) Predict output of the following: [2]

(i) Math.pow(25,0.5)+Math.ceil(4.2)

(ii) Math.round ( 14.7 ) + Math.floor ( 7.9)

(h) Give the output of the following java statements: [2]

(i) "TRANSPARENT".toLowerCase();

(ii) "TRANSPARENT".compareTo("TRANSITION")

(i) Write a java statement for each to perform the following task: [2]

(i) Find and display the position of the last space in a string str.

(ii) Extract the second character of the string str.


(j) State the type of errors if any in the following statements: [2]

(i) switch ( n > 2 )

(ii) System.out.println(100/0);

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 so that the logic
of the program is clearly depicted.
Flow-Charts and Algorithms are not required.

Question 4.
Anshul transport company charges for the parcels of its customers as per the following [15]
specifications given below:

Class name : Atransport

Member variables: String name – to store the name of the customer

int w – to store the weight of the parcel in Kg

int charge – to store the charge of the parcel

Member functions: void accept ( ) – to accept the name of the customer,


weight of the parcel from the user (using
Scanner class)

void calculate ( ) – to calculate the charge as per the weight


of the parcel as per the following
criteria.

Weight in Kg Charge per Kg


Upto 10 Kgs Rs.25 per Kg
Next 20 Kgs Rs.20 per Kg
Above 30 Kgs Rs.10 per Kg
A surcharge of 5% is charged on the bill.

void print ( ) – to print the name of the customer, weight of the parcel, total bill
inclusive of surcharge in a tabular form in the following format :

Name Weight Bill amount

Define a class with the above-mentioned specifications, create the main method,
create an object and invoke the member methods.

Question 5.

Write a program to input name and percentage of 35 students of class X in two separate [15]
one dimensional arrays. Arrange students details according to their percentage in the
descending order using selection sort method. Display name and percentage of first
ten toppers of the class.

Question 6.

Design a class to overload a function Sum( ) as follows: [15]

(i) int Sum(int A, int B) – with two integer arguments (A and B) calculate and return
sum of all the even numbers in the range of A and B.

Sample input: A=4 and B=16

Sample output: sum = 4 + 6 + 8 + 10 + 12 + 14 + 16

(ii) double Sum( double N ) – with one double arguments(N) calculate and return
the product of the following series:

sum = 1.0 x 1.2 x 1.4 x .................. x N

(iii) int Sum(int N) - with one integer argument (N) calculate and return sum of only
odd digits of the number N.

Sample input : N=43961

Sample output : sum = 3 + 9 + 1 = 13

Write the main method to create an object and invoke the above methods.
Question 7.
Using the switch statement, write a menu driven program to perform following [15]
operations:
3
(i) To Print the value of Z where Z = 𝑥 +0.5𝑥 where x ranges from – 10 to 10 with
𝑌

an increment of 2 and Y remains constant at 5.5.

(ii) To print the Floyds triangle with N rows

Example: If N = 5, Output:

2 3

4 5 6

7 8 9 10

11 12 13 14 15

Question 8.

Write a program to input and store integer elements in a double dimensional array of [15]
size 4×4 and find the sum of all the elements.

7 3 4 5

5 4 6 1

6 9 4 2

3 2 7 5

Sum of all the elements: 73


Question 9.
[15]
Write a program to input a string and convert it into uppercase and print the pair of
vowels and number of pair of vowels occurring in the string.

Example:

Input:

"BEAUTIFUL BEAUTIES "

Output :

Pair of vowels: EA, AU, EA, AU, IE

No. of pair of vowels: 5

Paper 2

ICSE SEMESTER 2 EXAMINATION SPECIMEN QUESTION PAPER


COMPUTER APPLICATIONS
Maximum Marks: 50
Time allowed: One and a half hours
Answers to this Paper must be written on the paper provided separately.
You will not be allowed to write during the first 10 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.
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
(Attempt all questions.)
Question 1

Choose the correct answers to the questions from the given options. (Do not copy the
question, Write the correct answer only.) [10]

(i) When primitive data type is converted to its corresponding object of its class, it is
called as .

(a) Boxing

(b) Explicit type conversion


(c) Unboxing

(d) Implicit type conversion

(ii) State the value of y after the following is executed:

char x='7';

y= Character.isLetter(x);

(a) false

(b) 7

(c) true

(d) ‘7’
(iii) Give the output of the following string methods:

"MISSISSIPPI".indexOf('S')+ "MISSISSIPPI".lastIndexOf('I')

(a) 10

(b) 12

(c) 20

(d) 11

(iv) Corresponding wrapper class of int data type is .

(a) integer

(b) INTEGER

(c) Int

(d) Integer

(v) Variable that is declared with in the body of a method is termed as:

(a) Instance variable

(b) class variable

(c) Local variable

(d) Argument variable

(vi) Identify the correct array declaration statement:

(a) int a[10];

(b) int a[]=new int[10];

(c) int arr[i]=10;

(d) int a[10]=new int[];

(vii) A variable that is bounded to the object itself is called as:

(a) Instance variable

(b) class variable

(c) Local variable

(d) Argument variable


(viii) The access modifier that gives most accessibility is:

(a) private

(b) public

(c) protected

(d) package

(ix) Give the output of the following code:

String A ="26.0", B="74.0";

double C= Double .parseDouble(A);

double D = Double .parseDouble(B);

System.out.println((C+D));

(a) 26

(b) 74

(c) 100.0

(d) 2674

(x) Wrapper classes are available in package.

(a) java.io

(b) java.util

(c) java.lang

(d) java.awt

SECTION B

(Attempt any four questions.)

Question 2 [10]

Define a class to declare an integer array of size n and accept the elements into the array.
Search for an element input by the user using linear search technique, display the element
if it is found, otherwise display the message “NO SUCH ELEMENT.
Question
3

[10]

Define a class to declare a character array of size ten, accept the character into
the arrayand perform the following:

 Count the number of uppercase letters in the array and print.

 Count the number of vowels in the array and print.

Question
4

[10]

Define a class to declare an array of size 20 of double datatype, accept the


elements intothe array and perform the following:

 Calculate and print the sum of all the elements.

 Calculate and print the highest value of the array.

Question
5

[10]

Define a class to accept two strings, convert them into uppercase, check and
display whether two strings are equal or not, if the two strings are not equal, print
the string with the highest length or print the message both the strings are of equal
length.

Question
6

[10]

Define a class to accept a string, convert it into lowercase and check whether
the string isa palindrome or not.
A palindrome is a word which reads the same backward

as forward.Example:

madam, racecar etc.

Question
7

[10]

Define a class to accept and store 10 strings into the array and print the strings
with evennumber of characters.

Paper 3
Sample Paper 4
Sample Papers ICSE Class 10 Computer
Applications

Section A

Question 1

(a) Define Java byte code.

(b) Write a difference between class and an object.

(c) Name the following:

(d) Which of the following are primitive data types?

1. double
2. String
3. char
4. Integer

(e) What is an operator? What are the three main types of


operators? Name them.

Question 2

(a) What is Autoboxing in Java? Give an example.


(b) Differentiate between length and length().

(c) What is constructor overloading?

(d) What is the use of the keyword 'import' in Java programming?

(e) What is meant by an infinite loop? Give an example.

Question 3

(a) Write a Java expression for the following:

(b) Evaluate the following if the value of x=7, y=5

x += x++ + x + ++y

(c) Write the output for the following:

String s1 = "Life is Beautiful";


System.out.println("Earth" + s1.substring(4));
System.out.println(s1.endsWith("L"));
(d) Write the output of the following statement:

System.out.println("A picture is worth \t \"A thousand words.\" ");


(e) Give the output of the following program segment and mention
how many times the loop will execute:

int k;
for ( k = 5 ; k < = 20 ; k + = 7 )
if ( k% 6==0 )
continue;
System.out.println(k);
(f) What is the data type returned by the following library methods?

1. isWhitespace()
2. compareToIgnoreCase()

Answer

1. boolean
2. int

(g) Rewrite the following program segment using logical operators:


if ( x > 5 )
if ( x > y )
System.out.println(x+y);
(h) Convert the following if else if construct into switch case:

if (ch== 'c' || ch=='C')


System.out.print("COMPUTER");
else if (ch == 'h' || ch =='H')
System.out.print("HINDI");
else
System.out.print("PHYSICAL EDUCATION");
(i) Give the output of the following:

1. Math.pow(36,0.5) + Math.cbrt(125)
2. Math.ceil(4.2) + Math.floor(7.9)

(j) Rewrite the following using ternary operator:

if(n1>n2)
r = true;
else
r = false;
Section B

Question 4

A private Cab service company provides service within the city at


the following rates:
NON AC
AC CAR
CAR

Upto 5 KM ₹150/- ₹120/-

₹08/- PER
Beyond 5 KM ₹10/- PER KM
KM

Design a class CabService with the following description:

Member variables /data members:


String car_type — To store the type of car (AC or NON AC)

double km — To store the kilometer travelled

double bill — To calculate and store the bill amount

Member methods:

CabService() — Default constructor to initialize data members.


String data members to '' '' and double data members to 0.0.

void accept() — To accept car_type and km (using Scanner class


only).

void calculate() — To calculate the bill as per the rules given above.

void display() — To display the bill as per the following format:

CAR TYPE:
KILOMETER TRAVELLED:
TOTAL BILL:

Create an object of the class in the main method and invoke the
member methods.

Question 5

Write a program to search for an integer value input by the user in


the list given below using linear search technique. If found display
"Search Successful" and print the index of the element in the array,
otherwise display "Search Unsuccessful".

{75, 86, 90, 45, 31, 50, 36, 60, 12, 47}

Question 6

An Abundant number is a number for which the sum of its proper


factors is greater than the number itself. Write a program to input a
number and check and print whether it is an Abundant number or
not.

Example:

Consider the number 12.


Factors of 12 = 1, 2, 3, 4, 6 Sum of factors = 1 + 2 + 3 + 4 + 6 = 16

As 16 > 12 so 12 is an Abundant number.

Question 7

Design a class to overload a method Number() as follows:

(i) void Number(int num, int d) — To count and display the frequency
of a digit in a number.

Example:

num = 2565685
d=5
Frequency of digit 5 = 3

(ii) void Number(int n1) — To find and display the sum of even digits
of a number.

Example:

n1 = 29865
Sum of even digits = 2 + 8 + 6 = 16

Write a main method to create an object and invoke the above


methods.

Question 8

Write a menu driven program to perform the following operations as


per user’s choice:

(i) To print the value of c=a²+2ab, where a varies from 1.0 to 20.0
with increment of 2.0 and b=3.0 is a constant.

(ii) To display the following pattern using for loop:

A
AB
ABC
ABCD
ABCDE

Display proper message for an invalid choice.


Question 9

Write a program to input integer elements into an array of size 20


and perform the following operations:

1. Display largest number from the array.


2. Display smallest number from the array.
3. Display sum of all the elements of the array

Sample Papers ICSE Class 10 Computer


Applications

Sample Paper 5
Section A

Question 1

(a) Define Polymorphism.

(b) Differentiate between static variable and instance variable.

(c) What are identifiers in Java? List three identifier formation


rules.

(d) Identify the literals listed below:

1. true
2. 'X'
3. "false"
4. 25.75

(e) Name the wrapper classes of char type and long type

Question 2

(a) Name the type of error in each case given below:

1. Multiplication operator used instead of division operator


2. Missing parenthesis

(b) Write two differences between if-else-if and switch-case


statements.

(c) What is the use of break statement in Java?

(d) Write the prototype of a function check which takes a String and
a character as an argument and returns a boolean.

(e) What is the use of the keyword 'this' in Java programming?

Question 3

(a) Write a Java expression for the following:

2 2
√ (x-h) + (y-k)

a b

Answer

Math.sqrt((Math.pow((x-h), 2) / a) + Math.pow((y-k), 2) / b)
(b) Give the output of the following:

1. Math.max(Math.ceil(14.5), 15.5)
2. Math.sqrt(Math.abs(-225))

(c) Evaluate the following if the value of m = 10 and n = 6

m -= 9 % ++n + ++n / 2

(d) Rewrite the following program segment using if-else:

tax = income > 1000000 ? income * 30.0 / 100 : income * 10.0 / 100;
(e) Give the output of the following program segment:

int n[] ={1,2,3,5,7,9,13,16};


double a=Math.pow(n[4], n[1]);
double b=Math.sqrt(n[5]+n[7]);
System.out.println("a=" + a);
System.out.println("b=" + b);
(f) Rewrite the following program segment using the corresponding
while loop:

int f=1, i;
for(i=1; i<=5; i++)
f*=i;
System.out.println(f);
(g) Give the output of the following program segment:

String a="10", b="20";


int x=Integer.parseInt(a);
int y=Integer.valueOf(b);
System.out.println(x+y);
System.out.println(a+b);
(h) Give the output of the following program:

public class StringCheck {

boolean foo(String str) {


int x = str.compareTo("INCOMMUTABLE");
System.out.println("x=" + x);
boolean ret = x == 0 ? true : false;
return ret;
}

public static void main(String[] args) {


StringCheck obj = new StringCheck();
boolean a = obj.foo("INCOMPUTABLE");
System.out.println(a);
}
}
.

(i) State a difference between constructor and function.


(j) For a class Toy, create two objects "Barbie" and "Stack"?

Section B

Question 4

Define a class named Pay with the following description:

Instance variables /Data members:

String name — To store the name of the employee

double salary — To store the salary of the employee

double da — To store Dearness Allowance

double hra — To store House Rent Allowance

double pf — To store Provident Fund

double grossSal — To store Gross Salary

double netSal — To store Net Salary

Member methods:

Pay(String n, double s) — Parameterized constructor to initialize the


data members.

void calculate() — To calculate the following salary components:

1. Dearness Allowance = 15% of salary


2. House Rent Allowance = 10% of salary
3. Provident Fund = 12% of salary
4. Gross Salary = Salary + Dearness Allowance + House Rent
Allowance
5. Net Salary = Gross Salary - Provident Fund

void display() — To display the employee name, salary and all salary
components.

Write a main method to create object of the class and call the
member methods.
Question 5

A Dudeney number is a positive integer that is a perfect cube such


that the sum of its digits is equal to the cube root of the number.
Write a program to input a number and check and print whether it is
a Dudeney number or not.

Example:

Consider the number 512.

Sum of digits = 5 + 1 + 2 = 8
Cube root of 512 = 8

As Sum of digits = Cube root of Number hence 512 is a Dudeney


number.

Question 6

Write a menu-driven program to display the following patterns as


per the user’s choice:

(a)

1234567
12345
123
1

(b)

11111
22222
33333
44444
55555
Question 7

Design a class to overload a function series( ) as follows:

(a) void series(int a, int n) — To display the sum of the series given
below:

a - (a/2!) + (a/3!) - (a/4!) + ...... n terms

(b) void series(int n) — To display the sum of the series given below:

1/2 - 2/3 + 3/4 - 4/5 + ...... n terms

Write a main method to create an object and invoke the above


methods.

Question 8

Write a program to input 10 alphabets in an array. Now ask the user


to input an alphabet and search if the alphabet is present in the
array or not using linear search technique. If found display "Search
Successful" and print the index of the alphabet in the array,
otherwise display "Search Unsuccessful".

Question 9

Write a program to create three single dimensional arrays cod[],


pric[], qty[] to store product code, unit price and quantity of each
product for 10 products. Calculate the total cost of each product
and print the result in tabular form including product code, unit
price, quantity and total cost of each product. At the end print total
of price, total of quantity and the total of costs.

Sample Papers ICSE Class 10 Computer Applications


Sample Paper 6
Section A

Question 1

(a) What are the differences between Procedural Programming and Object-Oriented
Programming?

(b) Arrange in descending order of byte size the following values:

'c', 94.245, true, 50

(c) Name the package which contains:

1. Scanner class
2. Wrapper classes

(e) Write two differences between Implicit and Explicit conversion.

Question 2

(a) Name two jump statements and their use.

(b) Write two differences between System.out.print() and System.out.println()

(c) Name the function which:

1. Returns the index of the first occurrence of a character in a string.


2. Returns the largest integer less than or equal to the given number as a double
value.

(d) Explain the difference between actual and formal parameters.

(e) What is the purpose of 'new' operator?

Question 3

(a) Write a Java expression for the following:

√m(ah+v2)
2

(b) Evaluate the following if the value of x = 20 and y = 20 and z = 10

z *= ++x * (y--) - y

(c) Give the output of the following program segment:


int x[] = {4, 3, 7, 8, 9, 10};
int p = x.length;
int q = x[2] + x[5] * x[1];
System.out.println("p=" + p);
System.out.println("q=" + q);
(d) Convert the following if else if construct into switch case:

if (a == 10)
System.out.println("TEN");
else if (a == 50)
System.out.println("FIFTY");
else if (a == 100)
System.out.println("HUNDRED");
else
System.out.println("UNKNOWN");
(e) Rewrite the following program segment using for loop:

int n = 152, s = 0;
while (n != 0) {
int d = n % 10;
s = s + d;
n = n / 10;
}
(f) Rewrite the following program segment using ternary operator:

if (m == 0)
System.out.println("Hello");
else
System.out.println("Good Day");
(g) What is a fall through? Give an example.

(h) Give the output of the following program segment and also mention the number of
times the loop is executed:

int x, y;
for (x = 9, y = 4; x <= 45; x+=9) {
if (x % y == 0)
break;
}
System.out.println(x);
(i) Consider the below function:

void strop(String s) {
char a = s.charAt(3);
int b = s.indexOf('M');
String t = s.substring(3,6);
boolean p = s.equals(t);
System.out.println(a + " " + b + " " + t + " " + p);
}
What will be the output for strop("COMPUTER")?
(j) Give the output of the following program segment:

System.out.println("nine:" + 5 + 4);
System.out.println("nine:" + (5 + 4));
Section B

Question 4

Define a class named Customer with the following description:

Instance variables /Data members:

String cardName — Name of the card holder.

long cardNo — Card Number.

char cardType — Type of card, 'P' for Platinum, 'G' for Gold, 'S' for Silver.

double purchaseAmount — The amount of purchase done on card.

double cashback — The amount of cashback received.

Member methods:

Customer(String name, long num, char type, double amt) — Parameterised constructor
to initialize all data members.

void compute() — To compute the cashback based on purchase amount as follows:

1. For Silver ('S'), 2% of purchase amount


2. For Gold ('G'), 5% of purchase amount
3. For Platinum ('P'), 8% of purchase amount

void display() — To display the details in the below format:

Card Holder Name:


Card Number:
Purchase Amount:
Cashback:

Write a main method to input the card details from the user then create object of the
class and call the member methods with the provided details.

Question 5

Using switch-case statement write a menu driven program for the following:

1. To display the pattern given below:


A
BC
DEF
GHIJ
KLMNO

2. To display the sum of the series given below:


1/1! + 3/3! + 5/5! + ..... + n/n!

Question 6

Write a program to input and store roll number and total marks of 20 students. Using
Bubble Sort technique generate a merit list. Print the merit list in two columns
containing roll number and total marks in the below format:

Roll No. Total Marks


... ...
... ...
... ...

Question 7

Write a class with the name Area using function overloading that computes the area of
a parallelogram, a rhombus and a trapezium.

Formula:

Area of a parallelogram (pg) = base * ht

Area of a rhombus (rh) = (1/2) * d1 * d2


(where, d1 and d2 are the diagonals)

Area of a trapezium (tr) = (1/2) * ( a + b) * h


(where a and b are the parallel sides, h is the perpendicular distance between the
parallel sides)

Write a main method to create an object and invoke the above methods.

Question 8

Write a program to print the sum of negative numbers, sum of positive even numbers
and sum of positive odd numbers from a list of numbers entered by the user. The list
terminates when the user enters a zero.

Question 9

Write a program to take a number from the user as input. Find and print the largest
digit of the number.
Example:

Sample Input: 748623


Largest digit: 8

You might also like