0% found this document useful (0 votes)
118 views

Question Bank - 345 Mod

This document contains a question bank with 30 questions related to object-oriented programming concepts in C++ and Java. The questions are grouped into 4 modules and cover topics such as OOP concepts, classes and objects, inheritance, polymorphism, exception handling, threads, and more. Sample questions include explaining encapsulation, writing a class to calculate areas of shapes, comparing method overloading and overriding, and creating threads using different approaches.

Uploaded by

abc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views

Question Bank - 345 Mod

This document contains a question bank with 30 questions related to object-oriented programming concepts in C++ and Java. The questions are grouped into 4 modules and cover topics such as OOP concepts, classes and objects, inheritance, polymorphism, exception handling, threads, and more. Sample questions include explaining encapsulation, writing a class to calculate areas of shapes, comparing method overloading and overriding, and creating threads using different approaches.

Uploaded by

abc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Question Bank

Module-1
https://www.vtupulse.com/cplusplus-programs/solution-to-18
cs45-ooc-module-1-question-bank/

1. List out the difference between a procedure-oriented program and an


object-oriented program. Jan.-18, 19, Marks 5

2. Give the difference between procedure-oriented programming and object-oriented


programming. July-19, Marks 4

3. Explain the concept of object-oriented program i) Encapsulation ii) Polymorphism


iii) Inheritance iv) Data initialization Jan.-18, Marks 8

4. List and explain any four features of an object-oriented program. Jan.-19, Marks 5

5. Explain the various features of OOC. July-19, Marks 8

6. State the important features of the Object-Oriented programming paradigm.


July-18, Marks 8

7. What is a reference variable? Explain. Write a C++ program to swap two integer
values and display the values before and after swapping. Jul.-17, Marks 5

8. Explain function prototyping with an example. Jan.-18, Jul-18 Marks 5

9. What is polymorphism? Write a C++ program using the overloaded function area to
find the area of a square, circle, and rectangle. Jul.-17, Marks 6

10. Define function overloading and Write a C++ program to find the areas of the circle
(PI * r * r), rectangle (l * b), and square (x * x) by getting the r, l, b, and x through the
keyboard and printing the areas on the console using the method area() by applying
the concept of function overloading. July 18, Marks 8.
11. What is Function Overloading? Write a C++ program to define three overloaded
functions to find the sum of two integers, the sum of two floating-point numbers, and
the sum of three integers. Jan.-19, Marks 7

12. Explain function overloading with an example. Jan.-18, Marks 5

13. Write a short note on function overloading. July-19, Marks 4

14. Explain how one can bridge two classes using the friend function. Write a C++
program to find the sum of two numbers using the bridge friend function add().Jul.-17,
Marks 6

15. What are static members of a class? Write a C++ program to count the number of
objects created. Jul.-17, Marks 5

16. Define a friend function. Illustrate with an example. Jan-19, Marks 5

17. What is the inline function? Write a C++ program to find the maximum of two
numbers using the inline function. July-19, Marks 8

18. Define a Student class with the following measures: Data Members: RollNo, Name,
average marks Member function: to read the data, to print the data. Write a C++
program to read the data of 10 students and print the 10 students’ information.
July-17, Marks 5

19. How does namespace help in preventing pollution of the global namespace?
July-17, Jan.-18, Marks 4

20. Explain namespace, with an example. July-18, Marks 4

21. Write a C++ program to get the employee details (empno, empname, bsalary
(initialized to 1000 by constructor) and allowance) of the Employee class through the
keyboard using the method GetData() and display them using the method DispData()
on the console in the format empno, empname, bsalary,allowance. VTU : July-18,
Marks 8
22. What is a constructor? List the different types of constructors and explain the
default constructor with an example. Jan.-18, Marks 6

23. What is a constructor? Mention its types. Explain parameterized constructor with
an example. Jan.-19, Marks 6

24. What is a constructor? Mention its type. Explain the parameterized constructor
with a suitable code. July-19, Marks 8

25. Write a C++ program to define an Employee class with the following Members:
Data Members: empid, emp salary Member Functions: to read a data and to print the
data. The program should use an array within the class to read 3 employee information
and print the 3 employee information.

Module-2
https://www.vtupulse.com/cplusplus-programs/solution-to-18
cs45-ooc-module-2-question-bank/

1. Write a C++ program to get the employee details (empno, empname, bsalary
(initialized to 1000 by constructor) and allowance) of the Employee class through
keyboard using the method GetData() and display them using the method DispData()
on the console in the format empno, empname, bsalary,allowance. VTU : July-18,
Marks 8

2. What is a constructor? List the different types of constructors and explain the
default constructor with an example. Jan.-18, Marks 6

3. What is constructor? Mention its types. Explain parameterized constructor with an


example. Jan.-19, Marks 6

4. What is a constructor? Mention its type. Explain the parameterized constructor with
a suitable code. July-19, Marks 8

