C# Interview Questions - 11 | Snaprecruit.com

C# Interview Questions - 11 | Snaprecruit.com

C SHARP interview questions part 11

C SHARP interview questions part 11

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. The number of input methods defined by the stream method Console.In in C#.NET is?

Correct Answer is : 40

2. Select the correct methodS provided by Console.In?

Correct Answer is : Csharp

3. Choose the output returned when read() reads the character from the console?

Correct Answer is : var sortedProds = _db.Products.Orderby(c => c.Category) . ThenBy(n => n.Name)

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

Correct Answer is : var sortedProds = _db.Products.Orderby(c => c.Category) . ThenBy(n => n.Name)

5. Choose the object of TextReader class.

Correct Answer is : It is not required that linq should make use of IEnumerable interface

6. Choose the object/objects defined by the Textwriter class.

Correct Answer is : It is not required that linq should make use of IEnumerable interface

7. Choose the output for the given set of code: static void Main(string[] args) { int a = 10, b = 0; int result; Console.Out.WriteLine("This will generate an exception."); try { result = a / b; // generate an exception } catch (DivideByZeroException exc) { Console.Error.WriteLine(exc.Message); } Console.ReadLine(); }

Correct Answer is : System.Collections.Generic

8. Choose the methods provided by Console.Out and Console.Error?

Correct Answer is : System.Collections.Generic

9. Choose the output for the following set of 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(); }

Correct Answer is : No

10. Choose the correct statement among the followings?

Correct Answer is : No

11. Choose the keyword which declares the indexer?

Correct Answer is : 1, 3, 0, 5

12. Choose the operator/operators which is/are not used to access the [] operator in indexers?

Correct Answer is : 1, 3, 0, 5

13. Choose the correct statement among the following?

Correct Answer is : System.Linq

14. For a class student consisting of indexer,which among the following declaration of indexers runs the code successfully ? student a = new student(); a[1,2] = 20;

Correct Answer is : System.Linq

15. Which among the following are the advantages of using indexers?

Correct Answer is : code run successfully and executes output

16. Choose the correct statement about properties describing the indexers?

Correct Answer is : code run successfully and executes output

17. Choose the correct alternative that utilizes the indexed property such that a group named class has indexed property which stores or retrieves value to/from an array of 5 numbers?

Correct Answer is : Arranged in descending order code runs successfully

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

Correct Answer is : Arranged in descending order code runs successfully

19. Choose the output for the given set of code? class list { ArrayList array = new ArrayList(); public object this[int index] { get { if (index < 0 || index >= array.Count) { return null; } else { return (array[index]); } } set { array[index] = value; } } public int Count { get; set; }}class Program{ static void Main(string[] args) { list list1 = new list(); list1[0] = "123"; list1[1] = " abc "; list1[2] = "xyz"; for (int i = 0; i<=list1.Count; i++) Console.WriteLine(list1[i]); Console.ReadLine(); }}

Correct Answer is : Code runs successfully prints required output

20. Which of the following keyword is used to overload user defined types by defining static member functions?

Correct Answer is : Code runs successfully prints required output

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon