Sie sind auf Seite 1von 8

Gandhinagar Institute of Technology

Information Technology Department


Question Bank
Academic Year(2019-20)

Subject Code: 2150704


Subject Name: Object Oriented Programming Using JAVA

UNIT -1 Basics of Java

1. Explain role of JVM.(Winter 2016)


2. The method main is a static method. Why? (Winter 2016)
3. Explain keyword this. (Winter 2016)
4. OOPS allows us to decompose a problem into a number of entities called _____.
5. Briefly explain JVM, JDK and JRE
6. What are the unique advantages of an object-oriented paradigm?
7. Explain basic concepts of OOP.
8. Discuss public, private and protected access modifiers(Winter 2017)
9. List features of Java. Briefly explain any two(Winter 2017)
10. Explain short circuited operator with example(Summer 2018)
11. Compare Object oriented programming with sequential programming.(Summer 2018)

UNIT -2 Array and String

1. How do you interpret following statement?(Summer 2016)


2. String [] s;(Summer 2016)
3. Explain right-shift operators.(Winter 2016)
4. Write two usage of keyword super.(Winter 2016)
5. Compare String and StringBuffer.
6. Explain keyword final by giving examples.
7. Describe the structure of typical java program
8. Why do we need import statement?
9. Explain the concept of class and object with example.
10. Create a two dimensional array. Instantiate and Initialize it.(Winter 2017)
11. Differentiate String class and StringBuffer class.(Winter 2017)

UNIT -3 Classes, Objects and Methods

1. How do you interpret following statement?(Winter 2015)


2. String [] s;(Winter 2015)
3. Explain right-shift operators.(Summer 2016)
4. The wrapping up of data and methods into a single unit is known as _____ .
5. _____ means the ability to take more than one form.
6. What will be the output of the following code? byte x= 64, y; y=(byte) (x<<2);
System. out. println(y);
7. What will be the output of the following code: byte b; double d=417.35; b=(byte)
d; System. out. println(b);
8. Explain use of final, static and super keyword by giving examples.
9. Explain method overriding and method overloading with the help of examples.

UNIT -4 Inheritance and Interfaces

1. Describe use of CLASSPATH.(Winter 2015)


2. Explain keyword volatile.(Winter 2015)
3. Explain method parseInt.(Summer 2016)
4. List two characteristics of an abstract class.(Summer 2016)
5. Write a method for computing first n terms of Fibonacci sequence. Define method main
taking value of n as command line argument and calling the method.(Winter 2015)
6. Explain instanceof operator.
7. Explain: Abstract Class and Interface with example. Compare Both.
Differentiate the followings:
8. Applet and Application
9. String class and StringBuffer class
10. Constructor and MethodDefine type casting. Why is it important?
11. Why is Java known as platform-neutral languages?
12. List the eight basic data types used in Java?
13. What are constants and variables?
14. How do Java strongly associated with the Internet?
15. When do we declare a member of a class static
16. What is constructor? Explain constructor overloading with example.(Winter 2017)
17. Differentiate between constructor and method of a class.(Summer 2018)
18. Explain following terms with example (Summer 2018)
(A) Nested Class (B) Anonymous Inner Class

UNIT -5 Package

1. Write a multithreaded program to compute and print prime numbers up to n where n i given
as command line argument. Instantiate requited number of threads where eac thread except
the last, examines next 50 numbers and the last thread examines remainin numbers to check
whether number is a prime or not.(Winter 2015)
2. Explain dynamic method dispatch by giving an example.(Winter 2016)
3. Declare a class called author having author_name as private data member. Extend author
class to have two sub classes called book_publication&paper_publication. Each of these
classes have private member called title. Show usage of dynamic method dispatch (dynamic
polymorphism) to display book or paper publications of a given author. Use command line
arguments for inputting data.(Summer 2017)
4. Write a complete program to have 3 Buttons in a frame having exit capabilities. Buttons are
to be added in the frame as per the layout of your choice. Count and display number of
times each Button being clicked.
5. Explain package and its use with appropriate example(Winter 2017)

