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

Computer Application Semester 2 Sample Paper 3

The document is a sample paper for a Computer Application course, containing multiple-choice questions and programming tasks related to Java. It includes questions on Java packages, class variables, access specifiers, string manipulation, and array operations. Additionally, it provides programming exercises for defining classes to handle integer arrays, count consonants in a sentence, check for unique letters in a string, and manipulate array elements.

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)
97 views

Computer Application Semester 2 Sample Paper 3

The document is a sample paper for a Computer Application course, containing multiple-choice questions and programming tasks related to Java. It includes questions on Java packages, class variables, access specifiers, string manipulation, and array operations. Additionally, it provides programming exercises for defining classes to handle integer arrays, count consonants in a sentence, check for unique letters in a string, and manipulate array elements.

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 III


Question 1
Choose the correct answers to the questions from the given options. (Do not copy the question, Write the
correct answer only.)
(i) Which of the following in not a Java package?
(a) java.awt (b) java.math (c) java.io (d) java.lang
(ii) Which keyword is used to declare a class variable?
(a) static (b) final (c) public (d) default
(iii) The ____________ access specifier used in a class cannot be accessed by subclass.
(a) private (b) public (c) protected (d) default
(iv) Find the odd one out
(a) toString() (b) valueOf() (c) parseInt() (d) toUpperCase()
(v) What is the index of the element 55 in the array {10, 50, 55, 26, 45, 75}?
(a) 0 (b) 1 (c) 2 (d) 3
(vi) What is the value returned by the given statement: “MONITOR”.indexOf(“O”);
(a) 5 (b) 6 (c) 1 (d) 2
(vii) String []names = {“Raman”, “Amir”, “Kapil” , “Raghav”};
System.out.print(names[2].length());
System.out.print(names[0].charAt(0));
(a) 4R (b) 5R (c) 4A (d) 5A
(viii) char ch='Z';
Integer A=new Integer(ch);
System.out.println(A);
(a) Z (b) 90 (c) 122 (d) error
(ix) Write a statement to find the position of a character ch in the string str, starting from the p th index.
(a) str.indexOf(p,ch) (b) indexOf(str,ch,p) (c) str.indexOf(ch,p) (d) str.indexof(ch,p)
(x) Which is the correct meaning of the expression: str1.compareTo(str2) > 0
(a) str1 is longer than str2 (b) str1 is bigger than str2
(c) str1 is smaller then str2 (d) str2 is longer then str1

Question 2
Define a class to store N integer values into an array. Create another array to contain the corresponding
ASCII characters of all the elements of the first array. Also print the characters which are alphabets of the
English letters,

Question 3
Define a class to input a sentence and print the number of consonants found in the longest word of the
sentence.
Example: Health is the most important thing in life.
Output: 6

Question 4
Define a class to input a string and check if the string has unique letters.

Question 5
Define a class to store N integers into an array, find the largest and shift it to the end of the array.
Example: 15, 16, 12, 10, 14, 18, 17, 11, 13
Output: 15, 16, 12, 10, 14, 17, 11, 13, 18

You might also like