C Sharp

1. An Overview of C# 2. OOP 3. C# Environment 4. IDE 5. Basic Requirement 6. Comments 7. My first program 8. Line Break 9. Escape Sequence 10. Identifiers 11. Variables 12. Datatypes 13. Range of datatypes in C# 14. Declare Variables 15. Reserved Key Words 16. Console.Write() 17. Chained & Embedded state 18. Prog.to print sum of 2 nos 19. Console.ReadLine() 20. Prg.to print sum & average 21. Area & Perimeter of Rectangle 22. Area Circumference of Circle 23. Prg.for Simple Calculator 24. Operatos in C# 25. Ex. Of Operators 26. Prg. to Swap two numbers 27. Hierarchy of Operators 28. if( ) statement 29. Prg.to check +ve,-ve or zero 30. if..else statement 31. Prg.to check Odd or Even 32. Prg.to print larger of 2 nos 33. Prg.to print largest of 3 nos 34. Prg.to check divisibility 35. Prg.to check print range 36. for. . . loop statement 37. prg.to print series of nos 38. Prg.to check divisibility 39. prg.to print sum of series 40. Prg.to print Pyramid 41. prg.for Factorial 42. prg.to fill screen 43. prg.for largest/smallest no 44. prg.to print reverse no 45. prg.to add each digit 46. prg.for sum of Factorial 47. prg.for fibonacci series 48. prg.to check Prime nos 49. prg. Prime no from 1 to 100 50. prg.Specified Prime nos 51. while( ) statement 52. do. . While statement 53. goto statement 54. break & continue statement 55. switch case statement 56. Array in C# 57. print reverse order using array 58. Ascending/Descending order 59. prg.to search no in Array 60. Multidimensional arrays 61. String in C# 62. String with spaces 63. prg.to print string in reverse 64. prg.to count A,E,I,O,U vowel 65. User Define Methods 66. Methods program example 67. General Purpose Programs 68. Loan & EMI calculation prg. 69. Table print prg. 70. Leap year program 71. lower to UPPER case prg. 72. Age Distribution prg. 73. Bank note calculation prg. 74. Simple Interest prg. 75. Compound Interest prg. 76. Simple Depreciation prg. 77. Reducing bal.Depreciation prg. 78. Marksheet prg. 79. Income Tax prg. 80. Time calculator prg. 81. Distance converter prg. 82. Volume Air Calculation prg. 83. Time to fill Water Tank prg. 84. Salary Calculation prg. 85. Total Sale Calculation prg. 86. Male/Female pecentage prg. 87. Library Rent prg. 88. Office Expance prg. 89. Total Salary Calculation prg. 90. Profit or Loss prg. 91. Total Profit/Loss prg. 92. Virtual Function . 93. C# Interview Part1 94. C# Interview Part2 95. C# Interview Part3 96. C# Interview Part4 97. C# Interview Part5 98. C# Interview Part6 99. C# Interview Part7 100. C# Interview Part8 101. C# Interview Part9 102. C# Interview Part10 103. C# Interview Part11 104. C# Interview Part12 105. C# Interview Part13 106. C# Interview Part14 107. C# Interview Part15
Pr.Pg Next Pg

C# Interview Questions and Answers Part 5

 

41. How do I create a multi language, multi file assembly?

  • Unfortunately, this is currently not supported in the IDE. To do this from the command line, you must compile your projects into netmodules (/target:module on the C# compiler), and then use the command line tool al.exe (alink) to link these netmodules together.

 

42. What are the basic concepts of object oriented programming?

  • It is necessary to understand some of the concepts used extensively in object oriented programming.These include

    • Objects

    • Classes

    • Inheritance

    • Polymorphism

    • Dynamic Binding

    • Message passing

    • Data abstraction and encapsulation.

 

43. What is the equivalent to regsvr32 and regsvr32 /u a file in .NET development?

  • Try using RegAsm.exe. The general syntax would be: RegAsm. A good description of RegAsm and its associated switches is located in the .NET SDK docs. Just search on "Assembly Registration Tool".Explain ACID rule of thumb for transactions.

  • Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no in-between case where something has been updated and something hasnot), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system crashes right after).

 

 

 

44. What are the advantages of inheritance?

  • Once a behavior (method) or property is defined in a super class(base class),that behavior or property is automatically inherited by all subclasses (derived class).

  • Code reusability increased through inheritance.

  • Inheritance provide a clear model structure which is easy to understand without much complexity Using inheritance, classes become grouped together in a hierarchical tree structure Code are easy to manage and divided into parent and child classes.

 

45. How do I create a multilanguage, single-file assembly?

  • This is currently not supported by Visual Studio .NET.

 

46.Why cannot you specify the accessibility modifier for methods inside the interface?

  • They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it is public by default.

 

47. Is it possible to restrict the scope of a field/method of a class to the classes in the same namespace?

  • There is no way to restrict to a namespace. Namespaces are never units of protection. But if you're using assemblies, you can use the 'internal' access modifier to restrict access to only within the assembly.

 

48. Why do I get a syntax error when trying to declare a variable called checked?

  • The word checked is a keyword in C#.

 

49. Why are there five tracing levels in System.Diagnostics.TraceSwitcher?

  • The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.

 

50.What is the syntax for calling an overloaded constructor within a constructor (this() and constructorname() does not compile)?

  • The syntax for calling another constructor is as follows:

class B

{

B(int i)

{ }

}

class C : B

{

C() : base(5) // call base constructor B(5)

{ }

C(int i) : this() // call C()

{ }

public static void Main() {}

}


Pr.Pg border                                              Next Pg