Answered step by step
Verified Expert Solution
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
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,16Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started