Computer Science
Computer Science
com/
Q2.
(a) Java is both a programming language and a platform. Comment.
(b) what is polymorphism? How does function overloading implement polymorphism?
(c) a _________ constructor create objects through values passed to it.
(d) where can the following members of a class be accessed: private, public protected?
(e) what is an Exception?
[ 2+2+1+3+2 = 10 ]
Q 3.
(a) what is a compound statement? Support with an example.
(b) State one similarity and one difference between while and do while loop.
(c) What is the significance of default clause in a switch statement?
(d) What is the function of operators? What are binary operators?
(e) What is meant by ‘floating constant’ in java?
[ 2+2+2+2+2 = 10 ]
Q4.
(a) enter any 2 variables through constructor parameters and write a program to swap and print the
values.
(b) What is ‘call by value’ and ‘call by reference’?
(c) Differentiate between if and switch statements.
-------------------------------------------------------------------------------------------------------
www.icbseguess.com
Other Educational Portals
www.cbseguess.com | www.ignouguess.com | www.dulife.com | www.magicsense.com
http://www.icseguess.com/
Attempt any four questions from this section. Write all the programs in Java BlueJ environment and
clearly explain the steps using the mnemonics and comments wherever required.
1. Write a program to initialize an array of 5 names and initialize another array with their respective
phone numbers. Search for a name input by the user, in the list. If found, display “Search
Successful” and print the name along with the phone number, otherwise display “Name not
enlisted. Try other names”. [ 15 ]
3. Write a Write an application that estimates the value of the mathematical constant e by using the
formula: e = 1 + 1/1! + 1/2! + 1/3! + …..
4. Create and populate one-dimensional integer array where duplicacy of elements is allowed.
Using any searching algorithm you like, locate the search key (i.e. the element to be searched) a
well as its number of occurrence in the array taking the search key as an input from the user. [15 ]
5. Write a program to generate all Armstrong numbers between 100 and 500. An Armstrong number is
one which is equal to the cubes of each of its digits. E.g. 153 = 13 + 53 + 33. [ 15 ]
-------------------------------------------------------------------------------------------------------
www.icbseguess.com
Other Educational Portals
www.cbseguess.com | www.ignouguess.com | www.dulife.com | www.magicsense.com