Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need a full explanation thanks 7. The Rational class example covered during the course has 2 instance variables of type int corresponding to the numerator

image text in transcribed

Need a full explanation thanks

7. The Rational class example covered during the course has 2 instance variables of type int corresponding to the numerator and denominator respectively. Consider the following: public void run() { Rational a = new Rational(1,6); Rational b = new Rational (2,6); Rational c = new Rational(1,3); Rational d = new Rational(1,6); Rational sum = a.add(b).add(c).add(d); Exam Version 1 - October 19, 2018 Name: Student ID: Assuming the overhead of representing an object in memory is negligible, how many bytes of memory are allocated on the heap and stack respectively on execution of the last statement in run()? You may assume that object references require 4 bytes. a. 56,20 b. 56,16 c. 40,20 d. 48,16 e. 40,16 Answer: 7. The Rational class example covered during the course has 2 instance variables of type int corresponding to the numerator and denominator respectively. Consider the following: public void run() { Rational a = new Rational(1,6); Rational b = new Rational (2,6); Rational c = new Rational(1,3); Rational d = new Rational(1,6); Rational sum = a.add(b).add(c).add(d); Exam Version 1 - October 19, 2018 Name: Student ID: Assuming the overhead of representing an object in memory is negligible, how many bytes of memory are allocated on the heap and stack respectively on execution of the last statement in run()? You may assume that object references require 4 bytes. a. 56,20 b. 56,16 c. 40,20 d. 48,16 e. 40,16

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

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

Recommended Textbook for

DB2 9 For Linux UNIX And Windows Advanced Database Administration Certification Certification Study Guide

Authors: Roger E. Sanders, Dwaine R Snow

1st Edition

1583470808, 978-1583470800

More Books

Students also viewed these Databases questions