0% found this document useful (0 votes)
2 views17 pages

OOP-I Question Bank

The document is a question bank for the Object Oriented Programming-I course, prepared by Prof. Aishwarya Divan for the academic year 2023-2024. It includes various questions categorized by units covering topics such as Java fundamentals, methods, arrays, object-oriented principles, and exception handling. Each unit contains multiple questions aimed at assessing students' understanding of Java programming concepts and practices.

Uploaded by

Yash Lathiya
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)
2 views17 pages

OOP-I Question Bank

The document is a question bank for the Object Oriented Programming-I course, prepared by Prof. Aishwarya Divan for the academic year 2023-2024. It includes various questions categorized by units covering topics such as Java fundamentals, methods, arrays, object-oriented principles, and exception handling. Each unit contains multiple questions aimed at assessing students' understanding of Java programming concepts and practices.

Uploaded by

Yash Lathiya
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/ 17

Object Oriented Programming-I

(3140705)

Question Bank

Year: 2023-2024

Prepared by: Prof. Aishwarya Divan

Question Bank
Text Book: Y.Daniel Liang 10E Mark
s

UNIT- 1 (Chapter 1,2) Introduction to java and CO1


elementary Programming:

1 JVM is platform dependent. Justify. (May-13,Dec-15,Nov-16) 1

2 There is no destructor in Java. (May-13,Dec-15) 1

3 List out different types of operators in JAVA. Explain Logical and 4


Bitwise Operators in detail. (Dec-19)

4 Explain short circuited operators and shift operators. (June-11, May-13, June-14) 4

5 Explain features of Java briefly.(Nov-17 )(May-16)(Dec-19) 7


6 Java program is to be compiled first and then to be interpreted for execution. 4
True or false? Justify youranswer. (Dec-15)

7 Discuss JVM, JRE, Javadoc. Why java is platform independent 4


language? Mention advantages of JavaProgramming Language
(Dec-18)

8 Draw and explain the process of building and running JAVA Program.(Dec-19) 7

9 What are the four integer types supported in Java?(Apr-17) 4

10 What will be the result of the following java expression: 4


4*2-5>4
&&3<5-
2
(Apr-17)

11 List out different types of operators in JAVA. Explain Logical and 4


Bitwise Operators in detail. (Dec-19)

12 Write a program to take three numbers as command line argument. 4


Display the maximum among them? (June19)

13 Define following. (Nov-18) 3


1) Byte code
2) Java Virtual Machine

14 Give the differences between JAVA and C++ (Dec-19) 4

15 Draw and explain the process of building and running JAVA Program (Dec-19) 7

16 What is command line argument? Explain it with program. (Dec-19) 7

17 Why java is preferred as a programing language for Internet? (Dec-20) 3

18 List out and explain three main principles of object-oriented programming? (Dec-20) 4

UNIT- 2 (Chapter 3,4,5 ) Selections , Mathematical functions and loops CO1

1 Write a java program to print prime number upto 100. (Apr-17) 3

2 Write a JAVA program to implement the Fibonacci series using for loop 7
control structure. (Nov-19)

3 Write a program to print multiplication table in java of user entered number. 7


4 Write a program that prompts the user to enter two positive integers and finds 7
their greatest common divisor.

5 Write a program that prompts the user to enter a three-digit integer and 7
determines whether it is a palindrome number. A number is palindrome if it
reads the same from right to left and from left to right

UNIT- 3 (Chapter 6,7,8) Methods and Arrays CO2

1 Create two dimensional array named marks‘ and initialize it(Apr-17) 3

2 Explain array implementation in Java. (Dec-15) 3

3 Explain Ragged Array With example (Nov-11) 3

4 Write a problem is to read 100 numbers get the average of these numbers, and 7
find the number of the itemsgreater than the average. (Dec_15)

5 Write a JAVA program to display the following output using 2-D 7


