CA3 OPP Question
CA3 OPP Question
MODULE I:
1. Abstract Datatypes and their specification.
2. How to implement an ADT.
a. Concrete state space.
b. Concrete invariant
c. Abstraction function
d. Implementing operations by the Text example.
Datatypes, ADT, Concrete state space , concrete invariant, method, class, object, types of
variables, JDK|JRE|JVM, bytecode, interpreter, static method, static variable.
…………………………………………………………………………………
Conceptual Questions:
1. What is an Abstract Data Type (ADT)? How is it different from a Data Structure?
2. Explain the importance of encapsulation in ADTs. How does it enhance abstraction?
3. Why is the behavior of an ADT specified without specifying its implementation?
4. What are some advantages of using ADTs in software development?
5. How do ADTs support modularity and reusability in programming?
6. Explain the difference between ADTs and object-oriented programming concepts like
classes.
7. Why are preconditions and postconditions important in the formal specification of
ADTs?
8. Give an example of an ADT and describe its key operations and properties.
9. How can you prove the correctness of an ADT specification?
10. Explain the difference between the axiomatic specification and operational specification
of ADTs.
11. What is concrete state space? Give example.
12. What do you mean by concrete invariant?
13. What are the various datatypes available in java.
14. Define class and object. Give real life example and coding example.
15. Define JDK, JRE and JVM.
16. Define bytecode.
17. “bytecode is magic in java”. Explain and justify.
18. What is interpreter in java.
19. Write short notes on static method and static variable.
20. What is qualified association? Describe with an example.
21. What is an object? Why java is called an object oriented programming language?
22. Write short notes on link and association.
23. Define abstraction.
24. Compare procedural and object oriented programming.
25. Create a package and write a java file with four methods for four basic Arithmetic
operations such as addition, subtraction, multiplication and division. These methods should save
the file in the Package. Write one more program that imports the above file to use these four
methods.
26. Briefly explain the use of “super” and “this” keywords.
27. Differentiate between ‘==’ and ‘equals’ methods in the context of String object.
Practical Questions:
1. Describe the stack ADT and list its fundamental operations.
2. What is the queue ADT, and how does it differ from the stack ADT?
3. Define a list ADT and describe the different types of lists (e.g., singly linked, doubly
linked).
4. How would you formally specify the ADT for a priority queue?
5. What are the basic operations of a tree ADT, and what are some common types of tree
data structures?
6. How would you represent a graph ADT, and what are its key operations?
7. Can an ADT have multiple implementations? Give an example of how a stack ADT could
be implemented using arrays and linked lists.
8. Describe the formal specification of the queue ADT and how its operations are defined.
9. What is meant by the term 'initial state' in the specification of an ADT? Give an example.
10. How would you extend the formal specification of an ADT to handle exceptions or error
states, such as popping from an empty stack?
11. Give example of abstract function and how to implement its operation?
12. WAP in Java to create an object of a class that produces various geometric shapes. Find
the area of various shapes by creating an object and calling the methods required.
Advanced/Theoretical Questions:
1. How do algebraic specifications formalize the behavior of ADTs?
2. Compare and contrast the specification of mutable and immutable ADTs.
3. How can you model complex data structures like graphs using ADTs?
4. What are some of the limitations of using ADTs for large-scale system design?
5. Discuss the role of ADTs in formal verification and testing of software systems.
6. How can you formalize the behavior of ADTs using functional programming paradigms?
7. What challenges arise in specifying concurrent data structures as ADTs?
8. How do generics or parametric polymorphism affect the design and specification of
ADTs?
9. Explain how inheritance and ADTs differ in terms of abstraction and reuse.
10. Describe how ADTs handle recursive data structures such as trees or linked lists.
MODULE II:
1 1. Features of Object Oriented Programming.
a. Encapsulation
b. Object identity
c. Polymorphism
Definition and examples of Encapsulation, Object identity, abstraction , Polymorphism ,
mehod overloading, constructor overloading, this, call by value, call by reference, varargs
method, Arrays, Strings.
1. What is encapsulation in Java, and how does it contribute to data security?
2. How is encapsulation implemented in Java through classes and access modifiers?
3. Can you explain the concept of getter and setter methods in relation to encapsulation?
4. How does encapsulation help in improving code maintainability and reusability?
5. What is object identity in Java, and how does it differ from object equality?
6. How does the hashCode() method relate to object identity in Java?
7. What role does the equals() method play in comparing object identities in Java?
8. What is polymorphism in Java, and how is it achieved through method overloading and method
overriding?
9. Can you explain the difference between compile-time and runtime polymorphism in Java?
10. How does polymorphism improve code flexibility and extensibility in Java applications?
11. What are object oriented Principle in Java?
Encapsulation
1. What is encapsulation, and why is it important in object-oriented programming?
2. How do access modifiers like private, protected, and public facilitate encapsulation in
Java?
3. Provide an example of encapsulation using getter and setter methods.
4. How does encapsulation improve security and modularity in a Java program?
Object Identity
5. What is object identity in Java, and how is it different from object equality?
6. How does Java distinguish between two different objects even if they contain the same
data?
7. Explain the significance of the hashCode() method in relation to object identity.
8. What is the difference between == operator and equals() method when comparing
objects?
Abstraction
9. What is abstraction in Java, and how does it differ from encapsulation?
10. How can you achieve abstraction using abstract classes in Java? Provide an example.
11. What role do interfaces play in achieving abstraction in Java?
12. Why is abstraction important in hiding implementation details from the user?
Polymorphism
13. Define polymorphism in Java, and explain the difference between static and dynamic
polymorphism.
14. What is method overriding, and how does it relate to runtime polymorphism in Java?
15. Provide an example of method overriding that demonstrates polymorphism.
16. How does polymorphism contribute to code flexibility in Java?
Method Overloading
17. What is method overloading in Java, and how does it differ from method overriding?
18. Provide an example of method overloading with different parameter lists.
19. Can overloaded methods have different return types in Java?
20. How does method overloading contribute to code readability and reusability?
Constructor Overloading
21. What is constructor overloading, and why is it useful in Java?
22. Provide an example of constructor overloading in a Java class.
23. How does constructor overloading improve flexibility when creating objects in Java?
this Keyword
24. What is the purpose of the this keyword in Java, and when is it used?
25. How does the this() constructor call work in Java, and how does it simplify code?
Call by Value and Call by Reference
26. What is the difference between call by value and call by reference in Java?
27. How does Java handle method arguments? Is it call by value or call by reference?
28. Provide an example to explain how changes to an argument inside a method affect the
original variable.
Varargs Method
29. What is a varargs method in Java, and how does it differ from passing an array as an
argument?
30. Provide an example of a varargs method and explain how it simplifies method calls.
Arrays
31. How are arrays declared and initialized in Java?
32. What are the advantages and disadvantages of using arrays in Java?
33. How can you iterate over an array using a for-each loop in Java? Provide an example.
Strings
34. What is the difference between String, StringBuilder, and StringBuffer in Java?
35. How does the immutability of strings in Java affect memory usage?
36. Provide an example of concatenating strings using the + operator and StringBuilder class.
37. What are some common string manipulation methods in Java (e.g., substring(), charAt(),
length())?
MODULE III:
1. Inheritance in OO design.
a. Deign Patterns
b. Introduction and classification.
c. The iterator pattern
What are design pattern for applying inheritance in object oriented programming,
Wrapper class, Various classification of Inheritance, method overriding, super, super(),
final,(for iterator pattern:) composition-association-aggregation, is-A, has-A, for loop, for-
each loop,[Collection iterator in Collection topic] , abstract class, abstract method,
interface, dynamic method dispatch, inner class, anonymous class.
Module IV:
1. Model-view-controller pattern.
2. Commands as methods and as objects.
3. Implementing OO language feature.
4. Memory management.
MODULE V:
1. Generic types
2. Collections
3. GUIs. Graphical Programming with Scale and Swing.
Generic types, Collections, GUIs Applet(life cycle and few basic commands), AWT, Swing.
Introduction to Generics
1. What are generics in Java, and why are they used?
2. How do generics enhance type safety in Java?
3. What is the syntax for defining a generic class in Java?
4. Can you explain the difference between a generic class and a generic interface?
5. What is a type parameter in Java generics, and how is it declared?
Generic Methods
6. How do you define a generic method in Java?
7. What is the purpose of the <T> notation in generic methods?
8. Can generic methods have multiple type parameters? Provide an example.
9. How does type inference work with generic methods?
Bounded Type Parameters
10. What are bounded type parameters in Java generics?
11. How do you define a bounded type parameter using the extends keyword?
12. Can you provide an example of a bounded type parameter with multiple bounds?
13. What happens if you try to use a type that does not meet the bounds specified in a
generic type?
Wildcards
14. What are wildcards in Java generics, and when are they used?
15. What is the difference between an unbounded wildcard and a bounded wildcard?
16. How do you declare an unbounded wildcard using the ? symbol?
17. Can you explain the use of the ? extends T and ? super T wildcards?
18. When would you use a ? super T wildcard in a method signature?
Type Erasure
19. What is type erasure in Java generics?
20. How does type erasure affect the use of generics at runtime?
21. What are the implications of type erasure on generic type parameters and casting?
Generic Collections
22. How do generics improve the use of Java Collections Framework (e.g., List, Map)?
23. What is the difference between List<T> and List<Object> in Java?
24. How do you create a generic method that operates on a collection of a specific type?
Common Issues and Best Practices
25. What are some common pitfalls when using generics in Java?
26. How can you prevent type-safety issues when using generics?
27. What are some best practices for naming type parameters in generic classes and
methods?
Advanced Topics
28. Can you use primitive types (e.g., int, char) as type parameters in generics?
29. How can you use generics with inheritance in Java?
30. What are some real-world applications of generics in Java programming?
Collections
Basic Questions:
1. What is the Java Collection Framework?
2. What is the difference between a Collection and a Collections class in Java?
3. What are the main interfaces of the Java Collections Framework?
4. What is the difference between List, Set, and Map in Java?
5. What is the difference between ArrayList and LinkedList?
6. What is the difference between HashSet and TreeSet?
7. What is the difference between HashMap and TreeMap?
8. What is the difference between HashMap and Hashtable?
9. How does the Iterator interface work in Java?
10. What is the difference between Iterator and ListIterator?
11. What is the difference between fail-fast and fail-safe iterators in Java?
12. What is the difference between Collection and Collections framework in Java?
Advanced Questions:
13. How does HashMap work internally?
14. What is hashing in Java?
15. What is the load factor in HashMap?
16. Why is the initial capacity of a HashMap always a power of two?
17. How does ConcurrentHashMap work internally?
18. How are collisions handled in a HashMap?
19. What is the difference between synchronized and concurrent collections in Java?
20. What are the different types of queues available in the Java Collections Framework?
21. What is the difference between ArrayList and Vector?
22. What are weak references and how does WeakHashMap work?
23. What are the thread-safe versions of collections in Java?
24. What is the difference between Comparable and Comparator interfaces?
25. How can you make a Collection read-only?
26. How does the Collections.sort() method work?
27. What is the difference between LinkedHashMap and HashMap?
28. What is the EnumSet and how is it different from a HashSet?