Q56. What is the difference between .net Standard, .net Framework and .net Core?
Q57. What are four pillars of OOPS? Explain Abstraction and Encapsulation in detail?
Q58. What is the difference between Array and Collection?
Q59. What are the two ways to prevent class from being inherited?
Q60. What is jagged Array?
-----------------------------------------------------------------------------------------------------------------------------
Q56. What is the difference between .net Standard, .net Framework and .net Core?
Answer:
-----------------------------------------------------------------------------------------------------------------------------
Q57. What are four pillars of OOPS? Explain Abstraction and Encapsulation in detail?
Answer:
Abstraction, Encapsulation, Polymorphism, and inheritance are called 4 pillars of OOPS.
Encapsulation - Binding or encapsulating of all related data into a single unit and keep it safe from outside misuse and access. Class is an example of encapsulation. We can methods private, protected and public to protect the misuse from outside code.
Abstraction - It means showing only the relevant information hiding the unnecessary complexity. Abstraction can be implemented by use of interface and abstract class. By use of Interface we are telling client only the method name, parameters required and output we will receive.
-----------------------------------------------------------------------------------------------------------------------------
Q58. What is the difference between Array and Collection?
Answer:
Difference between Array and Collection:
| Array | Collection |
| 1. Array is Group of Homogeneous data type object. | 1. Collection is Group of Homogeneous and Heterogeneous data type object. |
| 2. Array is fixed in size. | 2. Collection is not fixed in size. |
| 3. Array is Strong type. | 3. Collection is not strong Type. |
| 4. There is no boxing and unboxing process on Array | 4. There is process of Boxing and Unboxing on Collection. |
| 5.We use Generic on Collection to make Collection as Strong type |
Heterogeneous collection example - ArrayList a = new ArrayList()
collections examples - ArrayList, List, Stack, ICollection, IEnumerable, and IDictionary.
-----------------------------------------------------------------------------------------------------------------------------
Q59. What are the two ways to prevent class from being inherited?
Answer:
1. Make class sealed
2. Make class constructor private.
-----------------------------------------------------------------------------------------------------------------------------
Q60. What is jagged Array?
Answer:
Array of Array is known as jagged array.
Below is the example of jagged Array.
int[][] jaggedArray = new int[3][];
jaggedArray[0] = new int[5];
jaggedArray[1] = new int[4];
jaggedArray[2] = new int[2];
No comments:
Post a Comment