C++ Multiple Choice Question.

This topic is 4864 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I'm not new at c++, but when I took the Business Professionals of the US C++ test at my school, this one question stumped me: Which of the following does not have class scope? A. public accesss specifiers B private access specifiers C protected access specifiers D All have class scope The answer is at the bottom, after my quote/ OK. Can any of you technical c++ folks explain the question and the answer to me? I know all about c++ and classes and stuff, but this question makes no sense to me. --- This is why PacMan ruined an entire generation. All those people sitting in dark rooms, eating pills and running away from ghosts. -The Senshi ********************************** The answer is C **********************************

Share on other sites
Weird one. I'd assume it was refering to:

1) using the class keyword, the access specifier classwide is private (private inheritence, private members/functions, etc) unless overridden with the appropriate keyword.

Example:
class foo : bar //privately inherited{    int member; //private scoped};

2) using the struct keyword, the access specifier classwide is public (public inheritence, public members/functions, etc) unless overridden with the appropriate keyword.

3) There is no equivilant to "class" or "struct" with regards to protected access. Although one can use the protected keyword for inheritence or for following members, neither affects the other (thus, it is not "classwide").

Share on other sites
Honestly, that seems wrong to me. D seems like the correct answer, since anything specified as protected is available anywhere within the scope of the class, just like things specified private or public. Maybe theres something in the wording of the question that I'm misinterpreting.

Share on other sites
furthermore the question is simply stupid. Whatever the correct answer may be, knowing or not knowing it is not and indication of your ability to program in C++.

Share on other sites
Quote:
 Original post by Glakfurthermore the question is simply stupid. Whatever the correct answer may be, knowing or not knowing it is not and indication of your ability to program in C++.

I'm in total agreement. That's what I hate about this test- its SO random and doesnt test your c++ skills at all. There was a question about who developed c++ (bjarne strouspoursesatoujasokgd), and there are constant questions not about the actual language but standard library crap like setprecision(). When do you use the console for serious apps and need to use that?

And then they have questions like "What is the standard output function for c?" C?!!?!?! I thought this test was c++!!!! And then they have specific vocab like "What is the extraction operator?" It turned out to be the >>, but I know what it does and that it's overloaded in cin and cout, so why do I have to know its name?

And then its rife with inconsistencies. We had to make a program that averaged grades. In the directions it said "round up to the nearest whole number", which I took to meant 9.1 = 10, but in the sample source code it was revealed that 9.1 = 9, 9.5 = 10.

That's my rant. Thanks for listening.

Share on other sites
Quote:
Original post by ender7771
Quote:
 Original post by Glakfurthermore the question is simply stupid. Whatever the correct answer may be, knowing or not knowing it is not and indication of your ability to program in C++.

...

And then its rife with inconsistencies. We had to make a program that averaged grades. In the directions it said "round up to the nearest whole number", which I took to meant 9.1 = 10, but in the sample source code it was revealed that 9.1 = 9, 9.5 = 10.

That's my rant. Thanks for listening.

"round up to the nearest whole number"
If that was the question then your answer should have been correct.
"round up to the nearest whole number" means as it says.

It should have been stated:
"round to the nearest whole number"

Share on other sites
I have a copy of the test right here, so I know that they explicitly said to "round up", and I know that the source code went out of the way to explain that 9.1 = 9.0 .

Share on other sites
I can feel your frustration. I have been in similar situation where technically inferior people interview you for a programming job and think you are ignorant since they don't have comprehensive view on the topic themselves. Maybe that's what the test was about afterall - to prepare for such interviewers, even though I doubt it was intentional ;)

Share on other sites
Can you send me any contact information about the test and/or its administrators?
I recently reviewed and re-authored a C++ test for a different organization.

This question is awful.
The question misuses C++ terminology.
It uses negative logic.

I don't think access specifiers have class scope. It's not the same idea. Class scope means you can access it using ClassName:: anywhere the class (or an instance of it) is accessible.
Varaibles, typedef’s, member functions, etc... have class-scope. I think access specifiers have block-scope if it even makes sense to talk about thier scope.

Any test question you have to go to the The Standard to answer is no good.

One of the questions on the C test I reviewed actually asked a question where you would only come to the correct conclusion if you knew the precedence rules by heart (there's 16 of them).

Share on other sites
Quote:
Original post by ender7771
Quote:
 Original post by Glakfurthermore the question is simply stupid. Whatever the correct answer may be, knowing or not knowing it is not and indication of your ability to program in C++.

I'm in total agreement. That's what I hate about this test- its SO random and doesnt test your c++ skills at all. There was a question about who developed c++ (bjarne strouspoursesatoujasokgd), and there are constant questions not about the actual language but standard library crap like setprecision(). When do you use the console for serious apps and need to use that?

And then they have questions like "What is the standard output function for c?" C?!!?!?! I thought this test was c++!!!! And then they have specific vocab like "What is the extraction operator?" It turned out to be the >>, but I know what it does and that it's overloaded in cin and cout, so why do I have to know its name?

And then its rife with inconsistencies. We had to make a program that averaged grades. In the directions it said "round up to the nearest whole number", which I took to meant 9.1 = 10, but in the sample source code it was revealed that 9.1 = 9, 9.5 = 10.

That's my rant. Thanks for listening.

You should know most of that information if you want to be a C++ developer. It helps a great deal to be able to precisely communicate what you mean. And knowing/not-knowing what the extraction operators and setprecision are is a indication of your experience with the language. All that is about streams which are definetly used with files and can be used with other things such as strings or sockets. The console is one special case.

Who origianlly developed it ought to be a freebie question! (Bjarne Stroustrup)

They should be extremely precise in what they want you do or answer though.

• What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 18
• 12
• 12
• 11
• 9
• Forum Statistics

• Total Topics
634754
• Total Posts
3019147
×