Channabasaveshwara Institute of Technology
(Affiliated to VTU, Belgaum & Approved by AICTE, New Delhi)
(ISO 9001:2015 Certified Institution)
NH 206 (B.H. Road), Gubbi, Tumkur – 572 216. Karnataka
Department of Information Science & Engineering
Question Bank
Module 1
1. Explain Encapsulation, inheritance, abstraction and polymorphism
2. Differentiate two paradigms of programming.
3. Explain the differences between POP and OOP?
4. Explain while and do-while with example
5. Explain different lexical issues in Java (identifiers, keywords, literals, separators,
comments, whitespace).
6. Discuss the different data types supported by Java along with the default values
and literals.
7. What is automatic type promotion? Give example with arithmetic expressions.
8. Explain casting in Java (implicit and explicit). Why is explicit casting needed?
9. Explain the various Jump statements used in Java with examples.
10. List and explain control statements in Java with programming example.
11. Write a Java program to declare and print a two-dimensional integer array (3×4).
12. What is var (local variable type inference) in Java? When can it be used and when
not?
13. Write a Java program that takes n from command line arguments, creates an
integer array of size n, reads values from standard input, and prints the sum.
14. Convert the following code using var (where possible):
int[] arr = {1, 2, 3};
for (inti = 0; i<[Link]; i++) {
[Link](arr[i]);
}
15. Develop a Java program to convert Celsius temperature to Fahrenheit.
16. List the various operators supported by Java. Illustrate their working with an
example.
17. Explain the arithmetic compound assignment operator and ternary operators in
Java.
18. Explain various scope and lifetime in java.
19. Explain the syntax of declaration of 2D arrays in Java and Develop a Java
program to add two matrices using command line arguments.
20. Examine Java garbage collection mechanism
Module 2
1. Draw the general form of a Java class (fields, constructors, methods). Explain
each part with example.
2. What is a constructor? How does it differ from a regular method?
3. Explain the constructor method and parameterized constructors with an example
4. Explain method overloading. Write a Calculator class that overloads add for (i)
two ints, (ii) two doubles, (iii) three ints.
5. What are static fields and static methods? Give an example class using static
member to count object instances.
6. Explain method overloading in Java with examples.
7. Write a java program to illustrate:
i) Passing object as parameters.
ii) Returning objects.
8. Can methods be overloaded by return type alone? Explain with justification.
9. Explain the role of “Static” and “this” keyword in Java.
10. Write a Java program that reads basic salary for n employees, stores them in
objects, and prints the salaries (using class with read and write methods).
11. Develop a Java program to find area of rectangle, area of circle, and area of
triangle using method overloading. Call these from main.
12. With a code snippet, explain different access specifiers in Java.
Module 3
1. What is inheritance and Explain different types of inheritance in Java
2. What is the super keyword? Show usage example program (accessing
superclass fields, calling superclass constructor).
3. Build a Java program to create a class named ‘Shape’. Create 3 subclasses
namely circle, triangle and square: each class has 2 methods named draw() and
erase(). Demonstrate polymorphism concepts by developing suitable methods
and main program.
4. Explain the order of constructor execution in a multilevel class hierarchy.
5. Explain method overriding for any class and any method as an example.
6. Define dynamic method dispatch and write a code snippet in java to demonstrate.