All Computer Science Resources
Example Questions
Example Question #2 : Implementation Techniques
Class Person {
int height;
float weight;
public:
int getHeight();
void setHeight(int);
float getWeight();
void setWeight(float);
};
What is the access level of height
and weight
?
Possible Answers:
protected
friend
public
virtual
private
Correct answer:
private
Explanation:
Until an access specifier is given, all class members are implicitly private. All members defined after an access specifier is used will will have that access level until another access specifier is explicitly invoked. Since no access specifier was used, weight
and height
are automatically private.
Note that virtual
is not an access keyword.
Michael
Certified Tutor
Certified Tutor
University of Phoenix-Online Campus, Bachelor of Science, Computer and Information Systems Security. University of Phoenix-On...
Sio
Certified Tutor
Certified Tutor
University of Phoenix, Bachelor of Science, Computer Science. The University of Texas at Arlington, Master of Science, Comput...
All Computer Science Resources
Computer Science Tutors in Top Cities:
Atlanta Computer Science Tutors, Austin Computer Science Tutors, Boston Computer Science Tutors, Chicago Computer Science Tutors, Dallas Fort Worth Computer Science Tutors, Denver Computer Science Tutors, Houston Computer Science Tutors, Kansas City Computer Science Tutors, Los Angeles Computer Science Tutors, Miami Computer Science Tutors, New York City Computer Science Tutors, Philadelphia Computer Science Tutors, Phoenix Computer Science Tutors, San Diego Computer Science Tutors, San Francisco-Bay Area Computer Science Tutors, Seattle Computer Science Tutors, St. Louis Computer Science Tutors, Tucson Computer Science Tutors, Washington DC Computer Science Tutors
Popular Courses & Classes
GMAT Courses & Classes in Washington DC, GMAT Courses & Classes in Chicago, ISEE Courses & Classes in Phoenix, LSAT Courses & Classes in Miami, ACT Courses & Classes in New York City, ACT Courses & Classes in San Francisco-Bay Area, LSAT Courses & Classes in Los Angeles, Spanish Courses & Classes in Seattle, SSAT Courses & Classes in Miami, SSAT Courses & Classes in Chicago
Popular Test Prep
SAT Test Prep in Denver, SSAT Test Prep in Los Angeles, SSAT Test Prep in New York City, LSAT Test Prep in San Diego, GRE Test Prep in New York City, GMAT Test Prep in Chicago, GMAT Test Prep in Los Angeles, LSAT Test Prep in Washington DC, MCAT Test Prep in Chicago, ACT Test Prep in San Francisco-Bay Area
![Learning Tools by Varsity Tutors](https://vt-vtwa-app-assets.varsitytutors.com/assets/problems/og_image_practice_problems-9cd7cd1b01009043c4576617bc620d0d5f9d58294f59b6d6556fd8365f7440cf.jpg)