Dayananda Sagar Academy of Technology and Management Department of Computer Science Question Bank
Dayananda Sagar Academy of Technology and Management Department of Computer Science Question Bank
Dayananda Sagar Academy of Technology and Management Department of Computer Science Question Bank
MODULE - 2
Class and Objects: objects and arrays, Namespaces, Nested classes, Constructors,
Destructors. CO1
Introduction to Java: Java’s magic: the Byte code; Java Development Kit (JDK); the
8 Hours
Java Buzzwords, Object-oriented programming; Simple Java programs. Data types,
variables and arrays, Operators, Control Statements.
Text book 1: Ch2: 2.4 to 2.6 Ch 4: 4.1 to 4.2
Text book 2: Ch:1 Ch: 2 Ch:3 Ch:4 Ch:5
MODULE - 3
Classes, Inheritance, Exceptions: Classes: Classes fundamentals; Declaring objects;
Constructors, this keyword, garbage collection. Inheritance: inheritance basics, using
8 Hours
super, creating multi level hierarchy, method overriding. Exception handling: Exception CO1,
handling in Java. CO2
Text book 2: Ch:6 Ch: 8 Ch:10
MODULE - 4
Packages and Interface: Packages, Access Protection, Importing Packages, Interfaces.
Multi Threaded Programming : Multi Threaded Programming, What are threads? How to
make the classes threadable ; Extending threads; Implementing runnable; 8 Hours
Synchronization; Changing state of the thread; Bounded buffer problems, readwrite CO2
problem, producer consumer problems.
Graduate Attributes
• Programming Knowledge
• Design/Development of Solutions
• Conduct Investigations of Complex Problems
• Life-Long Learning
Text Books:
1. Sourav Sahay, Object Oriented Programming with C++ ,2nd Ed Oxford University Press,2006
2. Herbert Schildt, Java The Complete Reference, 7th Edition, Tata McGraw Hill, 2007.
Reference Book:
1. Mahesh Bhave and Sunil Patekar, "Programming with Java", First Edition, Pearson Education,2008,
ISBN:9788131720806
2. Herbert Schildt, The Complete Reference C++, 4th Edition, Tata McGraw Hill, 2003.
3. Stanley B.Lippmann, Josee Lajore, C++ Primer, 4th Edition, Pearson Education, 2005.
4. Rajkumar Buyya,S Thamarasi selvi, xingchen chu, Object oriented Programming with java, Tata
McGraw Hill education private limited.
5. Richard A Johnson, Introduction to Java Programming and OOAD, CENGAGE Learning.
6. E Balagurusamy, Programming with Java A primer, Tata McGraw Hill companies.
Module 2
1. How ‘compile once and run anywhere’ is implemented in Java, explain.(4M) June 2014, Jan 2013, Jan
2012, (4M) July 2017
2. Define Byte code, How does it help java program (s) achieve portability. (5M) June 2015. July2019
3. Write a java program to sum only the first five elements of the array {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, Using
for-each version of the for loop. (5M) June 2015
4. List and explain the Java buzzwords. (6M) Dec 2015, June 2014, July 2013, Jan 2017, (08M) July
2017 July2019
5. Explain : i) >>> ii) short circuit logical operators iii) for each. (6M) Dec 2015, June 2014, Jan 2017.
6. Describe the process of building and running Java program. (4M) June 2014, Jan 2014, July 2012, Dec
2011.
7. How arrays are defined in java (Explain arrays in java)? with examples. (6M) Jan 2015, July 2013,
Jan 2013, Jan 2017.
8. Defrentiate the usage of acess specifier in java and there scope. (5M) Dec 2015, Jan 2015, Jan 2017.
9. Explain how java is robust and Architecture neutral. (8M) Jan 2014, (5M) June 2015.
10. Write a note on Java Environment. (6M) Jan 2014.
11. Write and demonstrate the java program to initialize and display different types of integers and
floating point variables. (5M) Jan 2015.
12. Define typecasting, explain with example. (5M) Jan 2015.
13. What is jump statement? (4M) July 2013.
14. Discuss break and continue. (5M) Jan 2013.
15. Explain about JDK. (7M) July 2012, Jan 2012.
16. Explain the following: i) JVM ii) Type casting. (8M) Dec 2011.
17. Discuss three OOP principles. (6M) Jan 2014, Jan 2012.
18. class Example {
public static void main (String s[]) {
int a;
for(a=0;a<3;a++){
int b=-1;
b=50;
system.out.println(“ “+b);
What is the output of the above code? If you insert another ‘int b’ outside the for loop, what is the
output? (5M) June 2011.
19. With example, explain the working of >> and >>>. (6M) June 2011.
20. What is the default package and default class in Java? (2M) June 2011.
21. Write a program to calculate the average among the elements {4, 5, 7, 8}, using for each in Java. How
for each is different from for loop? (7M) June 2011.
22. Explain the process of compiling and running a java application, with the help of “Hello World”
program. (08M) Jan 2017
23. Explain the syntax of for-each loop. Write a JAVA program to search a key element by using a for-each
loop. (08M) Jan 2017
24. Correct the errors from the following code and explain. (02M) July 2016
byte b =50;
b = b * 2;
25. Write the output of the following code. (02M) July 2016
byte b;
int i = 257;
double d = 323.142;
b = (byte)i;
System.out.println(b);
b = (byte)d;
System.out.println(b);
26. b. Write a program to calculate the average among the elements {8, 6,2, 7} using for each in java. How
for each is different from for loop? (06M) July 2017 July2019
c. Explain type conversion, with an example (06M) July 2017
27. Explain the concepts of arrays and types of arrays in java with examples. Also write a program that
creates and initializes a four integer elements array. Find the sum and average of its values. (08M) July
2017 July2019
28. a. Explain how java is robust and interactive. (05M) Jan 2018
b. Write java program to sum only first five elements of the array using for each looping. (05M) Jan
2018
c. Explain the operation of the following operators with example.
i. % ii >>> iii && (06M) Jan 2018
Dept Of CSE 2019-2020 5
Object Oriented Concepts – 18CS45 Question Bank
29. a. Write java program to initialize and display different types of integers and floating point variables.
(06M) Jan 2018
b. What is type casting? Illustrate with an example. What is meant by automatic type promotion? (06M)
Jan 2018
c. How to declare two dimensional arrays in java? Explain with simple example. (04M) Jan 2018
30. List the different types of operators. Explain any three. (08M)July2019
31. Explain switch case with an example. (06M) July2019
Module 3
1. Describe the significance of final and super, with examples. (6M) June 2014.
2. Explain, with an example each, the effect of keyword “final” with i) a class ii) methods of a class. (5M)
June 2015.
3. What is an exception? Explain the different exception handling mechanisms, with an example. (8M) Dec
2015, June 2014, July 2012, Dec 2011.
4. Why overrien methods are used in java? Example. (8M) July 2013
5. What are command line arguments? WAP to demonstrate. (6M) July 2013
6. What is meant by instance variable hiding? How to overcome it? (4M) Dec 2015, Jan 2013
7. Explain constructor method.how it differs from other member function. (5M) July 2012
8. Write a java program to perform the addition of two complex number by using the method add() by
passing the object as a parameter and display results using method display(). Initialize the real and
imaginary values of the complex number using parameter constructor. (8M) Jan 2015.
9. Write a syntax of try and catch block to handle multiple exception, explain. (4M) Jan 2015.
10. Write short notes on: i) Final class ii) Abstract class. (8M) Dec 2011
11. Difference between method overloading & overriding. (6M) Jan 2014, Jan 2012
12. WAP for stack implementation. (8M) Jan 2014, Jan 2012
13. With example, give two uses of super. (6M) Jan 2014, June 2011
14. Write a program which contains one method which will throw IllegalAccessExeption and use proper
exception handlers so that exception should be printed. (4M) June 2011.
15. What are command line arguments? Write a Java program to read a number as command line arguments
and check whether it is prime or not (04M) Jan 2017
16. What is an exception? Explain the usage of throw keyword with an example. (06 M) Jan2017
17. Distinguish between method overloading and method overriding. (04 M) Jan 2017
18. Create a class figure in JAVA, with the following members dim1, dim2 and abstract method area.
Create subclasses Triangle, Rectangle with implementation of area. (07 M) July 2016
19. Explain dynamic method dispatch with example program (06M) July 2016
20. a. Briefly explain the role of interfaces while implementing multiple inheritance in Java (06M)
July2017
b. Compare and contrast method overloading and method overriding with suitable examples. (06M)
July2017, (05M) Jan2018
c. When constructors are called in the class hierarchy? (04M) July 2017
21. a. With examples, give two uses of super. (05M) July 2017 July2019
Module 4
1. What is synchronization? Explain with an example, how synchronization is implemented in Java. (6-
10M) Jan 2014, June 2014, Jan 2013, Jan 2012, June 2011.
2. Why is the “main” thread important? Write a java program that creates multiple child threads and also
ensures that the main thread is the last to stop. (10M) June 2015
3. What is the need for synchronization? How can synchronization be achieved in java? (5M) June 2015,
Jan 2017.
4. What is synchronization? What is producer – consumer problem? Explain the solution for producer –
consumer problem with a program. (10M) Dec 2015, Jan 2015, June 2014, Dec 2011.
5. What is meant by multithreaded programming? Explain with an example inter-thread communication.
(10M) July 2013, Jan 2013, Dec 2011.
6. What is meant by thread priority? How to assign and get the priority. (6M) Jan 2015, July 2013.
7. Explain action event class & adjustment event class. (4M) Jan 2013.
8. Short notes on static, Final, Abstract, Native. (10M) July 2012
9. What is a package? What are steps involved. (10M) July 2012
10. What is a thread ? explain 2 ways of creating thread. (10M) Dec 2015, Jan 2014, Jan 2012, Jan 2017,
July 2016, (05M) Jan 2018 July2019
11. With syntax, explain use of isAlive() and join() methods. (4M) June 2011, (06M) July 2017 July2019
12. Enlist the different methods in WindowListener. What is the use of WindowAdaptor? (3M) June 2011.
13. Write a java program to create two threads, one displays “computer science” and another displays
“information science” five times. (08M) July 2016
14. Write a java program to find a factorial of N numbers recursively. (04M) July 2016
15. a. How synchronization can be achieved for threads in Java? Explain with syntax (06M) July 2017
b. Explain the adapter class with an example. (04M) July 2017
16. a. What are the differences between suspending and stopping the threads (05M) July 2017
17. a. What is synchronization? When do we use it? (05M) Jan 2018
18. Explain the role of synchronization with producer and consumer problem. (08M) Jan 2018
Module 5
1. Explain the mechanism of event delegation model. Give an example for using keyboard event and
mouse event. Dec 2015, Jan 2015, Dec 2011.
2. Write short notes on Event Listener interface and explain any 2 interfaces with syntax (08M)
July2019
3. Discuss delegation event model with suitable examples. (06M) July 2017, (08M) Jan 2018
4. Explain inner class with example (05M) July 2017 July2019
5. Explain keyEvents and mouseEvent class. (06M) Jan 2018 July2019
6. Explain any two event listener interfaces with its function or methods. (5M) Jan 2015, Jan 2015.
7. What is delegation event model? Describe the significance of adapter class, with an example. (6M) June
2014, July 2013, Jan 2017.
8. Write a swing applet program to demonstrate withtwo Jbuttons named India and Srilanka. When either
of buttons pressed, it should display respective label with its icon. Refer the image icons "India.gif"and
"Srilanka.gif". Set the initial label is "press the button". (10M) Jan 2015.
9. Explain the JScrollPane with example. (5M) Jan 2015.
10. Explain the IComboBox with example. (5M) Jan 2015.
11. What is swing? List the main swing features. Explain the different types of panes of swing containers.
(6M) Jan 2014, June 2014, July 2013, Jan 2013, July 2012, July 2016.
12. Create a swing application having two buttons named alpha and beta. When either of the buttons
pressed, it should display “alpha pressed” and “beta pressed” respectively. (6M) Dec 2015, June 2014.
13. List the different types of swing buttons. Write a program to create four types of buttons on JApplet. Use
suitable events to show actions on the buttons and use JLabel to display the action invoked. (8M) June
2014, Jan 2012, Jan 2017.
14. Write the steps to create Jtable. WAP to create a table with the column headings Name, USN, age,
address & insert records and display. (10M) July 2013, Jan 2017,(05M) July 2017
15. Difference between swings and AWT. (5M) Jan 2013.
16. What is a swing? Explain the components and containers in the swings. (10M) Dec 2011, July 2016.
17. How AWT is different from Swings? What are the two key features of it? Explain. (8)June 2015, June
2011.
18. List 4 types of buttons in swings with their use and syntax. Dec 2015, Write a program to create 4
different types of button on JApplet. Use suitable events to show actions on the buttons and use JLabel
to display the action invoked. (12M) June 2011.
19. Explain with Syntax:
i) JLabel
ii) JText Field
iii) JButton
iv) JCheckBox
v) JList
vi) JTable (12)June 2015, July 2016. (08M) Jan 2018 July2019
20. Explain the following, with an example for each:
i) J Text Field class ii) J Button class iii) J Combo Box class. (10M) Dec 2011.
21. a. Explain briefly the components and containers used in swings. (05M) July 2017
Dept Of CSE 2019-2020 8
Object Oriented Concepts – 18CS45 Question Bank
b. Explain JLabel and ImageIcon with program. (06M) July 2017
22. a.Create swing applet that has two buttons named bet and gamma. When either of the buttons pressed, it
should display ”beta pressed” and “gamma was pressed” respectively. (08M) Jan 2018
b. Explain getDocumentbase and getCodebase in applet class. (08M) Jan 2018