Class X Pre Board 23
Class X Pre Board 23
Class X Pre Board 23
Preboard Examination
Class – X Subject – Computer Application F.M – 100 Time – 2 hrs
1 P.T.O
xv. Which of the following keyword is used to create a static method?
a. public b. protected c. static d. private
xvi. Assertion(A): A loop inside another loop is called a nested loop.
Reason(R): The break statement is used for exiting the loop.
a. Both (A) and (R) true and (R) is correct explanation of (A)
b. Both (A) and (R) true and (R) is not correct explanation of (A)
c. Assertion (A) is true and reason (R) is false
d. Assertion (A) is false and reason (R) is true
xvii. Which of the following is the correct syntax to create a parameterized constructor?
a. public int pco(int i){} b. public pco(){} c. public pco(int i){} d. private int pco(int i){}
xviii. Math.sqrt(-16) method returns …………….
a. 4.0 b. -4.0 c. NaN d. 4
xix. Which of the following is returned by the Math.cbrt(125.0) method?
a. 25.0 b. 5.0 c. -5.0 d. Error
xx. Which of the following is correct?
a. +,-,*, /,() b. (),/,*,+, - c. /,*, (), +, - d. None of these
Question 2. [10 x 2 =20]
i. What is call by reference ?
ii. Give two example of relational and logical operators.
iii. what is constructor? Name various type constructors.
iv. Give the size of each of the following in bytes: a) char b) double
v. What is Scanner class?
vi. Write a ternary operation to check if a given number is happy or not? [ a number is called happy if the repetitive
sum of the square of its digits returns 1]
vii. int x=10, y=15; x = ((x<y) ? (y+x) : (y-x)); what will be the value of x after executing the above statement?
viii. change the following code segment into a do while loop: int x, x; for(x=10, c=20; c>=10; c=c-2) x++;
ix. What will be the output : System.out.println((“ALEPPI”).lastIndexOf(‘P’));
System.out.println(“School”.substring(2));
x. What will be the output : math.ceil(5.7) + math.floor(5.5).
2 P.T.O
SECTION B ( 60 MARKS)
Answer any four questions from this section
Question 3. [15]
Define a class Student having following description:
Data members:
String name : to store the name
String clname : to store class name
double marks : to store the marks obtained by the student
double Fmarks : to store full marks
percentage : to store the percentage obtained
Member functions:
input() : to enter the class, name and Full marks.
percentageCal() : calculate percentage of a student on given full marks.
display() : output details of student
Write a program to compute the grade based on the following conditions:
Percentage Grade
90% and above A+
75% and above B+
60% and above C
40% and above D
Less than 40% Fail
Write main method to create an object and call the methods.
Question 4. [15]
Write a program in java to enter 10 names in an Array. Find and print largest name , smallest name and their
positions.
Question 5. [15]
Write a program to input a multidigit number from user and check if the given number is unique or not.
[Example: 121 – not unique for double occurrence of 1 but 123 – unique as there is no double occurrence]
Question 6. [15]
Write a program in java to input a nxn matrix and check if it is semi magical. An array is semi magical if the sum of all
the elements is divisible by sum of the diagonal.
Question 7. [15]
Write a program in java to find if a given word is present in a sentence which is terminated by either ? or .
input : god are you there?
Output: valid. Enter word : god
god is present in number 1 position.
input : devil are you there
output: invalid Enter word: devil
devil is not present but position cannot be disclosed for an invalid input
Question 8. [15]
Design a class to overload a function volume as follows :
Void volume(int s) – to calculate and print the volume of a cube(side 3)
Void volume (int l, int b, int h) – to calculate and print the volume of a cuboid (length x breadth x height)
Void volume (double r) – to calculate and print the volume of a sphere(4/3πr^3)
3 P.T.O