Friday, May 31, 2013

.NET MCQ Test – 1

Que.1. Which query expression is used to limit the number of results?
A.    Skip
B.    Take
C.    Where
D.    D.Select

Right Answer: B

Que.2. Which of the following are required to enable users to change the title of web part?
A.    CatalogZone
B.    TitleZone
C.    EditorZone, AppearanceEditorPart
D.    WebPart

Right Answer: C

Que.3. Application_Start event is available in which file?
A.    Global.asax
B.    Local.asax
C.    Web.config
D.    None

Right Answer: A

Que.4. Why should you write the cleanup code in finally block?
A.    Compiler throws an error if you close the connection in try block.
B.    Resource cannot be destroyed in catch block.
C.    Finally blocks run whether or not exception occurs.
D.    All choices are correct.

Right Answer: C

Que.5. Which LINQ statement defines the range variable in a LINQ query?
A.    from
B.    select
C.    join
D.    where

Right Answer: A

Que.6. Which of the following are correct?
1.    Delegates are like C++ function pointers.
2.    Delegates allow methods to be passed as parameters.
3.    Delegates can be used to define callback methods.
4.    Delegates are not type safe.

A.    1,3,4
B.    1,2,3
C.    2,3,4
D.    All are correct

Right Answer: B

Que.7. Which of the following is true?
A.    DataTable object contain DataRow and DataColumn objects
B.    DataSet and DataTable can be binary serialized
C.    DataSet and DataTable can be XML serialized
D.    All choices are correct

Right Answer: D

Que.8. namespace A
{
class MyClass
{
public void fun()
{
Consol.WriteLine(“C # is fun”);
}
}
namespace B
{
class MyClass
{
public void fun()
{
Console.WriteLine(“C # is interesting”);
}
}
}
}
Consider the above code what will be the output of following program

class Program
{
static void Main(string[] args)
{
A.MyClass obj = new A.MyClass();
obj.fun();
}
}

A.    C # is interesting
B.    C # is fun
C.    compiler time error
D.    None

Right Answer: B

Que.9. Which of the following are correct?
1.    Indexers enable objects to be indexed in a similar manner to arrays.
2.    The this keyword is used to define the indexers.
3.    Indexers can be overloaded.
4.    Indexer cannot be used in interface.

A.    1,2
B.    3
C.    1,2,3
D.    None

Right Answer: C

Que.10. Which of the following are correct?
Properties in .NET can be declared as
1.    Static, Protected internal, Virtual
2.    Public, internal, Protected internal
3.    Only public
4.    None

A.    1,2
B.    3
C.    1,2,3
D.    4

Right Answer: A

Que.11. class Myclass
{
public in count = 0;
public Myclass()
{
Count++;
}
}


class Program
{
Static void Main (string[] args)
{
Myclass obj1 = new Myclass(); Console.WriteLine(obj1.count);
Myclass obj2 = new Myclass(); Console.WriteLine(obj2.count);
Myclass obj3 = new Myclass(); Console.WriteLine(obj3.count);
}
}

A.    1,1,1
B.    1,2,3
C.    0,1,2
D.    All of the above

Right Answer: A

Que.12. An interface ca contain declaration of
A.    Methods, properties, events, indexers
B.    Methods
C.    Static members
D.    All of the above

Right Answer: A

Que.13. int[] numbers ={5,4,11,3,9,8,7,2,0};
var nums = numbers.Skip(4);

foreach(var n in nums)
{
Console.Write(n+””);
}

A.    9 8 6 7 2 0
B.    5 4 11 3 9 8
C.    5 4 11 3
D.    None

Right Answer: A

Que.14. int[] A= {0,2,4,5,6,8,9};
int[] B = {1,3,5,7,8};

IEnumerable<int> nums = A.Except(B);

foreach(var n in nums)
{
Console.Write(n+ “”);
}

A.    0,2,4,5,6,8,9
B.    1,3,5,7,8
C.    0,2,4,6,9
D.    All of the above

Right Answer: C

Que.15 Choose the correct one.
int[] numbers = {9,4,1,3,8,6,7,2,1};

var nums = numbers.Take(3);
foreach(var n in nums)
{
Console.WriteLine(n);
}

A.    7 2 1
B.    9 4 1
C.    3 8 6
D.    1 4 9

Right Answer: B

Que.16. int[] A = {0,2,4,56,8};
int[] B = {1,3,5,7,8};

var nums = A.Unioin(B);
foreach(var n in nums)
{
Consol.Write(n+ “”);
}
A.    0 2 4 5 6 8 1 3 5 7 8
B.    0 2 4 5 6 8 1 3 7
C.    0 1 2 3 4 5 6 7 8
D.    None

Right Answer: B

Que.17. Which of the following are correct?
1.    An interface can be instantiated directly.
2.    Interfaces can contain constructor.
3.    Interfaces contain no implementation of methods.
4.    Classes and structs can implement more than one interface.
5.    An interface itself can inherit from multiple interfaces.

A.    3,4,5
B.    1,2,3
C.    2,3,4
D.    All are correct

Right Answer: A

Que.18. From the following which works client side?
A.    ViewState
B.    HiddenField
C.    ControlState
D.    All Choices are correct

Right Answer: D

Que.19. namespace A
{
class MyClass
{
public void fun()
{
Console.WriteLine(“C # is fun”);
}
}
Namespace B
{
class MyClass
{
public void fun()
}
Console.WriteLine(“C # is interesting”);
}
}
}
}

Consider the above code what will be the output of the following program

class Program
{
Static void Main(string[] args)
{
A.B.MyClass obj = new A.B.MyClass();

Obj.fun();
}
}

A.    C # is interesting
B.    C # is fun
C.    Compile time error
D.    None

Right Answer: A

Que.20. From the following which works server side?
A.    ViewState
B.    HiddenField
C.    Application and session
D.    All choices are correct

Right Answer: C


No comments:

Post a Comment