5. Write a C++ program to define an Employee class with the following Members: Data
Members: empid, emp salary Member Functions: to read a data and to print the data.
The program should use an array within the class to read 3 employee information and
print the 3 employee information.

6. Discuss briefly the concept of byte code in Java. July-18, Marks 4

7. Elucidate how Java is a platform independent language, with neat sketches.


July-18, Marks 6

8. Define byte code. How does it help Java program(s) achieve portability? Jan.-19,
Marks 5

9. Describe the concept of byte code. July-19, Marks 4

10. How “compile once and run anywhere” is implemented in JAVA? Discuss. July-17,
Marks 4

11. List and explain the Java buzzwords. July-17, 19, Jan.-19 Marks 8

12. Explain how Java is robust and interactive. Jan.-18, Marks 5

13. Explain the structure of Java program and its keywords with an example. July-18
Marks 10

14. Write Java program to initialize and display different types of integer and floating
point variables. Jan.-18, Marks 6

15. Explain the operation of the following operators with example. Jan 18 Marks 6

i) % ii) >>> il) &&

16. With an example, explain in working of >> and >>> (unsigned right shift). Jan 19
Marks 4

17. List the different types of operators. Explain any three. July 19 Marks 8
18. Explain the concepts 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. July-17, Marks 8

19. How to declare two dimensional arrays in java? Explain with simple example.
Jan.-18, Marks 4

20. How arrays are defined in Java? Explain with an example. July-18, Marks 4

21. Explain switch case with an example. July-19, Marks 6

22. Write a Java program to find the factorial of a number ‘n’ using for loop. Jun.-18,
Marks 6

23. Write a java program to find the sum array elements. Jan.-18, Marks 5

24. Define type casting. Explain with an example. July 2017, Jan 19 Marks 5

25. Define type casting. Illustrate with an example. What is the mean by automatic
type conversion? Jan 18 Marks 6

26. Write a Java program to print first ‘n’ Fibonacci numbers.

27. Write a Java program to reverse a given number.

28. Write a Java program to find the number of and the sum of all numbers greater
than 100 and less than 200 (inclusive both) which are divisible by 7.

29. List and explain control statements in java.

Module-3
1. Can you overload the constructor and destructor? Justify with suitable program.
July-17, Marks 6

2. Write a short note on “this” keyword with an example. July-19, Marks 4


3. Explain the Java garbage collector. July-19, Marks 8

4. Illustrate with an example a superclass variable that can reference a subclass


object. Jan.-18, Marks 6

5. Elucidate the concept of inheritance and its classifications in Java with sketches.
July-18, Marks 8

6. With an example, give two uses of super. July-17, Marks 5

7. Write short notes on the “super” keyword, with an example. July-19, Marks 4

8. When constructors are called in the class hierarchy? July-17, Marks 4

9. Define inheritance. Explain multilevel hierarchy with an example program. Jan.-19,


Marks 5

10. Compare and contrast method overloading and method overriding with suitable
examples. July-17, Marks 6, Jan.-18, Marks 5, Jan.-19, Marks 4

11. Discuss the following terms with examples: i) super ii) final. Jan.-19, Marks 8

12. Define exception. Write a program that contains one method which will throw
IllegalAccessException and use proper exception handlers so that exception should be
printed. July-17, Marks 6

13. Give the basic form of an exception handling block. Jan.-18, Marks 8

14. Define the role of exception in software development. July-18, Marks 2

15. Define exception. Explain the exception handling mechanism with an example.
Jan.-19, Marks 8

16. Explain exception handling with a suitable code. July-19, Marks 8


Module-4

1. Define package. What are the steps involved in creating a user-defined package with
an example? July 2017, Marks 5.

2. Explain packages in Java with an example. July 2019, Marks 8

3. Describe the various levels of access protection available and their implications.
Jan 2018, 2019, Marks 8.

4. Write a Java program to define an interface called Area which contains a method
called Compute() and calculate areas of the rectangle(I*b) and triangle(1/2*b*h) using
classes Rectangle and Triangle. July-18, Marks 8 – V

5. Briefly explain the role of the interface while implementing the multiple
inheritances. July 2017, Marks 6 – V

6. What is Thread? Explain two ways of creation of thread. Jan.-18, Marks 5

Solution: 1. By Extending Threads Class and 2. By Implementing Runnable Interface -V

7. Elucidate the two ways of making a class threadable, with examples. July-18, Marks
8

Solution: 1. By Extending Threads Class and 2. By Implementing Runnable Interface -V

8. What is the thread? Explain two ways of creating a thread in JAVA with an example.
Jan.-19, Marks 8

Solution: 1. By Extending Threads Class and 2. By Implementing Runnable Interface –


V

9. Explain the concepts of multithreading in Java. Explain the two ways of making
class threadable with examples. July-19, Marks 10

Solution: 1. Multithreading By Extending Threads Class and 2. Multithreading By


