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 6 of 10

Explore more Topics under C# programming

Q51.
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 a);
     Console.ReadLine();
 }
 static void func(ref int[] x)
 {
     Console.WriteLine(" numbers are:");
     for (int i = 0; i < x.Length; i++)
     {
         if (x[i] % 2 == 0)
         {
             x[i] = x[i] + 1;
             Console.WriteLine(x[i]);
         }
     }
 }
Discuss
Answer: (b).numbers are : 3 5 7 9 11
Discuss
Answer: (a).References can be called recursively
Discuss
Answer: (b).β€˜=’ operator is used to assign values from one variable to another variable
Q54.
Select the correct output for following set of code.
static void Main(string[] args)
  {
      int X = 0;
      if (Convert.ToBoolean(X = 0))
      Console.WriteLine("It is zero");
      else 
      Console.WriteLine("It is not zero");
      Console.ReadLine();
  }
Discuss
Answer: (b).It is not zero
Q55.
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.ReadLine();
    }
Discuss
Answer: (c).18
Q56.
Select the ouput for the following set of code :
static void Main(string[] args)
    {
        int x = 4 ,b = 2;
        x -= b/= x * b;
        Console.WriteLine(x + " " + b);
        Console.ReadLine();
    }
Discuss
Answer: (c).4 0
Q57.
What is output for the following set of expression?

int a+= (float) b/= (long)c
Discuss
Answer: (b).int
Q58.
Select the output for the following set of code :
static void Main(string[] args)
   {
       int x = 8;
       int b = 16;
       int C = 64;
       x /= b /= C;
       Console.WriteLine(x + " " + b+ " " +C);
       Console.ReadLine();
   }
Discuss
Answer: (d).Compile time error
Q59.
What is the output of the following set of code?
static void Main(string[] args)
   {
       int x = 8;
       int b = 16;
       int C = 64;
       x /= b /= C;
       Console.WriteLine(x + " " + b+ " " +C);
       Console.ReadLine();
   }static void Main(string[] args)
 {
     int a = 5;
     int s = 0, c = 0;
     Mul (a, ref s, ref c);
     Console.WriteLine(s + "t " +c);
     Console.ReadLine();
 }
 static void Mul (int x, ref int ss, ref int cc)
 {
     ss = x * x;
     cc = x * x * x;
 }
Discuss
Answer: (b).25 125
Discuss
Answer: (a).C# allows a function to have arguments with default values
Page 6 of 10

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!