Java – Question Bank

‘Java’ Question Bank Ver. 2012
Written and Compiled by Neel

SEQUENTIAL STRUCTURE PROGRAMS

1. WAP to store / Initialize 2 integer type variables and display them.
2. WAP to store your name in a variable and display.
3. WAP to input Name, Age and Date of Birth and Display using Input Method (Streams and Buffers)
4. WAP to initialize / input two numbers and display their sum.
5. WAP to find the sum, product, difference & quotient of two numbers (initialize / input)
6. WAP to input / Initialize 2 nos. and store their sum in ‘s’ and product in ‘p’ and display both of them.
7. WAP to Store the value of side of a square and display the Area & Perimeter of the Square.
8. WAP to store / input the length and breadth of a Rectangle, calculate and print the area and Perimeter of Rectangle
9. WAP to store / input the radius of a Circle, and calculate the Area and Circumference using the formula Area =π.R2 and Circumference = 2 π.R
10. WAP to input the marks obtained by a student in English, Hindi, Maths, Science, History, Geography, Computers and EVS and calculate the Total and Aggregate marks obtained by a student in the 8 subjects.
11. WAP to input the values of resistances R1 and R2 and find out the total equivalent resistance in a circuit in which the 2 resistors are connected in series
(Series = R1 + R2) and when they are connected in parallel,
(Parallel = (R1*R2) / (R1+R2))
12. WAP to input the two angles of a triangle and find the 3rd angle
13. WAP to find out the value of distance (s) covered by a body, where s = ut + ½ at2 , value of u, a and t are provided by the user.
14. WAP to input the distance in meter and convert it into to centimeters.
15. WAP to input the time in hours and convert it into minutes and seconds.
16. WAP to input the time in seconds and split it into hours, minutes and seconds.
17. WAP to find out the distance covered by light in One Year (Speed light = 3 x 108 m/s)
18. WAP to input the distance covered by a body along with time and calculate the Speed
19. WAP to input the speed in km/hr and convert it into m/s.
20. WAP to input distance in km and convert it into yards (1 yard = 0.9144 m) and vice versa.
21. WAP to input the temperature in Centigrade and convert it into to Fahrenheit and vice versa,
Formula : C/5 = (F – 32) /9
22. If ‘m’ and ‘v’ denote the mass and velocity of any moving object WAP to input the values of ‘m’ and ‘v’ and find out the Kinetic Energy of a body which is given by the formula (KE = ½ mv2)
23. WAP to find out the Potential Energy given by the formula (PE= m*g*h) where the values of m, g and h are entered by the user.
24. WAP to input the Base and Height of a Right angled Triangle and calculate the Area using the formula
Area = ½ Base X Height
25. WAP to the convert the amount entered by the user in denominations of Rs. 1000, Rs. 500, Rs. 100, Rs. 50, Rs. 20, Rs. 10, Rs. 5, Rs. 2 and Re.1 notes (Note : denominations should be least possible numbers)
26. Write a program to find all the remainders when a number ‘n is divided by any number from 1 to 9
27. Write a program that takes the three ‘sides’ of a cube as input and displays the TSA and Volume of the same.
(Hint TSA = 6 * side * side) (Vol. = side * side * side)
28. WAP to swap the values stored in two variables (using a third variable) Display the values of the two variables before and after swapping.
29. WAP to swap the values stored in two variables (Without using a third variable) Display the values of the two variables before and after swapping.
30. Write a program to input the price of 1 pen and 1 eraser and calculate the total cost of 15 pens and 17 erasers.
31. WAP to input the Basic Salary of an employee and Calculate his Gross and Net Salary based on the information given below
D.A. (Dearness Allowance) = 75% of Basic Salary
H.R.A. (House Rent Allowance)= 25% of Basic Salary
P.F. (Provident Fund) = 12% of (Basic + D.A.)
Gross Salary = Basic + D.A + H.R.A
Net Salary = Gross Salary – P.F.
32. WAP to input the Principal, Rate and Time and calculate the Simple Interest and Amount
33. WAP to input the Principal, Rate per-annum and Time along with the compounding frequency in a year and calculate the Compound Interest and Amount.
34. Dish TV allows a discount of 30% on a monthly recharge of a channel pack. For the same channel pack Tata Sky offers two successive discounts of 20% and 10%. WAP to input the recharge amount and display which company is providing a cheaper deal.

