Friday, 16 December 2011

83.If Sample class has a Length property with get accessor then which of the following statements will work correctly?

A.Sample m = new Sample();
m.Length = 10;
B.Sample m = new Sample();
m.Length = m.Length + 20;
C.Sample m = new Sample();
int l;
l = m.Length;
D.Sample.Length = 20;
E.Console.WriteLine(Sample.Length);
Answer: Option C

82.If Sample class has a Length property with set accessor then which of the following statements will work correctly?

A.Sample m = new Sample();
int l;
l = m.Length;
B.    Sample m = new Sample();
m.Length = m.Length + 20;
C.    Sample.Length = 20;
D.    Console.WriteLine (Sample.Length);
E.    Sample m = new Sample();
m.Length = 10;
Answer: Option E

81. A property can be declared inside a namespace or a procedure.

A.True   
B.False
Answerca: Option B

80.If Sample class has a Length property with get and set accessors then which of the following statements will work correctly?p

1.Sample.Length = 20;
2.Sample m = new Sample();
3.m.Length = 10;
4.Console.WriteLine(Sample.Length);
5.Sample m = new Sample();
6.int len;
7.len = m.Length;
8.Sample m = new Sample();
9.m.Length = m.Length + 20;
A.1, 3
B.2, 4, 5
C.4 only
D.3, 5
Answer: Option B

79.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.
A.1, 3, 5
B.1, 2, 4
C.3, 5
D.2, 4
Answer: Option B

78.Which of the following statements is correct about properties used in C#.NET?

A.A property can simultaneously be read only or write only.
B.A property can be either read only or write only.
C.A write only property will have only get accessor.
D.A write only property will always return a value.
Answer: Option B

77.A property can be declared inside a class, struct, Interface.

A.True   
B.False
Answer: Option A