array.(Dec 19)0 1 2
345
6789

6 Write a program that creates and initializes a four integer element array. 7
Calculate and display the average of itsvalues (Dec_15)

7 Write a java program to do sum of command line argument passed two 7


Double numbers. (Dec_15)

8 Explain method overriding with example.(Dec-15) 7

9 Differentiate between Method overloading and Method overriding. Or 7


Explain Method overloading and Method overriding.(May-16) (Dec-19)

10 Define a recursive method for computing x raised to power y by doing 4


repetitive multiplication where xand y are positive integer numbers. Define
main to use above method (Nov-16)

11 Write a method for computing first n terms of Fibonacci sequence. Define 4


method main taking value ofn as command line argument and calling the
method.(Nov-16)

12 Write a program which takes five numbers as command line argument from 4
user, store them in onedimensional array and display count of negative
numbers. (Nov 18)
13 When will you declare a method as a static? Explain static method with 3
suitable example (Nov-18)

14 Write a JAVA program to create a super class called figure that stores the 7
dimensions of a two- dimensional object. It also defines a method called area ()
that computes the area of an object. The program derives two sub classes from
figure. The first is rectangle and the second is Triangle. Each ofthese subclasses
overrides area (), so that it returns the area of a rectangle and a triangle
respectively. (Nov-19)

15 Describe the following methods related to String i) replace() ii) compareTo() (Nov-19) 3

16 Define a recursive method for computing x raised to power y by doing 7


repetitive multiplicationwhere x and y are positive integer numbers.
Define main to use above method.(Nov-16)

UNIT- 4 (Chapter 9) Objects and Classes CO2

1 Define time class with hour and minute. Also define addition method to add 7
two time objects.(Dec-15)

2 Differentiate the followings: (i) Constructor and method (Nov-11, May 18, Jan 13) 3

3 Explain both the types of constructors in detail(Dec 19) 4

4 It is required to compute SPI (semester performance index) of n students of a class 7


for their registered subjects in a semester. Assume that all students register for 6
subjects andeach subject carry 5 credits. Also, follow GTUconvention 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(Nov-16)

5 Write a class named Rectangle to represent a rectangle. It contains following 7


members: DATA: width(double) and height (Double) that specify the width
and height of the rectangle. Methods:(June- 19 )
1. A no-arg constructor that creates a default rectangle.
2. A constructor that creates a rectangle with the specified width
and height. 3. A method named getArea() that returns the area of
this
rectangle.
4. A method named getPerimeter() that returns the perimeter.
6 Declare a class called employee having employee_id and employee_name as 7
members.Extend class employee to have a subclass called salary having designation
andmonthly_salary as members. Define following: - Required constructors - A
method to find and display all details of employees drawing salary more than Rs.
20000/-. - Methodmain for creating an array for storing these details given as
command line argumentsand showing usage of above methods.(May-18)

7 When will you declare a method as a static? Explain static method 7


with suitable example.(Dec-18)

8 Explain Java garbage collection mechanism. What is the purpose 4


of the finalize()method.(Apr-17, Nov-11,June-14)

9 Explain constructor and finalizer with the help of example. (Dec-13, June-14) 7

10 Explain keywords private and protected.(May-18)(Nov-16) 7

11 With the help of program show how to pass object as an argument of method(Nov-17) 7

12 Explain constructor overloading using example.(Dec-15)

13 Write a program to create circle class with area function to find area of circle. (Dec-15) 7

14 Differentiate between constructor and method of a class.(May-18) 4

15 Differentiate between protected and default access specifiers (May-19) 3

16 Distinguish between method overloading and overriding with suitable example. 4


(May 19) (Nov-19)(June 19)

17 What is constructor? Explain constructor overloading with example. (Nov-17) 4

18 What do you mean by Overloading? Explain constructor overloading 4


with suitable example. (Nov-18)

19 What is a constructor in JAVA? How many types of constructors are there 4


