Vous êtes sur la page 1sur 8

1

IMPORTANT VIVA QUESTIONS ON OBJECT ORIENTED PROGRAMMING


1. What is meant by object oriented programming? 2. What are properties of OOPS? 3. What is class? 4. What is object? 5. What is inheritance? 6. What is super class? 7. What is sub class? 8. What are the types if inheritances? 9. What is abstraction? 10. What is encapsulation? 11. What is polymorphism? 12. What is dynamic binding?

IMPORTANT VIVA QUESTIONS ON CORE JAVA

INTRODUCTION TO JAVA
1. 2. 3. 4. 5. 6. 7. 8. Explain about the origin of java programming language Why the name java is given to this particular programming language? Why C and C++ programming languages are called as system dependent? In what way java can be called as system independent? What are the importance features of java? ( java buzzwords) Define byte code Explain about JVM What is the difference between JDK and JVM? ( answer: JDK is java development tool kit which includes execution environment. Where as JVM is java virtual machine which is purely a run-time environment which can run the program but cannot compile it. Source code that is program written by us is compiled by javac i.e., java compiler ) 9. why java doesnt support pointer concept? 10. Why java dosent support multiple inheritance directly? 11. Is java a purely object oriented programming language ? (answer: yes. Because in C++ we can write program without using class and object also. Where as, in java even to write a simple program we need to use classes and object. Thus, C++ supports oops where as java a purely object oriented programming language). 12. Explain naming conventions in java 13. What are the data types available in java and give their ranges? 14. Why character variable occupies 2 bytes of memory in java?

15. List all the operators available in java 16. What is the difference between >> and >>> operators in java? 17. What are various control structures in java and their syntaxes? 18. Write the general structure of a java program 19. How main() method is written in java and explain its syntax ? 20. If String args[] is not written inside main() what will be result? 21. Why main() method in java is declared as public, static and void ? 22. Can char variable be manipulated like integers? Answer: yes char ch = A; System.out.println(ch++); Output : B ( ascii values are taken) 23. Why goto statements are nor available in java?

ARRAYS
1. 2. 3. 4. 5. 6. 7. Define array What is the syntax to declare an array? What are the types of arrays? Explain about arrayname.length Explain about arraycopy method Explain about command line arguments What is jagged array? Answer: jagged array is an array that contains a group of arrays with in it. These are also called as IRREGULAR MULTI-DIMENSIONAL ARRAYS.jagged arrays are useful when we are dealing with arrays of different size. syntax to declare is: int x[][]=new int[2][]; in this declaration x is jagged array of size 2. Memory allocation is done as follows: X[0] = new int[2]; // memory of array-1 X[1]=new int[2];// memory of array-2 8. What are 3D arrays?

STRING HANDLING
1. 2. 3. 4. 5. 6. 7. 8. Define string How to declare and initialize a string in java? Is string a data type or class in java? What are the various string handling methods? What is immutability of strings? What is the difference between string buffer class and string class? What is the difference between string buffer class and string builder class? What is the difference between == and equals() method of string class? Answer: For comparing equality of string ,We Useequals() Method. There are two ways of comparison in java. One is "==" operator and another "equals()" method . "==" compares the reference value of string object whereas , equals() method is present in the java.lang.Object class. This method compares content of the string object. .

CLASSES, OBEJCTS, CONSTRUCTORS, METHODS, KEYWORDS AND VARIABLES IN JAVA


1. How to declare a class and object in java? 2. Difference between a class and an object 3. In how many ways values can be passed to variables in java? Answer: using methods, using objects and using constructors 4. Define constructor and how to declare it? 5. What are the types of constructors? 6. Define copy constructor 7. What are the types of variables and what is the difference between them? 8. What is constructor overloading? 9. What is method overloading? 10. What is the difference between constructors and methods in java? 11. What are static methods? 12. What is static block? 13. Explain about this reference

14. How to relate objects in java? Answer: there are 3 ways to relate objects in java: Using references Using inner class Inheritance 15. What is reference variable? 16. What is inner class? 17. What is the use of super keyword? 18. What is method overriding? 19. What are the types of polymorphism? 20. Explain dynamic method dispatch concept. 21. What is the use of final keyword? 22. Define abstract method 23. Define abstract class 24. Define interface 25. What is the difference between class and interface 26. What are the differences between abstract class and interface 27. Can one interface implement other interface? 28. Can one class implement another class? 29. Can a class implement an interface?

PACKAGES
1. 2. 3. 4. 5. 6. Define package What are the types of packages? What is advantage of package in java? List out various built-in packages in java Which package is imported into java program by default? What is the difference between #include in C and CPP and import statements in java 7. How to declare a user defined package? 8. What is a sub-package and how to declare it? 9. What are access specifiers in java? 10. What is the difference between default and other access specifiers in java? 11. Explain the properties of access specifiers in packages?

