adplus-dvertising

Welcome to the Classes and Objects MCQs Page

Dive deep into the fascinating world of Classes and Objects with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Classes and Objects, a crucial aspect of C# programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Classes and Objects, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C# programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Classes and Objects. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C# programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Classes and Objects. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Classes and Objects MCQs | Page 9 of 10

Explore more Topics under C# programming

Q81.
Name a method which has the same name as that of class and which is used to destroy objects also called automatically when application is finally on process of being getting terminated.
Discuss
Answer: (c).Destructor
Q82.
Operator used to free the memory when memory is allocated ?
Discuss
Answer: (c).delete
Discuss
Answer: (c).Destructors can have modifiers or parameters
Q84.
Output from following set of code ?
class sample
  {
      int i;
      double k;
      public sample (int ii, double kk)
      {
          i = ii;
          k = kk;
          double j = (i) + (k);
          Console.WriteLine(j);
      }
      ~sample()
      {
          double j = i - k;
          Console.WriteLine(j);
      }
  }
  class Program
  {
      static void Main(string[] args)
      {
          sample s = new sample(8, 2.5);
          Console.ReadLine();
      }
  }
Discuss
Answer: (d).10.5 5.5
Q85.
What is the return type of destructor ?
Discuss
Answer: (d).none of the mentioned
Q86.
What is output for the following set of Code ?
class box
   {
       public int volume;
       int width;
       int height;
       int length;
       public box ( int w, int h, int l)
       {
           width = w;
           height = h;
           length = l;
       }
      public ~box()
      {
          volume = width * length * height;
 
      }
 
  }    
  class Program
  {
      static void Main(string[] args)
      {
          box b = new box(4, 5, 9);
          Console.WriteLine(b.volume);
          Console.ReadLine();
      }
 
  }
Discuss
Answer: (c).Compile time error
Q87.
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)
      {
          this.width = w;
          this.height = h;
          this.length = l;
      }
      ~ box()
      {
          volume = this.width * this.length * this.height;
          console.writeline(volume);
      }
  }    
  class Program
  {
      public  static void Main(string[] args)
      {
          box b = new box(4, 5, 9);
          Console.ReadLine();
      }
  }
Discuss
Answer: (d).180
Q88.
Which among these access specifiers should be used for main() method?
Discuss
Answer: (b).public
Q89.
Which of these is used as default for a member of a class if no access specifier is used for it?
Discuss
Answer: (a).private
Q90.
What is the process by which we can control what parts of a program can access the members of a class?
Discuss
Answer: (c).Encapsulation

Suggested Topics

Are you eager to expand your knowledge beyond C# programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!