in JAVA? Explain withexamples. (Nov-19)

20 Discuss various access modifiers available in JAVA? How access modifier 7


affects the visibility of amember in different access locations? (Nov-19)

21 Justify: 7
1. Why we declare main() method as public and static member.
2. Why we generally declare constructor as public member.
3. Why there is no destructor in java. (June 19)
22 Explain static keyword in detail using a sample program (Dec-19) 7

23 What is the purpose of ‘this’ and ‘static’ keyword? Write a java program 4
to explain this.(Dec-20)

UNIT- 5 (Chapter 10,11) Object oriented thinking: CO2

1 Explain method parseInt.(Nov-16) 1

2 What is wrapper class? What is Autoboxing? OR What is Wrapper class 3/7


in Java? Explain with examples.(May-16)

3 Describe the following methods related to String i) replace() ii) compareTo() (Dec-19) 7

4 State whether any error exists in the following code. If so, correct the error 7
and give output. (Nov-11)
class Test {
public static void main(String args[])
{A a = new A();
a.print();
}}
Class A {
String s;
A(String s)
{
this.s=s;
}
public void print() {
System.out.println(s);}}

5 What are command line arguments? Write a java program which reads a line 3
03 from – command line and printsthat line in reverse.(Apr-17)

6 Write a method for computing first n terms of Fibonacci sequence. Define 7


method main taking value of n ascommand line argument and calling the
method.(Nov-16)

7 Write a program to find whether the given string is palindrome or not. (Nov-17) 7

8 Describe Inheritance and its type with suitable example. (May-18 ,May-16) 3

9 What is compile time polymorphism? Use the compile time polymorphism 4


in a java program to create objects.(Apr-17)

10 What is inheritance in java? Explain different types of inheritance 7


with proper example partial code. (May-15,16, Apr-17,May-18)
11 Define polymorphism with its need. Define and explain static and dynamic 7
binding (dynamic method dispatch)to implement runtime polymorphism using
program. (Dec 10,Jan-13, Apr-17,Nov-16)

12 Explain following with example: 7


i) Finalize() ii) static iii) super iv) final(May-16)

13 Explain following key words: this, super, instance of, static. .(Apr-17) 7

14 Declare a class called book having author_name as private data member. Extend 7
book class to have two sub classes called book_publication & paper_publication.
Each of these classes have private member called title. Write a complete program
to show usage of dynamic method dispatch (dynamic polymorphism) to display
book or paper publications of given author. Use command line arguments for
inputting data. . (May 13)

15 Write a JAVA program to create a super class called figure that stores the 7
dimensions of a two- dimensional object. It also defines a method called area () that
computes the area of an object. The program derives two subclasses from figure.
The first is rectangle and the second is Triangle. Each of these subclasses overrides
area (), so that it returns the area of a rectangle and a triangle respectively.(Dec-19)

16 The abstract vegetable class has three subclasses named Potato, Brinjal and 7
Tomato. Write a java program that demonstrates how to establish this class
hierarchy. Declare one instance variable of type String that indicates thecolor of a
vegetable. Crete and display instances of these objects. Override the toString()
method of object to return a string with the name of vegetable and its
color.(May-16)

17 Explain different Visibility modifiers. (May-18) 3

18 Explain keywords private and protected.(May-18) 4

19 Write a program which shows an example of function overriding. .(May-18) 7

20 What do you understand by super keyword? Write use of super keyword 3


(May-19) (June 19)

21 Write an abstract class named Person and its two subclasses named Student and 7
Employee. A person hasa name, address, phone number, and email address. A
student has enrollment, course. An employee has an office, salary, and designation.
Define constructors and methods for input and display for both
classes. Write a main program to give demonstration of all.(May-19)

22 Explain Dynamic method dispatch with proper example. (Nov-17) (June 19) 7
23 Explain inner class with example.(Nov-18) 4