UNIT -6 Exception Handling


1. Explain multiplicity.(Winter 2015)
2. Explain association class.(Summer 2016)
3. Write a method for computing first n terms of Fibonacci sequence. Define method main
taking value of n as command line argument and calling the method.(Summer 2016)
4. Explain instanceof operator.(Summer 2016)
5. Write a multithreaded program to compute and print prime numbers up to n where n is
given as command line argument. Instantiate requited number of threads where each thread
except the last, examines next 50 numbers and the last thread examines remaining numbers
to check whether a number is a prime or not.
6. With example explain use of finally in exception handling
7. Discuss exception and error(Winter 2017)

UNIT -7 Multithreaded Programming

1. Explain Thread Life Cycle in detail. Write a code to create Thread in JAVA. (Winter 2015)
2. What is multithreading? Why it is required? Write a program that creates three threads.
Make sure that the main thread executes last.(Summer 2016)
3. Explain wait, notify, synchronized and native methods.(Summer 2016)
4. Write a complete multi threaded program to meet following requirements for producer-
consumer threads: ).(Winter 2017)
a. Three threads – one producer and two consumers to be instantiated in the
method main.
b. At a time, the producer produces one integer information along with
consumer_id to represent id of a consumer that will consume produced
information.
c. Information and consumer_id are stored in a shared buffer.
d. The information produced is to be consumed by appropriate consumer only, as
specified by the producer.
e. The producer thread produces total 6 information.
5. List and Explain Methods for Inter-thread communication (cooperation).(Winter 2017)

UNIT -8 IO Programming

1. Text I/O v/s Binary I/O. OR Character I/O v/s Byte I/O. (Winter 2015)
2. Explain File constructors, any two methods of class File and method seek. (Summer
2016)
3. Write a program to check that whether the name given from command line is file or
not? If it is a file then print the size of file and if it is directory then it should display
the name of all files in it.(Summer 2016)
4. Write a program that counts the no. of words in a text file. The file name is passed as a
command line argument. The program should check whether the file exists or not. The
words in the file are separated by white space characters.
5. Write a program to display the bytes of a file in reverse sequence. Provide the name of the
file as a command line argument. (Use Random_Access_File)
6. Write a program that counts number of characters, words, and lines in a file. Use exceptions
to check whether the file that is read exists or not.
7. Write a program to replace all “word1” by “word2” from a file1, and output is written to
file2 and display the no. of replacement.

8. Write a program to count the total no. of chars, words, lines, alphabets, digits, white spaces
in a given file.
9. Explain usage of class FileInputStream and FileOutputStream by giving an
example.(Winter 2017)

UNIT -9 Collection Classes

1 What is collection in java? Explain.(Summer 2016)


2 Compare List, Set and Map interfaces. Also compare LinkedList, ArrayList, and
AbstractList in java.(Summer 2016)
3 Programs for different collection class. (LinkedList, ArrayList, AbstractList, Vector and
Enumeration)
4. Explain Metadata with the help of an example.
5. What is collection in Java? Differentiate between Vector and ArrayList.
6. Explain use of Linked List collection class with example
7. Write a note on ‘Collection in JAVA’. Also discuss List and Enumeration Interface(Winter
2017)

UNIT -10 Networking with java.net

1. Explain methods in InetAddress class with example. (Summer 2015)


2. What is socket in network programing?
3. What is server socket? How it works in java? Explain with the help of ex.
4. What is datagram socket? Explain with example

UNIT -11 Introduction to Object orientation

1. What do you mean by object-orientation? Briefly discuss the characteristics of OO


approach.(Winter 2016)
2. Which different purposes are served by Models? Explain all three models which are
required to describe the complete system. (Summer 2016)
3. What is operation overriding? Discuss the reasons for override?
4. Define the following terms:Aggregation, Generalization, Rectification,
Constraints,Metadata(Winter 2017)
5. What is UML? How it is useful?(Summer 2018)

UNIT -12 Class Modeling

