1. What events do the following components generate?

  • JButton
  • JTextField
  • JComboBox

2. What methods does JTable implement which are required by the interfaces implemented by the JTable class beyond those interfaces implemented by the various parent classes of JTable?

3. Address how the differences among these various layout managers, focusing on their behavior as their container is resized:

  • FlowLayout
  • GridLayout
  • BorderLayout
  • GridBagLayout
  • Absolute Positioning (explain the basic steps required for this manager as well)

4. (Ex 1.8.2) The dining philosophers problem was invented by E. W. Dijkstra, a concurrency pioneer, to clarify the notions of deadlock and starvation freedom. Imagine five philosophers who spend their lives just thinking and feasting. They sit around a circular table with five chairs. The table has a big plate of rice. However, there are only five chopsticks (in the original formulation forks) available, as shown in Fig. 1.5. Each philosopher thinks. When he gets hungry, he sits down and picks up the two chopsticks that are closest to him. If a philosopher can pick up both chopsticks, he can eat for a while. After a philosopher finishes eating, he puts down the chopsticks and again starts to think.

  • What is wrong with everybody doing the following - other than that the philosophers never get up from the table?
1. think for a while
2. get left chopstick
3. get right chopstick
4. eat for a while
5. return left chopstick
6. return right chopstick
7. return to 1
  • How can the above be fixed to avoid deadlocks?
  • Is your solution starvation free? Literally!

5. What imports and methods need to be added to the Filter class (Figure 2.7) to allow the code to compile? What are reasonable implementations requirements of those methods in this class? (See Herlihy and Shavit Chapter 2)

6. NOTE: The issues with the code in Figure 2.9 are the same ones as those in Figure 2.7, so this problem is really the same as problem 5. Do that one and ignore this second one. +++++++ What imports and methods need to be added to the Bakery class (Figure 2.9) to allow the code to compile? What are reasonable implementations requirements of those methods in this class? (See Herlihy and Shavit Chapter 2)

7. In Figure 2.12, the Bounded Timestamp System, what denotations (patterns) are used in T4? In T4, how are 020 and 120 related? How many threads can be labeled in TN? (See Herlihy and Shavit Chapter 2)

8. Explain what the JVM does when it encounters a synchronized directive. Hint: consider carefully what is synchronized.

9. What happens when the JVM encounters a wait () call?

10. Describe the environment in which a wait () call is legal?

11. One characteristic of programming languages that varies widely from language to language is how parameters are passed. Among ALGOL, Pascal, Ada, C, C++, Java, and C#, no two languages pass parameters in exactly the same way. Among these languages, choose the one that you believe has adopted the best approach to parameter passing. Defend your decision by outlining the advantages of the approach of the language that you chose and the disadvantages of the approaches taken by other languages.

12. Describe in your own words what multithreading is and how can multiple threads run simultaneously on a single-processor system? You don't need to provide code examples, just try to describe the principles in your own words.

13. Almost any real world problem can be formulated in terms of a graph problem (of course, sometimes problems are easier, so, it is no need for a graph). Imagine a real world problem, and map it into the graph representation (clearly state what nodes and edges represent). Define the objective (what is the problem supposed to solve) in both real world and graph terms. If possible, identify (if any) an algorithm which would fit to solve your problem. Please avoid choosing similar problems. There are so many options.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.