24 Discuss Following with example: (Nov-17) 7


(i) Super Keyword
(ii) Final Keyword

25 Explain following keywords of java with example.(Nov-18) 7


1) super
2) this

26 Explain the use of final keyword in JAVA. (Nov-19) 3

27 What is wrapper class? What is the use of wrapper class in Java? (Nov-18) 3

28 Explain Super keyword with the help of example. (Nov-19)(Dec-20) 4


/
7

29 How package can be created in JAVA? Explain with suitable example. (Nov-19) 4

30 Differentiate between final, finally and finalize. What will happen if we make 7
class and method as final?
(June 19)

31 Explain Runtime Polymorphism with example (Dec-19) 7

32 State difference between String Class and StringBuffer Class. (May-18) 3

33 Explain the keywords: 1. Wrapper class 2. finalize () method 3. Recursion 4. 7


Static. (May 18)

UNIT- 6 (Chapter 12,13) Exception Handling, I/O, abstract classes and interfaces CO3

1 Differentiate the following: Checked and Unchecked exceptions (May-18) 2

2 Discuss exception and error(Nov-17) 2

3 What is Exception? Demonstrate how you can handle different types 4


of exception separately.(Dec-18)

4 Explain garbage collection and finalization. (Dec-19)(May-17)(Nov-19) 3


5 Explain Exception handling in JAVA. Write an application that generates custom 7
exception if anyvalue from its command line arguments is negative. (June-12,
June 14 , Dec-13)

6 Define exception. List java‘s common exceptions. Write a JAVA program 7


to generate and handledivision by zero arithmetic exception. (Dec-19)

7 Explain transient, finally, throw, throws. (Jan-13) 7

8 Explain & illustrate by examples use of final, finally and method 7


finalize. (May 13)(May-19)

9 Write a method for computing by doing repetitive multiplication. x and y are of 7


type integer andare to be given as command line arguments. Raise and handle
exception(s) for invalid values of x and y. Also define method main. Use finally in
above program andexplain its usage. (June-11)

10 Write an application that searches through its command-line argument. If an 7


argument is found thatdoes not begin with and upper case letter, display error
message and terminate. (Dec-15)

11 Write a program to create user define exception MyException. Define a class 7


ExceptionDemo that has a method named compute( ) which throws a MyException
object, when compute( )‘s integer parameteris greater than 10.(Nov-17)

12 Which class gives you access to the attribute of a file?(Apr-17) 1

13 Explain usage of class FileInputStream and FileOutputStream by 5


giving an example.(Nov-17)

14 Write a program that reads file name from user, through command line 3
argument and displays contentof the text file on console. (Dec-18)

15 Write a program to display the bytes of a file in reverse sequence. Provide 7


the name of the file asa command line argument. (Use RandomAccessFile).
(June 12)

16 Write a program to count the total no. of chars, words, lines, 7


alphabets, digits, white spaces in agiven file. . (Dec-13)

17 Write a program to replace all ―word1‖ by ―word2‖ to a file without 7


using temporary file anddisplay the no. of replacement. (Dec-10,
May-18)

18 Write a Java program to copy content of file1.txt to file2.txt using Java 7


file handling. (May-16)

19 Create a class called Student. Write a student manager program to 7


manipulate the studentinformation from files by using the
BufferedReader and BufferedWriter.(Nov-17)
20 Differentiate between abstract class and Interface. (Dec-14,May-16, Apr-17) 4

21 State whether the following statements are true or false: (Nov-11) 4


(i) An abstract class contains constructors. (T)

(ii) The catch block is the preferred means for releasing resources to
prevent resource leaks.(F)
(iii) If capacity increment is not specified for Vector, the system will
double the size of Vector each timeadditional capacity is needed. (T)
(iv)An interface can extend an abstract class(F)

22 Write a program that illustrates interface inheritance. Interface A is extended by 7


