10 Computer Applications
10 Computer Applications
CLASS X
Prelims, 2022–23
Computer Applications
Question No 1
Choose the correct options: [20 × 1 = 20]
(d) A programmer wants the members of his class Employee to be accessible only by the
methods of the same class. Which access specifier should he use for the members?
(i) public (ii) private (iii) protected (iv) default
(2)
(f) Which is the technique used for binding both data and methods together to keep them
safe from unauthorized access and misuse?
(i) Abstraction (iii) Data Hiding
(ii) Encapsulation (iv) Polymorphism
(m) Conversion of primitive data type into corresponding object of wrapper class is known
as:
(i) unboxing. (iii) implicit conversion.
(ii) autoboxing. (iv) explicit conversion.
(n) What is the total size in bytes of the array q[3] of char data type?
(i) 3 (ii) 6 (iii) 12 (iv) 16
(3)
(r) Choose the correct syntax for an array with the name arr, data type float and having
length such that its last index is 10.
(i) float arr[10] (iii) arr float[ ] = new arr[10]
(ii) float arr[ ] = new float[11]; (iv) float[ ] arr = new float[10];
(t) What is the default data types of floating point numbers in Java?
(i) long (ii) float (iii) double (iv) byte
Question No 2
(a) Write the Java expression for the following: [2]
(a + b)2 + √𝑎 + 𝑏
(b) What will be the output of the following program segment? [2]
int a = 0, b = 10, c = 40;
a – = – – b + c++ + b;
System.out.println(a + “ ” + b + “ ” + c);
(4)
(c) State the need for using wrapper classes in Java programs. [2]
(d) Correct the errors in the following code and rewrite the correct code: [2]
int a = new int(5);
for(int i = 0; i <= 5; i ++)
a[i] = sc.nextInt;
Question No 3
(a) What will be the output of the following function if 5 is passed to it? [2]
void calc(int a)
{
int x = 2;
a = ++a/x + a++/++x;
System.out.println(a);
}
Question No 4
Write a program to overload the function series as follows: [15]
(a) void series(): This function prints the following series:
1, 11, 111, 1111, 11111
(b) void series(int a): This function prints the sum of the following series:
a2 a4 a6 a12
+ + + .. . . . . . . +
3! 5! 7! 13!
Question No 5
Write a program to input a number and check whether it is an Abundant number or not.
An Abundant number is a number for which the sum of its proper factors (excluding the
number itself) is greater than the number itself.
For eg. 12 is an Abundant number because its factors are 1, 2, 3, 4, 6 excluding 12. The
sum of the factors is 16 which is greater than 12. [15]
Question No 6
Write a program to input a sentence and convert it to uppercase. Count and display the total
number of words starting with the letter ‘A’.
For eg. ADVANCEMENT AND APPLICATION OF INFORMATION TECHNOLOGY ARE
EVER CHANGING
Output: Total number of words starting with ‘A’ = 4 [15]
Question No 7
Write a menu-driven program to print the following patterns as per the user’s choice: [15]
(a) 1 (b) A
21 BB
321 CCC
4321 DDDD
54321 EEEEE
(6)
Question No 8
Write a program to input 10 cities and their corresponding STD codes in two different
one-dimensional arrays. The program should display the names of only those cities which
begin with a vowel along with their corresponding STD codes. [15]
Question No 9
Design a class named CaseConvert with the following specifications: [15]
Data members: String str1, str2 – to store a string and create a new string
Member methods:
(a) A parameterized constructor to initialize the data members.
(b) void convert(): to obtain a new string after converting each uppercase letter of the
original string to lower case and vice versa
(c) void display(): to display the original string and the new string
Write a main() method to create an object of the class and call the above methods.