The output of the given program will be:
Maria is in grade 9
Here’s the reasoning:
- The program creates two instances of the
Students
class:student34
andstudent35
. student34
is initialized with the name "Maria" and grade 10.student35
is initialized with the name "Jane" and grade 9.- The print statement concatenates
student34.name
(which is "Maria") with the string " is in grade ", followed bystr(student35.grade)
(which convertsstudent35.grade
, 9, into a string). - Since the print statement references
student35.grade
, the final output will reflect the grade of student35, which is 9.
Therefore, the correct output is:
Maria is in grade 9