A1 and A2. Interface A12inherits from both P1 and P2.Each interface declares
one constant and one method. Class B implements
A12.Instantiate B and invoke each of its methods. Each method displays one
of the constants. (Dec-14)

23 The abstract Vegetable class has three subclasses named Potato, Brinjal and Tomato. 7
Write an application that demonstrates how to establish this class hierarchy. Declare
one instance variable of type String that indicates the color of a vegetable. Create and
display
instances of these objects. Override the toString() method of Object to
return a string with the name of the vegetable and its color. . (Nov-11,
May-16)

24 Write an abstract class named Person and its two subclasses named student and 7
Employee. A person has a name, address, phone number and email address. A student
has enrolment course. An Employee has an office, salary, and designation. Define
constructors and methods for input and display for both classes. Define constructor
and
methods for input and display for both classes. Write a main program
to givedemonstration of all. (June-19)

25 Explain keywords abstract and volatile.(Dec-15) 2

26 With example explain use of finally in exception handling.(Dec-15)(May-18) 7

27 Write an application that searches through its command line argument. If an 7


argument is found that doesnot begin with and upper case letter, display error
message and terminate. (Dec-15)

28 Explain use of throw in exception handling with example (Dec-15)(May-17) 7

29 Write an application that reads a file and counts the number of occurrences of 7
digit 5. Supply the filename as a command-line argument.(Dec-15)
30 Explain use of Interface with suitable example. (May-16)(Nov-16) 7

31 Differentiate between interface and abstract class (May-16) 7

32 Explain Interface in JAVA. How do interfaces support polymorphism?(May-18) 7

33 Write a method for computing xy doing repetitive multiplication. X and y are of 7


type integer and are to be given as command line arguments. Raise and handle
exception(s) for invalid values of x and y (May-18)

34 Differentiate between Interface and abstract class. When Interface is 4


preferred over abstract class (May-19) (June 19)

35 What do you mean by Interface? Compare interface and abstract class 7


with suitable example. (Nov-18)

36 Explain following keywords of java with example. (Nov-18) 7


1) final
2) finally

37 Explain following keywords with example (Nov-18) 7


1) throw
2) throws

38 What is Exception? Demonstrate how you can handle different types 4


of exception separately. (Nov-18)

39 What is package? What are the requirements of it? What we can 4


achieve using package?(Nov-18)

40 Define exception. List java’s common exceptions. Write a JAVA program to 7


generate and handledivision by zero arithmetic exception. (Nov-19)

41 Explain the following terms with respect to exception handling. 3


(Nov 19) i) throw ii) finally

43 Differentiate between protected and default access specifiers (June 19) 3

44 What do you understand by inner class?(June 19) 3

45 What do you understand by package? Discuss benefits of package(June 19) 3


46 Consider following code fragment: (June 19) 4
try {
statement 1;
statement 2;
statement 3;
}
catch (Exception1 ex1) { }
finally {
statement 4;
}
statement5;
1. Which Statements will execute if no exception is occurs.
2. Which Statements will execute if Exception 1 is occurs at statement

47 Differentiate the followings: (June 19) 7


1. Checked and Unchecked Exceptions
2. Socket and ServerSocket
3. Text I/O and Binary I/O
4. String and StringBuffer

48 What is Interface? Write steps to declare and define an interface 7


and explain with sampleprogram.(Dec-19)

49 Explain try, catch, throw, throws and finally in detail (Dec-19) 7

50 What is Stream Class? Explain input stream class and output stream class 7
in details. (Dec-19)

51 What is exception? List out and explain the keywords used to handle 7
e
x
c
e
p
t
i
o
n
s
.
(
D
e
c
2
0
)

52 What are interfaces in java? How do they support polymorphism?.(Dec-20) 4


53 What is garbage collection? What is the roll of finalize () in it?(Dec-20) 4

54 Differentiate checked exceptions with unchecked exceptions (Dec-20) 3

