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. Choose the correct statements about write-only properties in C#.NET?

Question 1 of 10

Question 2 of 10

2. Select the statements which describe the correct usage of exception handling over conventional error handling approaches?

Question 2 of 10

Question 3 of 10

3. Which of the following cannot further inspect the attribute that is once applied?

Question 3 of 10

Question 4 of 10

4. Which of these exceptions will occur if we try to access the index of an array beyond its length?

Question 4 of 10

Question 5 of 10

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

   class program
   {
       public static void Main(string[] args)
       {
           try 
           {
               int a = args.Length;
               int b = 1 / a;
               Console.WriteLine(a);
           }
           catch (ArithmeticException e) 
           {
               Console.WriteLine("1");
           }
           Console.ReadLine();
       }
   }

Question 5 of 10

Question 6 of 10

6. Which of these is not a correct statement?

Question 6 of 10

Question 7 of 10

7. Select the correct statement about Attributes used in C#.NET?

Question 7 of 10

Question 8 of 10

8. Choose the statement which is incorrect?

Question 8 of 10

Question 9 of 10

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

  
 class maths
 {
     public int fact(int n)
     {
         int result;
         if (n == 2)
         return 1;
         result = fact(n - 1) * n;
         return result;
     }
 } 
 class Program
 {
     static void Main(string[] args)
     {            
         maths obj = new maths();
         Console.WriteLine(obj.fact(4));
         Console.ReadLine();
     }
 }

Question 9 of 10

Question 10 of 10

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

{
    try 
    {
        int []a = {1, 2, 3, 4, 5};
        for (int i = 0; i < 5; ++i) 
        Console.WriteLine(a[i]);
        int x = (1 / Convert.ToInt32(0));
    }
    catch(IndexOutOfRangeException e) 
    {
        Console.WriteLine("A");        	
    }
    catch(ArithmeticException e) 
    {     	
        Console.WriteLine("B");
    }
    Console.ReadLine();
} 

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.