Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 4, 2007, 09:44 PM   #1
bronxbomber92
macrumors regular
 
Join Date: Nov 2006
Learning the "fine" details of C++

Hello, recently I was presented with this test that covers very various details of C++. I found myself not knowing most of the answers, but I did fair well, considering I've only known C++ for a few months. I would like to improve myself, and try to learn about potential pitfalls, optimization, and other fine details of C++. The test is as following, to provide what some information of what i cam talking about. Please keep in mind, I'm not talking about these question in specific, just anything similar to these.

Edit - "Test" has been taken out

So, any sites, or resources that has good information would be highly appreciated!

Thanks,
Jedd

Last edited by bronxbomber92; Jan 5, 2007 at 07:52 PM.
bronxbomber92 is offline   0 Reply With Quote
Old Jan 5, 2007, 12:45 AM   #2
superbovine
macrumors 68030
 
superbovine's Avatar
 
Join Date: Nov 2003
Quote:
Originally Posted by bronxbomber92 View Post
Hello, recently I was presented with this test that covers very various details of C++. I found myself not knowing most of the answers, but I did fair well, considering I've only known C++ for a few months. I would like to improve myself, and try to learn about potential pitfalls, optimization, and other fine details of C++. The test is as following, to provide what some information of what i cam talking about. Please keep in mind, I'm not talking about these question in specific, just anything similar to these.

Please don't post this any where else, I would like to keep it contained
Thanks


So, any sites, or resources that has good information would be highly appreciated!

Thanks,
Jedd

I think this was my c++ final in college.



* What is the difference between between a const global variable and a #define? Where would you use one over the other?

const is a c++ construct that makes a variable constant and unable to change. The difference is it provides strong compile time checking.

* Difference between:
const int * const foo->const pointer integer
const int * foo->pointer integer
int * const foo->const integer pointer



* What is the difference between a recursive function and loops? Give an example of each.
recursive is a function that call itself. There is some math definition, but hell if i remember it.

* Write a bubble sort function
void BubbleSort (int * IntArray, const unsigned int ArraySize)
{
google bubble
}

* What errors would occur in the following code and why?

class Blah
{
private:
int Foo;

public:
Blah() { Foo = 10; }
~Blah() {}
MyFunction ( int &Mobor)
{
Mobor += 10;
}
};

int main( int argc, char **argv)
{
Blah * ptr = 0;
ptr->MyFunction(10);
return 0;
}

calling a method in class that hasn't been instantiated and is isn't a native c++ type. You probably need void in front of my function.

* What does a static variable do in a function?
variables get set and compile time. so when you run your software the static variables are already in memory.

* What is a ring buffer and how does a it differ from a standard queue?
i think a ring buffer is a circular queue which means there is pointer at the points back to the other end.
* What does "in place" mean (regarding algorithms)? Give an example.
no idea

* What are the differences between an Octree, Quadtree and a BSP? What can they be used for?
bsp stores branches of a polygon i believe. I don't what the others do

* Optimise this function:
const int Sum (const int * LotsOfNumbers, const unsigned int Size )
{
int Sum = 0;

for(int i = 0; i < Size; ++i)
{
Sum += LotsOfNumbers[ i ];
}

return Sum;
}

optimize in terms of what?

* The difference between ++i and i++;
++i is run before the line is executed.
i++ is run after.

* Describe a use of a function pointer and suggest other methods to produce the same effect.
pointer is a memory address. it sort of a stupid question.

* What is a template class? What an example that stores an object with a function that squares itself returning the object as a const. Give an example why this would not work with all objects.

i don't the definition.

* What is the difference between an Interface class and an Abstract class?
good question

* What is wrong with the following piece of code and how would you fix it? What would be the result of the error and

why?

class A
{
private:
int *AInt;
public:
A() { AInt = new int(0); } //int nTemp = 0; AInt = &nTemp;
~A() { delete AInt; } // {}
};