55 What is runnable interface? How can you use this interface in creating thread?(Dec-20) 4

56 Write a java program to explain the use of File class and its methods.(Dec-20) 7

57 Differentiate abstract class with interface(Dec-20) 3

58 What are the wrapper classes? Explain the use of any one wrapper class (Dec-20) 3

UNIT- 7 (Chapter 14,15) JAVAFX basics and Event-driven CO5


programming and animations

1 What interface defines (i) binding property (ii) source object. 3

2 What is a unidirectional binding and what is bidirectional binding? 3


Write a statement to bind property d1 withproperty d2bidirectionally

3 What are the binding object types for int, long, float, double, and boolean? 3

4 What is a pane? What is a node? How do you place a node in a pane? 3

5 Write code fragments to display a polygon connecting the following points: 7


(20, 40), (30, 50), (40, 90), (90, 10),(10, 30), and fill the polygon with green
color.

6 Write a program that draws two circles with radius 15 pixels, 7


centered at random locations, witha line connecting the two circles.

7 What is a lambda expression? What is the benefit of using lambda 3


expressions for event handling? What is thesyntax of a lambda expression?

8 What is a functional interface? Why is a functional interface required 3


for a lambda expression?

9 What methods do you use to register a handler for a mouse pressed, 3


released, clicked, entered, exited, movedand dragged event?

10 Explain: MouseEvent, KeyEvent, ActionEvent 3


11 What is an event source object? What is an event object? Describe 4
the relationship between an event sourceobject and an event object

12 What methods used to register handlers for key pressed, key released, and 7
key typed events? In which classesare these methods defined?

13 Explain Label and Button class and their methods in detail. (Dec-19) 7

UNIT- 8 (Chapter 16) JAVAFX UI controls and multimedia CO5

1 (Create a miles/kilometers converter) Write a program that converts miles and 7


kilometers, as shown in Figure 16.37b. If you enter a value in the Mile text field
and press the Enter key, the corresponding kilometer measurement is displayed in
the Kilometer text field. Likewise, if you enter a value in the Kilometer text
fieldand press the Enter key, the corresponding miles is displayed in the Mile text

field.

2 (Convert numbers) Write a program that converts between decimal, hex, and binary 7
numbers, as shown in Figure 16.37c. When you enter a decimal value in the
decimal value text field and press the Enter key, its corresponding hex and binary
numbers are displayed in the other two text fields. Likewise, you can enter values
in the other fields and convert them accordingly. (Hint: Use the Integer.parseInt(s,
radix) method to parse a string to a decimal and use Integer.toHexString(decimal)
and Integer.toBinaryString(decimal) to obtain a hex number or a binary number
from a

decimal.)

UNIT- 9 (Chapter 17,18,19) Binary I/O ,Recursion and Generics CO4

1 Explain usage of class FileInputStream and FileOutputStream by giving 3


an example. (Nov-17)

2 Write a program to read the content of a file into a character array and write 7
it into another file. Get names of thefiles from command line.

3 Write a program to create a file named example.dat if it does not exist. Append 7
new data to it if it already exists.Write 100 integers created randomly into the
file using
binary I/O.

4 How to define Generic class and interface explain with example. 3

5 Explain usage of class FileInputStream and FileOutputStream by giving 3


an example. (Nov-17)

6 Explain wildcard Generic type with example. 7

UNIT- 10(Chapter 20) List, Stacks, Queues and Priority Queues CO4

1 Write a note on Collection in JAVA‘. Also discuss List and 4


Enumeration Interface. (Nov-17)

2 What is Collection in Java? Explain the use of Iterator (Dec-20) 3

3 Explain utility class ArrayList and Hashtable with example (May-13, Dec-15) 7

4 Describe the Java Collections Framework. (June-14) 7

5 List the interfaces, abstract classes and concrete classes of collection hierarchy. 7
(Nov 11)

6 Write a complete program to implement a singly linked list with nodes 7


