Computer Preboard
Computer Preboard
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 (40 Marks)
(Attempt all questions from this Section.)
Question 1 [20]
Choose the correct answers to the questions from given options.
(Do not copy the questions, write the correct answers only.)
Question 5 [15]
Define a class to accept values in 4x4 array to store the characters. Perform the following:
i. Display the array elements in matrix form.
ii. Find the sum of the ASCII values of the array elements that are in upper case
iii. Find and display the frequency of digits in the array
iv. Form a new array by replacing uppercase characters with its equivalent lowercase
characters and vice versa. Display the newly formed array.
[Note: Write as a single program]
Question 6 [15]
Write a java program to input a number and print whether the number is a special number
or not. A number is said to be special if the sum of the factorial of the digits of the number
is the same as the original number.
Input: 145
Output:1! + 4! + 5! = 1+24+120= 145, so 145 is a special number.
Question 7 [15]
Write a java program to accept two arrays of size 10 from user, where array1 is of type
string and array2 is of type double. Write a method to combine these two arrays and print in
the following format. Assume necessary data and datatypes for it.
array1[]={“Aman”, “Saya”, “Jiya”,…..}
array2[]={78.0,87.0,89.45,…}
resultarray[]={“Aman:78.0”, “Saya:87.0”, “ Jiya:89.45”, …}
Question 8 [15]
Define a class to overload a method “pattern” as follows:
void pattern (): To print the following format using nested loop
7
76
765
7654
76543
void pattern (int n): To accept a 3-digit number and print square of its digits with original
digits and multiplication of all its digits.
Example: n=123
Output: 1: Square is:1
2: Square is:4
3: Square is: 9
Multiplication of digits: 6