SELECTION STRUCTURE PROGRAMS

35. WAP to input two numbers and print the greater.
36. WAP to input two numbers and print the smaller.
37. WAP to input two numbers and print the square of the smaller and cube of the greater.
38. WAP to find out the smallest of 3 nos. entered by the user.
39. WAP to find out the largest of 3 nos. entered by the user.
40. WAP to input 3 numbers and display the second largest number.
41. WAP to input three nos. and print the 1st largest, 2nd largest and the 3rd largest of them do not use arrays / loops or any sorting techniques.
42. Input age of a person and check if he is eligible to vote or not
43. Input age of a person determine for how many years he has been voting or how many years after will he be eligible to vote.
44. Input the age of a person and check if he is a Senior Citizen or not.
45. Input the age of a person and check if he is a teenager or not.
46. Input the sales and find out if he is eligible to get a commission, The salesman is entitled to a commission of 5% if sales is greater than Rs.50,000
47. WAP to input a number and display its Square if it is Even and Cube if the number is Odd.
48. WAP to input marks obtained by a student in 10 subjects and display whether Pass Certificate is awarded or Pass Certificate is NOT awarded.
49. Input the Radius of a circle and check if it is less than zero if YES display ERROR message or else in case of Radius greater than zero print the Area and the Circumference of the circle (Area =  * r * r) &
Circum. = (2 *  * r)
50. WAP to input the marks in 7 subjects and find out the Total, Percentage and Grade based on the structure given below,
Below 50% – Grade C
50% to 75% – Grade B
76% to 90% – Grade A
above 90% – Distinction

51. WAP to input a character and check whether it is an alphabet, number or special character.
52. WAP to input a character and check that whether it is a vowel or consonant.
53. WAP to input a number and check whether it a single, double, triple or ‘n’ digit number.
54. Input any number and check if it is odd or even.
55. Input any number and check if it is divisible by 5 or not.
56. Input any number and check if it is Odd and divisible by 9.
57. Input a number and check whether it is divisible by 7 and not by 3.
58. Input any year and check if it a leap year or not.
59. WAP to input the cost price and selling price of an article and find out Profit % or Loss %.
60. Input the 3 sides of a triangle and check if it is Isosceles, Scalene or Equilateral
61. WAP to input the 3 angles of a triangle and display whether it is an Acute, Obtuse or Right Angled Triangle.
62. WAP to enter the co-efficient of Quadratic Equation ax2+bx+c=0 and find out whether the roots are Real, Equal or Imaginary using the discriminant of the equation
X = ( – b + √(b2 – 4ac) ) / 2a
63. Write a program to enter the marks obtained by a student in 13 subjects, find out the total and average and allot a distinction Grade according to the following –
10000 30%
> 5000 & 2500 & <=5000 15%
<2500 10%

69. JSEB charges their consumer according to the tariff chart given below,
Units Consumed Charges
Up to 50 units Free
51 – 100 0.75p / unit
101 – 250 1.25p / unit
252 – 500 2.50p / unit
Above 500 3.00p / unit

WAP in java to input the units consumed and display the electricity bill calculated as per following. A fixed rental of Rs. 150.00 is charged to all the consumers.
70. A cab driver charges Rs. 15.00 on the first meter (km). He charges an extra of Rs. 22.00 on the next 5 kms. Anything beyond that is charged at Rs. 2.50 per km. WAP to input the distance covered and calculate the cab charges.
71. WAP to enter number from 1 to 7 and display the corresponding day of the week using switch…case
1 – Monday,
2 – Tuesday,

7 – Sunday

72. WAP to enter number from 1 to 7 and display the corresponding day of the week using if …else.
73. WAP to enter number from 1 to 12 and display the corresponding month of the year using switch…case.
1 – January
2 – February
3 – March

12 – December

