C# Test 8

Which of the following are valid .NET CLR JIT performance counters?
1. Total memory used for JIT compilation
2. Average memory used for JIT compilation
3. Number of methods that failed to compile with the standard JIT
4. Percentage of processor time spent performing JIT compilation
5. Percentage of memory currently dedicated for JIT compilation

Which of the following jobs are done by Common Language Runtime?
1. It provides core services such as memory management, thread management, and remoting.
2. It enforces strict type safety.
3. It provides Code Access Security.
4. It provides Garbage Collection Services.

What will be the output of the C#.NET code snippet given below?
char ch = Convert.ToChar ('a' | 'b' | 'c'); 
switch (ch)
{
case 'A':
case 'a':
Console.WriteLine ("case A | case a");
break;

case 'B':
case 'b':
Console.WriteLine ("case B | case b");
break;

case 'C':
case 'c':
case 'D':
case 'd':
Console.WriteLine ("case D | case d");
break;
}
Suppose n is a variable of the type Byte and we wish, to check whether its fourth bit (from right) is ON or OFF. Which of the following statements will do this correctly?
What will be the output of the C#.NET code snippet given below?
int num = 1, z = 5;

if (!(num <= 0))
Console.WriteLine( ++num + z++ + " " + ++z );
else
Console.WriteLine( --num + z-- + " " + --z );
What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[ ] args)
{
int i = 10;
double d = 34.340;
fun(i);
fun(d);
}
static void fun(double d)
{
Console.WriteLine(d + " ");
}
}
}
What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[ ] args)
{
object[] o = new object[] {"1", 4.0, "India", 'B'};
fun (o);
}
static void fun (params object[] obj)
{
for (int i = 0; i < obj.Length-1; i++)
Console.Write(obj[i] + " ");
}
}
}
What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class Sample
{
static Sample()
{
Console.Write("Sample class ");
}
public static void Bix1()
{
Console.Write("Bix1 method ");
}
}
class MyProgram
{
static void Main(string[ ] args)
{
Sample.Bix1();
}
}
}
Which one of the following statements is correct?
Which of the following are the correct ways to define an array of 2 rows and 3 columns?
1.
 int[ , ] a;
a = new int[1, 2]{{7, 1, 3}, {2, 9, 6}};

2.
 int[ , ] a = {{7, 1, 3}, {2, 9,6 }};

3.
 int[ , ] a;
a = new int[2, 3]{};

4.
 int[ , ] a;
a = new int[2, 3]{{7, 1, 3},{2, 9, 6}};

5.
 int[ , ] a;
a = new int[1, 2];
Which one of the following classes are present System.Collections.Generic namespace?
1. Stack
2. Tree
3. SortedDictionary
4. SortedArray

For the code snippet shown below, which of the following statements are valid?
public class Generic
{
public T Field;
public void TestSub()
{
T i = Field + 1;
}
}
class MyProgram
{
static void Main(string[] args)
{
Generic gen = new Generic();
gen.TestSub();
}
}
For the code snippet shown below, which of the following statements are valid?
public class TestIndiaBix
{
public void TestSub (M arg)
{
Console.Write(arg);
}
}
class MyProgram
{
static void Main(string[] args)
{
TestIndiaBix bix = new TestIndiaBix();
bix.TestSub("IndiaBIX ");
bix.TestSub(4.2f);
}
}
Which of the following CANNOT be used as an underlying datatype for an enum in C#.NET?
Which of the following statements is correct about an enum used in C#.NET?
Which of the following statements are correct?
1. The signature of an indexer consists of the number and types of its formal parameters.
2. Indexers are similar to properties except that their accessors take parameters.
3. Accessors of interface indexers use modifiers.
4. The type of an indexer and the type of its parameters must be at least as accessible as the indexer itself.
5. An interface accessor contains a body.

Which of the following statements is correct about the C#.NET program given below if a value "6" is input to it?
using System;
namespace IndiabixConsoleApplication
{
class MyProgram
{
static void Main (string[] args)
{
int index;
int val = 66;
int[] a = new int[5];
try
{
Consote.Write("Enter a number: ");
index = Convert.ToInt32(Console.ReadLine());
a[index] = val;
}
catch(Exception e)
{
Console.Write("Exception occurred ");
}
Console.Write("Remaining program ");
}
}
}
Which of the following statements are correct?
1. All operators in C#.NET can be overloaded.
2. We can use the new modifier to modify a nested type if the nested type is hiding another type.
3. In case of operator overloading all parameters must be of the different type than the class or struct that declares the operator.
4. Method overloading is used to create several methods with the same name that performs similar tasks on similar data types.
5. Operator overloading permits the use of symbols to represent computations for a type.

Schreibe einen Kommentar