0% found this document useful (0 votes)
20 views9 pages

Homework

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views9 pages

Homework

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

1. What is .Net framework and how does it work?

It is a virtual machine that executes managed code, code that is executed by the CLR (Common Language
Runtime) and that has been compiled from C# or VB .Net.
It works as follows:
1. you make a program in C# or VB .Net and compile it, this is translated to CIL (Common Intermediate
Language).
2. Subsequently, the program is assembled to bytecode to generate a CLI (Common Language Infrastructure)
assembly file that can be .exe or .dll.
3. You run the program (or use the DLL) and this is executed by the .Net framework CLR (Common Language
Runtime), not by the operating system directly, for this reason it is called "Managed Code".
4. The .Net Framework CLR, by means of the JIT compiler (Just In Time Compiler), is in charge of compiling
this managed code in intermediate language to native machine language assembler, so that it can be
executed by the CPU.

The CIL (Common Intermediate Language) is the language understood by the .Net Framework.

C# and VB .Net are languages that humans understand,

C# and VB. Net are translated to CIL.

2. What is the Heap and what is the Stack?


Both are memory locations, the Heap is global, the Stack is local.
The Heap is application level, the Stack is thread level.
The Stack is a stack, first-in-first-out, the Heap has no defined data structure.
Its size is defined at the time of its creation, the Heap at application startup, the Stack at thread creation.
Both can grow dynamically.
The Stack is faster, it is a stack, it is in "cache", it does not have to synchronize with the other threads like the
Heap.
The Stack stores values, the Heap, objects.

3. What is the Garbage Collector?


It is an automatic memory release process. When the memory is running low, for the threads that are
running, it goes through the Heap and eliminates the objects that are no longer being used, frees memory,
reorganizes all the threads that are left and adjusts the pointers to these objects, both in the Heap and in the
Stack.

4. What is a delegate?
It is a definition of a method, it encapsulates certain arguments and return type. It allows to pass a method
as an argument of a function, as long as it respects the definition.
5. What is LINQ?
It is a standardization for querying data and converting it into objects, regardless of the source. It is a query
manager for databases, xml and enumerable collections using a single language.
6. How does LINQ work?
Internally it constructs the correct query (in the case of databases) or generates the corresponding
operations on the collections or parses the xml and returns the corresponding data. It encapsulates all these
behaviors and provides a single implementation, so that we can use the same queries, the same language,
regardless of the underlying data source.
7. What is deferred execution and immediate execution in LINQ?
Deferred execution is encapsulating the query definition, but not executing it until runtime data is used.
Immediate execution sends to call the query at the same time of its definition.
By default, the executions are deferred, but we can make them immediate by calling ".ToList()" for example,
in this way, it will be executed and will return a list of objects at the moment we define it.
8. What is an object and a class?
An object is an instance of a class and a class is a template to create objects, it is the definition of an object,
the description of its characteristics and operations, its properties and methods. An object has identity
because its characteristics have values.
9. What is inheritance, polyformism and encapsulation?
Inheritance is the ability to reuse definitions from one class in another, it is the ability to base one class on
another.
Polyformism is being able to declare the same method within a class with different arguments or different
return type.
Encapsulation is being able to expose only the methods, property and arguments necessary to use the
operations of a class, while its detailed implementation remains private, hidden from other objects.

10. What is the difference between an abstract class and an interface?


The abstract class can contain constructors, methods and fields, public and private. The interface only
contains public methods and properties.
You can inherit from only one abstract class, but implement from many interfaces.
An interface defines behavior, something that the class that implements it will be able to do. An abstract
class defines what the class is, what it represents.
Neither can be instantiated.
An abstract class is useful when creating components, to make an initial partial implementation and a
concrete definition, leaving freedom to implement other methods.
11. Difference between public and static modifiers.
A static method, field or property can be invoked without having to instantiate the class.
A public method must be invoked from an instance of a class.
12. What is a sealed class?
It is a class that cannot be inherited. It is used when, by design, a class is super specialized and should not be
modified by overriding.
13. What is a jagged array?
It is an array of arrays.
14. What is serialization?
Converting an object to a data stream. You must implement ISerialize.
15. What is the difference between constants and read-only variables?
Constants are declared and initialized at compilation. Their value cannot change. Read-only variables are
assigned at run time.
16. Explain Mutex
Mutually exclusive is a manager of resources shared by threads, it ensures that only one thread at a time
makes use of a resource (an object) at a time. It is like a moderator who controls the microphone and gives
the floor to one person at a time, thus, Mutex grants access to resources one thread at a time, putting "on
hold" the resources that want to access the resources, until they are unoccupied.
17. What is immutability, what is it for and how is it coded?
The ability of objects not to change their state after being created, it serves to improve the maintainability of
the code since a mutable object can encapsulate its changes and not be explicit in the code, making it
difficult to follow the flow, especially in multi-threaded applications. To create immutable objects, you pass
the arguments for their creation in the constructor and then make their properties read-only.