74. Write a menu driven program to input/assign/store 2 numbers and perform the following mathematical operations on the two variables as given below in the menu…
1. Addition (+)
2. Subtraction (-)
3. Multiplication (x)
4. Division (/)
5. Modulus (%)

75. Write a menu driven program to calculate the area of
a. Circle (Π.r2)
b. Square (side * side)
c. Rectangle (l * b)

76. Write a menu driven program to calculate the volume of
a. Sphere (4/3.Π.r3)
b. Cube (side * side * side)
c. Cuboid (l * b * h)

77. WAP to input the time and using a menu driven program convert it into
a. Hours
b. Minutes and
c. Seconds
78. Using a menu driven program give a choice to the users to convert the time from
a. Fahrenheit to Celsius
b. Celsius to Fahrenheit
79. WAP to input the monthly salary of a person and calculate his Annual Income Tax based on the table given below – Annual Salary Income Tax
Less than equal to Rs. 1,80,000 Nil
Greater than Rs. Rs. 1,80,000 to Rs. 3,00,000 Rs. 5000 + 13% of the amount exceeding Rs. 1,80,000
Greater than Rs. Rs. 3,00,000 Rs. 15,000 + 33% of the amount exceeding Rs. 3,00,000

80. WAP to input a number and determine whether it is a Buzz number or not. A Buzz number is one which either ends with 7 or is divisible by 7. E.g. 70, 17, 21 etc…
81. WAP to input a number and check whether it is a Perfect square or not.
82. WAP to input a double digited number and display the sum and product of its digits, e.g. if the number entered by the user is 23 then the output is Sum = 5, Prod = 6
83. WAP to input a Triple digit number and display whether the middle digit is Odd or Even also display its square and cube.
84. WAP to input a double digit number and reverse it (without using any loops) e.g. if input is 23 output is 32

LOOPING STRUCTURE PROGRAMS

85. WAP to Display the first 10 Natural numbers
86. WAP to Display the first ten Whole numbers in reverse order.
87. WAP to Print the natural numbers between x and y limits where ‘x’ and ‘y’ are entered by the user.
88. WAP to Print all the Even numbers between x and y limits
89. Print all the Odd numbers between x and y limits
90. Print all the Series of Prime numbers between x and y limits
91. Input any number and check if it is Prime or not.
92. Generate all the Multiples of 5 till n
93. Generate all the multiples of 5 between x and y limits
94. Generate the table of 8…
8 x 1 = 8
8 x 2 = 16
8 x 3 = 24 till 10…

