IndiaBIX
IndiaBIX
Start typing & press "Enter" or "ESC" to close
  • Home
  • Jobs
  • Results
  • Current Affairs
  • GK
  • Online Test
  • HR Interview
  • BLOG

Structures - General Questions (2)

  • Home
  • Computer Science & Engineering
  • C# Programming Questions and Answers
  • Structures - General Questions
9. 

C#.NET structures are always value types.

 

A. True
B. False

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

10. 

Which of the following statements are correct?

1 A struct can contain properties.

2 A struct can contain constructors.

3 A struct can contain protected data members.

4 A struct cannot contain methods.

5 A struct cannot contain constants.

A. 1, 2
B. 3, 4
C. 1, 2, 4
D. 3, 5

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

11. 

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: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

12. 

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: Option B

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

13. 

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: Option E

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

14. 

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;
}

1 Emp e(); e = new Emp();

2 Emp e = new Emp;

3 Emp e; e = new Emp;

4 Emp e = new Emp();

5 Emp e;

 

A. 1, 3
B. 2, 5
C. 4, 5
D. 1, 2, 4

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

15. 

Which of the following is the correct way of setting values into the structure variable e defined below?

struct Emp
{
public String name;
public int age;
public Single sal;
}
Emp e = new Emp();

A. e.name = "Amol"; e.age = 25; e.sal = 5500;
B. With e { .name = "Amol"; .age = 25; .sal = 5500; }
C. With emp e { .name = "Amol"; .age = 25; .sal = 5500; }
D. e -> name = "Amol"; e -> age = 25; e -> sal = 5500;
E. name = "Amol"; age = 25; sal = 5500;

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

16. 

Which of the following will be the correct output for the C#.NET program given below?

namespace IndiabixConsoleApplication
{
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 + " ");
}
}
}

A. 10 20
B. 10 10
C. 20 10
D. 20 20
E. None of the above

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

  • 1
  • 2
  • 3

Questions & Answers

Aptitude Chemical Engineering Civil Engineering Computer Science & Engineering Current Affairs Data Interpretation Electrical & Electronics Engineering Electronics & Communication Engineering General Knowledge Logical Reasoning Mechanical Engineering Non Verbal Reasoning Verbal Ability Verbal Reasoning

Interviews

HR Interview

Jobs

Sarkari Jobs

Results

Rojgar ResultSarkari Result

Admission

Admission 2023

Admit Card

Admit Card 2023

Answer Key

Answer Key 2023
copyright
Privacy Policy
© 2026 IndiaBIX. All Rights Reserved.

Report