C# Interview Question and Answers

36. What is different about switch statements in C#?
  No fall-throughs allowed. Unlike the C++ switch statement, C# does not support an explicit fall through from one case label to another. If you want, you can use goto a switch-case, or goto default.
Case 1:
Cost += 25;
Break;
Case 2:
Cost += 25;
Goto case 1;
 
Your Name Your Email-ID
Your Answer
37. Can you use pointers in C#?
  Yes.
 
Your Name Your Email-ID
Your Answer
38. What is the c# equivalent of C++ catch(…), which was a catch all statement for any possible exception?
  A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.
 
Your Name Your Email-ID
Your Answer
39. What is the difference between the System.Array.CopyTo() and System.Array.Clone()?
  The first one performs a deep copy of the array, the second one is shallow.
 
Your Name Your Email-ID
Your Answer
40. Can multiple catch blocks be executed?
  No. once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block.
 
Your Name Your Email-ID
Your Answer
12345678910 Page 8 of 10