LOKHANDWALA FOUNDATION SCHOOL
INTERNAL ASSESSMENT
SUBJECT : COMPUTER APPLICATIONS ASSIGNMENT(Set 1)
ACADEMIC YEAR 2024– 2025
GRADE 10
Topic :- JAVA PROGRAMMING
Instructions:
The student is expected to use an A4 size interleaved journal of 100+
pages. Same journal is to be used in set 2(term 2) assignments.
The journal needs to be covered with a dark color tinted paper.
On that cover – Name of the student, Class, division, Roll no.
academic year 24-25 and Computer Applications Assignments
is to be written.
The student may write the answers in black or blue ink.
Except for questions, all other matter should be handwritten.
All programs should be followed by the variable description table.
Total questions - 12
Format for writing the programs:
Questions – to be printed and stuck on blank side
Answer / Program – hand written
Variable Description – hand written
Assignment submission last date : 12th August, 2024
Question 1.
Choose the correct answer :
(i) Indexes in Java arrays and Strings are numbered from :
(a) 0 to length (b) 0 to length – 1 (c) 1 to length (d) 1 to length+1
(ii) Which of the following is used to generate a random number between 0 to 10
(a) Math.random() (b) (int)Math.random()
(c) Math.random(0) (d) (int)(Math.random()*10)
(iii) Character array of size 4 will occupy _____ bits :
(a) 8 (b) 64 (c) 16 (d) 96
(iv) A method with the different name then the class but having parameters is
termed as:
(a) Parameterized constructor (b) Non-parameterized constructor
(c) Parameterized method (d) Non-parameterized method
(v) Statement to declare a double array of size 8 is :.
(a) double [ ]a = new double[8]; (b) double a = new double[8];
(c) double [ ]a = new double[7]; (d) double a[ ] = new a[8];
Question 2.
(a) Define all 4 principles of OOP.
(b) Differentiate between :
1. Actual and Formal parameters 2. Call by value, Call by reference
3. Pure and Impure functions. 4. Linear and Binary Search
5. Bubble Sort and Selection Sort 6. Searching and Sorting.
(c) Identify and name the following tokens :
(i) public (ii) ‘a’ (iii) = = (iv) {}
(d) State the output of the following code fragment:
public static void main()
{ int x = 7;
++x;
System.out.println(x);
x – = (x – –) – (– –x);
System.out.println(x);
}
Question 3.
Define a class called Salary with the following description:
Instance variables/data members:
name – to store the name of the Employee
salary– to store the annual salary of the employee
tax – to store the tax amount
Member methods:
default constructor – to initialize data members
void input( ) – to input and store name and salary of the employee.
void display( ) – to display all the details
void compute( ) – to compute the tax as follows :
Salary Tax
Upto 300000 No tax
>300000 and <=600000 10% of salary above 300000
>600000 20% of salary above 600000 + 30000
Write a main() method to create an object of a class and call the above member
methods.
Question 4.
Design a class to overload a function fun ( ) as follows:
(a) void fun(int n) – to print the following series
2, 5, 10, 17…… n terms
(b) void fun(int x, int y) – to print x lines and y values on each line as follows:
E.g x=3, y = 4
****
****
****
(c) int fun(int a, int b) – to return a shorter of two numbers
Question 5.
Design a class to overload a function series( ) as follows:
(a) int series() – to calculate the sum of the following series:
S = 1 + 1x2 + 1x2x3 + …………+ 1x2x3x4x5…..7
(b) double series (double x) –to calculate the sum of the following series:
S= 1 + 1 + 1 + 1
2.0 3.0 4.0 ………………. x
(c) void series (int m, int n) – to print the following pattern:
E.g. m =3, n=5 then Output :
11111
22222
33333
Question 6.
Define a class to accept 10 values in a character array and print the maximum and
minimum value based on Unicode.
Question 7.
Define a class StoreStock with the following description:
Instance variables/data members:
String nm – to store the name of the item
int qty – to store the quantity of the item
int price – to store the total amount (qty * price)-
first accept price per unit, then update price as mentioned.
double dis – to calculate and store the discount amount
double amt – to calculate and store the payable amount (price – dis)
Member methods:
default constructor to initialize the instance variables
void input( ) – to input and store the detail of the item
void calc( ) – to calculate the discount as follows :
qty discount rate
<=50 5%
<=100 10%
>100 15%
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 8.
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 9.
Define a class to declare a character array of size ten, accept the character into the
array and 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 10.
Using the switch-case statement, write a menu driven program to do the following
:
(a) To generate and print Letters from A to Z and their Unicode Letters
(b) Display the following pattern using iteration (looping) statement:
Question 11.
Define a class to declare an array of size 20 of double datatype, accept the
elements into the array and perform the following:
• Calculate and print the sum of all the elements.
• Calculate and print the highest value of the array.
Question 12.
Write a program to input and store integer elements in a double dimensional array
of size 3 x 3 and find the sum of elements in the left diagonal and all odd elements.
Example:
1 3 5
4 6 8
9 2 4
Output: Sum of the left diagonal elements = (1 + 6 +4) = 11
Sum of odd elements = (1+3+5+9) = 18
_______________________________