CS2311-Object Oriented Programming

advertisement
VALLIAMMAI ENGINEERING COLLEGE
SRM NAGAR, KATTANKULATHUR- 603 203
CS2311 OBJECT ORIENTED PROGRAMMING
V SEM EIE 1 & 2
QUESTION BANK
PART-A
UNIT I
1. What are the programming paradigms currently available?
2. What is object oriented paradigm?
3. What are the differences between structures and classes in C++?
4. Differentiate Object Oriented and Object Based Programming Languages.
5. What is Object Oriented Programming? How is it different from the Procedure
Oriented Programming?
6. List any tow drawbacks of procedure oriented languages.
7. What is meant by prototype based programming?
8. What is a Class? What is an Object? Give an example for each
9. Define encapsulation.
10. Compare inheritance and delegation with respect to Object Oriented
Programming.
11. Which feature of object oriented programming provides (a) data hiding
(b) reusability?
12. Define (a) Object
(b) class
13. What is the use of scope resolution operator :: in C++?
14. Can you have a class named main in C++? If yes how do you call its constructor?
15. What is an abstract class?
16. What is Object Orients Programming? List any four OOP languages.
17. What is meant by function overloading?
18. What are conditional constructor and destructor?
19. What is nameless object?
20. State the meaning of public access specifier?
21. How does an Inline function differ from a preprocessor macro?
22. How do we declare a member of a class “Static”?
23. What do you mean by Data Abstraction
24. Can a Constructor be Private? Why?
25. List the specialties of static variable.
26. Write a sample program for copy constructor.
27. What is the need of Abstract class?
28. What are the reasons for having concrete types when we can have abstract types?
29. How does constructor differ from normal functions?
30. What is the default access mode for class members?
31. Name the mechanism that binds together code and the data it manipulates.
32. What are the tow parts of a class specification?
33. What is an operator function? Describe the syntax of an operator function.
34. What are the properties of an Abstract Data Type?
35. Is class an ADT? Justify.
36. What are the three access specifiers used in C++? What type of access do they
provide?
37. What is a default constructor? When is it used?
38. List out any two salient differences between C++ and JAVA.
39. Define this pointer
40. What is unique about this pointer?
41. What is enum data type?
42. When a function will be made inline? How?
43. How does one invoke a constructor function?
44. List any four Object Oriented Programming concepts?
45. What is a copy constructor?
46. What do you mean by binding ogf data and functions?
47. What are the differences between a copy constructor and assignment operator?
Give example?
48. How and why is the scope resolution operator used (::) used in the class
definitions? How it can be used for global variable?
49. What does * this refers to?
50. How a class declared?
51. Name the input and output statements in C++
52. What are the two types of the members of the class and how are they declared?
53. What is meant by binding?
54. Can array become private member of the class? How?
55. What is meant by anonymous Union?
56. What is Static data member?
57. What is Polymorphism?
58. During what instances a copy constructor is called?
59. What are the various access levels supported by C++ classed?
60. Name atleast two OOPs languages other than C++.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
PART B –
UNIT I
Describe the basic concepts of Object Oriented Programming and bring out the
advantages of OOP.
Explain the declaration and defining a class in C++. How will you define the member
functions of a class? Explain.
What is the need for parameterized constructors? Explain the function of constructors
with their declaration and definition inside a class.
Illustrate the reserved word inline with two examples.
Explain the constructors and destructors.
explain the relation between (i)structured Programming(POP) and (ii)OOPs
Differentiate Object Oriented and Object based Languages.(8)
Explain copy constructor? Explain with a suitable example.
Differentiate Object Oriented and Object based Languages. Give examples for both. List
any 8 features of Oops. (Detailed explanation or examples are not required).
Explain the following terms with respect to OOPS .Give suitable examples
(i) Dynamic Binding
(ii) Message Passing
(iii) Reusability
(iv) Polymorphism
UNIT II
PART-A
1. Define interfaces in java .How interfaces are implemented? How they can be accessed?
How to apply interfaces? What is meant by extension of interfaces? Explain with an
example.
2. What are threads? Synchronization? Explain the life cycle of thread with example
3. Explain life cycle of applet with example
4. Explain in detail exception handling in java
5. Explain in detail about JAVA I/O operations
6. Explain Inheritance in JAVA
7. Develop a real-life application program to illustrate the use of multithreads.
8. Explain with an example how multiple inheritances is achieved in Java.
9. How is synchronization of threads performed?
10. An educational institution wishes to maintain its employee’s database which is divided
into a number of classes with minimum information as shown in figure. Specify all the
classes and define methods to create the database and retrieve individual information as
when required.
11. Explain the life cycle of an applet and write a simple applet to display a moving banner.
12. What is the purpose of garbage collection in Java, and when is it used?
13. Give the importance of operator overloading.
14. Differentiate overloaded and overridden functions.
15. What is the main purpose of a template in C++? Give an example.
16. Write a program to exchange values of two variables. Use template variables as
function arguments.
17. What is hierarchical inheritance?
18. What are the operators of C++ that cannot be overloaded?
19. Can friendship between classes be symmetric or transitive? Justify your answer
with an example.
20. What is the use of virtual function?
21. What are the types of inheritance?
22. List out any 4 operator that can not be overloaded.
23. List out any 2 differences between virtual and pure virtual function.
24. What is the use of templates
25. What is a friend function? What are its advantages and limitations?
26. What is an abstract base class? Give an example.
27. What are the operators that cannot be overloaded and what are the operators that
cannot be overloaded using friend functions?
28. Differentiate class template and template class.
29. What effect does inheritance have on the working of constructors and destructors?
30. What are templates?
31. What are the visibility modes in inheritance?
32. Write the prototype for a typical pure virtual function?
33. What is the difference between “Overloading” and “Overriding”?
34. Why should the stream operators <<and>> be Overloaded as friend function>
35. What is a pure virtual function?
36. What is the difference between a function template and template function?
37. What is the difference between an Abstract class and Interface?
38. What are the virtual functions? How do they differ from non-virtual member
functions?
39. Name the various types of multiple inheritance?
40. Is template a basic feature of C++? Justify your answer.
41. What is the role of templates?
42. What is protected visibility?
UNIT II PART-B
1. What is operator overloading? How will you define it? Illustrate unary operator
overloading with an example.
2. Describe the syntax of multiple inheritance. When do we use such an inheritance?
Explain with an example.
3. Define friend class and specify its importance. Explain with suitable example.
4. Explain the operators used for dynamic memory allocation with examples.
5. Define functional overloading with example.
6. Explain in detail the various types of Inheritance with example programs
7. Explain virtual function in C++. Describe any two applications in which virtual functions
may use. For each of these applications, specify the parent classes and derived classes.
8. What are inline functions? What are their advantages? Give an example .What is the rules
to be followed while defining inline functions?
9. What is the need for and advantages of Templates? What is the difference between
function template and class template?
10. What are the various type conversions? Explain each with a program
UNIT III PART-A
1.
2.
3.
4.
5.
6.
7.
Draw console stream class hierarchy.
Describe how exceptions are handled.
What are file pointers?
Give any two examples of exceptions.
What are the predefined C++ stream objects?
What stream class is required to create an output stream?
Why is it not possible to refer an exception declared within try block outside try
block?
8. Explain the various file stream classes needed for file manipulation.
9. What are file pointers? Describe get-pointers and put-pointers.
10. What is an I/O stream?
11. Why is it necessary to include the file iostream in all our programs?
12. Name the two ways in which a file can be opened.
13. Illustrate the exception handling mechanism
14. What are the file stream classes used for creating input and output files?
15. List out any four containers supported by Standard Template Library?
16. What is Seekg() and Seekp()?Give Example ?
17. What is rethrowing an expression?
18. What are the classes in iostream.h header files?
19. What is an exception? Give any four examples of exception.
20. What are the types of exceptions?
UNIT III PART-B
1. What is meant by exceptions? How an exception is handled in C++? Bring out the
advantages of using various exception handling mechanisms.
2. Explain the hierarchy of Stream classes in C++
3. Give the hierarchy of console stream classes
4. Explain in detail about STRINGS in C++, with necessary examples
5. Explain in detail the various File handling Operations
6. What are the keywords used in C++ for exception handling? Describe their usage with
suitable example.
7. What are file modes? Describe various file mode options available in C++.
8. Explain the use of keywords try, catch and throw in handling exceptions in a program.
Indicate how the control flows in case of occurrence and non-occurrence of exceptions.
Write a program to implement a stack with appropriate exception handling.
9. Explain the 4 functions Seekg, Seekp, tellg, tellp used for setting pointers during file
operation and show how they are derived from f stream class.
10. Write a program to append to the contents of a file.
11. Explain how exception handling is achieved in C++. Give 5 different constructs and
explain the working of them.
UNIT IV PART-A
1. What is a token? List the various types of tokens supported by Java.
2. How do we add a class to a package?
3. In Java, can a class be defined inside a method? If so what rule governs access to
the variables of the enclosing method? If not, give reasons.
4. How does Java achieve platform independence?
5. Distinguish between method overriding and method overloading in Java.
6. Justify the statement “ Java is platform independent”
7. Define Java Virtual Machine.
8. What is a package?
9. What is the type of class for which objects cannot be created?
10. What type of inheritance is supported in Java?
11. What is java Virtual machine?
12. What is default for methods in Java?
13. What is the need for java virtual machine?
14. What is wait(), notify(), notifyall()?
15. What method can be used for changing case of characters?
16. How can overriding be prevented?
17. What are the two ways of using Super Keyword?
18. What are the ways of calling a method in Java?
19. What is abstract class in Java?
20. Give the paint method of an applet which draws a blue circle.
UNIT IV PART-B
1. How is object class created in java environment ?Discuss on objects in java
2. Explain in detail about JAVA VIRTUAL MACHINE
3. Briefly explain about JAVA Byte-code
4. What is the purpose of using packages? How to create user-defined package? Give an
example.
5. Explain in detail about java documentation.
6. Explain about arrays(matrix multiplication) and strings in java
7. What is meant by Overloading objects? How are related classes used in java?
8. Differentiate abstract classes and interfaces
9. Describe the structure of a typical Java program.
10. How can a subclass call a method or a constructor defined in a super class? Illustrate with
an example program.
11. Explain with example passing objects as parameters to methods and returning objects
from methods in Java.
12. Explain method Overriding and Dynamic method dispatch.
UNIT V
PART-A
1. What are the similarities between interfaces and classes in Java?
2. How do we set priorities for threads?
3. What happens if an exception handler is not defined when exception is thrown?
4. Explain the life cycle of thread.
5. Compare interface and abstract class.
6. What is the major difference between interfaces and a class?
7. What are the two methods by which we may stop threads?
8. What is an exception? Give any four examples of exception.
9. List any four advantages of inheritance. What type of inheritance is not supported
by Java
10. What is multithreading?
11. What is an exception?
12. What is an interface? Write an interface to define the few constants, in Java.
13. What is final and finally?
14. Does Java support multiple inheritance? Justify your answer.
15. What is the difference between an abstract class and an interface in Java?
UNIT V PART-B
1. Define interfaces in java .How interfaces are implemented? How they can be accessed?
How to apply interfaces? What is meant by extension of interfaces? Explain with an
example.
2. What are threads? Synchronization? Explain the life cycle of thread with example
3. Explain life cycle of applet with example
4. Explain in detail exception handling in java
5. Explain in detail about JAVA I/O operations
6. Explain Inheritance in JAVA
7. Develop a real-life application program to illustrate the use of multithreads.
8. Explain with an example how multiple inheritances is achieved in Java.
9. How is synchronization of threads performed?
10. An educational institution wishes to maintain its employee’s database which is divided
into a number of classes with minimum information as shown in figure. Specify all the
classes and define methods to create the database and retrieve individual information as
when required.
11. Explain the life cycle of an applet and write a simple applet to display a moving banner.
12. What is the purpose of garbage collection in Java, and when is it used?
Download