|
INTERVIEW QUESTIONS
MICROSOFT
C#
DETAILS
Question: The field variables in a class or a struct in C# are by default given a value of zero
Answer: A value-type field variable is initialized to its default value, which is equal to the value computed by the value type's default constructor.
A reference type field variable is initialized to its default value, which is null.
All numeric type field variables are initialized to 0, bool is initialized to false, and string to empty string.
The field variables initialization is basically done by the memory manager by setting all memory bits to 0 before it is allocated for use.
|
|
|
Category |
C# Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 7478 users |
Added on |
7/28/2011 |
Views |
68037 |
Rate it! |
|
|
Question:
The field variables in a class or a struct in C# are by default given a value of zero
Answer:
A value-type field variable is initialized to its default value, which is equal to the value computed by the value type's default constructor.
A reference type field variable is initialized to its default value, which is null.
All numeric type field variables are initialized to 0, bool is initialized to false, and string to empty string.
The field variables initialization is basically done by the memory manager by setting all memory bits to 0 before it is allocated for use. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
All the variables local to a method in C# must be initialized before they can be used
|
View Answer
|
|
Difference between shadow and override?
|
View Answer
|
|
What happens when a C# project has more than 1 Main methods
|
View Answer
|
|
Which of the following explicit type conversion is achieved with out loosing the original data value
|
View Answer
|
|
Which of these operator has the Highest Precedence
|
View Answer
|
|
How do you determine the size required by a Value type on the stack
|
View Answer
|
|
How do you check whether an Object is compatible with Specific Type
|
View Answer
|
|
How do you make CLR enforce overflow checking
|
View Answer
|
|
X=X+1 is equivalent to
|
View Answer
|
|
If we need to compare X to a value 3 how do we do it in C#
|
View Answer
|
|
Which operator is used for TypeCasting
|
View Answer
|
|
Array declaration in C# is done with
|
View Answer
|
|
How to get the capacity of an array in C#
|
View Answer
|
|
Which of the following is wrong with regards to Out keyword
|
View Answer
|
|
Which modifiers hides an inherited method with same signature
|
View Answer
|
|
For Each statement implicitly implements which interface
|
View Answer
|
|
The condition for If statement in C# is enclosed with in
|
View Answer
|
|
If you need your own implementation of Equals method of object what needs to be done
|
View Answer
|
|
Which of the escape sequence is used for Backspace
|
View Answer
|
|
Which of the member is not a member of Object
|
View Answer
|