95. Sum of ‘n’ Natural numbers
96. Sum of ‘n’ Odd Numbers
97. Sum of ‘n’ Even Numbers
98. Sum of Natural Numbers between x and y limits
99. Sum of Odd Numbers between x and y limits
100. Sum of Even Numbers between x and y limits
101. Sum of Prime Numbers between x and y limits
102. Input a number and print its Factors
103. Input a number and count its factors.
104. Input a number and print its Odd/Even Factors
105. Input any 2 numbers and check if it is Twin Prime or not. (Hint: 3 & 5, 5 & 7 etc…)
106. Input 2 nos. and check whether they make up Brun’s Constant or not, Brun’s Constant is sum of
reciprocal of Twin Prime Nos. e.g (1/3) + (1/5) is a Brun’s Constant
107. Input any number and print its Factorial. (Hint: 5! = 5 x 4 x 3 x 2 x 1)
108. Input a number and count the number of digits.
109. Input any number and print the sum/prod. of its digits.
110. WAP to input a number and extracts the digits from reverse.
111. WAP to reverse and store a number in a different variable.
112. WAP to input 10 positive numbers and display the maximum and minimum amongst them.
113. Input ten numbers and count the number of positive nos., negative nos. and zeros
114. WAP to input a number and print the sum of all the digits that are even. E.g. 456, output is 10
115. WAP to input a number and print the sum of all the digits that are at even locations. E.g. 4567, output is 12.
116. WAP to input a number and display the sum of odd digits and even digits separately. E.g. 4567, output is Sum of Odds = 12 and Sum of Evens are 10.
117. Input a number and display all the prime digits and their sum. E.g. 347, output 3, 7 and sum = 10
118. 21, 19, 17 … series of odd in reverse order.
119. 50, 48, 46 … series of even in reverse order
120. 1, 4, 9, … series of squares
121. 1, 2, 4, 8, 16 … series of Decimal Equivalent Binary (Hint: 20, 21, 22 … etc)
122. S = 1 + 4 + 9 … sum of series of squares
123. S = 1 + 3 + 5 … sum of series of odd
124. S = 2 + 4 + 6 … sum of series of even
125. 1, 8, 27, … series of cubes
126. 1, 10, 2, 9, 3, 8, 4, … , 10, 1
127. 0, 3, 8, 15 … (one less than squares)
128. 2, 9, 28, … (one more than cubes)
129. 0, 1, 1, 2, 3, 5, 8, … Fibonacci Series (Hint: Every third element is a sum of 1st & 2nd)
130. 0, 7, 26, … one less than series of cubes
131. 1, 3, 6, 10 … differences increases by one.
132. 6, 2, 8, 4, 0, 6 … till 10 terms (last digit of multiples of 6)
133. 1, 10, 100, … till 10 terms
134. 1, 11, 111, 1111, … till 10 terms
135. 5, 55, 555 … till 10 terms
136. 1, 12, 123 … till 10 terms.
137. 1, 21, 321 … till 10 terms.
138. S = 1 + 1/2 + 1/3 + 1/4 + … till 10 terms.
139. S = 1 – 2 + 3 – 4 + 5 … till 10 terms.
140. S = 1 + 1/4 + 1/9 + … till 10 terms
141. S = 1 + 1/3 + 1/5 + … till 10 terms
142. S = y + y/8 + y/27 + … till ‘n’ terms
143. Sum of Products (SOP) S = 1 + (1×2) + (1x2x3) + … + (10 terms)
144. Product of Sums (POS) P = 1 * (1+2) * (1+2+3) * … * (n terms)
145. Sum of Sums (SOS) = 1 + (1+2) + (1+2+3) + (1+2+3+4) … till 10 terms.
146. Product of Products (POP) = 1 * (1*2) * (1*2*3) * (1*2*3*4) … till 10 terms.
147. 1 + 1/(1+2) + 1/(1+2+3) … (n terms)
148. (1)/(1) + (1+2)/(1*2) + (1+2+3)/(1*2*3) + … till ‘n’ terms
149. S = 1 + a2/1! + a3/2! + a4/3! … n terms
150. S = 1 + a2/2! + a4/4! + a6/6! … n terms
151. 1 – a2/3! + a4/5! – a6/7! … n terms
152. WAP to input a number and print the digits in ascending order. E.g. if the input is 5723 the output is 2357
153. Input any number and check if it is a Special (Krishnamurthy) number or not. (Hint: 145 = 1! + 4! + 5!)
154. Input any number and check if it is an Armstrong (Narcissistic) number or not. (Hint: 153 = 13 + 53 + 33)
155. Input any number and check if it is a Perfect number or not. (Hint: 6 = 1 + 2 + 3, sum of factors excluding itself)
156. Input any number and check if it is a Palindrome or not. (Hint: 121 = 121)
157. WAP to input two numbers and print the HCF (GCD) and LCM of the two numbers.
158. Convert a number from Decimal to Binary and vice versa.
159. Convert a number from Decimal to Octal and vice versa.
160. Convert a number from Decimal to Hexadecimal and vice versa.
161. WAP to input a number and count the number of Zeros
162. WAP to check whether a number entered by the user is a Automorphic number. E.g. 25 is an Automorphic number because 252 = 625 in which the number of digits in the original number (i.e. 25) before squaring is identical to that many number of digits from the LHS of the squared number (i.e. 625).
163. WAP to check whether a number entered by the user is an Evil number or not. An Evil number is one whose Binary counterpart has even number of ones. E.g. 10, as the binary of 10 is 1010 which has even number of ones.
164. WAP to check whether a number entered by the user is an Odious number or not. An Odious number is one whose Binary counterpart has odd number of ones. E.g. 7, as the binary of 7 is 111 which has odd number of ones.
165. WAP to generate the Tribonacci Series. E.g. 0, 1, 1, 2, 4, 7, 13… A Tribonacci series is one whose every 4th term is the sum of 1st, 2nd and 3rd terms.
166. WAP to check whether the number entered by the user is a Sunny number or not. A Sunny number is one which becomes a Perfect Square after adding one to it. E.g. 8, as 8+1=9 which is a perfect square.
167. WAP to check whether two numbers entered by the user belong to the set of Amicable Pair or not. Two numbers are said to be Amicable Pair if the sum of factors of the 1st excluding the number is equal to the 2nd number and the sum of factors of the 2nd number excluding itself is equal to the 1st E.g. 220 and 284
168. A Buzz number is one which is either divisible by 7 or has 7 as the last digit. E.g. 27 or 49.
169. Display all the Prime numbers between 1 and 100

170. WAP to input a number and print all the possible combination of consecutive natural nos. that adds up to the given number. E.g. Input is 15 then output is
1, 2, 3, 4, 5
4, 5, 6
7, 8
171. WAP to display the Triangular nos. till n. A Triangular number is formed by addition of consecutive integers starting from 1, e.g.
1+2=3
1+2+3=6
1+2+3+4=10, … Hence the triangular nos. are 3, 6, 10 …
172. WAP to input a number and display the Prime factors of the number e.g if the no. entered by the user is 24 the output is 2,2,2,3
173. WAP to input a no and check whether it is a Smith no. or not, A Smith Number is a composite no. whose sum of digits is equal to the sum of the digits of it’s prime factors obtained as a result of prime factorization.
(Excluding 1) e.g. 666, coz sum of digits is 6+6+6=18, prime factors of 666 = 2, 3, 3, 37 so 2+3+3+(3+7)=18
174. WAP to input a number and print its Primorial. A Primorial number also known as p-prime number (denoted by Pn# which is a product of all the prime numbers up to ‘n’ i.e. P5# = 2 x 3 x 5 = 30
(There is a conflicting definition which says that P5# is the product of first 5 prime numbers i.e. 2 x 3 x 5 x 7 x 11 = 2310, but the most prevailing definition says the former)
175. WAP to input a number and check whether it is a Mersene number or not. A Mersene number has all ones in its Binary counterpart, it can also be defined as n2 – 1 for e.g. Binary of 7 = (111)2 which is also equal to 23 – 1
Binary of 15 = (1111)2 which is also equal to 24 – 1
176. WAP to input a number and check whether it is a Kaprekar’s number or not. Consider an n – digit number K, Square it and add the right ‘n’ number of digits to the left n – 1 digits. If the resultant sum is K, then K is called a Kaprekar’s number. For example, 297 is a Kaprekar’s number as 2972 = 88209 and 297 has 3 digits hence extracting 3 digits from RHS and adding it to the rest of the digits, i.e. 209 + 88 = 297.

ARRAY STRUCTURE PROGRAMS (SINGLE DIMENSION)

177. WAP to store 10 numbers in an array and print the sum of all the ten nos.
178. WAP to input 5 real nos. in an array and display them as integers.
179. WAP to input 10 numbers in an array and display the element whose position is entered by the user.
180. WAP to input 10 numbers in an array and display in reverse order without using a second array.
181. WAP to input 10 numbers in an array and store the elements in reverse order in another array, Display both the arrays.
182. WAP to input 10 numbers in an array and store the elements in reverse order in the same array, Do not use any separate array. After reversing the array display the elements of this array.
183. WAP to input 10 numbers in an array and store the elements in reverse order in the same array, Do not use any separate array. After reversing the array display the elements of this array. Also do NOT use any separate (temporary) variable for swapping.
184. WAP to input ‘n’ numbers in an integer type array, where n is entered by the user and display the first and the last element.
185. WAP to input temperature for 7 days in an array and display the average temperature of the week.
186. WAP to accept 10 nos. integer type numbers in an array and print the largest and smallest number present within the array along with their positions. (Consider the ZEROth subscript as position ONE)
187. WAP to accept 10 numbers in an integer type array. Enter a search element and check how many times it occurs within the array. If the element is not found display “NOT FOUND”. Use Linear Search technique.
188. WAP to input 10 nos. in an array and search a given number from within that array and print all its positions of occurrence using Linear Search Technique. If not found display proper message.
189. WAP to enter 10 numbers in an integer type array and search a given number from within that array using Binary Search technique.
190. WAP to accept 10 integer type numbers in an array and sort the array in ascending order using Bubble Sort Technique. Display the elements of the array before and after sorting.
191. WAP to accept 10 integer type numbers in an array and sort the array in descending order using Bubble Sort Technique. Display the elements of the array before and after sorting. Also display the largest and the smallest element.
192. WAP to accept ‘n’ integer type numbers in an array and sort the array in ascending order using Exchange selection Sort Technique. Display the elements of the array before and after sorting.
193. WAP to accept ‘n’ integer type numbers in an array and sort the array in descending order using Exchange selection Sort Technique. Display the elements of the array before and after sorting. Also display the square and cube of the largest and the smallest element.
194. WAP to input 5 nos. in array A[ ] and 5 nos. in array B[ ] and merge them end to end into a third array C [ ] of size 10 and Display all the three arrays.
195. WAP to input 15 nos. in array A[ ] and 10 nos. in array B[ ] and merge the two dissimilar sized array end to end into a third array C [ ] of size 25 and Display all the three arrays.
196. WAP to input 5 nos. in array A[ ] and 5 nos. in array B[ ] and merge the elements of the array alternately into a third array C [ ] of size 10 and Display all the three arrays.
So if A[ ] = {10, 20, 30, 40, 50} and B[ ] = {11, 22, 33, 44, 55} then
Resulting array C[ ] = {10, 11, 20, 22, 30, 33, 40, 44, 50, 55}
197. WAP to input 10 nos. in array A[ ] and square of its corresponding elements in array B[ ]. Display both the arrays.
198. WAP to accept 10 integers in an array and display how many are positive integers, how many are negative and how many are zeros.
199. WAP to accept ‘n’ integers in an array and display the sum of all the odd and even separately.
200. WAP to accept ‘n’ integers in an array and display the sum of all the negatives and positives separately.
201. WAP to input 10 nos. in array A[ ] extract all the positive numbers and store them in an array P[ ] and negative numbers in array N[ ]. Display all the three arrays.
202. WAP to input 10 nos. in array A[ ] extract all the odd numbers and store them in an array ODD[ ] and even numbers in array EVEN[ ]. Display all the three arrays.
203. WAP to accept 15 integers in an array and display all the perfect numbers within the array. A perfect number is one whose sum of digits (excluding itself) is equal to the number, e.g. 6 as the factors of 6 (excluding 6) are 1, 2, and 3 so their sum, 1+2+3 = 6
204. WAP to create an array of user defined size and initialize by taking input from the user and check whether consecutive elements are twin prime or not, display those that are twin primes.
E.g. if the array A[ ] = {6, 3, 5, 16, 17, 19, 8, 9, 11, 13} then output is Twin Prime Pairs are
3, 5
17, 19
11, 13
205. WAP to accept 10 numbers in an array and display the no. of Palindrome numbers present within the array. Palindrome numbers are those that read the same from both the directions. E.g. 121, 777 etc…
206. WAP to accept 10 numbers in an integer type array and store the Armstrong numbers in another array and sort the second array in descending order using any of the sorting techniques.
207. Create an array of user defined size and initialize by taking input from the user and replace the prime nos. with the nearest prime number greater than the prime no. present within the array in another array.
N = 3
E.g. A [ ] = {45, 11, 17} then the resulting array is B [ ] = {45, 13, 19}
208. WAP to create an integer type array of size 10 and sort the first 5 elements of the array in descending order and remaining 5 elements in ascending order and display the array before and after sorting.
209. WAP to create an integer type array of size 10 and find out the element of highest density, i.e. the element within the array that occurs the maximum number of times.
E.g. A [ ] = {15, 89, 45, 85, 63, 15, 89, 15, 25, 12} then output is 15
210. WAP to create an integer type array of size 5 and fill it up with only double digit numbers, reverse the numbers and store it in another array of same size and display the second array. Make sure that the program accepts only double digit numbers and discards anything else entered by the user.
E.g. A [ ] = {25, 96, 78, 66, 70} then the resulting array B [ ] = = {52, 69, 87, 66, 7}
211. WAP to create a String type array of size 10 and display the longest word out of the 10 words stored in the array.
212. WAP to create a String type array of size 10 and form a word by concatenating the first letter of each word of the array.
213. WAP to create a String type array of size 5 and store the names of the members of Linkin Park and sort the array in lexicographic order using Bubble Sort Technique and display the elements of the sorted array.
E.g. STR [ ] = { “Delson”, “Hahn”, “Shinoda”, “Bourdon”, “Farrell”}
Then output is – Bourdon, Delson, Farrell, Hahn, Shinoda
214. WAP to create a String type array of size 10 and reverse each word within the array element and display the elements of the modified array.
215. WAP to store names of 10 employees in a String type array and their corresponding mobile numbers in another array. The program then displays a menu
a. Search Mobile Number
b. Search Employee Name
As per user choice the program asks for either the name of the employee and displays the mobile number or mobile phone number and displays the corresponding name of the employee. If not found then displays RECORD NOT FOUND.
216. WAP to accept 10 Strings in a String type array and display only those array elements that are Palindrome words.
217. WAP to create two arrays of size 20 each and store 20 country names along with their capital cities. Followed by which when user enters the name of the country the program displays the name of the capital if found otherwise displays “DATA NOT FOUND”
218. WAP to store names of 5 cities in a String type array and display only the ones that starts with a consonant and ends with a vowel. E.g. STR [ ] = {“Agra”, “Bhopal”, “Patna”, “Jamshedpur”, “Kolkata”} then the output is
Patna
Kolkata
219. WAP to create a string type array of size 10 and sort the elements of the array in increasing order of its length from shortest name to longest one.
220. Lucky Numbers are those that are generated by a sieving process similar to that of Sieve or Eratosthenes, consider a list of natural numbers that starts with 1
1, 2, 3, 4, 5, 6, 7, 8, 9, 10 now removing every second element we get
1, 3, 5, 7, 9 now removing every third we get
1, 3, 7, 9 now removing every fourth we get
1, 3, 7 we can no longer remove the fifth so the survivors are 1, 3 and 7 which are Lucky numbers from 1 to 10.
WAP to implement the same using arrays and display the Lucky numbers from 1 to 10

Comments
  1. xhhxhx says:

    Awesome you rock !!

  2. sharique says:

    it is a amazing site… thank u

  3. Shimone Liu says:

    i don’t know how much time it took 2 type these programs………..but they r really good….!!!!

  4. Swaraj says:

    Your knowledge of JAVA is too good. This can be seen in the questions in the Question Bank. Thank you Sir for providing such good questions.

  5. Naveen Shaji says:

    Awesome…..Thanks.

  6. Yash Vishal says:

    really helpful sir…………..

  7. shradha(9A) says:

    thnx sir for d question bank

  8. too good questions and vry helpful before d xams

  9. nishant(9b) says:

    sir………really helpful

  10. melissa says:

    Thanks 4 question bank

  11. srijit jeno toppo(IX B) says:

    these programs are a kind of addiction for me

  12. Aman says:

    Cannot do program no 31 but ques bank is awesome

  13. deepa says:

    Hi Neel,
    Ur knowledge in Java is gr8.
    All stuff if so helpful…

  14. prathyusha says:

    Really helpful for practice work

  15. prathyusha says:

    Really helpful for practice work .
    Interesting questions pattern.
    Helpful for class ten students.

  16. rekha joshi says:

    Really to good…..

  17. Cr7 says:

    Fantastic questions for 10th boards practice!!!!

  18. Vivan says:

    Really amazing questions for practice

  19. Lucky says:

    Fantastic!!

  20. Sahil Agarwal says:

    Fantastic questions….and very very helpful for exams
    very interesting series and patterns..

Leave a reply to sharique Cancel reply