18. What is the difference between Override and Overload in a method?


Override is to override the method, same signature (parameters and return type) but different functionality.
The method must be declared "virtual" in order to override it. Overload is to code several versions of the
same method, as long as it has different signature (parameters and/or return value). The method does not
need to be "virtual" to be overloaded.

19. What is the difference between struct and class?


A class is a definition of an object and can be inherited. A structure defines a data type, and cannot be
inherited.

20. What is the difference between ODBC and ADO?


Open DataBase Connectivity is a standard for managing database operations in applications, a standard,
using the same methods for Oracla as for Mysql, for example, with the particularity that connections are
declared at user or operating system level. ADO is a set of .Net libraries for data management, including
ODBC connections. For ADO, ODBC is a driver.

21. What is the difference between encrypting a password and hashing it?
Hashing (MD5 or SHA1, for example) cannot be decrypted, to validate the password we must have the
password in plain text, hash it and compare it against the stored one. An encrypted password, if we have the
keys and we know the encryption algorithm (like Triple-DES for example) we can obtain the password in
plain text from the encrypted password.

22. What is Reflection and what is it used for?


It is the ability to read properties and methods of the classes of an assembly, to be able to instantiate and
invoke them. It is especially useful when we do not have the original source code of these classes, only their
assembly.
23. What is a design pattern and what is it for? Give some examples
It is a reusable template to solve a common design problem. It is not code, but best practices to code a
solution. Some examples are Singleton, Abstract Factory, Observer or Pub/Sub, Model-View-Controller,
Model-View-Presenter and Model-View-View-Model.
24. What do we use the "using" statement for?
Using is used to make sure to free the resources of the used object, since it always calls "Dispose" when it
finishes its code block.
25. What is an implicit type variable and what is its scope?
It is a variable for which you do not have to declare type, since the compiler automatically determines its
type. Its scope is local, inside a method and it only allows to infer the type the first time it is assigned a value,
the second time, if the type is different, it will throw an error.
26. What is an anonymous method and how does it differ from a lamba expression?
An anonymous method is a method that does not need to be named or declared before being used,
implemented through a delegate. A lambda expression is a definition of an anonymous method in a single
line, replacing the delegate for this function, in a more elegant way.
27. What is Native Image Generator?
It is a tool that compiles .Net assemblies to machine code for a specific processor, thus improving its
performance, since the JIT is no longer involved.
28. Is JIT an interpreter?
No, the JIT is not an interpreter, it is a runtime compiler that improves performance by compiling method by
method only once, because if the method is called again, the native code already compiled is used, while the
JIT does not compile the method to machine code.

- What's a delegate ?
A delegate is a type that represents references to methods with a particular parameter list and return type.
When you instantiate a delegate, you can associate its instance with any method with a compatible
signature and return type. You can invoke (or call) the method through the delegate instance
- Have you work with events on ?
An event is a notification sent by an object to signal the occurrence of an action. ... In C#, an event is an
encapsulated delegate. It is dependent on the delegate. The delegate defines the signature for the event
handler method of the subscriber class
- Do you know what linq is ?
- What does the 'where' clause works ?

Entity Framework
- Do you know Lazy loading is when working with entity framework ?
is the process whereby an entity or collection of entities is automatically loaded from the database the first
time that a property referring to the entity/entities is accessed. Lazy loading means delaying the loading of
related data, until you specifically request for it. what lazy loading
- What would approaches would you use to generate a database for a new project using entity framework ?
It could be Code First or Database First.
I would use Code First
- When would you use each one of then ?
Code First modeling workflow targets a database that doesn't exist and Code First will create it. It can also be
used if you have an empty database and then Code First will add new tables to it. Code First allows you to
define your model using C# or VB.Net classes..
Database First allows you to reverse engineer a model from an existing database. The model is stored in an
EDMX file (. edmx extension) and can be viewed and edited in the Entity Framework Designer. The classes
that you interact with in your application are automatically generated from the EDMX file
- What is a migration ?
Migrations provide a way to control schema changes in the DB and Entity Framework Core Migrations
updates the database schema instead of creating a new database
ASP.NET Core
- Have you work with .NET Core ?

