C# Programming - Structures

Why C# Programming Structures?

In this section you can learn and practice C# Programming Questions based on "Structures" and improve your skills in order to face the interview, competitive examination and various entrance test (CAT, GATE, GRE, MAT, Bank Exam, Railway Exam etc.) with full confidence.

Where can I get C# Programming Structures questions and answers with explanation?

IndiaBIX provides you lots of fully solved C# Programming (Structures) questions and answers with Explanation. Solved examples with detailed answer description, explanation are given and it would be easy to understand. All students, freshers can download C# Programming Structures quiz questions with answers as PDF files and eBooks.

Where can I get C# Programming Structures Interview Questions and Answers (objective type, multiple choice)?

Here you can find objective type C# Programming Structures questions and answers for interview and entrance examination. Multiple choice and true or false type questions are also provided.

How to solve C# Programming Structures problems?

You can easily solve all kind of C# Programming questions based on Structures by practicing the objective type exercises given below, also get shortcut methods to solve C# Programming Structures problems.

Exercise :: Structures - General Questions

  • Structures - General Questions
1. 

The space required for structure variables is allocated on stack.

A. True
B. False

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.

2. 

Creating empty structures is allowed in C#.NET.

A. True
B. False

Answer: Option B

Explanation:

No answer description available for this question. Let us discuss.

3. 

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.

4. 

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.

5. 

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.