Moye Moye
Moye Moye
PRELIMINARY EXAMINATION
COMPUTER APPLICATION
Grade: 10 Time: 2 hours
Date: 12-01-2024 Max. Marks:100
SECTION A
(Attempt all questions from this Section.)
Question 1
i) Name the feature depicted in the picture given below: (1)
a) Encapsulation
b) Class and Object
c) Abstraction
d) Polymorphism
1
Computer Application 10
a) Pure Expression
b) Real Expression
c) Unreal Expression
d) Impure Expression
v) Assertion (A): The methods in the library class Math- max(), min()
and abs() has multiple definition of the same method with different
datatypes int, long, float and double.
Reason (R): In these methods the concept of method overloading is
used.
a) Assertion (A) and the Reason(R) are false
b) Assertion (A) and the Reason(R) are true
c) Assertion (A) is true and the Reason(R) is false
d) Assertion (A) is false and the Reason (R) is true
(vi) Read the following text and choose the correct answer: (1)
Sorting is the process of arranging the elements of an array so that they can be
placed either in ascending or descending order. There are different types of
sorting techniques.
In selection sort technique, the smallest value among the unsorted elements of
the array is selected in every pass and swapped with the value in appropriate
position. In the Bubble Sort technique the values are compared with the
adjacent elements and swaps them if they are not in the correct order.
Name the sorting technique which has more than on swap per pass.
a) Selection sort
b) Bubble sort
c) Merge sort
d) Both a and b
(vii) Among the following which is not a keyword: (1)
a) int
b) void
c) New
d) System
2
Computer Application 10
(viii) How many bits will the following declaration boolean a[] = new boolean[10]
: occupy: (1)
a) 10
b) 400
c) 80
d) 100
(ix) Which of the following is incorrect when primitive datatypes are passed as
parameters: (1)
a) The changes are not affected
b) The values are copied from the actual parameter to the formal
parameter
c) The changes are affected
d) Actual parameter and the formal parameters are different memory
location
(x) Which of the following is optional in switch- case statement: (1)
a) break
b) case
c) continue
d) switch
(xi) The searching technique which works on a sorted and unsorted array: (1)
a) Linear Search
b) Binary Search
c) Exponential search
d) Jump search
(xii) Assertion (A): Java provides four integer datatypes – byte, short, int, and long..
The memory allocation for each differs. So, depending on the range of value being
store that datatype can be used.
Reason (R): A variable of type int can hold a 12 digit integer. (1)
a) Assertion (A) and the Reason(R) are false
b) Assertion (A) and the Reason(R) are true
c) Assertion (A) is true and the Reason(R) is false
d) Assertion (A) is false and the Reason (R) is true
3
Computer Application 10
a) 27.0
b) 28.0
c) 29.0
d) 26.0
(xvi) The output of the following statement: (1)
System.out.println("Amazon".substring(0,4).concat("Hacking".substring(4)));
a) Amazoing
b) Amazoking
c) Amazing
d) Amazking
(xvii) Give the output of the following code: (1)
a) int
b) long
c) short
d) byte
Question 2
i) How many times is the loop executed and what is the output? (2)
{ int p=0,q=1;
while(p++ <= 10)
q += p++;
System.out.println(q);
}
ii) Write a function prototype in which the method Fun takes a long
value and a character value as argument and returns nothing. Also.
Write the function call statement for the above prototype. (2)
iii) The following code prints the sum of the arguments of a and b in the method
Display(). There is an error in the code. Identify, the type of error(Syntax,
4
Computer Application 10
Logical or Run-time). Also, re-write the method Display() with the correct
statement.
𝟐𝒙𝟓
+ 𝐬𝐢𝐧(𝟒𝟓)
|𝟓𝒙𝟕 |
5
Computer Application 10
SECTION B
(Answer any four questions from this Section.)
The answers in this section should consist of the programs in either BlueJ
environment or any program environment with java as the base.
Each program should be written using variable description / mnemonic codes
so that the logic of the program is clearly depicted.
Flowcharts and algorithms are not required.
Question 3 [15]
Write a menu driven program using switch-case to print the following depending
on the user’s choice:
+A+B+C
A +D+E+
BC +F+G
DEF +H+
GHIJ +I
KLMNO +
Question 4 [15]
Create a Double dimension array 5x5 to input 25 integers and perform the
following operations:
a) Print the non-diagonal elements
b) Find the sum of each row
Question 5 [15]
Write a program to accept N alphabets in a single dimension array. Arrange
them in alphabets order using Selection sort. Print only the vowels present in
the sorted array.
Question 6 [15]
Design a class to overload the following method to perform the following
operations:
void Print(int num): With one integer argument checks and print if the number
is a Balanced Number or not.
A number is a Balanced number if the sum of digits is equal to the count of
digits. Eg: num = 11 Sum = 2 count = 2
Num = 20 sum = 2 and count =2
void Print(String S1, String S2): convert both the Strings to uppercase. To
check and print if both the Strings are Balanced. A String is said to be Balanced
if both the String has the same count of vowels and consonants,
eg. String 1 = ANT String S2 = CAN
It is Balanced as both have same count of vowels(1) and same count of
consonant(2).
6
Computer Application 10
Question 7 [15]
Define a class to accept 10 strings in an array and convert all of them to
lowercase. Print the string which begins with a vowel.
Question 8 [15]
The travel agency Robin Hook provides Domestic and International packages.
Based on the package amount and the days travelled discount is calculated.
Additional discount is calculated for early booking. Write a program to calculate
discount amount.
Class Name:- Robin Hook
Member variables:-
String name – Name of the traveler
double p_amt – store the package amount
char cat – stores the category E-Early bird booking L-Late booking
int days – To store the number of days of the package
Member methods:-
(i)void accept () – accept name of the traveler, package amount, days and the
category
(ii) double Com_Disount() – calculate discount amount based on conditions:
Package Amount Days Discount
Amount
<=50,000 <=5 10%
>50,000 and >5 and <=10 15%
<=1,00,000
>1,00,000 >10 25%
If the category = E then an additional discount of 20% is given on the
Package amount
(iii) void Display () – To calculate the final amount and displays all the details
in the following format:
Passengers Name ------
Package amount ----------- Discount Amount ------
Final Amount ------
void main() – to create an object and call the above member methods.
**********************************************************************************
7
Computer Application 10