$25
Answer at least any 10 questions – maximum 100 marks. Each question is worth 10 marks. You must score at least 50 to pass the assignment.
1. Write a Java program that highlights file I/O operations in Java.
2. Write a program that exemplifies the difference between data streams and object streams.
3. Write a program that searches for a particular file name in a given directory.
4. Write a program named “MyQueue.java,” and implement some of the key Queue methods such as enterQueue() and leaveQueue(). The restriction, however, is that MyQueue should use only a stack to store and retrieve elements.
5. Write a program named “MyStack.java,” and implement some of the key Stack methods such as pop() and push(). The restriction, however, is that MyStack should use only an ArrayList class to store and retrieve elements.
6. How does Java allocate memory and manage memory dynamically to run programs in java?
7. What is a hashtable? Explain its use with an example program.
8. What is a circular linked list? Explain its use with an example program.
9. What is enumeration in Java? Explain its use with an example program.
10. Write a program to reverse characters in a string using a stack.
11. Write a program to reverse worlds in a sentence using a vector.
12. Write a program to reverse sentences (demarked by a period) in a paragraph (demarked by an empty line input from the console) using any list of your choice.
13. Create a vector that stores N numbers. Input N non-negative numbers through the console into the array. Then create another vector that stores only M prime numbers from the N numbers.
14. Explain JButton with an example program.
15. Explain MultiListener with an example program.
16. Create a password entry application that accepts the password but only shows the number of characters entered so far. Then, add a button that allows the user to toggle between seeing the password and seeing the number of characters in the same password field.
17. Create a Java program that employs a MouseListener in a dialog component.
18. Create an application that uploads the contents of a web page to a scrollable pane.
19. Write an applet that handles any two types of exceptions.
20. Create an applet that computes the body mass index (BMI). Refer to http://en.wikipedia.org/wiki/Body_mass_index for more information on BMI. Also, add a ‘help’ button that shows information on BMI.
21. Create an applet that presents information on supernovas. Refer to http://en.wikipedia.org/wiki/Supernova for additional information on supernovas. The applet should present a list of names of a number of supernovae. Once a name is clicked, information corresponding to that supernova (including a picture of it, if available) should be shown in a separate pane.
22. Create an applet that loads its own source code in a container.
23. First, pick any demo of your choice from http://docs.oracle.com/javase/tutorial/uiswing/examples/components/index.html#DynamicTreeDemo. In your own words, briefly describe how some of the Swing components have been used in the selected demo.
24. Write a program that reads words separated by spaces from a text file and displays words in ascending order. (If two words are the same, display only one). Pass the text filename from the command line. Assume that the text file contains only words separated by spaces.
25. In Java, a set is a collection that holds unique values. Adding a value that already exists in the set has no effect on the set. Write a class named “MySet.java”. In this class, create a set using HashSet (hint: set s = new HashSet();). From the console, add five values to the set s. Then prompt the user for a single value and search for this value in set s. Print the result of this search. Finally, using an iterator, print all the values in the set s.