C# Test 2

Which of the following constitutes the .NET Framework?
1. ASP.NET Applications
2. CLR
3. Framework Class Library
4. WinForm Applications
5. Windows Services
Which of the following statements are correct about the C#.NET code snippet given below?
if (age > 18 && no < 11)
a = 25;

1. The condition no 18 evaluates to True.
2. The statement a = 25 will get executed if any one condition is True.
3. The condition no 18 evaluates to False.
4. The statement a = 25 will get executed if both the conditions are True.
5. && is known as a short circuiting logical operator.

Which of the following will be the correct output for the C#.NET program given below?
namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[] args)
{
int a = 5;
int s = 0, c = 0;
Proc(a, ref s, ref c);
Console.WriteLine(s + " " + c);
}
static void Proc(int x, ref int ss, ref int cc)
{
ss = x * x;
cc = x * x * x;
}
}
}
How many values is a function capable of returning?
Which of the following statements is correct about the C#.NET code snippet given below?
class Sample
{
private int i;
public Single j;
private void DisplayData()
{
Console.WriteLine(i + " " + j);
}
public void ShowData()
{
Console.WriteLine(i + " " + j);
}
}
What will be the size of the object created by the following C#.NET code snippet?
namespace IndiabixConsoleApplication
{
class Baseclass
{
private int i;
protected int j;
public int k;
}
class Derived: Baseclass
{
private int x;
protected int y;
public int z;
}
class MyProgram
{
static void Main (string[ ] args)
{
Derived d = new Derived();
}
}
}
In an inheritance chain which of the following members of base class are accessible to the derived class members?
1. static
2. protected
3. private
4. shared
5. public

It is illegal to make objects of one class as members of another class.
The space required for structure variables is allocated on stack.
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;

Which of the following CANNOT be a target for a custom attribute?
In which of the following collections is the Input/Output based on a key?
1. Map
2. Stack
3. BitArray
4. HashTable
5. SortedList

Which of the following statements is correct about a namespace in C#.NET?
Which of the following statements are correct about the exception reported below?
Unhandled Exception: System.lndexOutOfRangeException:
Index was outside the bounds of the array.
at IndiabixConsoleApplication.Program.Main(String[] args) in
D:\ConsoleApplication\Program.cs:line 14

1. The program did not handle an exception called IndexOutOfRangeException.
2. The program execution continued after the exception occurred.
3. The exception occurred in line number 14.
4. In line number 14, the program attempted to access an array element which was beyond the bounds of the array.
5. The CLR could not handle the exception.

It is compulsory for all classes whose objects can be thrown with throw statement to be derived from System.Exception class.
Which of the following statement is correct about the C#.NET code snippet given below?
public class Sample
{
public int x;
public virtual void fun()
{ }
}
public class DerivedSample : Sample
{
new public void fun()
{ }
}
In order for an instance of a derived class to completely take over a class member from a base class, the base class has to declare that member as
Which of the following statements is correct about an interface used in C#.NET?
Which of the following statements are correct about an interface used in C#.NET?
1. An interface can contain properties, methods and events.
2. The keyword must implement forces implementation of an interface.
3. Interfaces can be overloaded.
4. Interfaces can be implemented by a class or a struct.
5. Enhanced implementations of an interface can be developed without breaking existing code.
Schreibe einen Kommentar