All Computer Science Resources
Example Questions
Example Question #1 : Information Hiding
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:
virtual
public
private
protected
friend
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.
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
SAT Courses & Classes in San Francisco-Bay Area, SAT Courses & Classes in Chicago, ACT Courses & Classes in Boston, GRE Courses & Classes in Atlanta, ACT Courses & Classes in San Diego, ISEE Courses & Classes in Houston, GMAT Courses & Classes in Dallas Fort Worth, MCAT Courses & Classes in Boston, LSAT Courses & Classes in Boston, MCAT Courses & Classes in Washington DC