Exam PCAP All QuestionsBrowse all questions from this exam
Question 35

A variable stored separately in every object is called:

    Correct Answer: D

    In object-oriented programming, a variable stored separately in every object is known as an instance variable. An instance variable is unique to each instance of a class, meaning that each object of the class can hold different values for this variable. This contrasts with class variables, which are shared among all instances of a class.

Discussion
locloc91Option: D

The answer should be D!?

PygineerOption: D

answer is D

anjuvinayanOption: D

an instance variable is correct answer

SophieSuOption: D

Answer should be D

AdeshinaOption: D

D. an instance variable In object-oriented programming, a variable that is stored separately in every object of a class is called an instance variable. An instance variable is associated with a specific instance of a class, and its value is unique to that instance. This means that if you have two objects of the same class, each object can have its own unique value for an instance variable.

pshdreddyOption: D

Answer should be D

pedrorodrigwezOption: A

Correct Answer is A. Python does not use variables per se, in fact, "variables" in python are just references to objects.

WorkingDaddy

Even so, python.org sayeth: "...instance variables are for data unique to each instance and class variables..." https://docs.python.org/3/tutorial/classes.html So with Python.org's definition of "instance variable" in mind, D is correct. The "just references to objects" thing is, I think, a little beyond the scope of the PCAP exam...?

macxszOption: D

D. an instance variable

TestPythOption: B

A Python class variable is shared by all object instances of a class. Class variables are declared when a class is being constructed. They are not defined inside any methods of a class. Because a class variable is shared by instances of a class, the Python class owns the variable. B IS CORRECT

BrodehOption: A

ANswer is A

FR99Option: D

The Answer is definitely 'D. an instance variable'

puneetkOption: B

Wondering, if Class Variable (B) is the right answer? Its "...A variable stored separately in every Object...", could mean a variable X in class definition, accessed by object O1, O2...On for their own copies.

AshitAdhikari

No. Every object shares a single copy of the class variable. So 'B' cannot be the right answer.

imsaadOption: D

should be D