177k views
4 votes
Basic Inheritance. Set the course student's last name to Smith, age in years to 20, and ID number to 9999. What will be the sample output for the given program?

a) Last Name: Johnson, Age: 22, ID: 1234
b) Last Name: Smith, Age: 20, ID: 9999
c) Last Name: Brown, Age: 18, ID: 5678
d) Last Name: Miller, Age: 25, ID: 8888

1 Answer

4 votes

Final answer:

The correct sample output after setting the student's attributes (last name, age, ID) in the program is 'Last Name: Smith, Age: 20, ID: 9999', which corresponds to option b).

Step-by-step explanation:

The provided schoolwork question relates to a basic understanding of object-oriented programming concepts, specifically, the concept of inheritance. When setting the attributes of an object in a program, one would typically use setter methods or direct assignment to change the object's state. Considering the instructions to set the last name to Smith, age to 20, and ID number to 9999, the correct sample output for the given program would be:

  • Last Name: Smith
  • Age: 20
  • ID: 9999

Hence, the correct answer to what the sample output will be is option b) Last Name: Smith, Age: 20, ID: 9999.

User Neleus
by
7.5k points