6.
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();
A. ss will be created on the heap.
B. Trial object referred by z will be created on the stack.
C. z will be created on the heap.
D. Both ss and z will be created on the heap.
E. ss will be created on the stack.
Answer & Explanation
Answer: Option E
Explanation:
No answer description available for this question. Let us discuss.
View Answer Workspace Report Discuss in Forum
7.
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();
A. 20 bytes
B. 12 bytes
C. 8 bytes
D. 16 bytes
E. 24 bytes
Answer & Explanation
Answer: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Workspace Report Discuss in Forum
8.
Which of the following will be the correct result of the statement b = a in the C#.NET code snippet given below?
struct Address
{
private int plotno;
private String city;
}
Address a = new Address();
Address b;
b = a;
A. All elements of a will get copied into corresponding elements of b.
B. Address stored in a will get copied into b.
C. Once assignment is over a will get garbage collected.
D. Once assignment is over a will go out of scope, hence will die.
E. Address of the first element of a will get copied into b.
Answer & Explanation
Answer: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Workspace Report Discuss in Forum
9.
Which of the following statements are correct?
A struct can contain properties.
A struct can contain constructors.
A struct can contain protected data members.
A struct cannot contain methods.
A struct cannot contain constants.
A. 1, 2
B. 3, 4
C. 1, 2, 4
D. 3, 5
Answer & Explanation
Answer: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Workspace Report Discuss in Forum
10.
C#.NET structures are always value types.
A. True B. False
Answer & Explanation
Answer: Option A
Explanation:
No answer description available for this question.