Leave a message
Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 0d 11h 47m 57s Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

C++ Institute Exam CPA-21-02 Topic 2 Question 30 Discussion

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

What happens when you attempt to compile and run the following code?

#include

using namespace std;

int main() {

float i = 1.0 / 2 * 2 / 1 * 2 / 4 * 4 / 2;

cout << i;

return 0;

}

Show Suggested Answer Hide Answer
Suggested Answer: C

Contribute your Thoughts:

Ria
4 months ago
I love how they try to make these questions so tricky. 'Protected' all the way, baby!
upvoted 0 times
Miesha
3 months ago
Definitely protected, no doubt about it.
upvoted 0 times
...
Miesha
3 months ago
I agree, 'protected' is the correct answer.
upvoted 0 times
...
Miesha
4 months ago
I think it will be protected.
upvoted 0 times
...
...
Andra
4 months ago
Haha, 'None of these'? Seriously? They're just trying to trick us, aren't they?
upvoted 0 times
Derick
3 months ago
They're definitely trying to test our understanding of inheritance.
upvoted 0 times
...
Keva
3 months ago
D) None of these
upvoted 0 times
...
Marshall
3 months ago
C) protected
upvoted 0 times
...
Esteban
4 months ago
B) private
upvoted 0 times
...
Freeman
4 months ago
A) public
upvoted 0 times
...
...
Meghann
4 months ago
Of course it's 'protected'! What else could it be? I could do this in my sleep.
upvoted 0 times
Merlyn
4 months ago
Of course it's 'protected'! What else could it be? I could do this in my sleep.
upvoted 0 times
...
Marget
4 months ago
D) None of these
upvoted 0 times
...
Benedict
4 months ago
C) protected
upvoted 0 times
...
Vilma
4 months ago
B) private
upvoted 0 times
...
Billy
4 months ago
A) public
upvoted 0 times
...
...
Barrie
5 months ago
Hmm, I'm pretty sure the answer is 'C) protected'. That's how inheritance works, you know.
upvoted 0 times
...
Chandra
5 months ago
The variable 'y' will be 'protected' in class B, since it is declared as 'protected' in the base class A.
upvoted 0 times
Luisa
4 months ago
C) protected
upvoted 0 times
...
Dona
4 months ago
B) private
upvoted 0 times
...
Bea
4 months ago
A) public
upvoted 0 times
...
...
Minna
5 months ago
I agree with Pearlie. Since class B is inheriting from class A, 'y' will remain protected.
upvoted 0 times
...
Pearlie
6 months ago
I think variable 'y' will be protected in class B.
upvoted 0 times
...

Save Cancel
a