MY Favorite .Net Question For Interview - Eg Net Solution

Here in this sites web and software developer can get some essential information.

MY Favorite .Net Question For Interview

This are not tidy. Just for rough. In Sha Allah will make it tiddy soon. 1.  DateTime2 Date range 0001-01-01 through 9999-12-31  vs Date...

Users Countries


Wednesday, July 11, 2018

MY Favorite .Net Question For Interview

This are not tidy. Just for rough. In Sha Allah will make it tiddy soon.

1.  DateTime2 Date range 0001-01-01 through 9999-12-31  vs DateTime Date range January 1, 1753, through December 31, 9999 in SQL Server
Ans: https://stackoverflow.com/questions/1334143/datetime2-vs-datetime-in-sql-server

2.  Dictionary  value different types use object as datatype of the eky value

3. If one property of a class is list<> of another class then how to deal with it if we want to initialize it in essential place to avoid Null Reference. See question 17 below.

4. How to create multi valued dictionary rather  than one valued dictionary.


5. Instance Methods as Delegates
6.  Generic:  Base Class Constraint
7. Defference btn logical ("AND, OR") vs  shortcircuit ("AND, OR")repectively

8. Use ref and out Parameters
9. Indexer vs Property Difference
10.Variable Number of Arguments function Arguments

11. How you copy one object to another object . Not reference of the object?

12. Make a simple character stack by a C# class and push pop public member function

13. How to use one constructor to invoke another Constructor and which one will execute first
Optional Arguments vs. Overloading: How optional argument become an alternative to Function Overloading

14. Static class and static method

15. C# 4.0: The Complete Reference: 296 PG: When Are Constructors Called?
 For multilevel hierarchy inheritance : During creation of  child class object which class constructor is executed first? The one in the derived class or the one defined by the base class? Or only one constructor will be called?


16. Dynamic method dispatch/ C# runtime polymorphism: (C# 4.0: The Complete Reference 297 - 305 PG : Base Class References and Derived Objects and Virtual Methods and Overriding)
For multilevel hierarchy inheritance, because of calling the virtual method with any level base class reference variable referring to a any of the child /base class object.
case 1: When both have the virtual method then Object  being referred class method/reference class overridden method will be called?
Case 2:  If a derived class does not override a virtual
method, then, while moving up the hierarchy/down the hierarchy,  the only first override of the method that is encountered is the one executed or only the last? or All from first to last vice versa?




        clsDataprocess  cls2 = new clsDataprocess();// Wrong
static  public   SqlConnection Con = cls2.getConnection253_Mymun(); // cls2 showing the errror

You cannot use an instance variable to initialize another instance variable. Why? Because the compiler can rearrange these - there is no guarantee that cls2 will be initialized before Con , so the above line might throw a NullReferenceException.
                static clsDataprocess  cls2 = new clsDataprocess(); // Correct  put static in both  variable 

               static  public   SqlConnection Con = cls2.getConnection253_Mymun();// Correct


18.Why can't I use alias in a count(*) “column” and reference it in a having clause?

The HAVING clause is evaluated before the SELECT - so the server doesn't yet know about that alias.





19. Null Reference Exception for Class Lists

Answer :


https://stackoverflow.com/a/38511001/2014745

When you create BookList, you haven't actually initialized the list that is its member. You can do this by changing your initialization to: BookList myBookList = new BookList() {bookList = new List<Book>()};

Or by writing a constructor for the BookList class which initializes the list; which would look like this: class BookList { public List<Book> bookList { get; set; } public BookList(){ //New constructor bookList = new List<Book>(); } }



20. Why compile error “Use of unassigned local variable”?

Local variables aren't initialized. You have to manually initialize them.

Members are initialized, for example:public class X { private int _tmpCnt; // This WiLL initialize to zero ... }

But local variables are not:public static void SomeMethod() { int tmpCnt; // This is not initialized and must be assigned before used. ... }
21. If you want to pass multiple different list in a View from ASP .Net MVC Controller Action How can you pass it?
Answer: 
In Action:  ViewBag.MyClassList = new List<MyClass>() ;
 List<MyClass> MyClassList = ViewBag.MyClassList as List<MyClass>;


PtideSys Vivaa Question: 
1. Introduce your selft.
They also introduced their selves. While continuing conversation...
2.  What type of word did you done in previous company?
3.  Asked me about the working procedure of .Net framework.. MSIL and CLR... mixed it  
5. Gave a programe to make the sum and asked it's time and space complexity with various situation. During this session asked me the difference between int type length of ASCII and C# . I said 2 byte and 4 byte, the asked sure, i replied sure..!
4. Garbage collection of .Net framework Dispose. type safety and un safety programming language.
5. Entity framework tasks, codefirst, database first, design first.. Transaction committing with EF
6. Binary search
7. Asked about Singleton patterns --  I said it can be done many ways from that I like JonSkeet c# in depths example with a sealed class and static reference of the same class
8. Factory patterns-- Implemented this with Interface Inheriting
9. Some others question. 
10. Asked about My Stack overflow reputation.
11. Asked if I have used Dictionary, List, Tuple
12. Some other features of OOP 
13. Difference between string And String, I said they are same. Asked what is main defference between String and Stringbuilder class. i said object of string is immutable, if you want to change one cjaracter of C# built in string class object you have to copy it in an char array o have to changed by pointer which is not intutively supported by c#, Also if string a ="7" and string b = "7". They will occupy same memery address. It is a special property of c# string. And All string builder contents object are not like this in built in string class. 
I have gave most of the answers.  
  But only stucked with the answer of Transaction of Enttity framework with question what will be happened when machine face  problem if power goes or network connection goes between program server and database server. I said it can be done manully will complex taskingg... but entity frame work provide easy way to tasking this type of scenario.   And made mistake with the name MISL and CLR
Oh Aro  3 ta question Bad Porche
14. Delegates in c# , keno, ki vabe apply kore
15. Dependency injection ki, keno kore subidha
16. Dynamic method dispatching  khetre ki vabe ki kore..


Asynchronous method ki..
Interface vs abstract class
Ienumarable vs queryable
Linq ar groupby dicilo
Sql ar 2 query
Extendclass ar example
Delegate ki example
JavaScript closure
Javascrip private public , inheritance
Javascrip callback function ar output
Oop ar kisu basic cilo mona portasa na
Event vs delegate

"string" ka reverse korta hoba c# dara





No comments:

Add Choice