My Report

C# Programming Mock Test 7


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. What will be the output of the following C# code snippet?

 static void Main(string[] args)
 {
     string h = "i lovelife";
     string h1 = new string(h.Reverse().ToArray());
     Console.WriteLine(h1);
     Console.ReadLine();
 }

Question 1 of 10

Question 2 of 10

2. Choose the class on which all stream classes are defined?

Question 2 of 10

Question 3 of 10

3. Which property among the following represents the current position of the stream?

Question 3 of 10

Question 4 of 10

4. Which method in Console enables to read individual inputs directly from the keyboard in a non line buffered manner?

Question 4 of 10

Question 5 of 10

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

{
    delegate string F(string str);
    class sample
    {
        public static string fun(string a)
        {
            return a.Replace(',''-');
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            F str1 = new F(sample.fun);
            string str = str1("Test Your c#.NET skills");
            Console.WriteLine(str);
        }
    }
}

Question 5 of 10

Question 6 of 10

6. Which among the following attempts to read up to count bytes into buffer starting at buffer[offset], returning the number of bytes successfully read?

Question 6 of 10

Question 7 of 10

7. Choose the output returned when an error condition is generated while read() reads from the console.

Question 7 of 10

Question 8 of 10

8. Incorrect statements about delegates are?

Question 8 of 10

Question 9 of 10

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

 static void Main(string[] args)
 {
     Console.WriteLine("This is a Console Application:");
     Console.Write("Please enter your lucky number:");
     string val1 = Console.ReadLine();
     int val2 = System.Convert.ToInt32(val1, 10);
     val2 = val2 * val2;
     Console.WriteLine("square of number is:" +val2);
     Console.Read();
 }

Question 9 of 10

Question 10 of 10

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

 static void Main(string[] args)
 {
     String a ="i love iostream";
     Console.WriteLine(a.IndexOf('i') + " " + a.IndexOf('e') + " " + a.LastIndexOf('i') + " " + a.LastIndexOf('e'));
     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.