My Report

C# Programming Practice Test 8


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

1. Which of these classes contains only floating point functions?

2. Can we use linq to query against a DataTable?

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

class Program
{
    static void Main(string[] args)
    {
        float x = 3.14F;
        int y = (int)Math.Abs(x);
        Console.WriteLine(y);
        Console.ReadLine();
    }
}

4. In the following C# code, what does the output represent?

class Program
{
    static void Main(string[] args)
    {
        int[] nums = { 1, -2, 3, 0, -4, 5 };
        var posNums = from n in nums
                      where n > 0
                      select n;
        int len = posNums.Count();
        Console.WriteLine(len);
        Console.ReadLine();
    }
}

5. Which method will be used to copy content from one array to another array?

6. What does the following C# code signify?

expr is type

7. Choose the correct statement about the IComparer interface in C#?

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

 static void Main() 
 {
     int[] nums = { 1, 2, 3, 4, 5 };
     Console.Write("Original order: ");
     foreach(int i in nums)
     Console.Write(i + " ");
     Array.Reverse(nums);
     Console.Write("Reversed order: ");
     foreach(int i in nums)
     Console.Write(i + " ");
     Console.WriteLine();
 }

9. Which among the given classes represents System.Collections.Generic namespace?

10. Which among the following is the correct way to find out the number of elements currently present in an ArrayListCollection called arr?


 

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.