Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java programming: The follow code applies to the next 3 questions MyModel model;

ID: 3909096 • Letter: J

Question

Java programming:

The follow code applies to the next 3 questions MyModel model; try Fileinput Stream file1n = new FileinputStream ("MyModel.out"); ObjectInputStream in - new ObjectInputStream (fileIn); model(MyModel) in.readObject ) in.close); fileIn.close ); Jcatch (Exception e){ System.out.println("didn' t work") (1) 38. What is likely occurring as part of the following model-view-controller code, where the model con- tains an ArrayList of Book objects? A. only the reference to the model object is read from a file, and not the Books, B. the reference to an ArrayList itself is read from a file, but not the Books, C. the model, ArrayList, and all Books within are read from a file, D. String placeholders are read in, E. none of the above. (1) 39. What is the likely format of "MyModel.out"? A. binary B. text, C. Unicode 16 D. sequential access E. none of the above (1) 40. What does the MyModel class need to do for this to compile? A. contain a method called readobject, B. contain a method called writeobject, C. implement the Serializable interface without any new methods D. all of the above are needed, E. none of the above are needed. (1) 41. What happens when calling on the following method (with header) public static String doSomething (E[] e) with Person[] arrayofPersons = new Person [2]; arrayofPersons [0] = new Person ("Eleanor"); arrayOfPersons [1] -new Person ("Eric"); doSomething (arrayOfPersons) A. it can compile, B. it cannot compile

Explanation / Answer

Answer 38: C, as the ArrayList is impleements serializable interface all objects will be copied

Answre 39:B, it mostly used unix/linux systems and these files are used for logging purpose

Answer 40: C, because here we are performing the serialization so MyModel must implment Serializable interface

Answer 41: A, it will compile because here we are using generics

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote