LOKHANDWALA FOUNDATION SCHOOL
PRELIMINARY EXAMINATION - 2023-24
SUBJECT: COMPUTER APPLICATIONS
Date:-10/01/2024 Duration:-2 Hrs.
Grade:-10 Max. Marks:-100
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 consists of 6 printed sides.
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
(Attempt all questions from this Section.)
Question 1
Choose the correct answer and write the correct option. [20]
(i) Name the feature of Java depicted in the following picture :
(a) Data abstraction (b) Polymorphism (c) Encapsulation (d) Inheritance
(ii) ! operator is a _______ operator.
(a) Unary (b) binary (c) ternary (d) None of these
(iii) int x = 10;
Integer obj = new Integer();
obj = x; This statement is an example of _______
(a) Implicit type conversion (b) Boxing (c) Unboxing (d) Type casting
pg. 1
(iv) Following expression is a ____________ expression :
if(a>b && a>c)
(a) Arithmetic (b) Assignment (c) Logical (d) Mathematical
(v) Number of bytes occupied by double array of size 4 is :
(a) 24 (b) 12 (c) 32 (d) 64
(vi) The method of a Scanner class used to accept a String without a space.
(a) next() (b) nextInt() (c) nextLine() (d) nextString()
(vii) Keyword to create symbolic constants in Java.
(a) Final (b) const (c) constant (d) final
(viii) State the result for the statement –
Math.round(19.79) + Math.abs(Math.floor(–3.7));
(a) 22 (b) 23 (c) 23.0 (d) 24.0
(ix) State the type of error if any, in the following statement:
String s = “Lokhandwala School”;
System.out.println(s.substring(12,19));
(a) Syntax (b) Runtime (c) Logical (d) No Error
(x) Statement to declare a DDA of 3 rows and 2 columns is :
(a) int a[ ] = new int[3][2]; (b) int a( )( ) = new int[3][2];
(c) int a[ ][ ] = new int[3][2]; (d) int a[3][2] = new int[ ][ ];
(xi) Output of “Outstanding”.substring(3,8).substring(2);
(a) and (b) stand (c) tstand (d) standing
(xii) Which of the following is not a Wrapper class?
(a) Character (b) String (c) Integer (d) Float
(xiii) Function Overloading is implementing which OOP Principle?
(a) Inheritance (b) Abstraction (c) Polymorphism (d) Encapsulation
(xiv) Which of the following is valid literal ?
(a) 10 (b) 20.5 (c) Only (a) (d) Both (a) and (b)
(xv) Which of the following methods belong to Integer class?
(a) parseDouble() (b) parseInt() (c) parseInteger() (d) isDigit()
(xvi) Which element of the array is represented by variable a[4] in array of size 10?
(a) 4th (b) 5th (c) 9th (d) 3rd
pg. 2
(xvii) Assertion(A) – String class functions can be used without importing any package
Reason(R) – String class is in the lang package which is imported by default
(a) Both Assertion(A) and Reason(R) are true and Reason(R) is the correct
explanation of Assertion(A)
(b) Both Assertion(A) and Reason(R) are true and Reason(R) is not the correct
explanation of Assertion(A)
(c) Assertion(A) is true and Reason(R) is false
(d) Assertion(A) is false and Reason(R) is true
(xviii) Assertion(A) – The formal parameters of a function carry value or reference of
actual parameters
Reason(R) – Arrays are passed by value
a) Both Assertion(A) and Reason(R) are true and Reason(R) is the correct
explanation of Assertion(A)
(b) Both Assertion(A) and Reason(R) are true and Reason(R) is not the correct
explanation of Assertion(A)
(c) Assertion(A) is true and Reason(R) is false
(d) Assertion(A) is false and Reason(R) is true
(xix) Access Specifier with maximum restrictions :
(a) private (b) package (c) protected (d) public
(xx) int x = 3; char y,z;
y=’Z’; z=(char) (y – x);
System.out.println(z);
(a) W (b) X (c) Y (d) Z
Question 2
(i) Write Java expression for the following: (2)
7 + √x+y
|x – y|
(ii) The following code segment should print the value of a as it is greater than b. (2)
boolean f = True;
boolean t = false;
int a = 10, b = 3;
if(a>b)
{ t=true;
f=false;
}
if(f && t)
System.out.println(a);
Correct the above code to print the value of a.
pg. 3
(iii) Evaluate the expression : (2)
m – = 8%n++ + ++n/2; where m = 10, n = 6 initially.
(iv) Rishit executes the following program to get the square root of the number. (2)
But the output of the code is always 1.0. State the type of error and also correct
the code to get proper square root of a number received as parameter. Do not
change pow function.
void squareroot(int a)
{
double s;
s=Math.pow(a, ½);
System.out.println(s);
}
(v) State the number of iterations and output of the following loop: (2)
int x = 10, y = 50;
do
{
if(y<10)
break;
y – = ++x;
System.out.println(y);
x++;
} while(++x <=20);
(vi) String s = “ARTIFICIAL INTELLIGENCE”, str= “Sincere”; (2)
State the output.
(a) s.lastIndexOf(‘A’) + s.substring(0,3);
(b) str.charAt(str.length() – 2);
(vii) State the output : (2)
String a = “97.3”, b = “24”;
int c = Integer. parseInt(b);
double d = Double.parseDouble(a);
System.out.println(a+b);
System.out.println(c+d);
(viii) Name the following : (2)
(a) keyword to go back to the calling function with or without a value
(b) keyword to make a variable have one copy in the memory.
(c) function to stop the program from executing further.
(d) function to convert a numeric value to a String.
pg. 4
(ix) Observe the following class and answer the questions: (2)
class Sample
{
double d;
static char c;
void function1()
{
int x = 10;
System.out.println(“Hello World ”+x+d);
}
}
(a) Name the global variables and local variables.
(b) State the output of the program.
(x) Convert the following if – else to ternary operator (2)
String x = a >= 90 ? "excellent" : a>=80 ?"very good" : "fair" ;
SECTION B
(Attempt any four questions.)
Question 3 [15]
Define a class Laptop with the following description:
Instance variables/data members:
String nm – to store the name of the customer
int price – to store the price of the laptop
double dis – to calculate and store the discount amount
double amt – to calculate and store the payable amount
Member methods:
default constructor to initialize the instance variables
void input( ) – to input the name and price
void calc( ) – to calculate the discount as follows :
price discount rate
upto 25,000 5%
25,001 – 50,000 7.5%
50,001 – 1,00,000 10%
>1,00,000 12.5%
Calculate the discount and update the value of amt accordingly.
void display( ) – to display the details
Write a main() method to create an object of a class and call the above member methods.
Question 4 [15]
Define a class to declare a double array to store percentage of 20 students. Sort the array
in descending order using selection sort technique and display the sorted array.
pg. 5
Question 5 [15]
Write a program to accept a sentence and count and display the number of capital vowels
in the original string and also convert all capital letters to small and small to capital.
(Toggle case)
Example : INPUT SENTENCE : Artificial IntelliGEnce & MACHINE Learning
OUTPUT : aRTIFICIAL iNTELLIgeNCE & machine Learning
Number of capital vowels : 6
Question 6 [15]
Define a class to accept values in 4 x 4 array and count the number of even elements in
the array. Also calculate the sum of the left and the right diagonal of the array.
Question 7. [15]
Write a program to accept a 2 digited number and check whether it is a Kaprekar number
or not. A Kaprekar number is a number, if the representation of its square when divided
into two halves and summed, results into the original number.
Example ; 45 its square 2025 divided into two halves and summed 20+25 = 45
Thus 45 is a Kaprekar number.
Example 1 : Input : 45 Output : Kaprekar number
Example 2 : Input : 297 Output : Invalid input
Question 8 [15]
Design a class to overload the method display as follows:
(a) void display() – To print the following using nested loop.
12345
1234
123
12
1
(b) void display(int n) – to print the square of each digit of a number.
E.g. n = 7342
O/P : 4
16
9
49
(c) double display(double x) – to return the cube root of the received number.
______________________________
pg. 6