Select chapter



Basics (2.papers)
Data Types (2.papers)
enums (2.papers)
OOPS (4.papers)
Arrays (1.papers)
Structs (2.papers)
Properties (2.papers)
Strings (2.papers)
Interfaces (1.papers)
Constructors (2.papers)
Ref-Out-Keywords (1.papers)
Collections (2.papers)
Generics (1.papers)
Hide

Sponsored Links


  

c# structs interview questions and answers

1
Why inheritance is not supported on value types ?
  1. Value types are created in Heap memory , Inheritance is not allowed on the members which are created in Heap memory .
  2. Since value types are created in stack memory and stack memory is limited memory. Hence inheritance is not allowed .
Show Answer
Share Facebook gmail Twitter
2
Why struct members can not be declared as virtual?
  1. By default structs are sealed.
  2. Inheritence is not allowed on structs.
  3. Interface implementaion is not allowed on structs.
  4. Options 1 & 2 are correct.
Show Answer
Share Facebook gmail Twitter
3
Why struct members can not be declared as abstract?
  1. Interface implementaion is not allowed on structs.
  2. Since a struct can not act as a base type hence abstract keyword is not allowed .
  3. Struct is sealed .
  4. 2,3
Show Answer
Share Facebook gmail Twitter
4
Why struct members can not be declared as protected?
  1. Cannot specify an access modifier for structs
  2. They are public by default
  3. They are private by default
  4. Inheritence is not supported on structs.
Show Answer
Share Facebook gmail Twitter
5
Is it possible to implement multiple interfaces in a struct ?
  1. Yes
  2. No
  3. Yes, but explicit implementation of Interface is not supported.
  4. Yes, but implicit implementation of Interface is not supported.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
7
Is it possible to declare and initialise read-only variables in a struct ?
  1. No, only declaration is allowed
  2. No, Declaration as well as assignment are not allowed
  3. Yes
  4. None of the above
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
11
Which of the below given statements are correct about the below given program ?
public class Test
{
    public static void main(string[] args)
    {
        int i = new int();
    }
}
  1. Compilation Error
  2. Runtime Error
  3. During compilation time value type int will be converted into Int32 struct.
  4. We cannot use new keyword on value types.
Show Answer
Share Facebook gmail Twitter
12
Which of the below statements are correct about structs?
  1. Structs are reference types.
  2. Garbage Collector cannot act on Structs.
  3. Structures are equivalent to Light weight classes.
  4. Most of the primitive types in .Net are structs
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Read more papers :