Search Placementyogi.com
 

C# Structures - Basic .NET Objective Questions

1

A structure variable declared in a C# program is garbage collected when it is no longer in use.

A. True
B. False
See Answer & Explanation Lets Discuss
Correct answer is : B
Explanation

Structure variable is destroyed at the moment it goes out of scope in any C# program.

 
2

What is the output of the following C# program?

using System;
namespace PlacementYogi
{
    struct Yogi
    {
        public int a;
    }
    class Bird
    {
        public static void Main()
        {
            Yogi x = new Yogi();
            x.a = 20;
            fly(x);
            Console.Write(x.a + " ");
        }
        static void fly(Yogi y)
        {
            y.a = 10;
            Console.Write(y.a + " ");
        }
    } 
}
A.

20 20

B.

10 20

C.

20 10

D.

10 10

E.

None of these

See Answer & Explanation Lets Discuss
Correct answer is : B
Explanation

No explanation available. Let's Discuss

 
3

The following C# program executes successfully and prints Name:Raman Age:200 Address:Sivana.

using System;
namespace PlacementYogi
{
    struct Yogi
    {
        public string name;
        public int age;
        public string address;
    }
    class TestYogi
    {
        public static void Main()
        {
            Yogi y = new Yogi();
            y.name = "Raman";
            y.age = 200;
            y.address = "Sivana";
            Console.Write("Name:" + y.name + " Age:" + y.age + " Address:" + y.address);
        }
    } 
}
A. Yes
B. No
See Answer & Explanation Lets Discuss
Correct answer is : A
Explanation

No explanation available. Let's Discuss

 
4

Which of the following statements is true regarding C# program given below?

using System;
namespace PlacementYogi
{
    class Asan
    {
        string x;
        int y;
    }
    struct Yogi
    {
        private string name;
        private int age;
        private TestYogi ty;
    }
    class TestYogi
    {
        public static void Main()
        {
            Yogi y = new Yogi();
        }
    }
}
A.

Object y will be created on stack.

B.

Object y will be created on heap.

C.

Program will not compile correctly.

See Answer & Explanation Lets Discuss
Correct answer is : A
Explanation

No explanation available. Let's Discuss

 
5

Which of the following statements is true regarding C# program given below?

using System;
namespace PlacementYogi
{
    struct Yogi
    {
        public int inx;
    }
    public class TestYogi
    {
        public static void Main(string[] args)
        {
            Yogi x = new Yogi();
            Yogi y;
            x.inx = 1;
            y = x;
            y.inx = 2;
            Console.WriteLine(x.inx + " " + y.inx);
        }
    } 
}
A.

1 1

B.

2 2

C.

1 2

D.

2 1

E.

None of these

See Answer & Explanation Lets Discuss
Correct answer is : C
Explanation

No explanation available. Let's Discuss

 
 

Banner to LogicGuns.com

Hide Page Information

C# Structures - Basic Objective Questions and Answers with Explanation

Here you can find basic level C# structures interview questions with answers and explanation.

Why Structures in C#?

In this section you can learn and practice different types of basic level questions with answers on structures to improve your skills in order to face the interviews, competitive examinations and various entrance tests with full confidence.

Where can I get C# Structures Basic Questions and Answers with Explanation?

PlacementYogi provides you lots of fully solved basic level structures questions and answers with explanation. Fully solved examples with detailed answer description, explanation are given and it would be easy to understand. All students, freshers can download quiz questions with answers as PDF files and eBooks.

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

Here you can find objective type basic structures questions and answers for interview and entrance examination. Multiple choice and TRUE or FALSE type and YES or NO type questions are also provided.