Computer Science QP
Computer Science QP
Maximum Marks:50
Time allowed: One and a half hours
Answers to this Paper must be written on the paper provided separately.
You will not be allowed to write during the first 10 minutes.
This time is to be spent In reading the question paper.
Question 2 is compulsory
SECTIONA
(Attempt all questions.)
Question1
Choose the correct answers to the questions from the given options.(Do not copy the
question, Write the correct answer only.) [10]
(a) 8
(b) ACHIEVEMANT
(c) ECHIEVEMENT
(d) ACHIAVAMANT
char x='A';
int y=(int) x;
(a) A
(b) 65
(c) x
(d) 120
“DEDICATE”.compareTo(“DEVOTE”);
(a) 0
(b) false
(c) 18
(d) -18
(a) Co-ercion
(c) Unboxing
(d) Autoboxing
(vi) Give the total size occupied by following array; long a[]={23, 6589, 0, 136}
(a) 4 bytes
(b) 8 bytes
(c) 10 bytes
(d) 32 bytes
(a) 10
(b) 42
(c) 4 6
(d) 6
T22861S2– SPECIMEN 2 of4
(viii) Which access modifier gives accessibility in all the classes of same package
(a) private
(b) public
(c) protected
(d) package
System.out.println((char) (c));
(a) 65
(b) A
(c) a
(d) c
(a) 10th
(b) 11th
(c) 12th
(d) 13th
SECTION B
Question 2 [10]
Define a class to declare two arrays to input the name and marks of 20 students in a
sequence of higher marks to lower marks. Search for a given marks in the array using
Binary search technique, and display the corresponding name and marks if it is found,
otherwise display the message “No such mark entry”.
Write a program to input two characters from the keyboard. Find the difference(d) between their
ASCII codes and display the following messages.
If d=0 : both characters are same
If d<0 : first character is smaller
If d>0 : second character is smaller
For example:
INPUT: D
d
Question4 [10]
Define a class to declare an array of size 10 of integer data type, accept the elements
into the array and perform the following:
Question5 [10]
Define a class to accept a sentence and display the new string after reversing the characters of each
word of the sentence.
Example: INPUT: India is Great
OUTPUT: aidnI si taerG.
Question6 [10]
Define a class in Java to accept a word and a sentence and word separately. Find and
print the frequency of the given word in the sentence.
EXAMPLE: INPUT: know God know peace
know
OUTPUT: 2
Question 7 [10]
Define a class to input a word convert it into upper case and print the word in
alphabetical orders of its letters.
INPUT: Computer
OUTPUT: CEMOPRTU/