VJAimportantQuestionsJava
VJAimportantQuestionsJava
1. Write a Java program to find out the even numbers from 1 to 100 using
for loop.
2. Write a java applet to display the following output in red color.
3. Enlist the logical operators in Java.
4. Give the syntax and example for the following functions: i) min() ii)
sqrt()
5. Define the interface in Java.
6. Enlist any four inbuilt packages in Java.
7. Explain any two methods of File Class.
8. Write syntax of ellipse.
9. Enlist any four compile time errors.
10. Explain any four features of Java.
11. Write a Java program to copy the content of one file into another.
12. Write the difference between vectors and arrays. (Any four
points)
13. Explain exception handling mechanism w.r.t. try, catch, throw
and finally.
14. Explain any four visibility controls in Java.
15. Draw and explain life cycle of Thread.
16. Explain how to create a package and how to import it.
17. Write a Java program using two threads: A (even 1–50, sleep
after 3 iterations), B (odd 1–50).
18. What is constructor? List types of constructors. Explain
parameterized constructor with example.
19. Write a Java program to count the number of words from a text
file using stream classes.
20. Explain the difference between String class and StringBuffer
class. Also explain any four methods of String class.
21. Write a Java applet to draw a bar chart for the given values.
22. Explain: i) drawLine ii) drawOval iii) drawRect iv) drawArc
23. Write a Java program to sort a 1-D array in ascending order using
bubble sort.
24. Explain switch case and conditional operator with examples.
25. Explain single and multilevel inheritance with example.
26. Define constructor. List its types.
27. Define class and object.
28. List the methods of FileInputStream class.
29. List any four Java API packages.
30. Define array. List its types.
31. List access specifiers in Java.
32. Define a class Circle with PI and radius. Accept and display data,
calculate area.
33. Define exception. State built-in exceptions.
34. Explain life cycle of Applet.
35. Differentiate between class and interface.
36. Define type casting. Explain its types with syntax and example.
37. Write a program to create a vector with five elements. Insert at
2nd position, remove 1st and 4th.
38. Write a program to create two threads (even and odd numbers 1–
50).
39. Explain how to pass parameter to applet. Write applet to accept
username and print greeting.
40. Implement inheritance with TA, DA, HRA and gross salary.
41. Write a program to: i) Create a text file and store data. ii) Count
number of lines and words.
42. List any eight features of Java.
43. State the use of finalize() method with syntax.
44. Name wrapper class methods for: i) String to int ii) int to String.
45. List types of inheritances in Java.
46. Write the syntax of try-catch-finally blocks.
47. Give the syntax of <param> tag to pass parameters to an applet.
48. Define stream class. List its types.
49. Explain the concept of platform independence and portability.
50. Explain types of constructors with example.
51. Explain two ways of creating threads in Java.
52. Distinguish between InputStream and OutputStream classes.
53. Define class Student with id and name. Accept and display data
for 5 students.
54. Differentiate between Java Applet and Java Application (any four
points).
55. Write a program using two threads: one prints 1–50, another 50–
1.
56. Explain command line arguments with example.
57. Write a program to input employee name and salary. Throw user-
defined exception if salary is negative.
58. Describe any methods of Vector class with syntax.
59. Describe instanceof and dot (.) operators with example.
60. Differentiate between method overloading and overriding.
61. Describe any 4 attributes of <applet> tag.
62. Design an applet that displays a blue rectangle and red “MSBTE
EXAM” text.
63. Write an applet to accept Account No and balance as parameters
and print “Low balance” if <500.
64. Design an applet to check if password has more than 8
characters.
65. Write a program to accept password and throw “Authentication
Failure” exception if incorrect.
66. Write a program to input customer name and balance. Throw
exception if balance <1500.
67. Define a “No match Exception” thrown when string is not equal
to “MSBTE”.
68. Write a program to create package Math_s with classes Addition
and Subtraction.
69. State three uses of final keyword.
70. Write a program to demonstrate multiple inheritance using
interfaces.
71. Explain multilevel inheritance with example.
72. Define class Student and create two objects using different
constructors.
73. Write a program to define class Employee. Accept 5 employees
and display one with highest salary.
74. Define a class Book. Accept and display data for 7 objects using
array of objects.
75. Write a program to demonstrate garbage collection using
finalize() and gc() method.
76. Describe types of variables in Java with scope.
77. Write all primitive data types in Java with storage size.
78. Write a program to reverse a string using StringBuffer.
79. Define an abstract class Shape. Derive classes Circle and
Rectangle, override area() method.
80. Write a program to print all Armstrong numbers from 0 to 999.
81. Develop an interface with methods for Simple and Compound
Interest. Implement them.
82. Create a program to demonstrate method overloading.
83. Define static block and explain its use with example.
84. Write a program using array of objects to store and display
information of students.
85. Create a class for employee details with method overloading.
86. Write a Java program to demonstrate use of super and this
keywords.