storing integer information using suitableutility class. (Dec-15)

7 Explain use of Linked List collection class with example. (Dec-15) 7

8 What do you understand by Collection framework in java? List methods 3


available in iterator interface. (June19)(May-19)

UNIT- 11(Chapter 21) Sets and Maps CO4

1 Explain the unique features of Map interface.. (Jan-13,June-14,Dec-14) 3

2 What are the differences between HashSet, LinkedHashSet, and TreeSet 7

3 Describe and compare HashMap, LinkedHashMap, and TreeMap 7

4 Write a program that counts the occurrences of words in a text and displays the 7
words and their occurrences inalphabetical order of the words. [hint: a TreeMap
to store an entry consisting of a word and its count]
UNIT- 12 Concurrency CO3

1 Explain multi threading in java using example. (Dec-15) 7

2 What are the methods to create thread? Write a multithreaded program to explain 7
the use of join() method. (May-17)

3 Explain Thread life cycle and describe creation of thread with suitable 7
example.(May 16)

4 What do you understand by thread? Describe the complete life cycle of thread. 4
(May 19)

5 Explain use of following methods with suitable example isAlive(), 7


join(), setPriority(). (Nov-18)

6 What is multithreading? What are the ways in which you can create a 2
thread? Explain with Example. (Nov-18)

7 Differentiate multithreading and multiprocessing.(Nov-19) 3

8 Draw and Explain Thread Life Cycle(Nov-17) 4

9 What are the different ways to create thread? Explain with example. (Nov-17) 7

10 Explain use of following methods with suitable example isAlive(), 7


join(), setPriority(). (Dec-18)

11 What is the effect of adding the synchronized keyword to a method?(Apr-17) 1

13 List and Explain Methods for Inter-thread communication (cooperation).(Nov-17) 2

14 Explain two usage of keyword synchronized. (Dec-15) 2

15 What is a thread? Describe the complete life cycle of thread. (Nov-19) (Nov-19) 4

16 Discuss the role of thread synchronization in inter-thread communication? 7


Explain with example.(Nov-19)

17 Why synchronization is required in multithreaded programming. 4


Write a program that usesthread synchronization to guarantee data
integrity in a multithreaded application.(Jan-13)
18 Explain wait, notify, synchronized and native methods. (May-13) 5

19 Write an application that creates and starts three threads. Each thread is 7
instantiated from the same class. It executes a loop with 10 iterations. Each
iteration displays string "HELLO", sleeps for 300 milliseconds.
Theapplication waits for all the threads to complete & displays the message
"Good Bye..." (Dec 13)

20 Write a complete multi-threaded program to meet following 7


requirements: - Read matrix [A] m x n
- Create m number of threads
- Each thread computes summation of elements of one row, i.e. ith row of
the matrix is processed by ith thread. Where 0 <= i< m.
- Print the results. . (June-11)

21 Write an application that executes two threads. One thread displays "Good 7
Morning" every 1000 milliseconds &another thread displays "Good Afternoon"
every 3000 milliseconds. Create the threads by implementing the Runnable
interface. (Dec-13, Nov 16, May-18)

22 Draw and explain the life cycle of thread in detail. (Dec-19) 7

23 Write a program of writing binary file using multithreading. Demonstrate use 7


of join() and yield(), interrupt().
(Dec-10)

24 Write a program to create two threads, one thread will check whether given 7
number is prime or not and secondthread will print prime numbers between 0 to
100. (May-18)

25 Write a program to create two thread one display alphabet from a to z and 7
other will display numbers from 1 to
100. (June-19)

26 Write a complete multi-threaded program to meet following requirements 4


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 aconsumer that will consume produced
information. - Information and consumer_id are stored in a shared buffer. - The
information produced is to be consumed byappropriate consumer only, as
specified by the producer.
- The producer thread produces total 6 information.(May-16)

You might also like