My Report

C# Programming Mock Test 9


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement
 10%

Question 1 of 10

1. Select the type of multitasking methods that exist:

Question 1 of 10

Question 2 of 10

2. What will be the output of the following C# code snippet?

 
#define DEBUG 
#undef DEBUG
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication13
{
    class Program
    {   
        static void Main(string[] args)
        {
            #if (DEBUG)
            Console.WriteLine("DEBUG is defined");
            #elif (!DEBUG && MYTEST)
            Console.WriteLine("MYTEST is defined");
            #elif (DEBUG && MYTEST)
            Console.WriteLine("DEBUG and MYTEST are defined");
            #else
            Console.WriteLine("DEBUG and MYTEST are not defined");
            #endif
            Console.ReadLine();
       }
   }
}

Question 2 of 10

Question 3 of 10

3. Which is the correct statement about the namespaces in C#.NET?

Question 3 of 10

Question 4 of 10

4. Which of the following functions return absolute value of a variable?

Question 4 of 10

Question 5 of 10

5. What is an iterator?

Question 5 of 10

Question 6 of 10

6. Which of these data types can be used for a method having a return statement in it?

Question 6 of 10

Question 7 of 10

7. What will be the output of the following C# 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();
     }
 }

Question 7 of 10

Question 8 of 10

8. What does the following C# code snippet specify?

public Thread(ThreadStart start)

Question 8 of 10

Question 9 of 10

9. Select the defined preprocessor in C#.NET?

Question 9 of 10

Question 10 of 10

10. Choose the correct statements for the following C# code?

 public System.Collections.IEnumerator GetEnumerator()
 {
     foreach (char ch in chrs)
     yield return ch;
 }

Question 10 of 10


 

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.