0% found this document useful (0 votes)
28 views1 page

Computer Application Semester 2 Sample Paper 2

The document is a sample paper for a Computer Application course, featuring multiple-choice questions and programming tasks. It includes questions on Java concepts such as access modifiers, string manipulation, inheritance, and arrays. Additionally, it contains programming exercises that require defining classes to manipulate strings and arrays based on user input and specified conditions.

Uploaded by

Rituraj Pradhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views1 page

Computer Application Semester 2 Sample Paper 2

The document is a sample paper for a Computer Application course, featuring multiple-choice questions and programming tasks. It includes questions on Java concepts such as access modifiers, string manipulation, inheritance, and arrays. Additionally, it contains programming exercises that require defining classes to manipulate strings and arrays based on user input and specified conditions.

Uploaded by

Rituraj Pradhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Computer Application

Semester II – Sample Paper II


Question 1
Choose the correct answers to the questions from the given options. (Do not copy the question, Write the
correct answer only.)
(i) Visible in the classes the same package.
(a) private (b) public (c) protected (d) default

(ii) Visible in the classes in the same package and classes in other packages.
(a) private (b) public (c) protected (d) default

(iii) Give the output of the following code:


double A =56.75, B=57.65;
String C= Double.toString(A)+String.valueOf(B);
System.out.println(C.length());
(a) 8 (b) 10 (c) 5 (d) error

(iv) String class is available in __________ package.


(a) java.io (b) java.util (c) java.lang (d) java.awt

(v) A library in Java is a collection of


(a)Classes (b) Functions (c) Methods (d) None of these

(vi) In encapsulation, access control is often referred to as:


(a) Classes storing (b) Library hiding (c) Classes overloading (d) Implementation hiding

(vii) Give the output of the following Java statement: “JAVA”.substring(1).toLowerCase();


(a) java (b) AVA (c) ava (d) Java

(viii) The real advantage of using inheritance is that ……………


(a) We can build on what we already have (b) Reuse what we already have
(c) Both (a) and (b) (d) None of these

(ix) What type of variable is this: arr[i]


(a) index variable (b) array variable (c) subscripted variable (d) local variable

(x) Which of the following term denotes an array of characters in Java?


(a) char ch[] (b) String ch[] (c) String s (d) char ch[10]

Question 2
Define a class to accept a sentence, convert the sentence into lowercase and print the words which start
and end with a character entered by the user.

Question 3
Define a class to store N integer values into an array. Create another array to contain squared values of
the even elements and cubed values of the odd elements of the first array.

Question 4
Define a class to input a string and convert it into uppercase and print the pair of vowels and number of
such pairs in the string.
Example: BEAUTIFUL BESTIES
Output: EA, AU, IE
No of pairs: 3

Question 5
Define a class to input the name and marks in 3 subjects of n number of students in 4 single dimensional
arrays and display the given remark based on the average marks along with the name of the student.
Average marks Remarks
85-100 Excellent
70-84 Very Good
40-69 Good
Below 40 Poor

You might also like