class B : public A //class B
{
private:
int *BInt;
public:
B() { BInt = new int(0); }//int nTemp = 0; AInt = &nTemp;
~B() { delete BInt; } //{}
};

Last edited by superbovine; Jan 6, 2007 at 11:28 AM.
superbovine is offline   0 Reply With Quote
Old Jan 5, 2007, 12:51 AM   #3
notjustjay
macrumors 603
 
notjustjay's Avatar
 
Join Date: Sep 2003
Location: Canada, eh?
Google is your friend. For programming related questions and discussion, Google Groups is often better than the web search.

If you want to kick start some discussion, why don't you post some of the answers you gave, and for questions you didn't know how to answer, maybe run through some of your thoughts, best guesses, etc. That way we won't feel like we're doing someone's homework for them, and you'll give people an idea of what you already know.

But I say again, Google is your friend. C++ programming is my profession now, and I use Google to look stuff up just about every day.
__________________
.
notjustjay is offline   0 Reply With Quote
Old Jan 5, 2007, 07:51 PM   #4
bronxbomber92
Thread Starter
macrumors regular
 
Join Date: Nov 2006
Dang, my friend who gave this "self test" Ino, it wasn't homework), requests me not to share it. So I have to edit the post, and superbovine, if you could edit the questions out, I would appreciate it.

Thanks for your suggestion notjustjay, I never thougt of Google groups. Also, I recently found that the book I've been reading isn't the most "informative" book one could buy. Perphaps i should get a different book :P

Thanks for the comments
bronxbomber92 is offline   0 Reply With Quote
Old Jan 5, 2007, 10:08 PM   #5
superbovine
macrumors 68030
 
superbovine's Avatar
 
Join Date: Nov 2003
Quote:
Originally Posted by bronxbomber92 View Post
Dang, my friend who gave this "self test" Ino, it wasn't homework), requests me not to share it. So I have to edit the post, and superbovine, if you could edit the questions out, I would appreciate it.

Thanks for your suggestion notjustjay, I never thougt of Google groups. Also, I recently found that the book I've been reading isn't the most "informative" book one could buy. Perphaps i should get a different book :P

Thanks for the comments
by friend I am sure you mean your professor.
superbovine is offline   0 Reply With Quote
Old Jan 5, 2007, 10:59 PM   #6
notjustjay
macrumors 603
 
notjustjay's Avatar
 
Join Date: Sep 2003
Location: Canada, eh?
Please don't take any "doing your homework for you" comments personally. I've just been around forums and Usenet groups (e.g. Google Groups) long enough to have seen some pretty thinly-disguised requests.

As for books, I'm generally very happy with anything published by O'Reilly and Associates (the books with the random animals on the covers).

Happy learning!
__________________
.
notjustjay is offline   0 Reply With Quote
Old Jan 5, 2007, 11:13 PM   #7
bronxbomber92
Thread Starter
macrumors regular
 
Join Date: Nov 2006
I don't take it personal, but this isn't homework.... My "friend", is someone who works for EA. I have the answers to these. I wasn't asking for answers, I was just looking for resources that provided similar like information to learn upon.

Btw, this is EA developer... http://forums.evilmana.com/index.php...sg3141#msg3141

I can also show you him giving it to me. I just need to take a screenshot of the thread, as it's in the moderator forum.
bronxbomber92 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
General: Do you believe jailbreaking has sort of a "learning" curve? tymaster50 Jailbreaks and iOS Hacks 9 Apr 9, 2013 03:50 PM
How do I disable "sourceID" and the other details my browser Firefox sends ? XPcentric Mac Applications and Mac App Store 0 Feb 25, 2013 02:06 PM
Learning "terms" in Autodesk Maya GD0X Design and Graphics 1 Sep 5, 2012 11:47 AM
"Potentially useful" Abbyy Fine Reader script. (does not replace input file) tiriya Mac Programming 0 Aug 9, 2012 09:19 AM

Forum Jump

All times are GMT -5. The time now is 03:38 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC