Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

C# QUESTIONS : PART 5

What is the return type of constructors?

int

 float

void

none of the mentioned 

SHOW ANSWER

Which method has the same name as that of its class?

delete

class

constructor

none of mentioned

SHOW ANSWER

The capability of an object in Csharp to take number of different forms and hence display behaviour as according is known as:

Encapsulation

Polymorphism 

 Abstraction

None of the mentioned

SHOW ANSWER

Wrong statement about run time polymorphism is?

The overridden base method should be virtual,abstract or override

An abstract method is implicitly a virtual method

 An abstract inherited property cannot be overridden in a derived class  

Both override method and virtual method must have same access level modifier

SHOW ANSWER

Select the correct output for the given set of code?

  1.  class sample
  2.  {
  3.      public  int i;
  4.      void display()
  5.      {
  6.          Console.WriteLine(i);
  7.      }
  8. }   
  9. class sample1 : sample
  10. {
  11.     public  int j;
  12.     public void display()
  13.     {
  14.         Console.WriteLine(j);
  15.     }
  16. }   
  17. class Program
  18. {
  19.     static void Main(string[] args)
  20.     {
  21.         sample1 obj = new sample1();
  22.         obj.i = 1;
  23.         obj.j = 2;
  24.         obj.display();
  25.         Console.ReadLine();
  26.     }
  27. }

1

3

Compile Time error

SHOW ANSWER

The following set of code is run on single level of inheritance. Find correct statement about the code?

  1.  class sample
  2.  {
  3.      int i = 10;
  4.      int j = 20;
  5.      public void display()
  6.      {
  7.          Console.WriteLine("base method ");
  8.      }
  9.  }   
  10.  class sample1 : sample
  11.  {
  12.      public  int s = 30;
  13.  }   
  14.  class Program
  15.  {
  16.      static void Main(string[] args)
  17.      {
  18.          sample1 obj = new sample1();
  19.          Console.WriteLine("{0}, {1}, {2}", obj.i,  obj.j,  obj.s);
  20.          obj.display();
  21.          Console.ReadLine();
  22.      }
  23.  }

10, 20, 30

10, 20, 0

 compile time error

base method

SHOW ANSWER

Which statements are correct?

If a base class consists of a member function fun() and a derived class do not have any function with this name. An object of derived class can access fun()

A class D can be derived from class C, which is derived from class B which in turn is derived from class A

If a base class and a derived class each include a member function with same name,the member function of the derived class will be called by object of derived class

 All of the mentioned

SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in