• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

C++ question...

 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK guys, see if you can help me with this. This is C++, but C++ is so much like java. I ran across this question and it is boggling my brain.
Read this partial code and see if you can figure out the answer, and why you chose that answer. I'd appreciate any help you can give me.

class Bicycle
{
Unknown,
RubberCore,
Tube,

};

WheelTypes Wheel;
};
Bicycle b;

Which of the following lines of code will generate a syntax error based on the sample code shown above?

a. b.Wheel = b. Tube
b. b.Wheel = Bicycle::WheelTypes::RubberCore;
c. b.Wheel = WheelTypes::Tube;
d. b.Wheel = Bicycle::Unknown;
e. None of the above will generate an error
_____________________________________________________________________
 
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you trying to ruffle someone's feathers?


Actually, while it is true that Java is often used to mean coffee in general, the word itself originally referred to the island of Java in Indonesia. You see, the Dutch stole a tree from the Arabian port of Mocha and carried it across the ocean to Java, and eventually...actually, just Google it yourself, and while you're at it, you may find better help for your question at any C++ forums that Google helps you to find. Happy hunting!
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to general computing since this has nothing to do with Java.
 
Ranch Hand
Posts: 985
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Stephen Huey:
Are you trying to ruffle someone's feathers?


Actually, while it is true that Java is often used to mean coffee in general, the word itself originally referred to the island of Java in Indonesia. You see, the Dutch stole a tree from the Arabian port of Mocha and carried it across the ocean to Java, and eventually...actually, just Google it yourself, and while you're at it, you may find better help for your question at any C++ forums that Google helps you to find. Happy hunting!



I heard on a different thread that Sun wanted to originally use the name �C#.� instead of Java. Unfortunately, Microsoft already had dibs on C#. I also heard that James Goslin�s wife is from the Java island of Indonesia. As you can see, the stories have sort of become urban legends.

Personally, I like to think that Java is an acronym that means Just-Another-Vague-Acronym.
[ October 26, 2004: Message edited by: Jesse Torres ]
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rose, could you please make sure if the piece of code that you have posted is correct? I see that the # of left curly braces in it does not match the # of right ones. That's a syntax error, and it's not in the answer options.
[ October 26, 2004: Message edited by: Dmitry Melnik ]
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not just that, but the code is all incomplete...

class Bicycle
{
Unknown,
RubberCore,
Tube,

};

is just a fragment of a variable declaration section... What type are these members?

If this is all, a bicycle has no wheels so b.Wheel will generate an error.
Therefore answers a through e are all incorrect.
In fact, the answer should be f) compiler error <syntax error>
 
Dmitry Melnik
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What type are these members?

int
 
Rose Evans
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, that is all the code that I have to work with.
It's supposed to be a snippet of a code and I am supposed to figure out which of the following lines of code will generate a syntax error based on this sample code. I have no clue!!! I am so clueless to C++. It drives me insane!!! Any help would be greatly appreciated!
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
based on that code it's impossible to tell, see my previous post why...

Either it's a trick question where none of the answers is correct and they want you to figure that out or the question itself is incorrect.
 
Rose Evans
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you're exactly right. Even my Instructor who gave it to me didn't know the answer, so I know my poor burned out brain couldn't have figured it out.
 
Rose Evans
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And guess what? Now I have another one to figure out. I think I can handle this one though....key word - think.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!