IndiaBIX.com
Arithmetic Aptitude Data Interpretation
Logical Reasoning Verbal Reasoning Non Verbal Reasoning
General Knowledge
Sudoku Number puzzles Missing letters puzzles Logical puzzles Playing cards puzzles Clock puzzles
C Programming C++ Programming C# Programming Java Programming
Microbiology Biochemistry Biotechnology Biochemical Engineering
Civil Engineering Mechanical Engineering Chemical Engineering Networking Database Questions Computer Science Basic Electronics Digital Electronics Electronic Devices Circuit Simulation Electrical Enigneering Engineering Mechanics Technical Drawing
Placement Papers Group Disucssion HR Interview Technical Interview Body Language
Aptitude Test Verbal Ability Test Verbal Reasoning Test Logical Reasoning Test C Programming Test Java Programming Test Data Interpretation Test General Knowledge Test
Data Structures Operating Systems Networking DATABASE Database Basics SQL Server Basics SQL Server Advanced SQL Server 2008 JAVA Core Java Java Basics Advanced Java UNIX Unix File Management Unix Memory Management Unix Process Managemnt C Interview Questions The C Language Basics .NET Interview Questions .NET Framework ADO.NET ASP.NET Software Testing

C# Programming - Structures

@ : Home > C# Programming > Structures > General Questions

Exercise

  • General Questions
"No one is as deaf as the man who will not listen."
- (Proverb)
1. 

The space required for structure variables is allocated on stack.

A. TrueB. False

2. 

Creating empty structures is allowed in C#.NET.

A. TrueB. False

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

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;

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



© 2008-2013 by IndiaBIX™ Technologies. All Rights Reserved | Copyright | Terms of Use & Privacy Policy

Contact us: info@indiabix.com     Follow us on twitter!