0% found this document useful (0 votes)
28 views

Computer Science QP

This document contains a 50-mark computer applications exam with 7 multiple choice and short answer questions. It tests concepts like string methods, arrays, binary search, character encoding, and classes. The exam has two sections - section A contains all questions and section B contains 3 out of 4 longer answer questions to attempt.

Uploaded by

pramod yadav
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Computer Science QP

This document contains a 50-mark computer applications exam with 7 multiple choice and short answer questions. It tests concepts like string methods, arrays, binary search, character encoding, and classes. The exam has two sections - section A contains all questions and section B contains 3 out of 4 longer answer questions to attempt.

Uploaded by

pramod yadav
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

COMPUTER APPLICATIONS

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]

(i) Give the output of following code: “ACHIEVEMENT”.replace(‘E’,‘A’);

(a) 8

(b) ACHIEVEMANT

(c) ECHIEVEMENT

(d) ACHIAVAMANT

(ii) State the value of y after the following is executed:

char x='A';

int y=(int) x;

(a) A

(b) 65

(c) x

(d) 120

T22861S2– SPECIMEN 1 of4


(iii) Give the output of the following string methods:

“DEDICATE”.compareTo(“DEVOTE”);

(a) 0

(b) false

(c) 18

(d) -18

(iv) Following is an example of___________.


int x=25;
Integer val=new Integer(x)

(a) Co-ercion

(b) Explicit type casting

(c) Unboxing

(d) Autoboxing

(v) Object is an example of______

(a) Reference type

(b) Non-primitive data type

(c) Composite data type

(d) All of the above

(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

(vii) Give output of following program snippet


int m[]={2,4,6,8}
System.out.println(m[1]+ ‘ ’+ m[2]

(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

(ix) Give the output of the following

code int c= ‘A’+ ‘ ’;

System.out.println((char) (c));

(a) 65

(b) A

(c) a

(d) c

(x) Which element of an array is represented by a[10]

(a) 10th

(b) 11th

(c) 12th

(d) 13th

SECTION B

(Question 2 is compulsory. Apart from question 2


attempt any three questions)

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”.

T22861S2– SPECIMEN 3 of4


Question 3 [10]

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

OUTPUT: d=(68-100)= -32


First character is smaller

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:

 Print the sum of square of all the numbers


 Print all the numbers which are perfect squares.

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/

T22861S2– SPECIMEN 4 of4

You might also like