Java Programming Question Bank
Java Programming Question Bank
Question Bank
UNIT – I - BASIC SYNTACTICAL CONSTRUCTS IN JAVA (10 Marks)
2. What is type casting? Explain its types with proper syntax and example.
4. Define a class and object. Write syntax to create class and object with an Example.
5. Write a java program to display all the odd numbers between 1 to 30 using for loop & if
statement.
9. Write all primitive data types available in Java with their storage sizes in bytes.
11111
2222
333
44
1. Write a program to accept two numbers as command line arguments and print the
2. Write a program to accept number from command line and print square root of the
number.
3. Write a java program to implement visibility controls such as public, private, protected
c. Concatenating strings
11. Explain the following methods of string class with syntax and example :
(i) substring()
(ii) replace()
12. What is Iterator class ? Give syntax and use of any two methods of Iterator class.
15. What is use of ArrayList class ? State any two methods with their use from ArrayList.
16. Write any two methods of array list class with their syntax.
17. Define a class person with data member as Aadharno, name, Panno implement concept of
constructor overloading. Accept data for 5 object and print it.
(i) compareTo( )
(ii) equalsIgnoreCase( )
19. What is the use of wrapper classes in Java ? Explain float wrapper with its methods.
21. Define a class and object. Write syntax to create class and object with an example.
4. Which are the ways to access package from another package? Explain with example.
9. What is package? State how to create and access user defined package in Java.
10. What is meant by interface? State its need and write syntax and features of interface.
11. What is Iterator class? Give syntax and use of any two methods of Iterator class.
15. What is the multiple inheritance ? Write a java program to implement multiple inheritance.
16. What is package ? How do we create it ? Give the example to create and to access
package.
18. What is importance of super and this keyword in inheritance ? Illustrate with suitable
example.
22. What is Iterator class ? Give syntax and use of any two methods of Iterator class.
2. What is thread priority ? Write default priority values and methods to change them.
3. What is exception ? WAP to accept a password from the user and throw “Authentication
4. Write a program to input name and balance of customer and thread an user defined
6. What is exception ? Why the exception occurred in program ? Explain with suitable
example.
7. Define throws & finally statements with its syntax and example.
12. Write a program to create two threads, so one thread will print even numbers between 1 to
10 whereas other will print odd numbers between 11 to 20.
4. Write a program to draw a bar chart for plotting students passing percentage in last 5
years.
6. Design an applet which accepts username as a parameter for html page and display
7. Design an applet which display equals size three rectangle one below the other and fill
9. Enlist any four built in packages in java API with atleast two class name from each
package.
10. How to pass parameter to an applet ? Write an applet to accept Account No and balance
in form of parameter and print message “low balance” if the balance is less than 500.
11. Write a applet program to set background with red colour and fore ground with blue
color.
12. With proper syntax and example explain following graphics methods :
13. Define applet. Write a program to create an applet to display message “Welcome to java
applet”.
(i) Draw poly (ii) Draw Rect (iii) Filloval (iv) Draw Arc ( )
19. Write a program to create an applet for displaying circle, rectangle and triangle one
below the other & filled them with red, green and yellow respectively
20. How can parameters be passed to an applet ? Write an applet to accept username in the
21. Design an applet which displays rectangle filled with blue colour and display message as
“MSBTE EXAM” in red colour below it.
UNIT – VI – MANAGING INPUT OUTPUT FILES IN JAVA (08 Marks)
2. Write any four methods of File Input stream class give their syntax.
3. Write a java program to copy the content of the file “file1.txt” into new file “file2.txt”.
7. Write any two methods of file and file input stream class each.
9. Explain OutputStreamClass.