Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

17) When declared as protected, data in an object can be accessed a) By that class's methods and by all of its subclasses b) Only

image text in transcribed
image text in transcribed
17) When declared as protected, data in an object can be accessed a) By that class's methods and by all of its subclasses b) Only by that class's methods. c) By any class. d) None of the above 18) Consider the following recursive code snippet: public int mystery (int n, int m) if (n 0) return 0; if (n 1) return m; return m + mystery (n 1, m) : What value is returned from a call to mystery (3, 6)? a) 3 b) 6 c) 18 d) 729 19) A stack is a collection that a) remembers the order of elements, and allows elements to be added and removed only at one end. b) does not remember the order of elements but allows elements to be added in any position. c) remembers the order of elements and allows elements to be inserted in any position. d) remembers the order of elements and allows elements to be inserted only at one end and removed only at the other end. 20) What is included in a linked list node? a reference to its neighboring nodes. Il an array reference III a data element a) I b) II c) II and III d) I and III 6. 21) Consider the following code snippet: LinkedList words = new LinkedList (); words.addLast ("abc") ; words.addLast ("def"); words.addLast ("ghi"); System.out.print (words.removeLast (0); System.out.print (words.removeFirst ()); System.out.print (words.removeLast ()); What will this code print when it is executed? a) abcdefghi b) ghiabcdef c) abcghidef d) defghiabc 22) What is the meaning of the type parameter E, in the LinkedList code fragment? a) The elements of the linked list are of class E. b) The elements of the linked list are of any subclass of class E. c) The elements of the linked list are any type supplied to the constructor. d) The elements of the linked list are of class object

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions