PreBoard 02
PreBoard 02
School, Baghpat
Pre Board Examination
Subject - Computer Applications
Class – X
TIME – 2 hours M.M.-80
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 [20x1=20]
Choose the correct answers to the questions from the given options.
(Do not copy the question, write the correct answers only.)
Question 2 [10x2=20]
I. What is the difference between static variable and non-static variable?
II. What do you mean by comments? What are the different types of comment supported by java?
III. Differentiate between break and return statements.
IV. What will be the output of the following code?
int a[ ] = {5, -1, 2, 9, 14, -6, 25};
System.out.println(Math.max(a.length,a[5]));
System.out.println((int)Math.sqrt(a[3]+a[6]));
V. What will be the output of the following program segment?
String s1 = “Application”,s2=”Computer”;
System.out.println(s1.substring(0,4)+s2.charAt(6));
System.out.println(s2.length()+s1.indexOf(‘e’));
𝑥1+𝑥2 𝑦1+𝑦2
+
2 2
VI. Write an expression in Java for 𝑥1+𝑦1
VII. Give the output of the following java statements:
"UppErCasE LettEr".toUpperCase().substring(5);
"Arun".compareTo("Arpan");
VIII. Write the statements for the following:
(a) Create an array to store ‘n’ double values.
(b) Assign the value 20.22 at the last index of the array.
IX. What is the value of m and n after evaluating the following expression:
m = 6*--n%++n + ++n/2 + n--; when int n=5;
X. Predict output of the following:
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < i; j++)
{
System.out.print(i + " " + j + " ");
}
}
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 [10]
If the age of the employee is above 50 he/she gets an additional allowance of Rs.5000.
void print() — to print the details as per the following format
eno ename age basic net
---------- ------------ --------- ---------- ----------
void main() — to create an object of the class and invoke the methods.
Question 4 [10]
2 3
4 5 6
7 8 9 10
Question 5. [10]
Define a class to accept values into a double array of length 20 and perform the following task
(i) Print array elements.
(ii) Print range of the array, range is the difference between the largest and the smallest elements of
the array.
(iii) Print sum of elements.
Question 6 [10]
Whole numbers are said to be abundant, deficient, or perfect. A whole number is abundant if the sum
of its proper divisors is greater than the whole number. The whole number 12 is abundant. Its proper
divisors are 1, 2, 3, 4, and 6 and the sum of the proper divisors is 16 which is greater than 12. A whole
number is deficient if the sum of its proper divisors is less than the whole number. The number 4 is
deficient. Its proper divisors are 1 and 2 and the sum of its proper divisors is 3 which is less than 4. A
whole number is perfect if the sum of its proper divisors is equal to the whole number. The number 6 is
perfect. Its proper divisors are 1, 2, and 3 and the sum of its proper divisors is 6.
Write a program to check whether the number entered by user is perfect, deficient or abundant.
Question 7 [10]
Define a class to accept a string, convert it in upper case and encode the string in the following format:
if the character is a vowel, then replace it with the next character. Other character will remain same.
Also count the number of vowels present in it.
Example : input = “BeaUTiFul”
Output — “BFBVTJFVL”.
No. of vowels = 5
Question 8 [10]
Write a program to input numbers into a 4x4 2 D array and print this 2D array in matrix form along
with sum of each row separately.
Example :
Input: 3 5 7 14
9 3 11 5
6 -2 3 7
-1 3 -1 7
output : Array elements Sum
3 5 7 14 29
9 3 11 5 28
6 -2 3 7 14
-1 3 -1 7 8