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                      
tip   SiteMap shows list of All Categories in this site.
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
 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 ?    3 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 ?    2 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 ?    2 Yes 1 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 ?    0 Yes 0 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 ?    0 Yes 0 No
Kishore Maddineni
 

 
 
 
Other C Sharp Interview Questions
 
  Question Asked @ Answers
 
Suppose in a scenario if we want to display information only until 4.00 p.m and after that means after 4.00 p.m if any one tries to access the information it should give error mesage. Then how will you write a delegate for this ? Give coding. HP1
Is there any way to access private memebers of an object from another object? TCS1
if i want to transmit binary data,,,will it be support by Webservices or any exceptions ? define  1
what are the advantages of c# over vb.net? Choice-Solutions4
how can i display crystalreport in button click? am working with VS2005  1
Does C# supports multi-dimensional arrays? Microsoft3
Is goto statement supported in C#? How about Java?  2
what is an internal specifier? what happens internally when I use access specifier Internal ? rsystems2
what is the use of master pages. how to use it  1
what is serilization? Protech5
What does the term immutable mean? Techno-Labs2
What is a pre-requisite for connection pooling?  1
Is array reference type / value type ? Accenture1
Explain the three services model (three-tier application).  2
what is the difference between int and Int32? TCS2
What?s a satellite assembly?  1
why instance? what are the uses of instance? Choice-Solutions2
What does assert() do? Wipro1
What is the difference between Abstract and Interface? HCL4
what is reference parameter? what is out parameters? what is difference these two? Bally-Technologies6
 
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