- Do you know what is a middleware on .NET Core ?


Middleware is software that's assembled into an app pipeline to handle requests and responses. Each
component: Chooses whether to pass the request to the next component in the pipeline.

- Do you know what's dependency injection is ?


It allows the creation of dependent objects outside of a class and provides those objects to a class through
different ways
Abstract Factory
En este patrón, una interfaz crea conjuntos o familias de objetos relacionados sin especificar el nombre de la
clase.

Builder Patterns
Permite producir diferentes tipos y representaciones de un objeto utilizando el mismo código de
construcción. Se utiliza para la creación etapa por etapa de un objeto complejo combinando objetos simples.
La creación final de objetos depende de las etapas del proceso creativo, pero es independiente de otros
objetos.

Factory Method
Proporciona una interfaz para crear objetos en una superclase, pero permite que las subclases alteren el tipo
de objetos que se crearán. Proporciona instanciación de objetos implícita a través de interfaces comunes

Prototype
Permite copiar objetos existentes sin hacer que su código dependa de sus clases. Se utiliza para restringir las
operaciones de memoria / base de datos manteniendo la modificación al mínimo utilizando copias de
objetos.
Singleton
Este patrón de diseño restringe la creación de instancias de una clase a un único objeto.

Patrones estructurales
Facilitan soluciones y estándares eficientes con respecto a las composiciones de clase y las estructuras de
objetos. El concepto de herencia se utiliza para componer interfaces y definir formas de componer objetos
para obtener nuevas funcionalidades.

Adapter
Se utiliza para vincular dos interfaces que no son compatibles y utilizan sus funcionalidades. El adaptador
permite que las clases trabajen juntas de otra manera que no podrían al ser interfaces incompatibles.

Bridge
En este patrón hay una alteración estructural en las clases principales y de implementador de interfaz sin
tener ningún efecto entre ellas. Estas dos clases pueden desarrollarse de manera independiente y solo se
conectan utilizando una interfaz como puente.
Decorator
Este patrón restringe la alteración de la estructura del objeto mientras se le agrega una nueva funcionalidad.
La clase inicial permanece inalterada mientras que una clase decorator proporciona capacidades adicionales.

Proxy
Se utiliza para crear objetos que pueden representar funciones de otras clases u objetos y la interfaz se
utiliza para acceder a estas funcionalidades
Interpreter
Se utiliza para evaluar el lenguaje o la expresión al crear una interfaz que indique el contexto para la
interpretación.

Iterator
Su utilidad es proporcionar acceso secuencial a un número de elementos presentes dentro de un objeto de
colección sin realizar ningún intercambio de información relevante.
Mediator
Este patrón proporciona una comunicación fácil a través de su clase que permite la comunicación para varias
clases.

Strategy
Permite definir una familia de algoritmos, poner cada uno de ellos en una clase separada y hacer que sus
objetos sean intercambiables.

Template method
Se usa con componentes que tienen similitud donde se puede implementar una plantilla del código para
probar ambos componentes. El código se puede cambiar con pequeñas modificaciones.

Visitor
El propósito de un patrón Visitor es definir una nueva operación sin introducir las
modificaciones a una estructura de objeto existente.
S: Principio de responsabilidad única

Como su propio nombre indica, establece que una clase, componente o microservicio debe ser
responsable de una sola cosa (el tan aclamado término “decoupled” en inglés). Si por el contrario,
una clase tiene varias responsabilidades, esto implica que el cambio en una responsabilidad
provocará la modificación en otra responsabilidad.

O: Principio abierto/cerrado

Establece que las entidades software (clases, módulos y funciones) deberían estar abiertos para su
extensión, pero cerrados para su modificación.

L: Principio de substitución de Liskov

Declara que una subclase debe ser sustituible por su superclase, y si al hacer esto, el programa
falla, estaremos violando este principio.

I: Principio de segregación de interfaz

Este principio establece que los clientes no deberían verse forzados a depender de interfaces que
no usan.

D: Principio de inversión de dependencias


Establece que las dependencias deben estar en las abstracciones, no en las concreciones. Es
decir:

 Los módulos de alto nivel no deberían depender de módulos de bajo nivel. Ambos deberían
depender de abstracciones.
 Las abstracciones no deberían depender de detalles. Los detalles deberían depender de
abstracciones.

You might also like