adplus-dvertising

Welcome to the Miscellaneous Topics MCQs Page

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

Miscellaneous Topics MCQs | Page 4 of 17

Q31.
Which of the following is the correct way of applying the custom attribute called Tested which receives two-arguments - name of the tester and the testgrade?

1. Custom attribute cannot be applied to an assembly.
2. [assembly: Tested("Sachin", testgrade.Good)]
3. [Tested("Virat", testgrade.Excellent)] class customer { /* .... */ }
4. Custom attribute cannot be applied to a method.
5. Custom attribute cannot be applied to a class.
Discuss
Answer: (c).2, 3
Q32.
Attributes can be applied to
1. Method
2. Class
3. Assembly
4. Namespace
5. Enum
Discuss
Answer: (b).1, 2 and 3
Q33.
Select the class which is the base class for all arrays in C#?
Discuss
Answer: (a).Array
Discuss
Answer: (d).Both b and c
Discuss
Answer: (c).Both a & b
Q36.
Choose the correct statement about the IComparer interface in C#:
Discuss
Answer: (d).Both a & b
Q37.
What does the following property defined in the array class defines in C#?

public bool IsReadOnly { get; }
Discuss
Answer: (d).All of the above
Discuss
Answer: (d).Both a and b
Q39.
What will be the output of given code snippet?
static void Main(string[] args)
 {
     int[] nums = { 5, 4, 6, 3, 14, 9, 8, 17, 1, 24, -1, 0 };
     Array.Sort(nums);
     int idx = Array.BinarySearch(nums, 14);
     if (idx == 9)
     {
         Console.WriteLine(Convert.ToBoolean(1));
     }
     else
    {
        Console.WriteLine(Convert.ToBoolean(0));
    }
    Console.WriteLine("Index of 14 is " + idx);
    Console.ReadLine();
}
Discuss
Answer: (c).True
9
Q40.
What will be the output of the given code snippet?
static void Main(string[] args)
  {
      string[] strings = {"beta", "alpha", "gamma"};
      Console.WriteLine("Array elements: ");
      DisplayArray(strings);
      Array.Reverse(strings); 
      Console.WriteLine("Array elements now: ");
      DisplayArray(strings);
      Console.ReadLine();
   }
   public static void DisplayArray(Array array)
   {
       foreach (object o in array)
       {
           Console.Write("{0} ", o);
       }
           Console.WriteLine();
   }
Discuss
Answer: (c).Array elements:
beta alpha gamma
Array elements now:
gamma alpha beta
Page 4 of 17

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!