Classes and Objects on C# related Questions and Answers

Question 1 : Output from selective set of code is :

  class box
  •   {
  •       public int volume;
  •       int width;
  •       int height;
  •       int length;
  •       public box ( int w, int h, int l)
  •       {

  • 1. 0
    2. Code executes successfully but prints nothing
    3. Compile time error
    4. 180
    View Answer   Discuss with Members

  • Question 2 : The method called by clients of a class to explicitly release any resources like network,connection,open files etc.When the object is no longer required?
    1. Finalize()
    2. End()
    3. Dispose()
    4. Close()
    View Answer   Discuss with Members

    Question 3 : Select the output for the following set of code :

        static void Main(string[] args)
  •     {
  •         int x = 4 ,b = 2;
  •         x -= b/= x * b;
  •         Console.WriteLine(x + " " 
    1. 4 2
    2. 0 4
    3. 4 0
    4. None of mentioned
    View Answer   Discuss with Members

  • Question 4 : Select the output for the following set of code :

        static void Main(string[] args)
  •     {
  •        int X = 6,Y = 2;
  •        X  *= X / Y;
  •        Console.WriteLine(X);
  •        Console
    1. 12
    2. 6
    3. 18
    4. Compile time error
    View Answer   Discuss with Members

  • Question 5 : Select output for the set of code :

     static void Main(string[] args)
  •  {
  •      int []a = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  •      func(ref
    1. numbers are : 2 4 6 8 10
    2. numbers are : 3 5 7 9 11
    3. numbers are : 2 3 4 5 6
    4. None of the mentioned
    View Answer   Discuss with Members

  • Question 6 : Select the output for the following set of code :

      static void Main(string[] args)
  •   {
  •       int a = 10 , b = 20;
  •       Console.WriteLine("Result before swap is: "+ a +" "+b);
  • View Answer   Discuss with Members

  • Question 7 : “A mechanism that binds together code and data in manipulates, and keeps both safe from outside interference and misuse.In short it isolates a particular code and data from all other codes and data. A well-defined interface controls the access to that particular code and data.”
    1. Abstraction
    2. Polymorphism
    3. Inheritance
    4. Encapsulation
    View Answer   Discuss with Members

    Question 8 : What is the return type of destructor ?
    1. int
    2. void
    3. float
    4. none of the mentioned
    View Answer   Discuss with Members


    View 1 - 10 of 25 Questions

    * Be the First to Post a Comment.

    Submit comment :


    Captcha Image
    Reload

    Ask Question

    Captcha Image
    Reload

    Note : Name and Email never shown.





    Subscribe


    Become a part of EducationForever. Subscribe to our FREE Newsletter