1. Draw Class Diagram for ATM.(Summer 2016)


2. Draw Class Diagram for College Management System. (Winter 2016)
3. Draw Class Diagram for Online Ticket Reservation System.(Summer 2016)
4. Explain various steps required for class design.
5. Explain link and association by example.
6. Develop the complete class diagram for Blood Donation Management System.
7. Explain ‘ordered’, ‘bags’ and ‘sequences’ in class diagram(Summer 2018)

UNIT -13 Advanced class Modeling

1. What is a qualified association? (Winter 2015)


2. Explain ‘ordered’, ‘bags’, ‘sequences’ in class diagram with example each. (Winter
2016)
3. Discuss visibility concepts in class modeling. (Summer 2016)
4. Prepare a class model to describe undirected graph. An undirected graph consists of a set of
vertices and a set of edges. Edges connect pairs of vertices. Your model should capture only
structure of graphs (i.e. connectivity) and need not be concerned with layout such as
location of vertices or lengths of edges.
5. Construct state diagram for a telephone line.

UNIT -14 State modeling

1. Draw state diagram for Book Issue process in Library Management System. (Winter
2015)
2. Draw state diagram for Book Issue process in Online Ticket reservation System.
(Winter 2016)
3. What is a one shot state diagram? Draw one shot state for chess game with entry and
exit points.
4. Define Event, State and Transition. Using example draw state diagram.
5. Differentiate state and event. List different types of events.
6. Prepare a class model to describe undirected graph. An undirected graph consists of a set of
vertices and a set of edges. Edges connect pairs of vertices. Your model should capture only
structure of graphs (i.e. connectivity) and need not be concerned with layout such as
location of vertices or lengths of edges.
7. Explain Metadata with the help of an example.
8. Develop the State Machine diagram for Blood Donation Management System.

UNIT -15 Interaction Modeling

1. Draw Use Case Diagram for Online Ticket Reservation System. (Summer 2015)
2. Draw Use Case Diagram for ATM. (Summer 2015)
3. Draw Use Case Diagram for Online Shopping. (Winter 2016)
4. Draw Use Case Diagram for Library Management System. (Winter 2016)
5. Prepare sequence diagram for booking a train ticket on line. Also Prepare sequence
diagram for booking a train ticket on line that fails.
6. Prepare sequence diagram for withdraw amount from ATM.
7. Prepare sequence diagram for shopping online.
8. Prepare sequence diagram for Issue or Return book in library.
9. Prepare an Activity diagram for Online Ticket Reservation System.
10. Prepare an Activity diagram for withdraw amount from ATM.
11. Prepare an Activity diagram for Online shopping.
12. Prepare an Activity diagram for Issue or return book in Library.
13. Develop the Activity and Seaquence diagram for Blood Donation Management System
Programs (Winter 2017 ,Winter-2016, Winter 2015 & Summer-2015, Summer 2016 ,Summer
2017, Summer 2018)