Implementing Runnable Interface – V
10. How synchronization can be achieved for threads in Java? Explain with syntax.
July-17, Marks 6 – V

11. Discuss briefly Synchronization in Java (2). July-18, Marks 2 – V

12. Write an example Program for implementing static synchronization in Java.


July-18, Marks 6

13. What is the need for synchronization? Explain with an example how
synchronization is implemented in JAVA. Jan.-19, Marks 8 )- V

14. What is synchronization? When do we use it? Jan.-18, Marks 5 – V

15. Interfaces in Java Difference between Class and Interface Extend Interface
Implement Interface -V

16. Explain the role of synchronization with the Bounded buffer problem.

17. What are the differences between suspending and stopping the threads? July-17,
Marks 5

18. Define the concept of multithreading in Java and explain the different phases in
the life cycle of a thread, with a neat sketch. July-18, Marks 8

Module-5

Event Handling in Java

1. Explain the delegation event model used to handle events in java with suitable
examples. July 17, 6M Jan 18, 8M

2. Write a short note on Event class and explain with syntax. July 19, 8M

3. Explain the delegation event model used to handle events in JAVA. What are events,
event listener, and event sources? Jan.-19, Marks 6
4. Write short notes on the Event Listener interface and explain any two interfaces with
syntax. July-19, Marks 8

5. Describe the delegation event model and explain what happens internally at a button
click. July-18, Marks 8

6. Explain key event and mouse event class. Jan. 18, Marks 6

7. Explain the adaptor class with an example. July-17, Marks 4

8. Explain inner class with an example. July-17, Marks 5

9. Explain the Adapter class and Inner classes with examples. Jan.-19, Marks 6

10. How inner classes are used in Java? Explain. July-19, Marks 4

Java Applets

1. Briefly explain Applets. July-18, Marks 3

2. What are applets? Explain different stages in the lifecycle of an applet. July-17,
Marks 5

3. What is an applet? Explain five main methods of the applet. Jan.-18, Marks 8

4. What is an applet? Explain the life cycle of an applet. July-19, Marks 10

5. Elucidate lucidly the skeleton of an applet. July-18, Marks 5

6. Design an applet to display three buttons “Red”, “green”, and “blue”. The color of the
background changes according to the button pressed by the user.

7. Write a program using an applet that will print “key pressed” on the status window
when you press the key. “Key released on the status window when you release the key
and when you type the characters it should print “Hello” at coordinates (50,50) on the
applet. Jan.-19, Marks 8
8. Develop an applet that receives two numerical values as input from the user and
then displays the sum of these numbers on the screen.

9. What are the two types of applets? Explain the skeleton of an apple. Enlist applet
tags. July-17, Marks 6

10. What is an applet? Explain the skeleton of an applet. Enlist applet tags. Jan.-19,
Marks 8

11. Explain the applet architecture and demonstrate how to pass parameters for font
size and font name in applets. July-17, Marks 5

12. Explain passing parameters in Applets. July-19, Marks 10

13. Explain getDocumentbase and getCodebase in Applets. Jan-18, Marks 8

14. Write a Java program to play an audio file using Applets. July-18, Marks 8

Java Swings

1. Write the advantages of swing over AWT. July-18, Marks 4

2. Describe the two key features of swings. Jan.-19, Marks 4

3. Write a brief note on containers in the swing. July-18, Marks 4

4. Explain briefly the components and containers used in swings. July-17, Marks 5

5. Explain JLable and ImageIcon with the program. July-17, Marks 6

6. Explain with syntax the following: JLabel. Jan.-18, Marks 2

7. Explain the following with an example for each and syntax: JLabel. Jan.-19, Marks 3

8. Explain the following with a suitable code: JLabel July-19, Marks 5


9. Explain with syntax the following: JTextField. Jan.-18, Marks 2

10. Explain the following with an example for each and syntax: JTextfield. Jan.-19,
Marks 3

11. Explain the following with a suitable code: JTextField. July-19, Marks 5

12. Create a swing applet that has two buttons named beta and gamma. When either
of the buttons is pressed, it should display “beta pressed” and “gamma pressed”
respectively. Jan.-18, Marks 8

13. Explain with syntax the following: JButton. Jan.-18, Marks 2

14. Explain the following with an example for each and syntax: JButton. Jan.-19,
Marks 3

15. Explain the following with a suitable code: JList. July-19, Marks 5

16. Write a swing program for displaying any one of the options C, C++, Java, PHP
through a selection of Combobox by clicking the show button. June-18, Marks 8

17. Explain the following with an example for each and syntax: JComboBox Jan.-19,
Marks 3

18. Write steps to create JTable, also write a program to demonstrate the same.
July-17, Marks 5

19. Explain the following with a suitable code: JTable July-19, Marks 5

20. Explain with syntax the following: JCheckBox. Jan.-18, Marks 2

21. Explain with syntax the following: JRadioButton. Jan.-18, Marks 2

You might also like