HSBC
HSBC
{
public virtual void Print()
{
Console.WriteLine("In A");
}
}
public class B : A
{
public override void Print()
{
Console.WriteLine("In B");
}
}
public class C : B
{
public new virtual void Print()
{
Console.WriteLine("In C");
}
}
public class D : C
{
public override void Print()
{
Console.WriteLine("In D");
}
}
public class E : D
{
public new void Print()
{
Console.WriteLine("In E");
}
}
A a = new A();
A b = new B();
A c = new C();
A d = new D();
A e = new E();
C e1 = new E();
a.Print();
b.Print();
c.Print();
d.Print()
e.Print();
e1.Print()
what is the output above snipet?
In A
In B
In B
In B
In B
In D
2)
public class Student {
public int RollNumber{get;set;}
public string Name{get;set;}
public string FatherName {get;set;}
public DateTime DOB{get;set;}
}
s1 == s2 /// true/false
s1.Equals(s2) // true/false
3) Design the calculator by following the design principle - code on white board
ASHX Generic Handler is a concept to return dynamic content. It is used to return ajax calls,
image from a query string, write XML, or any other data.
Generic handler is a dynamic file and is generated with c# code and disk resource. Generic
handler do not have web forms. Generic handler is also known as ASHX generic handler. It
is useful when we want to return image from a query string, write XML and other Data.
This out-turn in a remarkable performance boost and high-grade code, because it helps to
reuse data processing algorithms without replicating type-specific code. Generics are
similar to templates in C++ but are different in implementation and capabilities. Generics
introduces the concept of type parameters, because of which it is possible to create
methods and classes that defers the framing of data type until the class or method is
declared and is instantiated by client code. Generic types perform better than normal
system types because they reduce the need for boxing, unboxing, and type casting the
variables or objects.
Parameter types are specified in generic class creation.
Collections in C#
Collections standardize the way of which the objects are handled by your program. In other
words, it contains a set of classes to contain elements in a generalized manner. With the
help of collections, the user can perform several operations on objects like the store,
update, delete, retrieve, search, sort etc.
https://www.geeksforgeeks.org/collections-in-c-sharp/
A Common Table Expression (aka CTE, aka WITH statement) is a temporary data set to be
used as part of a query. It only exists during the execution of that query; it cannot be used
in other queries even within the same session.
A subquery is a nested query; it’s a query within a query. This means it gives a result from a
query as a temporary data set which can be used again within that query
https://www.alisa-in.tech/post/2019-10-02-ctes/
7) Method hiding
Answer: C# also provides a concept to hide the methods of the base class from derived
class, this concept is known as Method Hiding. It is also known as Method Shadowing. In
method hiding, you can hide the implementation of the methods of a base class from the
derived class using the new keyword. Or in other words, in method hiding, you can redefine
the method of the base class in the derived class by using the new keyword.
https://www.geeksforgeeks.org/method-hiding-in-c-sharp/
8) Solid principle
9) Memory Allocation of Object
https://www.codeproject.com/Articles/1058126/Memory-allocation-in-Net-Value-type-Reference-
type
10) IDisposable
https://www.c-sharpcorner.com/UploadFile/b08196/idisposable-interface-in-C-Sharp/
A message handler is a class that receives an HTTP request and returns an HTTP response.
The first handler receives an HTTP request, does some processing, and gives the request to
the next handler. At some point, the response is created and goes back up the chain. This
pattern is called a delegating handler.
12. Which design patterns used for designing the calculator- code on white
board
https://softwareengineering.stackexchange.com/questions/257259/which-pattern-is-most-intuitive-
for-a-calculator-app/406419
Delegates are pointers to function. Delegates are used for implementing events and call
back methods.
1) Func Delegate
2) Action Delegate
3) Predicate Delegate
Func, Action and Predicate are generic inbuilt delegates present in System
namespace.
All three can be used with method, anonymous method, and lambda
expression.
Func can contains 0 to 16 input parameters and must have one return type.
Action can contain 1 to 16 input parameters and does not have any return type.
Predicate delegate should satisfy some criteria of method and must have one
input parameter and one Boolean return type either true or false.
Input parameters of custom delegates is fixed but Func and Actions input
parameter is variable from 0 to 16 and 1 to 16 respectively.
https://www.c-sharpcorner.com/blogs/c-sharp-generic-delegates-func-action-and-predicate
https://www.c-sharpcorner.com/UploadFile/tirthacs/func-delegates-in-linq/
The Equality Operator ( ==) is the comparison operator and the Equals() method compares
the contents of a string.
The == Operator compares the reference identity while the Equals() method compares only
contents.
http://net-informations.com/faq/general/equals.htm
https://www.c-sharpcorner.com/UploadFile/8911c4/singleton-design-pattern-in-C-Sharp/
https://www.c-sharpcorner.com/UploadFile/1492b1/restful-day-sharp5-security-in-web-apis-basic-
authentication-a/
https://www.codeproject.com/Articles/652556/Can-You-Explain-Lazy-Loading
*C# :*
.NET framework provides Threading.Tasks class to let you create tasks and run them
asynchronously. A task is an object that represents some work that should be done. The
task can tell you if the work is completed and if the operation returns a result, the task
gives you the result.
What is Thread?
When the time comes when the application is required to perform few tasks at the
same time.
https://www.c-sharpcorner.com/article/task-and-thread-in-c-sharp/
9. How to wait for all threads to complete their execution and then use the
combined result to perform next operation?
https://www.geeksforgeeks.org/joining-threads-in-c-sharp/
*.NET Core :*
https://www.c-sharpcorner.com/article/create-a-custom-middleware-in-an-asp-net-core-
application/
Though, this package does not contain any actual dlls or code itself, it merely contains a
series of dependencies on additional packages. By adding this package to your project, you
bring in all the relevant packages along with their dlls on which it depends and it is called a
metapackage.
*SQL Server :*
1. If I have billions of records in my result set and I want to search through the
result set based on each character entered by the user in the search box so
which data structure is perfect for this scenario?
3. Which design pattern would you use for the scenario : in case of login the
system sends 3 parameters : username, password and loginType. LoginType
can be one of the three values : SqlLogin, OAuthLogin, SocialMediaLogin.
Which design pattern will you use to provide separate implementation for
each login type?
*Angular :*
1. How angular works internally? Means sequence of operations that happen after the command 'npm
start'
2. Which is faster between JIT and AOT compilation and why?
3. How to implement cascaded drop down list in angular?
4. How to enable submit button of reactive form only when all validations have passed?
5. Sharing data and events between parent child components
6. Operators for observables and when to use which
7. BehaviourSubject vs Subject vs Observables
8. Async pipes in angular
9. How to implement custom pipe