Select chapter



Basics (2.papers)
Data Types (2.papers)
enums (2.papers)
OOPS (4.papers)
Arrays (1.papers)
Structs (2.papers)
Properties (2.papers)
Strings (2.papers)
Interfaces (1.papers)
Constructors (2.papers)
Ref-Out-Keywords (1.papers)
Collections (2.papers)
Generics (1.papers)
Hide

Sponsored Links


  

c# properties interview questions and answers

Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
4
Which of the following Statement is true about given code?
 public class A
    {
        public int Name{get;set;}
    }
  1. Class A should be Abstract
  2. Class A should have a private field Associated with property
  3. Property should have definition.
  4. Code will be compiled Successfully
Show Answer
Share Facebook gmail Twitter
5
Which of the following Statement is true for the below given code in C#3.0 ?
 public class A
    {
        public int Name { get; }
    }
  1. Yes, it is allowed since it is readonly auto implemented property.
  2. Yes, it is allowed since it is writeonly auto implemented property.
  3. Class A should have a private field Associated with property.
  4. Compilation error.
Show Answer
Share Facebook gmail Twitter
6
Which of the following Statement is true about below given code?
 public class A
    {
        public int Name   {  set;   }
    }
  1. Class A should have a private field Associated with property.
  2. Yes, it is allowed since it is writeonly property.
  3. Compilation error.
  4. Yes, it is allowed since it is readonly property.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
8
which of the following statement is true about given code?
public class Student
    {
        private string _name="ravi";
        protected string Name
        {
           public get{return _name;}
             set{_name = value;}
        }
    }
  1. The code will be compiled successfully
  2. get should be declared as protected
  3. In all cases, the access modifier for an accessor must be more restrictive than the access specification of its property.
  4. In some cases, the access modifier for an accessor must be more restrictive than the access specification of its property.
Show Answer
Share Facebook gmail Twitter
Read more papers :