Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C# Programming
»
Structures
How many bytes will the structure variable samp occupy in memory if it is defined as shown below? class Trial { int i; Decimal d; } struct Sample { private int x; private Single y; private Trial z; } Sample samp = new Sample();
20 bytes
12 bytes
8 bytes
16 bytes
24 bytes
Correct Answer:
12 bytes
← Previous Question
Next Question→
More Questions from
Structures
When would a structure variable get destroyed?
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();
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments