ALLInterview.com :: Home Page KalAajKal.com
 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                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Microsoft Related  >>  C Sharp
 
 


 

 
 Visual Basic interview questions  Visual Basic Interview Questions
 C Sharp interview questions  C Sharp Interview Questions
 ASP.NET interview questions  ASP.NET Interview Questions
 VB.NET interview questions  VB.NET Interview Questions
 COM+ interview questions  COM+ Interview Questions
 ADO.NET interview questions  ADO.NET Interview Questions
 IIS interview questions  IIS Interview Questions
 MTS interview questions  MTS Interview Questions
 Crystal Reports interview questions  Crystal Reports Interview Questions
 BizTalk interview questions  BizTalk Interview Questions
 Dot Net interview questions  Dot Net Interview Questions
 Exchange Server interview questions  Exchange Server Interview Questions
 SharePoint interview questions  SharePoint Interview Questions
 Microsoft Related AllOther interview questions  Microsoft Related AllOther Interview Questions
Question
What is the Difference between read only and constant 
variables?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is the Difference between read only and constant variables?
Answer
# 1
Read only variable can be assigned a value at the runtime. 
Where as const have to be assigned at the compile time only.
 
Is This Answer Correct ?    11 Yes 1 No
Guest
 
  Re: What is the Difference between read only and constant variables?
Answer
# 2
We can assign a value to a readonly variable at runtime 
till it is a unassined identifier, but once value is 
assigned, it cannot be changed.

In case of const we cannot assign a value at run time i.e. 
the value assigned to it at declaration time cannot be 
change
 
Is This Answer Correct ?    8 Yes 0 No
Parmjit
 
 
 
  Re: What is the Difference between read only and constant variables?
Answer
# 3
Readonly variable can be assigned in run time but constant
variables cnt assign at run time.constant variables is
assigned at compile time only
 
Is This Answer Correct ?    7 Yes 2 No
Pankaj
 
  Re: What is the Difference between read only and constant variables?
Answer
# 4
The difference between the readonly and const data members 
is that const requires you to initialize with the 
declaration, that is directly
 
Is This Answer Correct ?    1 Yes 3 No
Zia Khan
 
  Re: What is the Difference between read only and constant variables?
Answer
# 5
all above answers are correct.But there is another point.

readonly variable can be assigned at declaration or at run 
time which is must be in constructor. Readonly value can't 
be modified.

Constant variable must be assigned at the time of 
declaration only ,which is can't be modified.
 
Is This Answer Correct ?    5 Yes 1 No
Kishore Maddineni
 
  Re: What is the Difference between read only and constant variables?
Answer
# 6
All the answers is right.
But the last one is very right.
 
Is This Answer Correct ?    1 Yes 0 No
Anil Chauhan
 

 
 
 
Other C Sharp Interview Questions
 
  Question Asked @ Answers
 
Can multiple catch blocks be executed? Visual-Soft4
how can i display crystal report in button_click? am working with VS2005..........plz help me  1
Can we inherit a private class in chsarp? how? explain(with code) ? Techno-Labs3
Difference between dispose and destructor? TCS2
Difference between direct type casting and using "as" keyword? TCS1
Can you declare the override method static while the original method is non-static? Mind-Tree2
What statements can enclose a "continue" statement?  3
what are the advantages of c# over vb.net? Choice-Solutions6
How can i load the text box and label at the runtime based on the existing text box and tabel Merrill-Lynch1
How many catch blocks can be there for a single try block? HCL2
What is raise event and what is its use? Wipro1
Explain constructor. Wipro6
When a new instance of a type is created, what is the type of method implicitly called?  2
When compiler adds a default constructor to a class? TCS3
Is there any way to access private memebers of an object from another object? TCS4
what is a constructor? Choice-Solutions4
What are object oriented concepts? Microsoft2
What are the Different kinds of methods? Wipro4
About Virtual functions and their use ? MMTS8
Explain constructor? Wipro6
 
For more C Sharp Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com