EXCEPTION HANDLING
1. Define exception 2. How many types of errors are there in java and what are they? 3. What is the difference between error and exception? 4. Cant we call a compile time error as compile time exception? 5. What are the types of exceptions? 6. Which package contains all exception handling related classes? ( java.lang) 7. Which is the base class of all exceptions? (Throwable) 8. What are the various mechanisms available for handling exceptions in java? 9. What is the difference between throw and throws? 10. Define finally block and its use 11. Explain the process of handling exceptions in java 12. List out some pre-defined exception classes in java 13. What is user defined exception? 14. What happens to exception after handling it ? ( exception object will be garbage collected ) 15. Can a catch block exist without try block? ( no) 16. Can try block exist without catch block? (no) 17. Can a finally block exists with our try and catch blocks? ( yes ) 18. Single try block can have many catch blocks (true) 19. One execution of try block can handle only one exception (true) 20. Exceptions can be re-thrown to the calling method (true)

MULTI-THREADING
1. What is thread? 2. What are types of multi-tasking? 3. What is the difference between multi-tasking and multi-threading? 4. How to create a thread in java? 5. Which package contains thread related classes and interfaces?(java.lang) 6. What is the use of run() method in java? 7. When will run() method is invoked? 8. Explain thread life cycle 9. What is the default thread for a program? (main thread) 10. What is the difference between wait and notify() methods in java? 11. What is thread synchronization ? 12. Explain producer consumer problem 13. What are the various thread priorities? 14. What is thread scheduler?

15. Explain wait, notify() and notifyAll() methods. 16. What is thread dead lock? 17. What is daemon thread? 18. What are the various thread class methods? 19. What is the difference between sleep and wait methods? 20. Define thread group. 21. What are the applications of threads? 22. Explain about isAlive() and join() methods.

STREAMS AND FILES


1. 2. 3. 4. 5. 6. 7. 8. 9. Define stream What are the types of streams? What is difference between byte and character streams? List some of the input and output streams classes in java List some reader and writer classes in java Explain the process of accepting values from keyboard at run time Define serialization Define de-serialization List out some of the file class methods

APPLETS AND AWT


1. 2. 3. 4. 5. 6. Define applet What are types of applets? Where the applet code is executed? Explain various methods applet life cycle Does applet contain main() method? What happens when an applet is loaded? Answer: the following sequence happens when an applet is loaded: Instance (object) for the Applet sub class is created Applet initializes it self Applet starts running

7. Can we connect applets to data base? (no) 8. What is the difference between applet and normal java application? Answer: applets are executed with in web browser and java application will be out of the browser. But both require JVM.

Normal java programs has main() where as applets will have, init(),start(), stop() and destroy() methods. 9. What is the difference between CUI and GUI? 10. What are the advantages of GUI over CUI? 11. What is AWT and why we use AWT? 12. What is a component? 13. What is the difference between window and frame? 14. List some of the component classes in java? 15. What is event delegation model? 16. Define listener interface 17. List some of the listener interfaces and methods in them. 18. What is the component that has to be created irrespective of creation of any other component? (frame) 19. How to create and display frame? 20. How to handle the event generated on the frame? 21. List out various components and listeners that handle event generated on these components? 22. What is layout manager? 23. List various layout managers 24. What is use of paint() method ? 25. When the paint() method will be called while writing programs on components? 26. What is the difference between paint() and repaint() methods? 27. What is the difference between choice class and list class? 28. What is default layout manager for frame?( border layout) 29. What is default layout manager for applet?(flow layout) 30. What is adapter class and list various adapter classes? 31. How to create a radio button? 32. How to specify the size and starting position of the components in a frame? 33. How to set layout for a frame? 34. How to hide the text being typed in a text field or text area by a special character? 35. List some of the component class methods? 36. How to add components into the frame? 37. List out the methods of mouse listener and mouse motion listener interfaces 38. List methods of key listener interfaces

39. What is the use of drawString() method? 40. List out various Graphics class methods and their use

COLLECTIONS
What is wrapper class? Why it is used? List some wrapper classes. What is the use of methods like intValue(), doubleValue() etc.,, ? List some of the methods of various wrapper classes What is collection frame work? What is the difference between normal object and a collection class object? 6. Does collection object store copies of other objects? (not objects, but their references are stored) 7. List out various collection interfaces and their implementation classes 8. What is the difference between set and list interfaces? 9. What are the various ways of retrieving elements from collection objects, name them? 10. Can collection primitive data type values? ( no. Only objects are stored) 11. What is the use of Iterator interface and what methods are involves in it? 12. Explain about list iterator interface 13. What is the difference between iterator and list iterator interfaces? 14. Define enumeration interface 15. What is the difference between hash set, linked hash set and tree set classes? 16. Explain map interface 17. What is the difference between array list and linked list ? Answer: Elements can be added or removed from any location in linked list but it is not possible in array list. 18. What is the difference between array list and vector classes? Answer: array list in not synchronized where as vector class is synchronized. 19. What is the use of comparator interface? 20. What is the use of Date class and list various methods available in it. 21.What is the use of Calendar class and list various methods available in it 1. 2. 3. 4. 5.

Vous aimerez peut-être aussi