Monday, March 10, 2008

Try out when free

You are given an arbitrarily long string of parentheses i.e. a string comprising of '(' and ')'.

Give an efficient way of finding whether a given string contains a balanced parentheses or not. Note that the string can be of any length.

A string with balanced parentheses is a string containing same number of left parentheses '(' and right parentheses ')'. Also, they must be in correct order i.e. ( ( ) ( ) ) is balanced whereas ( ) ) ( ( ) is not.

Monday, February 25, 2008

Memory CORRUPTION

From Wikipedia, the free encyclopedia

Memory corruption happens when the contents of a memory location are unintentionally modified due to programming errors. When the corrupted memory contents are used later in the computer program, it leads either to program crash or to strange and bizarre program behavior.

Modern programming languages like C and C++ have powerful features of explicit memory management and pointer arithmetic. These features are designed for developing efficient applications and system software. But when these features are used incorrectly, it may lead to memory corruption errors.

Memory corruption is one of the most intractable class of programming errors because of two reasons. First, the source of the memory corruption and its manifestation may be far apart making it hard to correlate the cause and the effect. Second, symptoms appear under unusual conditions, making it hard to consistently reproduce the error.

Memory corruption errors can be broadly classified into four categories:

1. Using un-initialized memory: Contents of un-initialized memory are considered
to be garbage values and using these values can lead to unpredictable program
behavior.
2. Using un-owned memory: It is common to use pointers for accessing and modifying
memory. If a pointer happens to be a null pointer, dangling pointer (pointing
to memory that has already been freed), or to a memory location outside of
current stack or heap bounds, it is referring to memory that is not currently
possessed by the program. And using such pointer is a serious programming
flaw. Writing to such memory can crash another program or even the operating
system.
3. Using beyond allocated memory (buffer overflow): If an array is used in a
loop, with incorrect terminating condition, memory beyond the array bounds may
be manipulated. Buffer overflow is one of the most common programming flaw
exploited by computer viruses causing serious computer security issues (e.g.
Return-to-libc attack, Stack-smashing protection) in widely used programs.
4. Faulty heap memory management: Memory leaks and freeing non-heap or unallocated
memory are the most frequent errors caused by faulty heap memory management.

Many memory debuggers such as Purify, Valgrind, Insure++ are available for detecting memory corruption errors.

Memory is said to be corrupted if we try one of the following :

* Free a dynamic variable that has already been freed

char *str = new char[100];
delete [] str;
delete [] str;

* Free a dynamic variable that has not been yet allocated

char *str;
delete str;

* Assign a certain value to a dynamic variable that was never allocated

char *str;
strcpy(str, "error");

The previous three examples will most probably cause the application to crash. However the next two "bugs" are harder to detect :

* Assign a certain value to a dynamic variable, after it has been freed (this may also affect other data stored in the heap)

char *str = new char[100];
delete [] str;
char *test = new char[100];
strcpy(str, "surprise !");
cout << test;
delete [] test;

* Access an element with an index out of range

char *str = new char[30];
str[40] = 'C';

Thursday, January 31, 2008

Multi Threading Interview Questions

 
Q1) What are the two types of multitasking?
Ans : 1.process-based 2.Thread-based

Q2) What are the two ways to create the thread?
Ans : 1.By implementing Runnable 2.By extending Thread

Q3) What is the signature of the constructor of a thread class?
Ans : Thread(Runnable threadob,String threadName,Thread_KIND) //this depends on API

Q4) What are all the methods available in the Runnable Interface?
Ans : Run()

Q5) What is the data type for the method isAlive() and this method is available in which class? Ans : boolean, class Thread

Q6) What are all the methods available in the Thread class?
Ans : 1.isAlive() 2.join() 3.resume() 4.suspend() 5.stop() 6.start() 7.sleep() 8.destroy()

Q7) What are all the methods used for Inter Thread communication and what is the class in which these methods are defined?
Ans : 1. wait(),notify() & notifyall() 2. Object class

Q8) What is the mechanism defind by CPP for the Resources to be used by only one Thread at a time?
Ans : Synchronisation //find out how to achieve this

Q9) What is the procedure to own the monitor by many threads?
Ans : not possible ??

Q10) What is the unit for 1000 in the below statement?
objThrd.sleep(1000)
Ans : milliseconds

Q11) What is the data type for the parameter of the sleep() method?
Ans : long

Q12) What are all the values for the following level? max-priority , min-priority , normal-priority
Ans : 10,1,5 // varies with the API 100,0,50

Q13) What is the method available for setting the priority?
Ans : SetPriority()

Q14) What is the default thread at the time of starting the program?
Ans : Main thread

Q15) What are all the four states associated in the thread?
Ans : 1. new 2. runnable 3. blocked 4. dead

Q16) The suspend() method is used to teriminate a thread? True /False
Ans : False

Q17) The run() method should necessary exists in classes created as subclass of thread? True /False
Ans : True

Q18) When two threads are waiting on each other and can't proceed the programme is said to be in a deadlock? True/False
Ans : True

19) Which method waits for the thread to die ?
Ans : join() method

20) Which of the following is true? 1) wait(),notify(),notifyall() are defined as final & can be called only from with in a synchronized method 2) Among wait(),notify(),notifyall() the wait() method only throws IOException 3) wait(),notify(),notifyall() & sleep() are methods of object class
A-1
B-2
C-3
D-1 & 2
E-1,2 & 3
Ans : D

21) What is meant by timeslicing or time sharing?
Ans : Timeslicing is the method of allocating CPU time to individual threads in a priority schedule.

22) What is meant by daemon thread? In java runtime, what is it's role? //GC is.nET/Java Specific
Ans : Daemon thread is a low priority thread which runs intermittently in the background doing the garbage collection operation for the java runtime system.

Sunday, January 27, 2008

Copy Constructor

A Copy Constructor is a special type of constructor in the C++ programming language used to creat a new objects a copy of another of an existing object. This constructor takes single argument : a reference of the object to be copied.
Normally the compiler automatically creates a copy constructor for each class (known as an implicit copy constructor) but for special cases the programmer creates a copy constructor, known as a explicit copy constructor. In such cases, the complier doesnt create the implicit one.
A copy constructor is generally needed when an object owns pointers or non-sharable references such as to a file and then you usually need a destructor and assignement operator too.
Copying of objects is achieved by the use of a copy constructor and a copy assignment operator. A copy constructor has as its first parameter a (possibly const or volatile) reference to its own class type. It can have more arguments, but the rest must have default values associated with them.

There are four instances when a copy constructor is called:
1) When an object is returned by value
2) When an object is passed (into a function) by value as an argument
3) When an object is constructed based on other object (pf same class)
4) When compiler generates a temporary object (e.g.-as in explicit casting)

Examples:
These examples illustrate how copy constructors work and why they are required sometimes.

The Implicit Copy Constructor

#include "iostream.h"
class Person
{
public:
int age;
Person(int age): age(age) {}
};
int main()
{
Person timmy(10);
Person sally(15);
Person timmy_clone = timmy;
std::cout << timmy.age << " " << sally.age << " " << timmy_clone.age << std::endl;
timmy.age = 23;
std::cout << timmy.age << " " << sally.age << " " << timmy_clone.age << std::endl;
return 0;
}
OutPut:
10 15 10
23 15 10

As expected, timmy has been copied to the new object, timmy_clone. While timmys age was changed, timmy_clones age remained the same. This is because they are totally different objects.
The compiler has generated a copy constructor for us, and it could be written like this:

Person(Person const& copy):age(copy.age) {}

The Explicit Copy Constructor:

#include "iostream.h"
class Array
{
public:
int size;
int* data;
Array(int size): size(size), data(new int[size]) {}
~Array()
{
delete[] data;
}
};
int main()
{
Array first(20);
first.data[0] = 25;
{
Array copy = first;
std::cout << first.data[0] << " " << copy.data[0] << std::endl;
} // (1)

first.data[0] = 10; // (2)
return 0;
}

OutPut:
25 25
Segmentation fault

Since we didn't specify a copy constructor, the compiler generated one for us. The generated constructor would look something like

Array(Array const& copy): size(copy.size), data(copy.data) {}

The problem with this constructor is that it performs a shallow copy of the data pointer. It only copies the address but not the actual data. When the program reaches line (1), copy`s destructor will get called (because objects on the stack are destroyed automatically when their scope ends). As you can see, Arrays destructor deletes the data array, therefore when it deleted copys data, it also deleted firsts data. Line (2) now accesses invalid data and writes to it! This produces the famous Segmentation Fault.
If we write our own copy constructor that performs a deep copy then this problem goes away.

Array(Array const& copy): size(copy.size), data(new int[copy.size])
{
std::copy(copy.data, copy.data + copy.size, data); // #include for std::copy
}

Here, we are creating a new int array and copying the contents to it. Now, copys destructor only deletes its data and not firsts data as well. Line (2) will not produce a segmentation fault anymore.
Instead of doing a deep copy right away, there are some optimization strategies that can be used. These allow you to safely share the same data between several objects, thus saving space. The Copy on write strategy makes a copy of the data only when it is written to. Reference counting keeps the count of how many objects are referencing the data, and will delete it only when this count reaches zero (e.g boost::shared_ptr).

If you still want to know more for Copy constructor then please go through the following link also
(1)http://www.fredosaurus.com/notes-cpp/oop-condestructors/copyconstructors.html
(2)http://cse.stanford.edu/class/cs193d/handouts/14CopyConstructors.pdf

Wednesday, January 23, 2008

Converting int to string(CString) in MFC

int nVAl = 10;
CString strConverter;
strConverter.Format("%d",nVal);
::AfxMessageBox(strConverter);

another method is native itoa

int nVAl = 10;
char strBuf[3];
_itoa( nVal,strBuf,3,10); // here 10 is radix
CString strForCnvrsn(strBuf);
::AfxMessageBox(strForCnvrsn);

Monday, January 21, 2008

Can we use dynamic cast instead of QueryInterface?

The dynamic_cast operator

It combines the type check with the cast, and uses the syntax of the new keyword casts It is only legal for pointers and references to polymorphic types; it will fail to compile for non-polymorphic and incomplete types. For a pointer, a successful cast will result in a pointer correctly cast and adjusted to the applicable part of the object – including multiple inheritance and virtual base class cases – whereas an unsuccessful cast will result in a testable null pointer:

base *b = ...;
derived *d = dynamic_cast(b);
if(d)
... // successful cast
else
... // unsuccessful cast


As dynamic_cast checks that the cast is possible, rather than checking for an exact type match, it is our substitute for an is-kind-of operation.


A dynamic_cast is normally presented as a safe downcast mechanism, but this is a very narrow view of its capabilities: it may also be used for safe crosscasting to sibling classes. In this context the role of dynamic_cast is to query interfaces


Using dynamic_cast to query interface support.
document *d = new wp_document;
...
if(storable *s = dynamic_cast(d))
... // use storable operations for d
if(notifiable *n = dynamic_cast(d))
... // will not be executed for d

Friday, January 18, 2008

All you have to know about static keyword

Hi! Folks

Hope this compilation on static keyword proves to be useful .
As a OOP i will try to explain static keyword w.r.t classes
A local variable is initialized when the thread of execution reaches its definition. By default, thishappens in every call of the function and each invocation of the function has its own copy of the variable. If a local variable is declared static , a single, statically allocated object will be used to represent that variable in all calls of the function. It will be initialized only the first time the thread of execution reaches its definition.


Both function and data members of a class can be made static.

A static variable provides a function with ‘‘a memory’’ without introducing a global variable that might be accessed and corrupted by other functions.

A static member can be referred to like any other member by non-static member function too. In addition, a static member can be referred to without mentioning an object.

There is exactly one copy of a s t a t i c member instead of one copy per object, as for ordinary non-st a t i c members.

Similarly, a function that needs access to members of a class, yet doesn’t need to be invoked for a particular object, is called a static member function.


When you declare a static data member within a class, you are not defining it. (That
is, you are not allocating storage for it.)

Instead, you must provide a global definition for it elsewhere, outside the class.
This is done by redeclaring the static variable using the scope resolution operator to identify the class to which it belongs.
This causes storage for the variable to be allocated. (Remember, a class declaration is simply a
logical construct that does not have physical reality.)
To understand the usage and effect of a static data member, consider this program:


#include
#include "conio.h"
using namespace std;
class X

{
int i;
static int x;
public:
X(int ii = 0) : i(ii) {} // Default
~X()
{
cout << "X::~X()" <<>
}

static void func() {//i=10;
x++;cout<
};
void f()

{
static X x1(47);
static X x2; // Default constructor required
}

int X::x =27;//initialization of static

int main()
{
f();
X::func();
getch();
}


Note:**
In C++, the preceding use of static is still supported, but deprecated. This means that it is not recommended for new code. Instead, you should use a namespace.


A static member variable exists before any object of its class is created.

One use of a static member variable is to provide access control to some shared resource used by all objects of a class.

Interesting use of a static member variable is to keep track of the number of objects of a particular class type that are in existence.

By using static member variables, you should be able to virtually eliminate any
need for global variables. The trouble with global variables relative to OOP is that they
almost always violate the principle of encapsulation.



Actually, static member functions have limited applications, but one good use
for them is to "preinitialize" private static data before any object is actually created.


What do you have to say please post your reply

Please comment on the same.
Feedbacks will be executed .

Do visit:
http://techie-paradise.nicetopic.net/index.htm
and become member for free.



Q: Can static member functions act only on static member variables?
A: Yes! It can only act on static member variables

Thursday, January 17, 2008

MIx C & C++

If you are including a C header file that isn't provided by the system, you may need to wrap the #include line in an extern "C" { /*...*/ } construct. This tells the C++ compiler that the functions declared in the header file are C functions.

// This is C++ code
extern "C" {
// Get declaration for f(int i, char c, float x)
#include "my-C-code.h"
}
int main()
{
f(7, 'x', 3.14); // Note: nothing unusual in the call
...
}

Alternate linkage specifications

What happens if you’re writing a program in C++ and you want to

use a C library? If you make the C function declaration,

float f(int a, char b);

the C++ compiler will decorate this name to something like

_f_int_char to support function overloading (and type-safe

linkage). However, the C compiler that compiled your C library has

most definitely not decorated the name, so its internal name will be

_f. Thus, the linker will not be able to resolve your C++ calls to f( ).

The escape mechanism provided in C++ is the alternate linkage

specification, which was produced in the language by overloading

the extern keyword. The extern is followed by a string that

specifies the linkage you want for the declaration, followed by the

declaration:

extern "C" float f(int a, char b);

This tells the compiler to give C linkage to f( ) so that the compiler

doesn’t decorate the name. The only two types of linkage

specifications supported by the standard are “C” and “C++,” but

compiler vendors have the option of supporting other languages in

the same way.

If you have a group of declarations with alternate linkage, put them

inside braces, like this:

extern "C" {

float f(int a, char b);

double d(int a, char b);

}

Or, for a header file,

extern "C" {

#include "Myheader.h"

}

Most C++ compiler vendors handle the alternate linkage

specifications inside their header files that work with both C and

C++, so you don’t have to worry about it.

Something about Singleton Class in cpp

Singleton Class :- A class whose number of instances that can be instantiated is limited to one is called a singleton class. Thus, at any given time only one instance can exist, no more.

Where To Use Singlton Class :- The singleton design pattern is used whenever the design requires only one instance of a class. Some examples:

1) Application classes. There should only be one application class.

2) Logger classes. For logging purposes of an application there is usually one logger instance required.

Example:-

class CMyClass
{
private:
CMyClass() {} // Private Constructor

Static int nCount; // Current number of instances
Static int nMaxInstance; // Maximum number of instances

Public:
~CMyClass(); // Public Destructor
Static CMyClass *CreateInstance(); // Construct Indirectly
};

int CMyClass :: nCount = 0;
int CMyClass :: nMaxInstance = 1; // When maxInstance is 1, we have a pure singleton class

CMyClass:: ~CMyClass()
{
--nCount; // Decrement number of instances
}

CMyClass* CMyClass :: CreatInstance()
{
CMyClass* ptr = NULL;
if(nMaxInstance > nCount)
{
ptr = new CMyClass;
nCount++; // Increment no of instances
}
return ptr;
}

int main()
{
CMyClass* pObj = CMyClass::CreateInstance();
if(pObj)
{
// Success
}
else
{
// Failed to create, probably because the maximum number of instances has already
// been Created
}
delete pObj ;
return 0;
}

Article on Symbol table

Symbol Table:

In computer science, a symbol table is a data structure used by a language translator such as a compiler or interpreter, where each identifier in a program's source code is associated with information relating to its declaration or appearance in the source, such as its type, scope level and sometimes its location.

The symbol table of a small program is listed below. The table itself was generated using the GNU binutils' nm utility. There is one data symbol,
holaamigosh (noted by the "D" type), and many functions (self defined as well as from the standard library). The first column is where the symbol is located in the memory, the second is "The symbol type" and the third is the name of the symbol. By passing suitable parameters, the symbol table was made to sort on basis of address

Example table

Address Type Name
00000020 a T_BIT
00000040 a F_BIT
00000080 a I_BIT

20000004 t irqvec
20000008 t fiqvec
2000000c t InitReset
20000018 T _main

20000024 t End
20000030 T AT91F_US3_CfgPIO_useB
2000005c t AT91F_PIO_CfgPeriph
200000b0 T main
20000120 T AT91F_DBGU_Printk
20000190 t AT91F_US_TxReady
200001c0 t AT91F_US_PutChar
200001f8 T AT91F_SpuriousHandler
20000214 T AT91F_DataAbort
20000230 t AT91F_PDC_SetNextRx


An object code file will contain a symbol table of the identifiers it contains that are externally visible. During the linking of different object files, a linker will use these symbol tables to resolve any unresolved references.
A symbol table may only exist during the translation process, or it may be embedded in the output of that process for later exploitation, for example, during an interactive
debugging session, or as a resource for formatting a diagnostic report during or after execution of a program.


For more details ,
Other link:http://www.sco.com/developers/gabi/2001-04-24/ch4.symtab.html

By Vinod Mahalle

mahalle.v@gmail.com

Excellent Site for EBooks

I bet you wont get better site to download ebooks of your liking then here
at http://www.ebookee.com/

nJOy! Downloading

Are You Fond Of Downloading!

Q: What is Rapidshare, Megaupload or YouSendIt ?

A: These are free and unlimited file hosting services where anyone can upload and download large files including MP3 songs, videos, games, software, ebooks, etc.While Rapidshare and Megaupload are available only in the browser, alternative YouSendIt also has a desktop client that can resume uploads.Problem: Since services like Rapidshare or Megaupload make file sharing so simple, they are often used for sharing illegal content like warez, adult movies and software cracks. Rapidshare URLs are not protected by passwords so anyone can download that content.

हाय एवेर्य्बोद्य

Attention !!!! All u need to know about CPP & C++

Good Sites for Tech Stuff Reloaded

A Tutorial on creating DLLs with VC++
Advanced C++ Lessons
C Language FAQ Part 2
CodeProject Thread Synchronization for Beginners. Free source code and programming articles
Contents
DLLs
Free C and C++ eBooks - Download C and C++ eBooks - List of C and C++ eBooks
Free ebooks, audiobooks & magazines from the web fiction, nonfiction C++ and Visual Basic
Head First Object-Oriented Analysis and Design A Brain Friendly Guide to OOA Free eBooks Download!
InformIT Visual C++ 6 Unleashed
Instructions for use
Interview questions for tech companies » C++ notes for discussion
ITStudy8.org
Mfc Programming With Visual C 6 Unleashed Free eBooks Download!
What are Virtual Functions How to implement virtual functions in C&

Wednesday, January 16, 2008

Some more Interview Qns

Useful Links
http://diamond/exchweb/bin/redir.asp?URL=http://www.gnu.org/software/libc/manual/html_node/index.html
http://diamond/exchweb/bin/redir.asp?URL=http://www.parashift.com/c%2B%2B-faq-lite/

1. What is logical difference between Memory leak & dangling pointer?
A dangling pointer occurs when a pointer doesnot have a target. Example includes an uninitialized pointer and a pointer whose target has been deallocated(perhaps via an aliasing pointer).
A memory leak occurs when a process fails to deallocate memory and does not retain any pointer to that memory. The result is that the process can make no use of memory, nor can it deallocate the memory.
2. How to allocate dynamic memory on stack?
http://diamond/exchweb/bin/redir.asp?URL=http://www.codersource.net/c%2B%2B_dynamic_memory_allocation.aspx
3. What is Template?
http://diamond/exchweb/bin/redir.asp?URL=http://www.cplusplus.com/doc/tutorial/templates.html
http://diamond/exchweb/bin/redir.asp?URL=http://www.codersource.net/cpp_class_templates.html
4. What is STL? Explain different containers. Introduction & Overview:
http://diamond/exchweb/bin/redir.asp?URL=http://www.codebeach.com/tutorials/what-is-stl.asp
Everything about STL:
http://diamond/exchweb/bin/redir.asp?URL=http://www.decompile.com/html/tut.html
5. What are smart pointers. Explain in detail.
http://diamond/exchweb/bin/redir.asp?URL=http://en.wikipedia.org/wiki/Smart_pointer http://diamond/exchweb/bin/redir.asp?URL=http://www.informit.com/articles/article.aspx?p=31529
6. Explain exception handling.
http://diamond/exchweb/bin/redir.asp?URL=http://en.wikipedia.org/wiki/Exception_handling
http://diamond/exchweb/bin/redir.asp?URL=http://www.eastcoastgames.com/articles/cppexception.html
7. What is casting?
http://diamond/exchweb/bin/redir.asp?URL=http://www.codeguru.com/forum/showthread.php?t=312456
http://diamond/exchweb/bin/redir.asp?URL=http://www.acm.org/crossroads/xrds3-1/ovp3-1.html
8. Difference between new operator and operator new. When do we use operator new?
Here is what I meant.
------ 1 ------ Foo* p = static_cast(operator new (n * sizeof (Foo))); // Stuff delete p; ---------------
------ 2 ------ Foo* p = new Foo [n]; // Stuff delete[] p; The former will allocate with the global operator new allocator, enough room for n Foo objects, but will not call any constructor. So, p will point to raw memory, and accessing any member of Foo, or casting Foo to one of its base class, or doing similar things, will have undefined behaviour (see [basic.life]-5) Moreover, the delete expression will call a destructor on a non-alive Foo object. Thus, the behaviour is undefined. If, you replace the delete expression by an explicit call to the global operator delete, it correct this problem:
Foo* p = static_cast(operator new (n * sizeof (Foo))); // calls the global operator new // You can't access Foo members or subtypes here ::operator delete (p); // free the memory
The later code allocates memory with operator new[], which may be the global operator new[], but may also be an overloaded operator new[] by the Foo class. It also constructs all objects, using the default-constructor of Foo (or nothing if Foo is a POD type).
delete[] p, will destroy properly all Foo objects, and release memory with the correct version of operator delete[], which may be overloaded by the Foo class.
9. Why do we use virtual destructor?
http://diamond/exchweb/bin/redir.asp?URL=http://www.geekinterview.com/question_details/19709
http://diamond/exchweb/bin/redir.asp?URL=http://www.codersource.net/cpp_virtual_destructors.html
10. Difference between malloc, calloc and relloc.
http://diamond/exchweb/bin/redir.asp?URL=http://wiki.answers.com/Q/What_is_the_difference_between_malloc_and_calloc_functions
11.can constructors be virtual and why? http://diamond/exchweb/bin/redir.asp?URL=http://www.acetheinterview.com/questions/cats/index.php/cplusplus/2006/10/24/virtual-constructors-by-neetu
http://diamond/exchweb/bin/redir.asp?URL=http://www.geekinterview.com/question_details/36942
12. Static Keyword
http://diamond/exchweb/bin/redir.asp?URL=http://www.cprogramming.com/tutorial/statickeyword.html
13.what is the aggregation and composition..................when it is used and which one is preferred
http://diamond/exchweb/bin/redir.asp?URL=http://www.artima.com/forums/flat.jsp?forum=17%26thread=24715
http://diamond/exchweb/bin/redir.asp?URL=http://ootips.org/uml-hasa.html

14.what is nmake what are the parameters given to it?\
http://diamond/exchweb/bin/redir.asp?URL=http://msdn2.microsoft.com/en-us/library/ms930369.aspx
15.what is copy constructor? its significance? why it is necessary? example...
http://diamond/exchweb/bin/redir.asp?URL=http://www.codersource.net/cpp_copy_constructors.html http://diamond/exchweb/bin/redir.asp?URL=http://en.wikipedia.org/wiki/Copy_constructor
16.difference between reference and pointers. why references are useful?practicle example.
http://diamond/exchweb/bin/redir.asp?URL=http://www.embedded.com/story/OEG20010311S0024
http://diamond/exchweb/bin/redir.asp?URL=http://www.go4expert.com/forums/showthread.php?t=5492
http://diamond/exchweb/bin/redir.asp?URL=http://www.daniweb.com/blogs/entry1664.html

17.what is virtual base class?
http://diamond/exchweb/bin/redir.asp?URL=http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.vacpp7a.doc/language/ref/clrc14cplr135.htm
http://diamond/exchweb/bin/redir.asp?URL=http://www.deitel.com/articles/cplusplus_tutorials/20060225/virtualBaseClass/
18.what are virtual functions? how they get invoked?
http://diamond/exchweb/bin/redir.asp?URL=http://www.parashift.com/c%2B%2B-faq-lite/virtual-functions.html
http://diamond/exchweb/bin/redir.asp?URL=http://en.wikipedia.org/wiki/Virtual_function
19.concepts related to VTABLE.Does classes having non virtual function can have VTABLE?
http://diamond/exchweb/bin/redir.asp?URL=http://www.cauniversity.org/node/382
http://diamond/exchweb/bin/redir.asp?URL=http://gcc.gnu.org/ml/gcc-help/2002-12/msg00280.html

20.what is mutable keyword?when it is used?example... if mutable allows us to change the value of const variable then why we declare it as a const?
http://diamond/exchweb/bin/redir.asp?URL=http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=/com.ibm.xlcpp8l.doc/language/ref/mutable_storage_class_specifier.htm
http://diamond/exchweb/bin/redir.asp?URL=http://www.highprogrammer.com/alan/rants/mutable.html
21.what are volatile variables?when it is used?example...
http://diamond/exchweb/bin/redir.asp?URL=http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?topic=/com.ibm.vacpp6m.doc/proguide/ref/xviexvvs.htm
http://diamond/exchweb/bin/redir.asp?URL=http://en.wikipedia.org/wiki/Volatile_variable

22.what is the size of empty class?why?
1 Byte
Because compilers are not bound by any rule that says that class size must increase by the size of what is added. If you add an extra byte to an empty class so each object has a distinct address, then you clearly no longer need the extra byte when the class is non-empty. So the compiler discards it (or, more accurately, doesn't add it in the first place).
http://diamond/exchweb/bin/redir.asp?URL=http://www.velocityreviews.com/forums/t268090-re-why-empty-class-size-is-1-byte-.html


23. What is name mangling
http://diamond/exchweb/bin/redir.asp?URL=http://en.wikipedia.org/wiki/Name_mangling


24. What is RTTI and different operators used in that.
http://diamond/exchweb/bin/redir.asp?URL=http://en.wikipedia.org/wiki/Run-time_type_information
25. Which opertors cant be overloaded http://diamond/exchweb/bin/redir.asp?URL=http://www.velocityreviews.com/forums/t286554-operators-that-cannot-be-overloaded-why.html

Interview Questions !!!

Interview Question asked to VINAYAK

1.Tell me something about your Education and Family Background and last employer and
project

2.What are the contents in a empty class?

3.What is the size of the class?why?

4.Explain virtual mechanism in cpp?

5.What are Templates ? when r they used ?

6.what are function templates?

7.Explain working of copy constructor and assignment operator ?
why do u need to override them? Give a example and write down the code for same?

8.predict the output of the program:

#include
#include
using namespace std;
class Base
{
virtual void func(int x=10){cout<func();
getch();
return 0;
}

9.Are you ready to settle in pune This project requires lot of proactiveness from you and have to learn a lot about mech stuff and around 35% of c++ coding?

10.Did u undergone the CAA training?
we will get back to you!

extern keyword with example

http://msdn2.microsoft.com/en-us/library/0603949d(VS.80).aspx

Request For Links

Here you can request for the link you need on any technical stuff.
Please do post some important links known to you.

This is our blog.

Help yourself to keep it alive.