Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

C++ Institute CPA-21-02 Exam - Topic 1 Question 8 Discussion

What will variable "y" be in class B?class A {int x;protected:int y;public:int age;};class B : public A {string name;public:void Print() {cout
C) protected
A) public
B) private
D) None of these

C++ Institute CPA-21-02 Exam - Topic 1 Question 8 Discussion

Actual exam question for C++ Institute's CPA-21-02 exam
Question #: 8
Topic #: 1
[All CPA-21-02 Questions]

What will variable "y" be in class B?

class A {

int x;

protected:

int y;

public:

int age;

};

class B : public A {

string name;

public:

void Print() {

cout << name << age;

}

};

Show Suggested Answer Hide Answer
Suggested Answer: C

Contribute your Thoughts:

0/2000 characters
Rhea
8 months ago
None of these options seem right to me.
upvoted 0 times
...
Isidra
9 months ago
Wait, so y is still accessible? That's interesting!
upvoted 0 times
...
Leanna
9 months ago
I thought it would be private?
upvoted 0 times
...
Portia
9 months ago
Definitely protected! Makes sense.
upvoted 0 times
...
Corazon
9 months ago
y is protected in class B.
upvoted 0 times
...
Genevieve
10 months ago
I'm confused about this one. I thought protected members could be accessed in derived classes, but I don't remember if that applies here.
upvoted 0 times
...
Mitzie
10 months ago
This seems similar to a practice question we did on inheritance. I think "y" remains protected, but I might be mixing it up with another example.
upvoted 0 times
...
Joanne
10 months ago
I remember something about access specifiers, and I feel like "y" should be accessible in class B, but I can't recall if it changes to private.
upvoted 0 times
...
Alise
10 months ago
I think "y" is protected in class B since it inherits from class A, but I'm not entirely sure how that affects access.
upvoted 0 times
...
Nu
10 months ago
Hmm, I'm not entirely confident about this one. I'll need to review the access modifier rules for inheritance to make sure I'm not missing anything.
upvoted 0 times
...
Alpha
10 months ago
I've got this! Since 'y' is declared as protected in class A, and class B inherits publicly from A, 'y' will be accessible as protected in class B. The answer is C.
upvoted 0 times
...
Hortencia
10 months ago
I'm a bit unsure about this one. The access modifiers can get confusing, especially when dealing with inheritance. I'll need to double-check the rules to be sure.
upvoted 0 times
...
Mirta
10 months ago
Okay, let me think this through step-by-step. Class A has a protected member 'y', and class B inherits publicly from A. So 'y' should be accessible in B, right?
upvoted 0 times
...
Gearldine
10 months ago
Hmm, this looks like a tricky inheritance question. I'll need to carefully consider the access modifiers to determine the visibility of the variable 'y' in class B.
upvoted 0 times
...
Tiera
10 months ago
I'm pretty sure option D is not the right answer here. Locating the email sends in the Tracking tab within Email Studio won't give me the list of subscribers I need. I think I'll go with either option A or C, depending on how comfortable I feel with the criteria.
upvoted 0 times
...
Lorriane
10 months ago
Based on my understanding of Okta's capabilities, SAML is definitely a supported SSO protocol in their integration network. I'll select 'Yes' for this.
upvoted 0 times
...
Emeline
11 months ago
I'm a bit confused by this question. Acquiring a golf club overseas seems like a really big move for a club that's struggling with cash flow. I think I'd focus on the more straightforward options like the free trial or the referral program.
upvoted 0 times
...

Save Cancel