19348CompXSet1 (1) - Decrypted
19348CompXSet1 (1) - Decrypted
com/
(c) Explain the concept of try-catch-finally with a suitable example. What is the use of ‘finally’
keyword in respect of that
(d) State and explain the multiple branch selection statement provided by Java.
(e) Given numbers 23, 45, -33, 533, 100. Illustrate a binary search to locate the number 500.
www.icseguess.com
Other Educational Portals
www.cbseguess.com | www.ignouguess.com | www.aipmtguess.com | www.aieee.com |
www.niosguess.com | www.iitguess.com
http://www.icseguess.com/
Question 2
(a) What is a package? Name any 2 packages of java those are yet not used by you. (2 marks)
(b) What is the value of the following expressions( or ERROR)? (1 mark each)
i) “DISARIHALDIA”.substring(4).indexOf(‘A’);
ii) “ Correct”.charAt(1).compareTo(“Option”.charAt(0));
(c) Unlike other languages, why does Java need a compiler as well as an interpreter? (2
marks)
(ab)3
(e) Write a statement in Java for 4
(2 marks)
ab
(c) If a =12, b =11 and a+= a++ – (--a * --b). Find the values of a and b.
(f) Given String str = “60”; write the statement to convert it to an integer data type.
(h) Name the method used to print random numbers between 0 and 1.
(j) How many iterations are involved while bubble sorting an array of 5 integers?
Question 4
Write a program to accept any string and sort the words in ascending order. [15]
Input :- Annual Cultural Program in Disari
Output :- Annual Cultural Disari in Program
Question 5
Input a number from keyboard and check whether it is DISARIUM or not. A number will be
called DISARIUM if sum of its digits powered with their respective position is equal with the
number itself. [15]
Sample Input: 135
Output : It is a DISARIUM
(Workings 11+32+52 = 135, some other DISARIUM are 89, 175, 518 etc)
www.icseguess.com
Other Educational Portals
www.cbseguess.com | www.ignouguess.com | www.aipmtguess.com | www.aieee.com |
www.niosguess.com | www.iitguess.com
http://www.icseguess.com/
Question 6
WAP to input an array that contains positive, negetive and zero. Swap the positive element at
the beginning of the array followed by negetive without changing their sequence
Question 7
Input a number and find nearest prime number of the same. [15]
Sample Input: 25
Sample Output: Nearest Prime number is 23
Question 8
Input a sentence (sen), a word to search (srchwrd) and another word to replace (repwrd). Find
the occurrence of search keyword within the given string, finally display the sentence after
replacing with the replace keyword. Also display its occurrences in number. [15]
Sample Input: Disari Public College is located in Haldia. It is co-ed residential cum day boarding
College.
Search Keyword: College
Replace Keyword: School
Sample Output : Disari Public School is located in Haldia. It is co-ed residential cum day
boarding School.
Question 9
Input a sentence and print the same after converting every alternate character to uppercase and immediate next
character in lowercase [15]
www.icseguess.com
Other Educational Portals
www.cbseguess.com | www.ignouguess.com | www.aipmtguess.com | www.aieee.com |
www.niosguess.com | www.iitguess.com
http://www.icseguess.com/
Email susmitamarch24@gmail.com
www.icseguess.com
Other Educational Portals
www.cbseguess.com | www.ignouguess.com | www.aipmtguess.com | www.aieee.com |
www.niosguess.com | www.iitguess.com