1) An instance of a structure allocates space in?
- Data Segment
- Stack Segment
- Heap Segment
- Code Segment
Correct answer: 2
Stack Segment
In C#.Net, an instance of structure occupies space in the stack segment.
2) Can we create a structure without any member?
- Yes
- No
Correct answer: 1
Yes
Yes, we can create a structure with an empty body in C#.NET.
3) If we created a variable of structure when it gets destroyed?
- It is garbage collected when it is not pointed by any reference.
- It destroyed automatically, when it goes outside the scope.
- We need to destroy it using the delete operator.
- We need to implement a destructor to destroy it.
Correct answer: 2
It destroyed automatically, when it goes outside the scope.
In C#.NET, the variable of the created structure is destroyed automatically when it goes outside the variable scope.
4) In C#.NET, the structure tag name is mandatory?
- Yes
- No
Correct answer: 1
Yes
Yes, In C#.Net, it is mandatory; we need to give tag-name to create a structure.
5) In C#.NET, can we create a structure within a class?
- Yes
- No
Correct answer: 1
Yes
Yes, In C#.Net, we can create a structure inside a class.