C SHARP interview questions part 31

C SHARP interview questions part 31

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

Total Questions: 20

1. Select the output for the following set of code : static void Main(string[] args) { int i = 0; while (i <= 50) { if (i % 10 == 0) continue; else break; i += 10; Console.WriteLine(i % 10); }}

Correct Answer is : 0

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

Correct Answer is : =

3. Select the output for following set of Code : static void Main(string[] args) { int i = 1; while (i <= 1) { if ('A' < 'a') { Console.WriteLine("Hello..."); } else { Console.WriteLine("Hi..."); } i++; } Console.ReadLine(); }

Correct Answer is : 45505

4. Select the output for the following set of codes: static void Main(string[] args) { int i = 0; while (i++ != 0) ; Console.WriteLine(i); Console.ReadLine(); }

Correct Answer is : y = 5, m = 6; y = 7, m = 7

5. What will be the output of the given code snippet? static void Main(string[] args) { Console.Write("c"); Console.Write("sharp" ); Console.ReadLine(); }

Correct Answer is : 37289

6. What would be the output of given 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(); }

Correct Answer is : 11, 4, False

7. What will be the output of given code snippet? static void Main(string[] args) { StringBuilder sb = new StringBuilder("hello world"); sb.Insert(6, "good"); Console.WriteLine(sb); Console.ReadLine(); }

Correct Answer is : Math

8. What will be the output of given code snippet? static void Main(string[] args) { string h = "i lovelife"; string h1 = new string(h.Reverse().ToArray()); Console.WriteLine(h1); Console.ReadLine(); }

Correct Answer is : Round()

9. Which of the following statement is correct?

Correct Answer is : Math

10. Which of these classes is used to create an object whose character sequence is mutable?

Correct Answer is : double Ciel(double X)

11. Select the namespace/namespaces which consists of methods like Length(), Indexer(), Append() for manipulating the strings.

Correct Answer is : double Floor(double X)

12. Select the method used to write single byte to a file?

Correct Answer is : Abs()

13. Which class is used to design the base class?

Correct Answer is : 1 2 1 2

14. Which is used to create a pure virtual function?

Correct Answer is : 3

15. Which is also called as abstract class?

Correct Answer is : 4

16. What is meant by pure virtual function?

Correct Answer is : Determines the type of an object

17. Pick out the correct option.

Correct Answer is : a is an A

18. Where does the abstract class is used?

Correct Answer is : as

19. What is an abstract class in C++?

Correct Answer is : as

20. What is a pure virtual function in C++?

Correct Answer is : The cast in b = (B) a is NOT allowed

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon