10 Computer Applications HY 23-24
10 Computer Applications HY 23-24
CLASS X
Question No 1
Choose the correct options: [20]
(a) The process of binding data and functions together as one unit is called
(i) encapsulation. (ii) abstraction. (iii) polymorphism. (iv) inheritance.
(c) Assertion(A): In Java, statements or words written after // are not executed.
Reason(R): Anything written after // becomes a comment and comments are not
executed by Java.
(h) Arrange the following data types in descending order of their size:
(i) byte, double, float, short (iii) double, float, short, byte
(ii) short, double, byte, float (iv) byte, short, float, double
(n) Assertion(A): The Math.random() method returns a random number between 0 and
less than 2.
Reason(R): The Math.round() method returns the value of a number rounded off to
the nearest integer.
(o) The prototype of a function test that returns true or false and takes an integer variable
and a character variable as its arguments is:
(i) int test(int x, char c)
(ii) boolean test(int x, char c)
(iii) boolean test(int x, int c)
(iv) int test(char x, char c)
(s) Which of the following variable declaration would not compile in a Java program?
(i) int var; (ii) int VAR; (iii) int var1; (iv) int 1_var;
Question No 2
(a) Find the output of the following:
(i) String str = “Information Technology”; [2]
String s = str.substring(str.lastIndexOf(‘o’));
System.out.println(s);
a = x + 5 ÷ x2 – �x + y ÷ 2
(c) Read the following code and answer the questions given below: [3]
(i) Name the variables for which each object will have its own distinct copy.
(ii) Name the variables which are common to all objects of the class.
(iii) Name the local variables.
(5)
Question No 3
Write the output of the following:
Question No 4
Write a menu-driven program to perform the following as per the user’s choice: [15]
a2 a3 a4 a10
a– + – +…… –
2! 3! 4! 10!
Question No 5
(a) void number(int n): Input a number, check and print whether it is a Disarium number or
not.
(A Disarium number is a number whose sum of digits powered with their respective
positions is equal to the original number. Eg. 175 = 11 + 72 + 53)
(b) void number(int a, int n1): Print the sum of the following series:
x x3 x5 xn1
+ + + ……… +
2 4 6 (n1 + 1)
Question No 6
Write a menu-driven program to the print the following patterns as per the user’s choice: [15]
44444 BC
33333 DEF
22222 GHIJ
11111 KLMNO
(7)
Question No 7
Write a program to input a sentence and print the longest word in the sentence and also the
length of the longest word. [15]
Sample input: We are learning Java
Sample output: longest word: learning length: 8
Question No 8
Design a class Showroom according to the following specifications: [15]
Data members: String name: name of the customer
String mbno: mobile number of the customer
int cost: cost of items purchased
double dis: amount of discount
double amt: amount to be paid after discount
Member methods:
(a) A default constructor to initialize the data members.
(c) void calculate(): to calculate the discount on the cost of items purchased and also the
final amount to be paid based on the following:
Cost(₹) Discount
<=10000 5%
>10000 and <=20000 10%
>20000 and <=35000 15%
>35000 20%
Question No 9
Write a program to input a sentence and a word in upper case. Count and print the number
of times the word occurs in the sentence. [15]