Question

True or False? 1. In the program stack, the second record on the stack belongs to...

True or False?

1. In the program stack, the second record on the stack belongs to the method that called the current method.

2. The ArrayDeque class implements the Stack interface.

3. You should always trace a recursive method to ensure it is correct.

4. An iterator that is implemented as an inner class of a list ADT has direct access to the ADT’s data fields.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1.)

  • The program stack a called function is being executed look like:

local of current function <- top of stack

return addresses

parameters of current function

local of calling function

return addresses

parameters of calling function.

  • The first three elements is activation record for current method and the next three elements is activation record for calling method.
  • So, the second record, infact belongs to the calling method.
  • Answer: True

2.)

  • ArrayDeque implements these interfaces:
  • Serializable, Cloneable, Iterable<E>, Collection<E>, Deque<E>, Queue<E>
  • They do not implemetn Stack interface.
  • Answer: False

3.)

  • No, we do not have to trace recursive functions all the time, when the recuirive formula is knows, it can be implemented directly. The tracing might be costly when there are huge number of recursions.
  • Answer: False

4.)

  • Yes, an inner iterator class has direct access to ADT's data. This is a basic property of classes, any inner class can access the data of outer class.
  • Answer: True.
Add a comment
Know the answer?
Add Answer to:
True or False? 1. In the program stack, the second record on the stack belongs to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT