Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

H was a participant at a programming event last month. The speaker at the event stated that Polymorphism promotes extensibility. In order to explain

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

H was a participant at a programming event last month. The speaker at the event stated that Polymorphism promotes extensibility. In order to explain how this is possible, the speaker should state all of the following facts except: 1) Software that invokes polymorphic behavior is independent of the object types to which message are sent as long as those types are in the same inheritance hierarchy. 2) New object types that can respond to existing method calls can be incorporated into a system without requiring modification of the base system. 3) The code that instantiates new objects must be modified to accommodate new types. 4) Software that invokes polymorphic behavior is dependent of the object type to which messages are sent. Which method of an exception object provide information about the chain of method calls that led to the exception? 1) printStrackTrace() 2) getMessage() 3) printCallStack() 4) getStackTrace() Study the following code carefully. Select the option that represents the output of this code. Queue q = new LinkedList (); g.add("Ottawa "); g.add("Perth "); g.add("Pembroke "); 21 while (q.size() > 0) { System.out.print(q.remove() + "); } 1) Perth Pembroke Ottawa 2) Ottawa Perth 3) Perth Pembroke 4) Only the third and fourth options are correct 5) None of the answers are correct You just started your work placement at Canada Revenue Agency and your manager presented you with this code snippet. Class Space Travel implements Interface1, Interface2, Interface 3 { // all methods and other necessary items come in here. } While both of you reviewed this code, the supervisor asked you what is wrong with this code? Your answer should be: 1) Methods in this code will not execute because the listed interfaces will clash with one another. 2) This code will execute as long as you choose some methods to implement from the listed interfaces. 3) Nothing is wrong with this code. 4) All of these answers are incorrect. and enable you to specify, with a single method declaration, a set of related methods, or with a single class declaration, a set of related types, respectively. 1) Interface methods and polymorphic classes 2) Abstract classes and generic subclasses 3) Generic methods and generic classes 4) Polymorphic methods and abstract classes The scope of a generic class's type parameter is the entire class and its static members. True / False P was at a workshop organized by his manager at the office today. P was asked if he could use Java generics with primitive types, e.g. ArrayList , His answer should be: 1) Yes 2) No 3) Both yes and no are correct. 4) Both yes and no are incorrect. The expression: Integer.parseInt(textField.getText()) can be used to: 1) Revise the contents of a text field 2) Read the integer contents held by a text field 3) Store the integer content held by a text field 4) Reload the content of a text field In a generic class declaration, the class name is not followed by a type-parameter section True / False What will print out from the program code below? public static void main(String[] args) { } int answer = 42; try { If(answer == 42) { { Throw new Exception("B"); System.out.print("Z"); catch(Exception e) } finally { System.out.print(e.getMessage()); System.out.prin(e.getMessage()); } finally { } System.out.print("G"); System.out.print("A"); 1) BZGA 2) BGA 3) ZBGA 4) GBA

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting

Authors: Carl s. warren, James m. reeve, Philip e. fess

21st Edition

978-0324400205, 324225016, 324188005, 324400209, 9780324225013, 978-0324188004

More Books

Students also viewed these Programming questions