C# Test 3

Which of the following statements are TRUE about the .NET CLR?
1. It provides a language-neutral development & execution environment.
2. It ensures that an application would not be able to access memory that it is not authorized to access.
3. It provides services to run "managed" applications.
4. The resources are garbage collected.
5. It provides services to run "unmanaged" applications.

Which of the following statements correctly define .NET Framework?
Which of the following is the correct output for the C#.NET program given below?
int i = 20 ;
for( ; ; )
{
Console.Write(i + " ");
if (i >= -10)
i -= 4;
else
break;
}
Which of the following statements are correct?
1. A switch statement can act on numerical as well as Boolean types.
2. A switch statement can act on characters, strings and enumerations types.
3. We cannot declare variables within a case statement if it is not enclosed by { }.
4. The foreach statement is used to iterate through the collection to get the desired information and should be used to change the contents of the collection to avoid unpredictable side effects.
5. All of the expressions of the for statement are not optional.

Which of the following statements is correct about the C#.NET code snippet given below?
switch (id)
{
case 6:
grp = "Grp B";
break;

case 13:
grp = "Grp D";
break;

case 1:
grp = "Grp A";
break;

case ls > 20:
grp = "Grp E";
break ;

case Else:
grp = "Grp F";
break;
}
Which of the following are NOT Relational operators in C#.NET?
1. >=
2. !=
3. Not
4. <=
5. =

Which of the following statements are correct about functions used in C#.NET?
1. Function definitions cannot be nested.
2. Functions can be called recursively.
3. If we do not return a value from a function then a value -1 gets returned.
4. To return the control from middle of a function exit function should be used.
5. Function calls can be nested.

Which of the following statements is correct about the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class Sample
{
public int func()
{
return 1;
}
public Single func()
{
return 2.4f ;
}
}
class Program
{
static void Main(string[ ] args)
{
Sample s1 = new Sample();
int i;
i = s1.func();
Single j;
j = s1.func();
}
}
}
Which of the following statements is correct about constructors?
Which statement will you add in the function fun() of class B, if it is to produce the output "Welcome to IndiaBIX.com!"?
namespace IndiabixConsoleApplication
{
class A
{
public void fun()
{
Console.Write("Welcome");
}
}
class B: A
{
public void fun()
{
// [*** Add statement here ***]
Console.WriteLine(" to IndiaBIX.com!");
}
}
class MyProgram
{
static void Main (string[ ] args)
{
B b = new B();
b.fun();
}
}
}
Which of the following statements is correct about the array declaration given below?
int[][][] intMyArr = new int[2][][];
Which of the following will be the correct output for the C#.NET code snippet given below?
String s1="Kicit";
Console.Write(s1.IndexOf('c') + " ");
Console.Write(s1.Length);
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();
Which of the following statements is true about an enum used in C#.NET?
Which of the following will be the correct output for the C#.NET code snippet given below?
enum color : int
{
red = -3,
green,
blue
}
Console.Write( (int) color.red + ", ");
Console.Write( (int) color.green + ", ");
Console.Write( (int) color.blue );
Which of the following statements are correct about the Stack collection?
1. It can be used for evaluation of expressions.
2. All elements in the Stack collection can be accessed using an enumerator.
3. It is used to maintain a FIFO list.
4. All elements stored in a Stack collection must be of similar type.
5. Top-most element of the Stack collection can be accessed using the Peek() method.
Which of the following statements are correct about a HashTable collection?
1. It is a keyed collection.
2. It is a ordered collection.
3. It is an indexed collection.
4. It implements a IDictionaryEnumerator interface in its inner class.
5. The key - value pairs present in a HashTable can be accessed using the Keys and Values properties of the inner class that implements the IDictionaryEnumerator interface.

Which of the following statements is correct about properties used in C#.NET?
Which of the following statements is correct about the C#.NET program given below?
using System;
namespace IndiabixConsoleApplication
{
class MyProgram
{
static void Main(string[] args)
{
int index = 6;
int val = 44;
int[] a = new int[5];
try
{
a[index] = val ;
}
catch(IndexOutOfRangeException e)
{
Console.Write("Index out of bounds ");
}
Console.Write("Remaining program");
}
}
}
Which of the following keyword is used to overload user-defined types by defining static member functions?
Schreibe einen Kommentar