Technical Interview Questions and Answers :: Capgemini
Tot. Mock Test: 16
Total Qs: 31+
1. C can run most of the code of C, but C can't run C code.
2. C supports procedural programming paradigm whereas C supports both procedural and object oriented programming paradigm.
3. C is a function driven and C is an object driven language.
4. C doesn't allow function definitions within structures whereas in C function definition can be within structures.
5. C doesn't support reference variables but C does support.
Yes, Size of an empty class is not zero. It is 1 byte generally. It is nonzero to ensure that the two different objects will have different addresses.
Copy constructor is used to declare and initialize an object from another object.
For example, the statement
Would define the object I2 and at the same time initialize it to the values of I1. another form of this statement is integer I2=I1;
The process of initializing through a copy constructor is known as copy initialization. A copy constructor takes a reference to an object of the same class as itself as an argument.
A friend function can access a class private data, even though it is not a member function of the class. This is useful when one function must have access to two or more unrelated classes and when an overloaded operator must use, on its left side, a value of a class other than one of which it is a member. Friends are also used to facilitate functional notation.
It is possible to grant a non-member function access to the private members of a class by using a friend. A friend function has access to all private and protected members of the class for which it is a friend.
No Discussion on this question yet!
Declaring a variable is initializing a variable where as defining a variable is defining what variables you are initialized.
By default the value unchanged means we can give as static.
Variable which is declared as static and no further initialisation then static variable takes value from zero.
Register variables are a special case of automatic variables. Automatic variables are allocated storage in the memory of the computer; however, for most computers, accessing data in memory is considerably slower than processing in the CPU. These computers often have small amounts of storage within the CPU itself where data can be stored and accessed quickly. These storage cells are called registers.
Each program is allocated two types of storage stack and heap .Auto variables are also known as local variable
and are stored in stack.