Unit-1 Java

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

1) (a) List at least ten major differences between C and Java

(b) Compare in terms of their functions, the following pairs of statements:


i. while and do?.while
ii. while and for

(c) What is an empty statement? Explain its usefulness.

2) Distiguish between the following terms:


(a) Objects and classes
(b) Data abstraction and data encapsulation
(c) Inheritance and polymorphism
(d) Dynamic binding and message passing.

3) (a) Describe the genesis of java. Also write brief overview of java
(b) List and explain the control statements used in java. Also describe the syntax
of the control statements with suitable illustration

4) Write a program that will compute the following series:


(a) 1/1 + 1/2 + 1/3 + ...... + 1/n
(b) 1/1 + 1/2 + 1/22+ ....... + 1/2n.

5) (a) What are conventional styles for class names, method names, constants and
variables?
(b) Can a java run on any machine? What is needed to run java on a computer?
(c) Explain the concept of keywords. List some java keywords.
6) (a) java is freeform language. Comment
(b) Describe in detail the steps involved in implementing a stand-alone program.
c) What are command line arguments? How are they useful?

7) (a) When dealing with very small or very large numbers, what steps would you
take to improve the accuracy of the calculations
(b) What are symbolic constants? How are they useful in developing programs?
(c) Write a program to determine the sum of the following harmonic series for
a given value 1 + 1/2 + 1/3 + ..... + 1/n The value of n should be given
interactively through the keyboard.

8) (a) java is freeform language. Comment


(b) Describe in detail the steps involved in implementing a stand-alone program.
(c) What are command line arguments? How are they useful?

9) (a) What are the drawbacks of structured procedural languages? Explain how
Java solved these problems.
(b) How is portability achieved in Java?
(c) Write any five applications of OOP technology.

10) (a) What is object oriented programming? How is it different from procedure
oriented programming?
(b) What are unique advantages of an object oriented paradigm?

11) Write a program that takes an integer value and returns the number with its digits
reversed.
12) Write a program segment that accomplishes each of the following.
(a) Calculate the integer part of Quotient when integer a is divided by integer b.
(b) Calculate integer remainder when integer a is divided by integer b.
(c) Use the program pieces developed in a) and b) to write a method displayDigit
that receives an integer between 1 and 99999 and prints it as a series of digits,
separated by one space and two successive integers by two spaces. For example,
integers 4562 and 4563 should be printed as 4 5 6 2 5 6 2

You might also like