You are on page 1of 4

LILAVATIBAI PODAR HIGH SCHOOL

PRACTICE PAPER – 2
SUBJECT : COMPUTER APPLICATIONS

Question 1
Choose the correct answers to the questions from the given options.
(i) When object is converted to primitive data type, it is called as _______
(a) Auto boxing
(b) Type casting
(c) Unboxing
(d) Coercion

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


char ch = ‘k’ ;
y = Character.toUpperCase(ch) ;
(a) K
(b) true
(c) false
(d) k

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


“COMPUTER APPLICATIONS”.substring(1,3) ;

(a) COMP
(b) COM
(c) OMP
(d) OM

(iv) Corresponding wrapper class of char data type is _______


(a) Char
(b) Character
(c) Characters
(d) character
(v) A variable that receives a value when the method is called is termed as:
(a) Class variable
(b) Actual parameter
(c) Local variable
(d) Formal parameter
(vi) Identify the correct array initialization statement:
(a) int arr[ ] = [5,6,7,8] ;
(b) int arr[4] = {5,6,7,8} ;
(c) int arr[ ] = (5,6,7,8) ;
(d) int arr[ ] = {5,6,7,8} ;
(vii) A variable that is defined with static prefix is called as:

(a) Instance variable

(b) Class variable

(c) Local variable

(d) Argument variable

(viii) The access specifier which is least restricted is __________

(a) private

(b) public

(c) protected

(d) default

(ix) Give the output of the following code:


String str1 =”78” , str2 = “100” ;
int no1 = Integer.parseInt(str1) ;
long no2 = Long.parseLong(str2) ;
System.out.println(no2 – no1) ;
(a) 22

(b) -22
(c) 100-78
(d) 178
(x) _____ package provides many methods which help to manipulate primitive data type.

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

Question 2
Define a class to store 10 numbers into the array. Search for an element input by the user using binary
search technique, display the element if it is found, otherwise display the message “NO SUCH
ELEMENT”

Question 3
Define a class to declare a character array of size 10, accept the character into the array and perform
the following:
•Count the number of lowercase letters in the array and print.
•Count the number of non – vowel characters in the array and print.

Question 4
Define a class to declare an array of size 50 of double data type, accept the elements into the array
and perform the following:
•Calculate and print the average of all the elements.
•Calculate and print the lowest value of the array.

Question 5
Define a class to accept two strings, convert them into lowercase. Check and print whether the first
character of first string is same as first character of second string or not. Also check and print whether
the last character of first string is same as last character of second string or not.

Question 6
Define a class to accept a string and a character. Calculate and print frequency of given character in
given string.
Question 7
Define a class to accept 10 strings into the array and print the strings which has more than four
characters.

You might also like