1. Write a complete program to accept N integer numbers from the command line. Raise
and handle exceptions for following cases :
- when a number is –ve
- when a number is evenly divisible by 10
- when a number is greater than 1000 and less than 2000
- when a number is greater than 7000
2. Skip the number if an exception is raised for it, otherwise add it to find total sum.
3. Write a complete program to read from console up to n lines or until “quit” is entered.
The lines entered are displayed on the screen after reading all lines. The program also
counts lines beginning with character ‘A’ or ‘E’ as first letter.
4. Declare a class called Coordinate to have 3 dimensional Cartesian coordinates. Define
following methods :
- Constructor(s)
- add_coordinates to add two Coordinate objects and to produce resultant object. Generate
and handle exception if all three coordinates of the resultant Coordinate object are zero.
5. Define method main to show use of above methods.
6. Write a complete program to implement a singly linked list with nodes storing integer
information using suitable utility class.
7. Write a multithreaded program to print all odd positive numbers in ascending order up to n,
where n is a positive integer number given as a command line argument. Instantiate
requited number of threads, where each thread except the last, examines next 50 numbers
and the last thread examines remaining numbers up to n.
8. Write a multi-threaded program to have two producer threads, each writes (push) total 7
integer items to the same (common) stack. The producers enter into sleep state for 500 ms
after writing every item. There is one consumer thread that reads (pop) from the same stack
and enters into sleep state then-after for 600 ms. Assume stack size as 10. Incorporate all
required conditions so that all valid items are popped only once and there is no stack
overflow & underflow.
9. Write a program that creates and initializes a four integer element array. Calculate and
display the average of its values
10. Write a java program to do sum of command line argument passed two Double numbers
11. Define time class with hour and minute. Also define addition method to add two time
objects
12. Write a program to create circle class with area function to find area of circle.
13. Write an application that searches through its command-line argument. If an argument is found
that does not begin with and upper case letter, display error message and terminate.
14. Write an application that reads a file and counts the number of occurrences of digit 5. Supply
the file name as a command-line argument
15. Declare a class called Book having book title & author name as members. Create a sub-class of
it, called BookDetails having price & current stock of book as members. Create an array for
storing details of n books. Define methods to achieve following:
- Initialization of members
- To query availability of a book by author name / book title
- To update stock of a book on purchase and sell
-Define method main to show usage of above methods.
16. It is required to compute SPI (semester performance index) of n students of a class for their
registered subjects in a semester. Assume that all students register for 6 subjects and each
subject carry 5 credits. Also, follow GTU convention and method for computation of SPI.
Declare a class called student having following data members:
id_no, grades_obtained and spi.Define constructor, display and calculate_spi methods.
Define main to process data of n students
17. Define a recursive method for computing x raised to power y by doing repetitive multiplication
where x and y are positive integer numbers. Define main to use above method
18. It is required to maintain and process the status of total 9 resources. The status value is to be
stored in an integer array of dimension 3x3. The valid status of a resource can be one of the
followings:
free: indicated by integer value 0
occupied: indicated by integer value 1
inaccessible: indicated by integer value 2 .
Declare a class called ResourcesStatus, having data member called statusRef, referring to a two
dimensional array (3x3) of integers to be used to refer to the above mentioned status values.
Define a member method called processStausCount that counts and displays total number of
free resources, total number of occupied resources and total number of inaccessible resources.
The exception to be raised and handled if total number of occupied resources exceeds total
number of free resources. The handler marks status of all inaccessible resources as free. Accept
initial status values from command line arguments and initialize the array. Raise and handle
user defined exception if invalid status value given.
19. Write a method for computing first n terms of Fibonacci sequence. Define method main taking
value of n as command line argument and calling the method.
20. Write a complete program to accept N integer numbers from the command line. Raise and
handle exceptions for following cases :
- when a number is –ve
- when a number is evenly divisible by 10
- when a number is greater than 1000 and less than 2000
- when a number is greater than 7000
Skip the number if an exception is raised for it, otherwise add it to find total sum.
21. Write a multithreaded program to compute and print prime numbers up to n where n is given as
command line argument. Instantiate requited number of threads where each thread except the
last, examines next 50 numbers and the last thread examines remaining numbers to check
whether a number is a prime or not.
22. Write a complete program to read from console up to n lines or until “quit” is entered. The lines
entered are displayed on the screen after reading all lines. The program also counts lines
beginning with character ‘A’ or ‘E’ as first letter.
23. Write a complete multi threaded program to meet following requirements for producer-
consumer threads:
-Three threads – one producer and two consumers to be instantiated in the method main.
-At a time, the producer produces one integer information along with consumer_id to represent
id of a consumer that will consume produced information.
- Information and consumer_id are stored in a shared buffer.
- The information produced is to be consumed by appropriate consumer only, as specified by
the producer.
- The producer thread produces total 6 information.
24. Create a class called Student. Write a student manager program to manipulate the student
information from files by using the BufferedReader and BufferedWriter.
25. Write a program for chat application using TCP
26.Write a program to find whether the given string is palindrome or not.

Das könnte Ihnen auch gefallen