C# - Structures Questions and Answers

Take Exam

C# Structures programming questions and answers help learners understand value types and memory management in .NET. Structures in C# are lightweight data types that store related data efficiently without the overhead of classes. Companies like Infosys, HCL, and TCS often include structure-related questions in interviews to test programming fundamentals. Practicing programming interview questions with answers based on structures allows candidates to learn syntax, constructors, field declarations, and performance differences compared to classes. Mastering structures improves understanding of memory optimization and efficient coding—vital skills for software developers and interview aspirants.

Study structures and unions in C programming. Pair this with data types and dynamic memory allocation

C# - Structures

Showing 10 of 39 questions

21. Can a structure have a parameterless constructor

  • Yes, always
  • Explanation: Structures cannot define a parameterless constructor explicitly.
  • Only in abstract structures
  • Only with private access
Show Answer Report

22. Which access modifier is allowed for structure members

  • protected
  • Explanation: Structure members can have access modifiers like private and public.
  • internal only
  • protected internal only
Show Answer Report

23. Which statement about structures and classes is correct

  • Both are reference types
  • Structures are faster than classes
  • Explanation: Structures are value types while classes are reference types.
  • Classes cannot contain methods
Show Answer Report

24. What happens when a structure variable is assigned to another

  • Reference is copied
  • Address is shared
  • Explanation: Assigning a structure copies the entire value.
  • Compilation error occurs
Show Answer Report

25. Which interface can a structure implement

  • Only IDisposable
  • Explanation: Structures can implement one or more interfaces.
  • Only IComparable
  • No interface
Show Answer Report

26. Which keyword is used to prevent modification of structure fields

  • static
  • sealed
  • Explanation: The readonly keyword prevents modification after initialization.
  • fixed
Show Answer Report

27. Which of the following is true about structure size

  • It is always fixed
  • It can grow dynamically
  • Explanation: Structures usually consume less memory than class objects.
  • It has no memory allocation
Show Answer Report

28. Which scenario is best suited for using a structure

  • Large objects with many methods
  • Objects requiring inheritance
  • Explanation: Structures are ideal for small and simple data objects.
  • Objects with complex behavior
Show Answer Report

29. Which keyword allows a structure to be passed by reference

  • ref
  • out
  • in
  • Explanation: Structures can be passed by reference using ref, out, or in.
Show Answer Report

30. Which of the following statements is invalid for a structure

  • It can contain properties
  • It can have static members
  • Explanation: Structures cannot inherit from other structures.
  • It can implement interfaces
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test