My Report

C# Programming Mock Test 6


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. Which of these exceptions handles the divide by zero error?

Question 1 of 10

Question 2 of 10

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

 class program
 {
     public static void Main(string[] args)
     {
         try
         {
             throw new NullReferenceException("C");
             Console.WriteLine("A");
         }
         catch (ArithmeticException e) 
         {
             Console.WriteLine("B");
         }
         Console.ReadLine();
     }
 }

Question 2 of 10

Question 3 of 10

3. Choose the correct option among the following indexers which correctly allows to index in same way as an array?

Question 3 of 10

Question 4 of 10

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

 public  static void Main(string[] args)
 {
     try
     {
         int a, b, c = 5;
         b = 0;
         a = c / b;
         Console.WriteLine("A");
     }
     catch (ArithmeticException e)
     {
         int c = 5;
         int i = 10;
         int z = 2 * c - i;
         Console.WriteLine("B");
         Console.WriteLine(z);
     }
     Console.ReadLine();
 }

Question 4 of 10

Question 5 of 10

5. The correct way to implement a read only property add, in a math class is?

Question 5 of 10

Question 6 of 10

6. Which of the following is the correct statement about inspecting an attribute in C#.NET?

Question 6 of 10

Question 7 of 10

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

 class Output 
 {
     public static void main(String args[]) 
    {
        try 
        {
            int a = 0;
            int b = 5;
            int c = a / b - 5;
            Console.WriteLine("C");
        }
        finally 
        {
            Console.WriteLine("sharp");
        } 
    }
}

Question 7 of 10

Question 8 of 10

8. Choose the correct statement among the following?

Question 8 of 10

Question 9 of 10

9. To apply an attribute to an Assembly, the correct way of implementation is?

Question 9 of 10

Question 10 of 10

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

 class Output 
 {
     public static void main(String args[]) 
     {
         
         try 
         {
             int a = 9;
             int b = 5;
             int c = a / b - 5;
             Console.WriteLine("Hello");
         }
         catch(Exception e) 
         {
             Console.WriteLine("C");
         } 
         finally 
         {
             Console.WriteLine("sharp");
         } 
     }
 } 

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.