Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C# Programming
»
Structures
When would a structure variable get destroyed?
When no reference refers to it, it will get garbage collected.
Depends upon whether it is created using new or without using new.
When it goes out of scope.
Depends upon the Project Settings made in Visual Studio.NET.
Depends upon whether we free it's memory using free() or delete().
Correct Answer:
When it goes out of scope.
← Previous Question
Next Question→
More Questions from
Structures
Which of the following will be the correct output for the C#.NET program given below? namespace CuriousTabConsoleApplication { struct Sample { public int i; } class MyProgram { static void Main() { Sample x = new Sample(); x.i = 10; fun(x); Console.Write(x.i + " "); } static void fun(Sample y) { y.i = 20; Console.Write(y.i + " "); } } }
Which of the following will be the correct output for the program given below? namespace CuriousTabConsoleApplication { struct Sample { public int i; } class MyProgram { static void Main(string[] args) { Sample x = new Sample(); Sample y; x.i = 9; y = x; y.i = 5; Console.WriteLine(x.i + " " + y.i); } } }
Which of the following statements is correct?
C#.NET structures are always value types.
Which of the following is the correct way to define a variable of the type struct Emp declared below? struct Emp { private String name; private int age; private Single sal; } Emp e(); e = new Emp(); Emp e = new Emp; Emp e; e = new Emp; Emp e = new Emp(); Emp e;
Which of the following will be the correct output for the C#.NET program given below? namespace CuriousTabConsoleApplication { struct Sample { public int i; } class MyProgram { static void Main(string[] args) { Sample x = new Sample(); x.i = 10; fun(ref x); Console.Write(x.i + " "); } public static void fun(ref Sample y) { y.i = 20; Console.Write(y.i + " "); } } }
The space required for structure variables is allocated on stack.
Which of the following statements is correct about the C#.NET code snippet given below? class Trial { int i; Decimal d; } struct Sample { private int x; private Single y; private Trial z; } Sample ss = new Sample();
Which of the following statements is correct about the C#.NET code snippet given below? struct Book { private String name; private int noofpages; private Single price; } Book b = new Book();
Which of the following statements are correct about Structures used in C#.NET? A Structure can be declared within a procedure. Structs can implement an interface but they cannot inherit from another struct. struct members cannot be declared as protected. A Structure can be empty. It is an error to initialize an instance field in a struct.
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments