C# Interview Questions - 3 | Snaprecruit.com

C# Interview Questions - 3 | Snaprecruit.com

C SHARP interview questions part 3

C SHARP interview questions part 3

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

Total Questions: 20

1. Which of the following format specifiers is used to print hexadecimal values and return value of output as Octal equivalent in C# ?

Correct Answer is : Copy()

2. Select the output for the following set of code : static void Main(string[] args) { int i; for (i = 0; ; ) { Console.WriteLine("hello"); } Console.ReadLine(); }

Correct Answer is : System.String

3. Select the output for the following set of code : static void Main(string[] args) { float f; for (f = 0.1f; f <= 0.5; f += 1) Console.WriteLine( ++f ); Console.ReadLine(); }

Correct Answer is : Csharp

4. Select the output for the following set of code: static void Main(string[] args) { int I, X; for (I = 1; I <= (9 % 2 + I); I++) { X = (I * 3 + I * 2) / I; Console.WriteLine(X); } Console.ReadLine(); }

Correct Answer is : A string has a zero-based index

5. Select output for the following set of code: static void Main(string[] args) { int I, J = 0; for (I = 1; I < 10; ) ; { J = J + I; I += 2; } Console.WriteLine("Sum of first 10 even numbers is:"+J); Console.ReadLine(); }

Correct Answer is : Unequal

6. Select the output for the following set of code: static void Main(string[] args) { int i = 5; for (; Convert.ToBoolean(Convert.ToInt32(i)); Console.WriteLine(i--)) ; Console.ReadLine(); }

Correct Answer is : Hello I Love ComputerScience

7. Select the output for the following set of code: static void Main(string[] args) { int i, s = 0; for (i = 1; i <= 10; s = s + i, i++); { Console.WriteLine(s); } Console.ReadLine(); }

Correct Answer is : String literals can contain any character literal including escape sequences

8. Which statement is correct among the mentioned statements? 1. The for loop works faster than a while loop 2. for( ; ; )implements an infinite loop

Correct Answer is : #ERROR!

9. Select the output for the following set of code : { int i; Console.WriteLine("Hi"); for (i = 1; i <= 10; i++) Program.Main(args); Console.ReadLine(); }

Correct Answer is : Trim()

10. Which of the code should be added to get the following output? * * * * * * * * * * * * * * * static void Main(string[] args) { int i,j; /* Add code here */  }

Correct Answer is : 0, 10

11. Predict the output for the following set of code : static void Main(string[] args) { int i; for (i =-3; i <= 3; i++) { switch (i) { case 0: Console.WriteLine("zero"); break; } if (i > 0) Console.WriteLine("A"); else if (i < 0) Console.WriteLine("B"); } Console.ReadLine(); }

Correct Answer is : 30, 10

12. Which of the following is not infinite loop?

Correct Answer is : 102 0 38

13. Select the output for the following set of code : static void Main(string[] args) { int i, j; for (i = 1, j = i; i <= 3 && j >= 0; i++, j--) { if (i == j) continue; else Console.WriteLine(j); } Console.ReadLine(); }

Correct Answer is : #ERROR!

14. Select the output for the following set of code : static void Main(string[] args) { int i = -10; for ( ;Convert.ToBoolean(Convert.ToInt32(i)) ;Console.WriteLine(i++)) ; Console.ReadLine(); }

Correct Answer is : TRUE

15. Suppose a Generic class called as SortObjects is to be made capable of sorting objects of any type(integer, single, byte etc).Then, which of the following programming constructs is able to implement the comparison function?

Correct Answer is : x % y == 0 ? y += 10:(x += 10);

16. To generate a simple notification for an object in runtime, the programming construct to be used for implementing this idea?

Correct Answer is : 45509

17. Choose the incorrect statement among the following about the delegate?

Correct Answer is : ?:

18. What is meant by the term generics?

Correct Answer is : TRUE

19. Are generics in C# are same as the generics in java and templates in C++?

Correct Answer is : ?: < && < &

20. Choose the advantages of using generics?

Correct Answer is : FileInputStream

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon