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 9 of 17

Explore more Topics under C# programming

Q81.
Which method is used to abort thread prior to it’s normal execution?
Discuss
Answer: (d).Abort()
Discuss
Answer: (d).A thread can exist only in two states, running and blocked
Discuss
Answer: (b).It’s a process in which two or more parts of same process run simultaneously
Discuss
Answer: (d).all of the mentioned
Q85.
What will be the output of the given code snippet?
class MyClass
 {
     char[] chrs = { 'A', 'B', 'C', 'D' };
     public System.Collections.IEnumerator GetEnumerator()
     {
         foreach (char ch in chrs)
         yield return ch;
     }
 }
 class Program
 {
     static void Main(string[] args)
     {
         MyClass mc = new MyClass();
         foreach (char ch in mc)
         Console.Write(ch + " ");
         Console.WriteLine();
         Console.ReadLine();
     }
 }
Discuss
Answer: (d).Code runs successfully prints A, B, C, D
Q86.
What does the yield return statement specify in below code snippet?
public System.Collections.IEnumerator GetEnumerator()
 {
     foreach (char ch in chrs)
     yield return ch;
 }
Discuss
Answer: (b).returns the next object in the collection
Q87.
What does the given code snippet specify?
class MyClass
{
    char chrs = 'A' ;
    public IEnumerator GetEnumerator()
    {
        for (int i = 20; i >=0; --i)
        yield return (char)((chrs + i));
    }
}
class Program
{
    static void Main(string[] args)
    {
        MyClass mc = new MyClass();
        foreach (char ch in mc)
        Console.Write(ch + " ");
        Console.WriteLine();
        Console.ReadLine();
    }
}
Discuss
Answer: (c).U T S R Q P O N M L K J I H G F E D C B A
Q88.
What will the given code snippet specify?
class MyClass
{
    char chrs = 'A' ;
    public IEnumerator GetEnumerator()
    {
        for (int i = 20; i >=0; --i)
        if (i == 10) yield break;
        yield return (char)((chrs + i));
    }
}
class Program
{
    static void Main(string[] args)
    {
        MyClass mc = new MyClass();
        foreach (char ch in mc)
        Console.Write(ch + " ");
        Console.WriteLine();
        Console.ReadLine();
    }
}
Discuss
Answer: (c).U T S R Q P O N M L
Q89.
What will be the output of the code snippet?
class MyClass
 {
     int[] a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
     public IEnumerator GetEnumerator()
     {
         for (int i = 0; i < 20; i++)
         {
             if (a[i] % 2 == 0)
             yield return (int)(a[i]);
         }
     }
 }
 class Program
 {
     static void Main(string[] args)
     {
         MyClass mc = new MyClass();
         foreach (int i in mc)
         Console.Write(i + " ");
         Console.WriteLine();
         Console.ReadLine();
     }
 }
Discuss
Answer: (c).code runs successfully prints even number between 1 to 20
Q90.
What will be the output of the code snippet?
class MyClass
 {
     char ch = 'A';
     public IEnumerable MyItr(int end)
     {
         for (int i = 0 ;i < end ;i++)
         yield return (char)(ch + i);
     }
     public IEnumerable MyItr(int begin, int end)
     {
         for (int i = begin ;i < end ;i++)
         yield return (char)(ch + i);
     }
 }
 class Program
 {
     static void Main(string[] args)
     {
         MyClass mc = new MyClass();
         Console.WriteLine("Iterate the first 7 letters:");
         foreach (char ch in mc.MyItr(7))
         Console.Write(ch + " ");
         Console.WriteLine("n");
         Console.WriteLine("Iterate letters from F to L:");
         foreach (char ch in mc.MyItr(7, 12))
         Console.Write(ch + " ");
         Console.WriteLine();
         Console.ReadLine();
     }
 }
Discuss
Answer: (b).Iterate the first 7 letters:
A B C D E F G
Iterate letters from F to L:
H I J K L

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!