Questions Bank JPR
Questions Bank JPR
-------------------------------------------------------------
Sub:JPR (22412) Course Code:-CW/CO/CM/IF-4I
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Unit:-I ( Basic Syntactical Constructs in java) Marks-10
------------------------------------------------------------------------------------------------
2 Marks Questions:-
4 Marks Questions:-
1) Explain the concept of platform independence and portability with respect to Java
language
2) Define type casting. Explain its types with syntax and example.
3) Explain any two logical operators in Java with example..
4) State syntax and describe working of ‘for each’ version of for loop with one example.
5) Explain any four features of Java.
6) Describe break and continue statement with example.
7) Describe?, : (Ternary operator) in Java with suitable example.
8) Explain : 1) Platform independence 2) Compiled and interpreted features of Java.
9) Define a class having one 3-digit number as a data member. Initialize and display
reverse of that number
10) What do mean by typecasting ? When it is needed ?
11) Write a program to check whether an entered number is prime or not.(2 times)
www.gunwantmankar.com 1
12) Write a program to generate Fibonacci series : 1 1 2 3 5 8 13 21 34 55 89.
13) Write a program to print reverse of a number.
------------------------------------------------------------------------------------------------
Unit:-II (Derived Syntactical Constructs in Java) Marks-18
------------------------------------------------------------------------------------------------
2 Marks Questions:-
4 Marks Questions:-
www.gunwantmankar.com 2
14) Define constructor. Explain parameterized constructor with example.
15) Describe use of ‘super’ and ‘this’ with respect to inheritance.
16) Write a program to implement following inheritance :
Class : person
name, age
Class : employee
emp_designation
name, age
emp_salary
17) Define a class Item having data member code and price. Accept data for one object
and display it.
18) Explain use of following methods :
i) indexOf ( ) ii) charAt ( ) iii) subString ( ) iv) repalce ( )
19) What is final variable and method ? How it is different from abstract method ?
20) What is garbage collection and finalize method in Java ?
21) What is constructor ? Describe the use of parameterized constructor with suitable
example.
22) What is the difference between array and vector ? Explain elementAt( ) and
addElement( ) method.
23) Explain method overloading with example
24) Describe final method and final variable with respect to inheritance.
25) What is difference between arrays and vectors ? Explain any 2 methods of vector
with example.
26) What is constructor ? Demonstrate the use of parameterised constructor with suitable
example.
27) Explain abstract class with suitable example.
28) State the use of ‘super’ and ‘final’ keyword w.r.t. inheritance with example.
6 Marks Questions:-
1) Describe the use of any methods of vector class with their syntax.
2) Explain the command line arguments with suitable example
3) Write a program to create vector with five elements as (5, 15, 25, 35, 45). Insert new
element at 2nd position. Remove 1st and 4th element from vector.
www.gunwantmankar.com 3
4) Write a program to create a vector with seven elements as (10, 30, 50, 20, 40, 10, 20).
Remove element at 3rd and 4th position. Insert new element at 3 rd position. Display
the original and current size of the vector.
5) Describe the following string class methods with examples :
(i) length( ) (ii) charAt( ) (iii) CompareTo( )
6) Write a program to implement a vector class and its method for adding and removing
elements. After remove display remaining list.
7) Define a class ‘employee’ with data members empid, name and salary. Accept data
for five objects using Array of objects and print it.
8) Define wrapper class. Give the following wrapper class methods with syntax and use :
i) To convert integer number to string.
ii) To convert numeric string to integer number.
iii) To convert object numbers to primitive numbers using typevalue ( ) method.
9) Explain following methods of vector class :
i) elementAt ( ) ii) addElement ( ) iii) removeElement ( )
10) Explain following methods of string class with their syntax and suitable example.
i) substring ( ) ii) replace ( )
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
Unit:-III (Inheritance, Interfaces and Packages) Marks-12
------------------------------------------------------------------------------------------------
2 Marks Questions:-
4 Marks Questions:-
www.gunwantmankar.com 4
6) Write a program to implement following hierarchy
Interface: Gross Class: Emplyee
Class:salary
disp_sal ( ), hra
6 Marks Questions:-
www.gunwantmankar.com 5
--------------------------------------------------------------------------------------------
Unit:-IV (Exception Handling & Multithreading ) Marks-12
--------------------------------------------------------------------------------------------
2 Marks Questions:-
4 Marks Questions:-
1) Explain life cycle of thread.
2) Define exception. State built-in exceptions
3) Explain the two ways of creating threads in Java.
4) Define an exception. How it is handled ?
5) Explain thread priority and method to get and set priority values.
6) With suitable diagram explain life cycle of Thread.
7) Describe life cycle of thread.
8) Describe use of ‘throws’ with suitable example.
9) Explain following methods related to threads :
1) suspend ( ) 2) resume ( ) 3) yield ( ) 4) wait ( )
10) What is exception ? How it is handled ? Explain with suitable example.
11) Explain the following clause w.r.t. exception handling :
(i) try (ii) catch (iii) throw (iv) finally
6 Marks Questions:-
1) Write a program to create two threads. One thread will display the numbers from
1 to 50 (ascending order) and other thread will display numbers from 50 to 1
(descending order).
2) Write a program to input name and salary of employee and throw user defined
exception if entered salary is negative
3) Write a program to create two threads one thread will print even no. between 1 to
50 and other will print odd number between 1 to 50.
4) Write a program to input name and age of a person and throws an user define
exception if entered age is negative.
www.gunwantmankar.com 6
5) What is thread priority ? How thread priority are set and changed ? Explain with
example.
6) Write a program to input name and age of person and throws user defined
exception, if entered age is negative .
7) Write a program to create two threads ; one to print numbers in original order and
other to reverse order from 1 to 50.
8) What are different types of error ? What is use of throw, throws and finally
statement?
9) Write a program to accept password from user and throw ‘Authentication failure’
exception if password is incorrect.
10) Explain life cycle of thread with a neat diagram.
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
Unit:-V (Java Applets & Graphics Programming) Marks-10
------------------------------------------------------------------------------------------------
2 Marks Questions:-
1) Give the syntax of < param > tag to pass parameters to an applet.
4 Marks Questions:-
1) Describe the use of following methods: (i) Drawoval ( ) (ii) getFont ( ) (iii)
drawRect ( ) (iv) getFamily ( )
2) Differentiate between Java Applet and Java Application ( any four points)
3) Write a syntax and example of (i) drawRect( ) (ii) drawoval( )
4) Explain life cycle of Applet.
5) Write syntax and example of 1) drawString ( ) 2) drawRect ( ) ; 3) drawOval ( )
4) drawArc ( ).
6) Describe following states of applet life cycle :
a) Initialization state. b) Running state. c) Display state
7) State the use of font class. Describe any three methods of font class with their syntax
and example of each.
8) Differentiate applet and application with any four points.
9) State syntax and explain it with parameters for : i)drawRect ( ) ii) drawOral ( )
www.gunwantmankar.com 7
10) Design an Applet program which displays a rectangle filled with red color and
message as “Hello Third year Students” in blue color.
11) Describe applet life cycle with suitable diagram.
12) Differentiate between applet and application (any 4 points).
6 Marks Questions:-
1) Describe the applet life cycle in detail.
2) Explain how to pass parameter to an applet? Write an applet to accept username in
the form of parameter and print “Hello <username>”.
3) Explain <PARAM> Tag of applet with suitable example.
4) State the use of font class. Describe any three methods of font class with their syntax
and example of each.
5) Write a simple applet program which display three concentric circle.
6) Write method to set font of a text and describe its parameters.
7) Write the syntax and example for each of following graphics methods : 1) drawPoly
( ) 2) drawRect ( ) 3) drawOval ( ) 4) fillOval ( )
8) State the use of Font class. Write syntax to create an object of Font class.
9) Describe any 3 methods of Font class with their syntax and example of each.
10) Write syntax and example of following Graphics class methods : (i) drawOval( ) (ii)
drawPolygon( ) (iii) drawArc( ) (iv) drawRect( )
11) Differentiate between applet and application and also write a simple applet which
display message ‘Welcome to Java’.
How can parameters be passed to an applet ? Write an applet to accept user name in the form
of parameter and print ‘Hello < username >’.
------------------------------------------------------------------------------------------------
Unit:-VI (Managing I/O Files in Java) Marks- 08
------------------------------------------------------------------------------------------------
2 Marks Questions:-
1) Define stream class. List its types.
www.gunwantmankar.com 8
4 Marks Questions:-
1) Distinguish between Input stream class and output stream class
2) Write a program to count number of words from a text file using stream classes
3) Write a program to copy content of one file to another file.
4) Explain the following classes. (i) Byte Stream Class (ii) Character Stream Class
5) Write any two methods of file and file input stream class each.
6) Write a program to copy contents of one file to another file using character stream
class.
7) What are stream classes ? List any two input stream classes from character stream.
8) What are stream classes ? List any two input stream classes from character stream
9) Explain serialization with stream classes.
10) Explain serialization in relation with stream class.
11) Write syntax and function of following methods of Date class :
i) getTime ( ) ii) getDate ( )
13) State syntax and describe any two methods of map class.
14) Write any four mathematical functions used in Java.
15) What is use of stream classes ? Write any two methods FileReader class.
16) Write syntax and function of following methods of date class :
1) sethme ( ) 2) getDay ( )
17) What is use of setclass ? Write a program using setclass.
18) What are streams ? Write any two methods of character stream classes.
19) Write any two methods of File and FileInputStream class each.
20) What is use of ArrayList Class ? State any three methods with their use from
ArrayList.
21) What is use of Array list class ? State any two methods with their use from Array
List.
22) Explain serialization in relation with stream classes.
6 Marks Questions:-
1) Write a program to perform following task.
(i) Create a text file and store data in it.
(ii) Count number of lines and words in that file.
--------------------------------------------------End------------------------------------------------------
www.gunwantmankar.com 9