Submission Instructions
All questions should be answered
The assignment carries 40 marks
Don’t make a mistake of copying, have original work
Include screenshots of code snippets from your IDEs
Make sure you include your name & reg number
QUESTION 1:
A) Explain what Inheritance is
B) What are the advantages of Inheritance
C) What are the problems of Inheritance
D) Explain with code, why Java doesn't accept multiple inheritance
E) Demonstrate with a practical example how you can implement single level
inheritance
F) Demonstrate with a practical example how you can implement multi level
inheritance
QUESTION 2:
A) Explain what Aggregation in Java is
B) What are the advantages of Aggregation
C) What are the problems of Aggregation
D) Demonstrate with a practical example how you can implement Aggregation in
Java
QUESTION 3:
A) What are inner classes in Java
B) Demonstrate with a practical example how you can implement inner classes in
Java
QUESTION 4:
A) What is encapsulation in Java?
B) Demonstrate with a practical example how you can implement encapsulation in
Java
QUESTION 5:
A) Java supports method overloading, explain what it means
B) Explain the advantages of method overloading
C) Demonstrate with a practical example how you can implement method
overloading in Java
QUESTION 6:
A) Java supports method overriding, explain what it means
B) Explain the advantages of method overriding
C) Demonstrate with a practical example how you can implement method overriding
in Java
QUESTION 7:
A) Explain what polymorphism is in Java
B) Demonstrate with a practical example how you can implement runtime
polymorphism in Java
QUESTION 8:
A) Explain what you understand by the term "Abstraction in Java"
B) Demonstrate with a practical example how you can implement Abstraction in Java
with abstract classes
C) Demonstrate with a practical example how you can implement Abstraction in Java
with interfaces
D) Demonstrate with a practical example how you can implement inheritance within
interfaces
QUESTION 9:
A) Explain what a package is in Java
B) Why do we need packages in Java
C) Demonstrate with a practical example how you can implement packages in Java
QUESTION 10:
A) Explain what constructors in Java are
B) Demonstrate with a practical example how you can implement constructors in Java
QUESTION 11:
A) Java supports arrays, explain what an array is.
B) Explain the advantages of using arrays in Java
C) Demonstrate with a practical example how you can implement 1 Dimensional
arrays in Java
D) Demonstrate with a practical example how you can implement 2 Dimensional
arrays in Java
E) Demonstrate with a practical example how you can implement 3 Dimensional
arrays in Java
F) Demonstrate with a practical example how you can implement Jagged arrays in
Java
QUESTION 12:
A) Explain what static, local and instance variables are in Java
B) Demonstrate with a practical example how you can use static, local and instance
variables in Java
QUESTION 13:
A) What are methods in Java
B) Demonstrate with a practical example how you can use methods in Java
QUESTION 14:
A) Demonstrate with a practical example how you can use the util package in Java
B) Demonstrate with a practical example how you can use the math package in Java
QUESTION 15:
A) Java supports conditional statements for java application execution redirection,
explain the different conditional statements
supported by Java
B) Demonstrate with a practical example how you can use if statements in Java
C) Demonstrate with a practical example how you can use if-else statements in Java
D) Demonstrate with a practical example how you can use switch statements in Java
E) Demonstrate with a practical example how you can use break statements in Java
F) Demonstrate with a practical example how you can use continue statements in
Java
QUESTION 16:
A) Explain what a loop is in Java
B) Demonstrate with a practical example how you can use for loops in Java
C) Demonstrate with a practical example how you can use for each loops in Java
D) Demonstrate with a practical example how you can use while loops in Java
E) Demonstrate with a practical example how you can use do while loops in Java