fbpx

C++ interview questions gleaned from Bloomberg, Bank of America, Goldman Sach, Microsoft

(Last Updated On: May 11, 2010)

There are so many questions for interviews. These were gleaned from careercup.com There are over 300 pages in this document. Entire downloadable PDF at the bottom of this post. It contains well over 300 pages. Next up is compiling questions for Java for a job interview at Morgan Stanley in Montreal. I am prepping for Bloomberg C++ in NYC.

Bloomberg LP Interview Question for Software Engineer / Developers about C++
Keyur on April 25, 2010
what will be size of class and size of object of class.
class A{
int *p;
static int a; }
5
[Full Interview Report]

Tags: Bloomberg LP » C++ » Software Engineer / Developer
Question #1898670 (Report Dup) | Edit | History

Jay on April 27, 2010 http://www.careercup.com/editcomment?id=1940664 http://www.careercup.com/editcomment?id=1940664
4
Reply to Comment
abhimanipal on May 06, 2010 http://www.careercup.com/editcomment?id=2134661 http://www.careercup.com/editcomment?id=2134661
Is the size of the class and object always same ?Why is it so ?
If the class has static members, then these members are not stored in the object. Inspite of that will the class and object have the same size ?
Aditya on May 06, 2010 http://www.careercup.com/editcomment?id=2130663 http://www.careercup.com/editcomment?id=2130663
I would say that for the class, the size of the static is taken into consideration, where as for the object you do not because static does not instantiate an object. So, in this case: size of the class would be 8 bytes and size of the object will be 4 bytes
Reply to Comment
sandy on May 10, 2010 http://www.careercup.com/editcomment?id=2152667 http://www.careercup.com/editcomment?id=2152667
What do you mean y size of a class..? Unless and until you instantiate, the memory will not be allocated right? Just class does not make sense right? Please clarify.
Reply to Comment
Anonymous on May 10, 2010 http://www.careercup.com/editcomment?id=2160666 http://www.careercup.com/editcomment?id=2160666
Yes, you are right. But, assuming that the object has been instantiated, the size of the class will be 8 bytes ‘on paper’ and 4 bytes for the object

What is pure virtual function ?
—-
how is a system call executed.. when the API resides in the user space how are u still able to

whenever an API is called from User mode that would require a service from an underlying kernel module, the system traps to kernel mode to execute the requested service.
the system calls transfers the control from user program mode which is of low privilege to kernel mode ( high privilege )

you inadvertently overwrite some portion of memory that some pointer or a variable is
memory corruption, call stack corruption. In unix, scope is limited to these 2 inside a process. In RTOS, the corruption can span across multiple tasks/processes
—-
what does fork do, can the child process use the fd’s immediately
fork copies the snapshot of the process. The special case of fd’s, kernel makes sure these are properly duplicated and available for child process immediately
—–
what is new in C++, and operator, function, functor
operator
—-
how will you write constructor such that if will deallocates memory when there is exception.
duplicate Q. Ans: By using function try-blocks. The key word here is ‘function’
They have explained why do you need function try blocks for constructors. Somewhere in that article.. it says if exception occurs in function try block then whatever objects that were successfully created will be destructed by calling their destructors.

// Example 1(a): Constructor function-try-block
//
C::C()
try
: A ( /*…*/ ) // optional initialization list
, b_( /*…*/ )
{
}
catch( … )
{
// We get here if either A::A() or B::B() throws.

// If A::A() succeeds and then B::B() throws, the
// language guarantees that A::~A() will be called
// to destroy the already-created A base subobject
// before control reaches this catch block.
}

—-
what will be size of class and size of object of class.
class A{
int *p;
static int a; }
5

Is the size of the class and object always same ?Why is it so ?
If the class has static members, then these members are not stored in the object. Inspite of that will the class and object have the same size ?
I would say that for the class, the size of the static is taken into consideration, where as for the object you do not because static does not instantiate an object. So, in this case: size of the class would be 8 bytes and size of the object will be 4 bytes
What do you mean y size of a class..? Unless and until you instantiate, the memory will not be allocated right? Just class does not make sense right? Please clarify.
Yes, you are right. But, assuming that the object has been instantiated, the size of the class will be 8 bytes ‘on paper’ and 4 bytes for the object
—–
catch (…) //default type

Reply to Comment
Add a Co
Complete PDF can be downloaded here.

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!
Don't miss out!
Get my TRADE LIKE A BOSS 2 PDF Books

You will received instantly the download links.

Invalid email address
Give it a try. You can unsubscribe at any time.

NOTE!

Check NEW site on stock forex and ETF analysis and automation

Scroll to Top