| Back to Questions Page |
| |
| Question |
what is a ststic variable and stiticfunction
briefly explain with exmple and in which case we use |
Rank |
Answer Posted By |
|
Question Submitted By :: Saroj |
| This Interview Question Asked @ HCL |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Static variable is the one allocated statically, meaning
that, it is allocated once in the program space and exists
till the program space is deallocated (the close of the
application).
Note:- Some people get confused between stack allocation
and static allocaion. Both are different terms.
A static function is again the same concept with static
variable allocation, but here the allocation is not just a
variable but a function's 'activation frame'. The
activation frame, for now, consider the function's
information required by the compiler to execute the
function which is stored internally.  |
| Zubeir |
| |
| |
| Question |
what is the virtual function overhead, and what is it used
for ? i hope i can get and appropriate answers, thanks a lot.... |
Rank |
Answer Posted By |
|
Question Submitted By :: Sami Alkindi |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | when use hybride inhertance,virual function avoid the
ambiguity.  |
| Deepanjali |
| |
| |
| Answer | I thnk virtual fns r declared with 'virtual' keyword
nd it must be redifend in the derivd classes.
wen mor dan one classes derivs a methd in the base class,
dat method can be writn with virtual to avoid ambiguity.  |
| Sanish Joseph |
| |
| |
|
|
| |
| Answer | Refer to this.
http://www.parashift.com/c++-faq-lite/virtual-functions.html#faq-20.4  |
| Ashutosh Bhawasinka |
| |
| |
| Answer | virtual function supports run-time polymorphrism. Ovarhead
is run-time has to create 'virtual' table.
'Derived' class object can be stored in the 'base' class
pointer. Using 'base' class pointer, client can call base
class method but not in the derived class method; if client
wants to call the derived class method then based method
should declare as virtual.  |
| Vadivel |
| |
| |
| Answer | We use Virtual function as Dyanamic Polymorphism.
i.e run time we can passed referencr of derived class into
base class pointer and call the derived class method.Thi
sis its benefit.
But Virtual destructor is also needed when we use virtual
constructor other wise it will cause memory leaks.  |
| D N Gavade |
| |
| |
| Question |
what's the difference between abstract class and concreate
class? what's the meaning of standard template library(STL)? |
Rank |
Answer Posted By |
|
Question Submitted By :: Franz |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | An abstract class is the class that define the interface
without the necessity to implement all the member
functions.
The derived class (from base abstract class) that implement
all the missing functions  |
| Hkouki |
| |
| |
| Answer | An abstract class is a class which contains atleast one
abstract method(i.e., an abstract method is one which has
only definition not implementation,which is done in some
other class.
We cannot create an object for Abstract class.
A class is said to be a concrete class if and only if it
contains fully defined methods.Defined methods are also
known has "concrete methods " or "Implemented methods".
We can instantiate an object for concrete class.  |
| A.srinivas Rao |
| |
| |
| Answer | First of all, we should understand what is the meaning
of 'abstract' in terms of software. It's the same meaning
as in English, that is, the entities (objects) which do not
exist in the real world are abstract entities. For example,
Dog, Cat, Bear, Deer are all animals that exist but animal
is also an entity which is just a concept and there is no
existance.
So we can define an abstract class for 'Animal'. We can
derive any number of real world animal classes from the
abstract class 'Animal' like Tiger, Lion, Donkey, etc.
Obviously, we can understand now why we cannot create
objects for abstract classes. The answer is we must not,
right?
Because the Animal class has no existance in real world. So
we cannot create a real world entity (nothing but an
object). That is the very reason this concept is followed.
The derived classes that we've seen above are concrete
classes since they are real world objects and have definite
properties and operations on them.  |
| Zubeir |
| |
| |
| Question |
what's the difference between function overloading and
function overiding? |
Rank |
Answer Posted By |
|
Question Submitted By :: Franz |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | function overloading is the process of defining the same
function name with different arguments,number of
arguments ,or ordinal positions of arguments.
function overriding is the process of defining the Base
class function in the derived class with different code
implementation.  |
| A Srinivas Rao |
| |
| |
| Answer | Function overloading is providing more than one function
with the same name which will operate on different
type/number of input data. Most probably, the kind of
operation will not be changed.
Function overriding is nothing but giving different
operations with the same function name and with same type
of input data (that is, the signature is not being changed)
depending upon the context (the context here means that the
class that holds the function of a hierarchy of classes)  |
| Mms Zubeir |
| |
| |
| Question |
If P is the population on the first day of the year, B is
the birth rate, and D is the death rate, the estimated
population at the end of the year is given by the formula:
The population growth rate is given by the formula:
B – D
Write a program that prompts the user to enter the starting
population, birth and death rates, and n, the number of
years. The program should then calculate and print the
estimated population after n years. Your program must have
at least the following functions:
1. growthRate: This function takes its parameters the
birth and death rates, and it returns the population growth
rate.
2. estimatedPopulation: This function takes its
parameters the current population, population growth rate,
and n, the number of years. It returns the estimated
population after n years
Your program should not accept a negative birth rate,
negative death rate, or a population less than 2.
|
Rank |
Answer Posted By |
|
Question Submitted By :: Haddad |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | #include <iostream.h>
#include <conio.h>
class population
{
int b,d,p,n,c;
public:
void read()
{
c=1;
do
{
if(c>1)
{
cout<<"\n\nYou are entered wrong input";
cout<<"\nPress Enter And Re-Enter The Input";
getch();
c++;
}
clrscr();
cout<<"Enter The Birth and Death Rates:\n\t\t";
cin>>b>>d;
cout<<"\n\nEnter The current population:\n\t\t";
cin>>p;
cout<<"Enter How many Years Estimated:\n\t\t";
cin>>n;
}while(b<0&&d<0&&p<2);
}
int growth_rate(int b,int d)
{
return(b-d);
}
int estimatedPopulation(int p,
int growthrate(b,d),
int n)
{
for(int i=1;i<=n;++i) p=p+growthrate(b,d);
return p;
}
void execute()
{
read();
cout<<"The Population after"<<n<<"years"
<<estimatedPopulation(p,growthrate(b,d),n);
}
};
void main()
{
clrscr();
population pop;
pop.execute();
getch();
}  |
| Chaitanya Raj Budumuru |
| |
| |
| Question |
Definition of Object Oriented Programming in single line? |
Rank |
Answer Posted By |
|
Question Submitted By :: Jay.net2005 |
| This Interview Question Asked @ TCS |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Object oriented programming is a programming paradigm which
uses objects and its interactions to design applications
and computer programs.  |
| Sidhi.r |
| |
| |
| Answer | An Object-Oriented Program consists of a group of
cooperating objects, exchanging messages, for the purpose
of achieving a common objective  |
| Sreevals |
| |
| |
| Answer | An Obiect Oriented Programming is a programming which
consist's mainly of object's(because objects are real world
entities any thing in the world can be shown in the form of
an object)  |
| A Srinivas Rao |
| |
| |
| Answer | OOP is a programming technique for developing software
solutions wherein real world is represented in terms of
objects.  |
| Sheetal |
| |
| |
| Answer | OOP is a programming technique in which focuses on objects
to get the real world applications.  |
| Sureshk_ap |
| |
| |
| Answer | oop is the feature that allows a mode of modularizing
programs by forming separate memory area for data as well
as functions that is used as object for making copies of
modules as per requirement.  |
| Chitra |
| |
| |
| Answer | oops is real world entity,in which data and function are
hidden from outside the world only object of the class can
access the dat and function of class  |
| Deepanjali Joshi |
| |
| |
| Answer | Object-oriented programming as an approach that provides a
way of modularizing programs by creating partitioned memory
area for both data and functions that can be used as
templates for creating copies of such modules on demand.  |
| Sekar |
| |
| |
| Answer | It is an structutured approach where all program segmented
into classes and objects to minimise the mesmerizing the
data and code.  |
| Ganesd Pradhan |
| |
| |
| Answer | it is a programming paradiam which is used a object  |
| Nirmala |
| |
| |
| Answer | It is an approach that provide a way of modularizing
programs by creating partitioned memory area for both data
and function that can be used as templates for creating
copies of such modules on demand  |
| Suresh Palkar |
| |
| |
| Answer | OOPs is the Programming language in which we intrect with
the object world.And we define our logic inside a class and
take it by object.  |
| Brijesh |
| |
| |
| Answer | OOPS is the language use to write a real world software
which binds the data and associated funtions together.  |
| Santosh |
| |
| |
| Answer | We deal with an object.  |
| Muhammad Arfan |
| |
| |
| Question |
what is the need of abstraction? what is abstraction?what
is the abstraction for stack? |
Rank |
Answer Posted By |
|
Question Submitted By :: Srinivas |
| This Interview Question Asked @ Verizon |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | for the user simplicity .with knowing the internal
details we can use the pakages.in the oops interfaces are
created .with knowing the internal procedure we can use the
interface.
in the large projects in the organization .the team
lader gives the interfaces to the project members they can
impliment that interfaces packages .
ex:-all packages in windows like summation in word pad.
the machanism in stack is "first in last out".
the processes which comes first that will be exicuted last.  |
| Ranjit |
| |
| |
| Answer | plz give me the correct answer  |
| Chandrakala |
| |
| |
| Answer | As I answered one of the questions here, the abstraction is
nothing but declaration of a concept in software terms
which does not exist in real-world.
For example, mango, drumstick, brinjal, potato are all
vegetables. But "Vegetable" is just a concept and it has no
real-world existance.
To represent these kind of concept in software terms, we
need abstration.
On the other hand, the mango, brinjal, ... are all have
concrete implementations since they have certain properties
and can do some operations on them in the real world.
I couldn't get the third question "abstraction for stack",
but I try to answer with what I understood.
Normally, stack's operations include push, pop, top, size,
empty e.t.c. If we define an interface with these, it ll be
an abstraction for stack. Let me know if it doesn't answer
your question.  |
| Mms Zubeir |
| |
| |
| Answer | Abstraction is nothing but binding the code and data
together to protect the code and data from out side world.  |
| Vara Prasad |
| |
| |
| Answer | Abstraction is nothing but the hierarchical clasification
of complex system. that is abstraction is a process to
break the complex system in to small manageble parts.
It is use full in coding.  |
| Vara Prasad |
| |
| |
| Question |
what is importance of data sturture in a programming
language? |
Rank |
Answer Posted By |
|
Question Submitted By :: Vikram |
| This Interview Question Asked @ L&T |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | tell me  |
| Vikram |
| |
| |
| Answer | Data Structure is logical memory representation of
storage.In electronic terms insted of gate complications
storage is given in specific structure to store in Bit
format.With the identififcation and type.  |
| Dd |
| |
| |
| Answer | Data structure is an organisation of data in which data can
be organised in many different ways
... logical
... mathematical  |
| Disha |
| |
| |
| Answer | Data structure is nothing but a way to organize and
manipulate any given set of data in a specific and reusable
format/structure hence simplifying the manipulation of data.
Some of the commonly and frequently used data structures
are Stack, Queue, List, Set, e.t.c. But this list is not
limited to what we see here, rather we can invent our own
as long as there is a definite structure and better
efficiency by using it than work with raw data.  |
| Zubeir |
| |
| |
| Answer | data structure saving the memory space rather than the
normal program ..and to organise the memory space in the
computer ....  |
| Ponnusamy |
| |
| |
| Answer | which is provides the mechanism of storing the data in
different ways. this optimizes searching and memory
usage. for example when searching is to be faster
datastructure of type linear type is used. if memory
utilization is more importance then lists data structure
used  |
| Vitts |
| |
| |
| Answer | Data sturcture is the logical representation and
organization of data in the main memroy.Which is used to
organize data in such a way that the insertion
,deletion,searhing i.e manipulation of data is done with
minimal complexity , and that gives a efficiet performance
of our computing.  |
| Rajesh Prasad Sarkar |
| |
| |
| Answer | Data structures play a central role in modern computer
science. Data structure enables an efficient storage of
data for an easy access. It enables to represent the
inherent relationship of the data in the real world. It
enables an efficient processing of data. It helps in data
protection and management.  |
| Neha Khurana |
| |
| |
| Answer | Logical representation and organization of data in the main
memory in other words it is a logical memory representation
of a storage  |
| Kranthikumar |
| |
| |
| Answer | Regarding use of programming languages, Niclaus Wirth wrote
a book with title "Data Structure + Algorithm = Program".
Therefore one can consider a programming language
as "capabilities to describe data objects of some
structures PLUS cabpabilities to define algorithms. Also,
data structures are very important in the implementation of
programming languages.  |
| A. Nahas |
| |
| |
| Question |
Why u change company? |
Rank |
Answer Posted By |
|
Question Submitted By :: Yathirajulu |
| This Interview Question Asked @ BOB-Technologies |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | ya, i develop my fimalar frameworks Ajax,Jsf & Hibernate in
this company, as well as my friend suggested to join in this
orgnazation, if u get a chance.  |
| Yathirajulu |
| |
| |
| Answer | I looking for growth and improve knowledge.  |
| Nageshind |
| |
| |
| Answer | Better prospects
Learing New technologies.  |
| Nagababu |
| |
| |
| Question |
Difference between new operator and operator new |
Rank |
Answer Posted By |
|
Question Submitted By :: Sundari |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | The "new" operator allocates a new instance of an object
from the heap, utilising the most appropriate constructor
for the arguments passed.
Like many operators in C++, the "new" operator for a
particular class can be overriden, although there is rarely
a need to do so. "operator new" is the mechanism for
overriding the default heap allocation logic. Ask your
interviewer to provide you with a concrete example of when
he or she has been required to do this.  |
| Skybeaver |
| |
| |
| Answer | pls refer
http://objectmix.com/c/34028-difference-between-new-operator-new.html  |
| Nutan |
| |
| |
| Question |
What is 2*2? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | 4  |
| Guest |
| |
| |
| Answer | four  |
| Leo Theboss |
| |
| |
| Answer | 2*2=2 x 2=4
thwe answer is four  |
| Aarthi |
| |
| |
| Question |
whats the size of class EXP on 32 bit processor?
class EXP
{
char c1;
char c2;
int i1;
int i2;
char *ptr;
static int mem;
}; |
Rank |
Answer Posted By |
|
Question Submitted By :: Shrinidhi |
| This Interview Question Asked @ Huawei |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | 20 bytes.
static is given memory in heap.
for 1st two data members c1 and c2 compiler will take 4
bytes cz of padding.  |
| Shrinidhi |
| |
| |
| Answer | 20 bytes is right, but static is in data segment portion od
memory, not the heap.  |
| Sxx010100 |
| |
| |
| Answer | Both answers are wrong.
First of all, static - class data do NOT contribute to the
class'/objects overall size.
Second, its totally wrong to assume that c1 and c2 will be
given both padding of 3 bytes (so they end up taking space
of 4). Why ?
Because (though Im not sure about every compiler, but 99% of
them will do something like the following) it is simply a
waste of space.
Here are the sizes of member variables of EXP :
class EXP
{
char c1; //1 byte
char c2; //1 byte + 2 bytes of padding! = 3 bytes
int i1; //4 bytes
int i2; //4 bytes
char *ptr; //4 bytes (compiler specific)
static int mem; // 0 bytes
};
this is why on most compilers
sizeof(EXP) is 16.  |
| Jaroosh |
| |
| |
| Answer | The answer is 16 (on most compilers), but not for the
reasons stated above.
If the class contained only c1 and c2, the size would be
2. Since i1 is an integer, though, it needs to be aligned
on a 4-byte multiple. The pointer and the other integer
also uses up 4 bytes. So, the total size is 16.
If there were another character field "c3" adjacent to c2,
the size would still be 16 bytes.  |
| Ricardo |
| |
| |
|
| |
|
Back to Questions Page |