Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
666 views

Java Programming Question Bank

This document contains questions from 6 units that cover key Java programming concepts: 1. The first unit covers basic Java syntax like features, type casting, variables, classes, loops, operators, and methods. 2. The second unit builds on this with derived syntax like command line arguments, methods, strings, arrays, collections, and access modifiers. 3. The third unit introduces object-oriented concepts like inheritance, interfaces, packages, and polymorphism. 4. The fourth unit covers exception handling, multithreading, and thread methods. 5. The fifth unit focuses on Java applets, the applet lifecycle, graphics methods, and passing parameters. 6. The final

Uploaded by

shital7028733151
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
666 views

Java Programming Question Bank

This document contains questions from 6 units that cover key Java programming concepts: 1. The first unit covers basic Java syntax like features, type casting, variables, classes, loops, operators, and methods. 2. The second unit builds on this with derived syntax like command line arguments, methods, strings, arrays, collections, and access modifiers. 3. The third unit introduces object-oriented concepts like inheritance, interfaces, packages, and polymorphism. 4. The fourth unit covers exception handling, multithreading, and thread methods. 5. The fifth unit focuses on Java applets, the applet lifecycle, graphics methods, and passing parameters. 6. The final

Uploaded by

shital7028733151
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Java Programming-22412

Question Bank
UNIT – I - BASIC SYNTACTICAL CONSTRUCTS IN JAVA (10 Marks)

1. Explain any four features of java programming.

2. What is type casting? Explain its types with proper syntax and example.

3. State & explain scope of variable with an 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.

6. Explain following bitwise operator with an example :

 left shift operator


 right shift operator

7. Explain any two relational operators in Java with example.

8. Write a program to find sum of digit of number entered by user.

9. Write all primitive data types available in Java with their storage sizes in bytes.

10. Write a program to generate Fibonacci series 1 1 2 3 5 8 13 21 34 55 89.

11. Why java became platform independent language? Explain.

12. Write a program to check wheater given number is prime or not.

13. Write a program to print the following output :

11111

2222

333

44

14. Illustrate with example the use of switch case statement.

15. Explain any four mathematical functions


16. Explain with example labeled for loop

UNIT – II – DERIVED SYNTACTICAL CONSTRUCT IN JAVA (18 Marks)

1. Write a program to accept two numbers as command line arguments and print the

addition of those numbers.

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

access modes. Assume suitable data, if any.

4. State & explain scope of variable with an example.

5. Explain byte stream class in detail.

6. Write a java program to implement following functions of string :

a. Calculate length of string

b. Compare between strings

c. Concatenating strings

7. Enlist types of constructor. Explain any two with example.

8. Explain Array list & Iterator methods of collections with an example.

9. Write a program to add 2 integer, 2 string and 2 float objects to a vector.

10. Remove element specified by user and display the list.

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.

13. State three uses of final keyword.

14. What is garbage collection in Java ? Explain finalize method in Java.

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.

18. Describe following string class method with example :

(i) compareTo( )

(ii) equalsIgnoreCase( )

19. What is the use of wrapper classes in Java ? Explain float wrapper with its methods.

20. Describe access control specifiers with example.

21. Define a class and object. Write syntax to create class and object with an example.

UNIT – III – INHERITANCE, INTERFACE AND PACKAGE (12 Marks)

1. Which are the restrictions present for static declared methods?

2. Explain how interface is used to achieve multiple Inheritances in Java.

3. Write a java program to implement multilevel inheritance with 4 levels of hierarchy.

4. Which are the ways to access package from another package? Explain with example.

5. Write a java program to extend interface assuming suitable data.

6. Write a java program to implement runnable interface with example.

7. How to add new class to a package? Explain with an example.

8. What is single level inheritance? Explain with suitable 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.

12. Write a program to implement following inheritance :


13. List any four built-in packages from Java API along with their use.

14. Explain inheritance and polymorphism features of Java.

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.

17. Explain method overriding with suitable example

18. What is importance of super and this keyword in inheritance ? Illustrate with suitable

example.

19. Write a single program to implement inheritance and polymorphism in java.

20. Explain concept of nesting of interface.

21.Explain dynamic method dispatch.

22. What is Iterator class ? Give syntax and use of any two methods of Iterator class.

UNIT – IV – EXCEPTION HANDLING AND MULTITHREADING (12 Marks)

1. What is thread ? Draw thread life cycle diagram in Java.

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

Failure” exception if the password is incorrect.

4. Write a program to input name and balance of customer and thread an user defined

exception if balance less than 1500.


5. What is the use of try catch and finally statement give example.

6. What is exception ? Why the exception occurred in program ? Explain with suitable

example.

7. Define throws & finally statements with its syntax and example.

8. With proper syntax and example explain following thread methods :

(1) wait( ) (2) sleep( ) (3) resume( ) (4) notify( )

9. With syntax and example explain try & catch statement.

10. Explain following clause w.r.t. exception handling :

(i) try (ii) catch (iii) throw (iv) finally

11. Explain following terms :

(i) Thread Priority (ii) Types of Exception

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.

UNIT – V – JAVA APPLETS AND GRAPHICS PROGRAMMING (10 Marks)

1. Explain applet life cycle with suitable diagram.

2. Describe the following attributes of applet :

(i) Codebase (ii) Alt (iii) Width (iv) Code

3. Differentiate between Applet and Application (any 4 points).

4. Write a program to draw a bar chart for plotting students passing percentage in last 5

years.

5. Explain the following methods of applet class :

(i) drawRect() (ii) drawPolygon() (iii) drawArc() (iv) drawRoundRect()

6. Design an applet which accepts username as a parameter for html page and display

number of characters from it.

7. Design an applet which display equals size three rectangle one below the other and fill

them with orange, white and green color respectively.


8. Give the syntax of following methods of graphics class. Explain their use with suitable

program : (i) drawRoundReel() (ii) drawPolygon() (iii) drawOval() (iv) drawString( )

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 :

(1) SetColor( ) (2) SetForeGround( ) (3) getFont( ) (4) setSize( )

13. Define applet. Write a program to create an applet to display message “Welcome to java

applet”.

14. Explain any four applet tag.

15. Explain applet life cycle with suitable diagram.

16. Explain following methods for applet with an example :

a. Passing Parameter to applet

b. Embedding <applet> tags in java code.

17. Write syntax and example of

(i) Draw poly (ii) Draw Rect (iii) Filloval (iv) Draw Arc ( )

18. Explain applet life cycle with suitable diagram.

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

form of parameter and print “Hello <username>”.

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)

1. Write any four methods of file class with their use.

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”.

4. Explain byte stream class in detail.

5. Differentiate between Input stream class and Reader class

6. Explain fileinputstream class to read the content of a file.

7. Write any two methods of file and file input stream class each.

8. Explain Stream Classes

9. Explain OutputStreamClass.

10. Write program to handle primitive data types.

You might also like