The C# keyword .int. maps to which
.NET type?
|
1. System.Int16
2. System.Int64
3. System.Int32
4. System.Int128
Ans:- System.Int32
|
Which of these string definitions
will prevent escaping on backslashes in C#?
|
1. string s = #.n Test string;
2. string s = @.n Test
string;
3. string s = ..n Test string;
4. string s = .n Test string;
Ans:- string s = @.n Test string;
|
Which of these statements correctly
declares a two-dimensional array in
C#?
|
1. System.Array[2] myArray;
2. int[][] myArray;
3. int[2] myArray;
4. int[,]
myArray;
Ans:-
int[,] myArray;
|
If a method is marked as protected
internal who can access it?
|
1. Classes that are both in the same assembly and derived from the
declaring class.
2. Only methods that are in the same class as the method in
question.
3. Classes within the same
assembly, and classes derived from
the declaring class.
4. Internal methods can be only be called using reflection.
Ans:- Classes within the same assembly, and
classes derived from
the declaring class.
|
What is boxing?
|
a) Encapsulating an object in a value type.
b) Encapsulating a copy of a
value type in an object.
c) Encapsulating a value type in an object.
d) Encapsulating a copy of an object in a value type.
Ans:- Encapsulating a copy of a value type in an
object
|
What compiler switch creates an xml file from
the xml comments
in the files in an assembly?
|
a/text
2. /xml
3. /doc
4. /help
Ans:- /doc
|
What is a satellite Assembly?
|
1. A peripheral assembly designed to monitor permissions requests
from
an application.
2. Any DLL file used by an EXE file.
3. An assembly designed to alter the appearance or .skin. of an
application.
4. An assembly containing
localized resources for another assembly.
Ans:-An assembly containing localized resources for another
assembly.
|
What is a delegate?
|
1. A light weight thread or process that can call a single method.
2. A strongly typed function
pointer.
3. A reference to an object in a different process.
4. An inter-process message channel.
Ans:- A strongly typed function pointer.
|
What is Output of following code?
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication8
{
class Program
{
static
void Main(string[]
args)
{
float [] values = new float[3];
Console.WriteLine(values);
Console.ReadLine();
}
}
}
1)0
2)System.Single[]
3)System.Int32[]
4)0 1 2
Ans:- System
.Single[]
|
What is Output of following code?
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication8
{
class Program
{
static
void Main(string[]
args)
{
double
[] values = new double[3];//if
string is used then ans in String
Console.WriteLine(values);
Console.ReadLine();
}
}
}
1)0
2)System.Double[]
3)error
4)0 1 2
Ans:- System . Double[]//System .string[]
|
What is Output of following code?
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication8
{
class Program
{
static
void TestPassByRef(ref int i)
{
i = 21;
}
static
void Main(string[]
args)
{
int
i = 15;
TestPassByRef(ref i);
Console.WriteLine(i);
Console.ReadLine();
}
}
}
1)15
2) 21
3) error
4)0
Ans:- 21
|
Write a program for swap the number using swap keyword?
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication8
{
class Program
{
static
void swap(ref
int a, ref int b)
{
int c;
c = a;
a = b;
b = c;
}
static void
Main(string[] args)
{
int
a = 15; int b = 20;//int required her b’z we
used ref keyword
swap(ref
a, ref b);
Console.WriteLine("a={0} & b={1}",a,b);
Console.ReadLine();
}
}
}
OUTPUT:-
A=20, b=15
|