adplus-dvertising

Welcome to the Interfaces,Inheritance and Polymorphism MCQs Page

Dive deep into the fascinating world of Interfaces,Inheritance and Polymorphism with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Interfaces,Inheritance and Polymorphism, a crucial aspect of C# programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Interfaces,Inheritance and Polymorphism, 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 Interfaces,Inheritance and Polymorphism. 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 Interfaces,Inheritance and Polymorphism. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Interfaces,Inheritance and Polymorphism MCQs | Page 7 of 20

Discuss
Answer: (a).Structures can be declared within a procedure
Q62.
The correct way to define a variable of type struct abc among the following is?
struct abc
 { 
     public string name;
     protected internal int age;
     private Single sal;
 }
Discuss
Answer: (a).abc e = new abc();
Q63.
Which of the following is the correct way to settle down values into the structure variable ‘e’ defined in the following code snippet?
struct emp
 { 
     public String name;
     public int age;
     public Single sal;
 }
 emp e = new emp();
Discuss
Answer: (a).e.name = "Ankit";
e.age = 24;
e.sal = 200;
Discuss
Answer: (c).As variable goes out of the scope
Q65.
Calculate the number of bytes a structure variable s occupies in the memory if it is defined as follows.
class abc
  {
      int i;
      Decimal d;
  }
  struct sample
  {
     private int x;
     private Single y;
     private trial z;
  }
  sample s = new sample();
Discuss
Answer: (d).12 bytes
Q66.
Which of the following is the correct output for the C#.NET program code given below?
{
    struct abc
    {
        public int i;
    }  
    class Program
    {
        static void Main(string[] args)
        {
            sample a = new sample();
            a.i = 10;
            fun(ref a);
            Console.WriteLine(a.i);
        }
        public static voidn fun(ref sample x)
        {
            x.i = 20; 
            Console.WriteLine(x.i);
        }
    }
}
Discuss
Answer: (d).20
20
Discuss
Answer: (c).A structure can contain protected data members
Q68.
Which of the following is the correct result for the given statement in the C#.NET statement given below?
p = q
struct employee
{
    private int employee id;
    private string city;
}
employee q = new employee();
employee p;
p = q;
Discuss
Answer: (a).Elements of ‘q’ will be copied into corresponding elements of p.
Q69.
Which of the following will be the correct output for the program given below?
{
     struct abc
     {
         int i;
     }
     class Program
     {
         static void Main(string[] args)
         {
             abc x = new abc();
             abc z;
             x.i = 10;
             z = x;
             z.i = 15;
             console.Writeline(x.i + "  " + y.i)
         }
     }
 }
Discuss
Answer: (b).10 15
Discuss
Answer: (c).An enum variable cannot have a protected access modifier

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!