ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Programming Languages >> C++ >> OOPS
 
 


 

 
 STL interview questions  STL Interview Questions (90)
 OOPS interview questions  OOPS Interview Questions (554)
 C++ General interview questions  C++ General Interview Questions (458)
Question
What is the difference between declaration and definition?
 Question Submitted By :: Tribhuvan Sharma
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is the difference between declaration and definition?
Answer
# 1
Declaration means we are just creating a variable or method.
Defination means we are assigning some value for a variable
& doing some functions in method
 
Is This Answer Correct ?    109 Yes 46 No
S
 
  Re: What is the difference between declaration and definition?
Answer
# 2
During declaration we just specify the type and no memory
is allocated to the variable. But during the definition an
initial value is assigned and memory is allocated to the
variable.
 
Is This Answer Correct ?    178 Yes 30 No
Roshan
 
 
 
  Re: What is the difference between declaration and definition?
Answer
# 3
Declaration means only declaring a function or a variable
with its return type or datatype respectively.

Definition means assiging values to variable or procedure
to be performed by a function.
 
Is This Answer Correct ?    21 Yes 40 No
Sandhya Shetty
 
  Re: What is the difference between declaration and definition?
Answer
# 4
Declaration means,we just inform to compiler return
type,funtion name and argument list of funtion that later
use in program.Definition define the operation of that
funtion.
 
Is This Answer Correct ?    15 Yes 20 No
Deepanjali Joshi
 
  Re: What is the difference between declaration and definition?
Answer
# 5
The definition is the one that actually allocates space,
and provides an initialization value, if any.
There can be many declarations, but there must be exactly
one definition. A definition tells the compiler to set
aside storage for the variable. A declaration makes the
variable known to parts of the program that may wish to use
it. A variable might be defined and declared in the same
statement
 
Is This Answer Correct ?    52 Yes 3 No
Sanjay
 
  Re: What is the difference between declaration and definition?
Answer
# 6
Declaration means just telling to complier about variable
or function but definition means actually allocating memory
for variable.
 
Is This Answer Correct ?    24 Yes 3 No
Omkar
 
  Re: What is the difference between declaration and definition?
Answer
# 7
Declaration Mean You just Declare a variable and Function
their is No Allocation of Memory.But In Defination Actual
use of use declare Variable and Function Assing the value
with accupy Memory as Per their Type.
 
Is This Answer Correct ?    10 Yes 6 No
Sachin Bhosale
 
  Re: What is the difference between declaration and definition?
Answer
# 8
defination=(declration+space reservation)
int a; -------------Declaration
a=20; ------------- Defination

For Function

int amiya(int a,int b); ---------------Declaration
int a=amiya(5,10) ---------------Function call
int amiya(int a,int b) Function Defination Logic is here
{
int c=a+b;
return(c);
}
 
Is This Answer Correct ?    23 Yes 33 No
Amiya
 
  Re: What is the difference between declaration and definition?
Answer
# 9
Ans: The declaration is means the memory is not yet all to
be allocated..
For example:
Int a; //is it declaration? Or definition?
Just check this
Int main()
{
Int I;
Printf(%d,i);
}
It prints the garbage value that means the memory is
allocated for this declaration so we can say that this int I
is both declaration and definition.
And take another example extern int I -- declaration
because no memory is allocated.
Similarly for function prototypes all are declarations.
In the case of class declaration String s; // Declaration
[because reference is created]
When the new keyweord encounters then it is definition
String *s=new Stirng(); //declaration and
definition
 
Is This Answer Correct ?    36 Yes 2 No
Rajesh Manem
 
  Re: What is the difference between declaration and definition?
Answer
# 10
Declaration means it exits but it has no meaning. But where
as definition means it has a meaning. Without decalration
there is no definition. Why means without existing how can
we use.
Some situations we do both in a single statement like,
int i = 10;
here i is declared and definie with the value 10;
But some languages give some value to the variable without
defining like
class DiffsDemo {
int i;
}

DiffsDemo demo = new DiffsDemo();
print: demo.i;
output: 0;

This will happen because some default values are assigned
to that types. Internally at run time they will define.
 
Is This Answer Correct ?    8 Yes 4 No
Krishna Chowdary Garapati
 

 
 
 
Other OOPS Interview Questions
 
  Question Asked @ Answers
 
oops concept is used for? Synergy 3
what is the technical or oop name of object?   1
How Do you Code Composition and Aggregation in C++ ? IBM 3
What is conditional Compilation? emc2 3
some one give d clear explanation for polymorphism   3
WAP find square root of any number (without using sqrt() )?   3
what are three tenets of object orinted Systems?Why they call like that ? Please answer me. Advance thanks. Excel 2
Why is it so that we can have virtual constructors but we cannot have virtual destructors?   2
explain dynamic binding by drowing Cognizent 2
what does exactly the linker do?   1
write a c++ code of diagonal matrix.   2
write a short note on Overloading of Binary Operator?   2
 
For more OOPS Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com