Podcast
Questions and Answers
Which of the following is a key feature of.NET Core?
Which of the following is a key feature of.NET Core?
The primary usage of an EXE file is to serve as a dynamic link library.
The primary usage of an EXE file is to serve as a dynamic link library.
False
What does OOPS stand for in programming?
What does OOPS stand for in programming?
Object-Oriented Programming System
.NET Framework is developed by _____ and provides an environment to run and debug applications.
.NET Framework is developed by _____ and provides an environment to run and debug applications.
Signup and view all the answers
Match the following C# access modifiers with their descriptions:
Match the following C# access modifiers with their descriptions:
Signup and view all the answers
What is the purpose of a garbage collector in .NET?
What is the purpose of a garbage collector in .NET?
Signup and view all the answers
Method overloading and method overriding are the same concepts.
Method overloading and method overriding are the same concepts.
Signup and view all the answers
What are SOLID Principles?
What are SOLID Principles?
Signup and view all the answers
What is the primary aim of method overriding in object-oriented programming?
What is the primary aim of method overriding in object-oriented programming?
Signup and view all the answers
In ASP.NET Core, a singleton service is created each time it is requested.
In ASP.NET Core, a singleton service is created each time it is requested.
Signup and view all the answers
What principle states that a software module should have only one reason to change?
What principle states that a software module should have only one reason to change?
Signup and view all the answers
In dependency injection, a __________ service is created once per request.
In dependency injection, a __________ service is created once per request.
Signup and view all the answers
Match the type of access modifier to its level of accessibility:
Match the type of access modifier to its level of accessibility:
Signup and view all the answers
Which SOLID principle encourages defining small interfaces based on specific submodules?
Which SOLID principle encourages defining small interfaces based on specific submodules?
Signup and view all the answers
Middleware in ASP.NET Core is responsible for handling responses but not requests.
Middleware in ASP.NET Core is responsible for handling responses but not requests.
Signup and view all the answers
What is the purpose of garbage collection in .NET?
What is the purpose of garbage collection in .NET?
Signup and view all the answers
Which type of cookie in ASP.NET remains on the user's computer even after the browser is closed?
Which type of cookie in ASP.NET remains on the user's computer even after the browser is closed?
Signup and view all the answers
In C#, boxing is the process of converting a value type into a __________ type.
In C#, boxing is the process of converting a value type into a __________ type.
Signup and view all the answers
In .NET, Dispose is automatically called by the garbage collector.
In .NET, Dispose is automatically called by the garbage collector.
Signup and view all the answers
Which of the following is not a method of dependency injection in ASP.NET Core?
Which of the following is not a method of dependency injection in ASP.NET Core?
Signup and view all the answers
What is the main responsibility of a View Controller in the MVC architecture?
What is the main responsibility of a View Controller in the MVC architecture?
Signup and view all the answers
The Liskov Substitution Principle allows derived classes to modify the behavior of their parent classes.
The Liskov Substitution Principle allows derived classes to modify the behavior of their parent classes.
Signup and view all the answers
What are the three main service lifetimes in ASP.NET Core Dependency Injection?
What are the three main service lifetimes in ASP.NET Core Dependency Injection?
Signup and view all the answers
Session cookies are deleted once the user closes the ______.
Session cookies are deleted once the user closes the ______.
Signup and view all the answers
Match the following types of caching in .NET with their descriptions:
Match the following types of caching in .NET with their descriptions:
Signup and view all the answers
The __________ exception in .NET is derived from the System.Exception class.
The __________ exception in .NET is derived from the System.Exception class.
Signup and view all the answers
Match the description to the corresponding lifetime type in ASP.NET Core:
Match the description to the corresponding lifetime type in ASP.NET Core:
Signup and view all the answers
Which SQL command is used to remove all records from a table but keep the table structure intact?
Which SQL command is used to remove all records from a table but keep the table structure intact?
Signup and view all the answers
APIs are primarily used to manage user interface components.
APIs are primarily used to manage user interface components.
Signup and view all the answers
What is the main difference between Dispose and Finalize?
What is the main difference between Dispose and Finalize?
Signup and view all the answers
Caching in .NET improves application ______ and scalability.
Caching in .NET improves application ______ and scalability.
Signup and view all the answers
What is the purpose of functions in ASP.NET?
What is the purpose of functions in ASP.NET?
Signup and view all the answers
What does the 'sealed' keyword indicate about a class?
What does the 'sealed' keyword indicate about a class?
Signup and view all the answers
The using keyword can be used in .NET to ensure Dispose() is called even if an exception occurs.
The using keyword can be used in .NET to ensure Dispose() is called even if an exception occurs.
Signup and view all the answers
What are generics in C#?
What are generics in C#?
Signup and view all the answers
Entity Framework is an ORM framework that allows developers to interact with a __________ as a set of objects.
Entity Framework is an ORM framework that allows developers to interact with a __________ as a set of objects.
Signup and view all the answers
What is the primary purpose of a stored procedure?
What is the primary purpose of a stored procedure?
Signup and view all the answers
EF Core is generally considered less flexible than traditional ADO.NET.
EF Core is generally considered less flexible than traditional ADO.NET.
Signup and view all the answers
Name two characteristics of asynchronous programming in ASP.NET Core.
Name two characteristics of asynchronous programming in ASP.NET Core.
Signup and view all the answers
A __________ is a reusable set of SQL statements that can accept parameters and return a value or a table variable.
A __________ is a reusable set of SQL statements that can accept parameters and return a value or a table variable.
Signup and view all the answers
Match the following terms with their definitions:
Match the following terms with their definitions:
Signup and view all the answers
Which keyword is used to declare an asynchronous method in C#?
Which keyword is used to declare an asynchronous method in C#?
Signup and view all the answers
Kestrel is a cross-platform web server used primarily for ASP.NET applications.
Kestrel is a cross-platform web server used primarily for ASP.NET applications.
Signup and view all the answers
What distinguishes LINQ from Entity Framework?
What distinguishes LINQ from Entity Framework?
Signup and view all the answers
Synchronous programming blocks further execution until the current task is _______.
Synchronous programming blocks further execution until the current task is _______.
Signup and view all the answers
What does the 'dynamic' type allow in C#?
What does the 'dynamic' type allow in C#?
Signup and view all the answers
In traditional ADO.NET, database operations are usually more abstracted compared to Entity Framework.
In traditional ADO.NET, database operations are usually more abstracted compared to Entity Framework.
Signup and view all the answers
What is the primary advantage of using .NET Core over .NET Framework?
What is the primary advantage of using .NET Core over .NET Framework?
Signup and view all the answers
An EXE file can be shared and used by multiple applications.
An EXE file can be shared and used by multiple applications.
Signup and view all the answers
What is a stored procedure in SQL?
What is a stored procedure in SQL?
Signup and view all the answers
In ASP.NET, a cookie that is stored on the client side and is persistent is referred to as a ______ cookie.
In ASP.NET, a cookie that is stored on the client side and is persistent is referred to as a ______ cookie.
Signup and view all the answers
Match the following programming concepts with their definitions:
Match the following programming concepts with their definitions:
Signup and view all the answers
Which component in the .NET framework is responsible for converting CIL into machine code?
Which component in the .NET framework is responsible for converting CIL into machine code?
Signup and view all the answers
LINQ is more advantageous than EF for data manipulation in .NET applications.
LINQ is more advantageous than EF for data manipulation in .NET applications.
Signup and view all the answers
Describe the main difference between Synchronous and Asynchronous programming.
Describe the main difference between Synchronous and Asynchronous programming.
Signup and view all the answers
In C#, method overloading allows a class to have multiple methods with the same name but different ______.
In C#, method overloading allows a class to have multiple methods with the same name but different ______.
Signup and view all the answers
What is IIS mainly used for?
What is IIS mainly used for?
Signup and view all the answers
The .NET Framework is cross-platform compatible.
The .NET Framework is cross-platform compatible.
Signup and view all the answers
What is the primary function of the Entity Framework?
What is the primary function of the Entity Framework?
Signup and view all the answers
Kestrel is a ______ web server designed for ASP.NET Core applications.
Kestrel is a ______ web server designed for ASP.NET Core applications.
Signup and view all the answers
Match the following SQL operations with their descriptions:
Match the following SQL operations with their descriptions:
Signup and view all the answers
What is the purpose of using Delegates in C#?
What is the purpose of using Delegates in C#?
Signup and view all the answers
Study Notes
.NET Framework
- .NET Framework is developed by Microsoft and allows code execution, debugging, and deployment using object-oriented programming
- Various languages like C#, Cobol, VB, F#, Perl can be used to write applications
- It supports services, websites, desktop applications, and more
.NET Core
- Newer version of .NET Framework
- Cross-platform framework that runs on Windows, Linux, and macOS
- Can be used for applications like mobile, web, IoT, cloud, microservices, machine learning, game, etc.
Core Concepts
- .NET framework applications are compiled into Common Intermediate Language (CIL) code
- CIL code is stored in files known as assemblies, which have .dll or .exe extensions
- The Common Language Runtime (CLR) takes assemblies and uses Just-In-Time (JIT) compiler to translate CIL into machine code
.NET vs .NET Framework
- .NET Core is open-source, cross-platform, and has a modular lightweight runtime. It's focused on modern cloud-based applications and microservices.
- .NET Framework is Windows-only, has a larger set of libraries, and is focused on traditional desktop applications and web services.
EXE vs DLL
- EXE files are executable files that run the application they are designed for, they are typically specific to one application.
- DLL files are libraries that contain code shared among multiple applications, they encapsulate code that can be hidden and reused.
MVC
- Model-View-Controller is a software architectural pattern that separates concerns.
- The Model represents the data and business logic.
- The View displays the data for the user.
- The Controller handles user interactions and updates the Model and View.
Object Oriented Programming (OOP)
- The key principles of OOP are encapsulation, abstraction, inheritance, and polymorphism.
- Encapsulation bundles data and methods into a single unit, restricting direct access to data and providing access through public methods.
- Abstraction hides complex details and shows only essential features, simplifying programming.
- Inheritance allows a subclass to inherit methods and properties from a parent class.
- Polymorphism enables methods to behave differently based on the object, achieved through method overloading and method overriding.
Method Overloading and Method Overriding
- Method Overloading is a compile-time polymorphism feature.
- It enables a class to have multiple methods with the same name but different parameter lists (different types or number of parameters).
- The correct method is selected at compile-time based on the method signature.
- Method Overriding is a runtime polymorphism feature.
- It allows a subclass to provide a specific implementation for a method already defined in its superclass.
- The overridden method in the subclass must have the same name, return type, and parameters as the method in the superclass.
Abstraction vs Interface
- Abstract Class defines a base class that can have incomplete methods and properties.
- It forces derived classes to implement abstract methods and provide their specific implementation.
- Interface defines a contract that multiple classes can implement.
- Interfaces cannot have methods with implementation, only signatures.
- Classes that implement an interface must provide the implementation for all methods defined.
SOLID Principles
- Single Responsibility Principle: Each software module should have only one reason to change.
- Open-Closed Principle: A software module/class should be open for extension but closed for modification.
- Liskov Substitution Principle: Derived classes should be substitutable for their base classes without affecting the behavior of the parent class.
- Interface Segregation Principle: Clients should not be forced to implement interfaces they don't use.
- Dependency Inversion Principle: High-level modules should not depend on low-level modules, instead, both should depend on abstractions.
Dependency Injection
- Dependency Injection (DI) is a design pattern that encourages loosely coupled and testable code.
- It promotes the separation of code concerns by injecting dependent classes into a class at runtime.
- ASP.NET Core provides a built-in dependency injection container for managing dependencies.
Service Lifetimes
- Singleton: A single instance is created for the entire application lifespan.
- Transient: Creates a new instance for each request.
- Scoped: Creates a new instance for each scope (generally a web request).
Middleware
- Middleware in ASP.NET Core processes requests and responses.
- It allows developers to modify or extend the request/response pipeline based on specific conditions and logic.
- It can be used for authentication, authorization, logging, error handling, and much more.
Middleware vs Filters
- Middleware operates on requests and responses and applies logic to the entire request pipeline.
- Filters focus on specific actions or controllers in ASP.NET Core, allowing for action-level filtering.
Exceptions
- Exceptions are runtime errors or unexpected events encountered during the execution of code.
- The
try
,catch
, andfinally
blocks provide a structured way to handle these exceptions. - The
throw
keyword allows you to manually raise an exception.
Value Type vs Reference Type
- Value Type: Stores the data directly in the variable, copies the data when assigned to another.
- Reference Type: Stores a reference to the data in the variable, shares the same data when assigned to another.
Boxing and Unboxing
- Boxing: Converting a value type to a reference type.
- Unboxing: Converting a reference type back to a value type.
The Garbage Collector
- The garbage collector automatically reclaims unused memory in .NET to improve performance.
- Memory is managed in generations, with more recently allocated objects being more likely to be garbage collected.
- Garbage collection can be triggered manually or automatically based on memory usage and generational thresholds.
Authentication and Authorization
- Authentication validates user identities to determine if a user is who they claim to be.
- Authorization determines the permissions based on the authenticated user's identity.
- ASP.NET Core provides various mechanisms for both:
- Cookies: Small pieces of data stored on the client's computer to identify the user.
- JSON Web Token (JWT): A standard for securely transmitting information between parties as a JSON object.
- OpenID Connect: An authentication layer built on top of OAuth 2.0 that provides a standard for signing in and authenticating users.
IEnumerable, ICollection, IList, IQueryable
- IEnumerable: Defines an interface for iterating over a sequence of elements.
- ICollection: Extends IEnumerable and introduces methods for adding, removing, and checking the count of elements.
- IList: Extends ICollection and provides indexing capabilities for accessing elements by their position.
- IQueryable: Represents an object that can be used to query data from a data source, enabling complex filtering, sorting, and projection operations.
C# Access Modifiers
- public: Code accessible from anywhere.
- private: Code accessible only within the same class.
- protected: Code accessible within the same class or classes that inherit from it.
- internal: Code accessible only within the same assembly (a set of code compiled together).
var vs dynamic
- var: Allows the compiler to infer the type of a variable at compile time.
- dynamic: Delays type checking until runtime, allowing for more flexible but potentially less predictable behavior.
const, readonly and static
- const: Initialized once at compile time and cannot be changed.
- readonly: Initialized once, either at compile time or in the constructor, cannot be changed after that.
- static: Belongs to the class, not an instance, shared amongst all instances of the class.
Using Keyword
- using: Used to include namespaces, making their members available in the current scope.
- Also used in
using
blocks to dispose of resources (like files, connections) to prevent memory leaks.
Generics
- Generics enable code re-use by using type parameters that can be specified at runtime.
- They allow developers to work with a variety of data types without writing repetitive code.
Delegates
- Delegates represent references to methods - they are like function pointers.
- They allow developers to pass methods as arguments to other methods, enabling more flexible and dynamic code.
- They can also be used for events, providing a standard way for objects to signal occurrences.
Entity Framework (EF)
- Entity Framework is an Object-Relational Mapper (ORM) framework that simplifies interaction with relational databases (like SQL Server).
- It allows developers to treat database tables as .NET objects using classes and properties.
- Two main approaches to using EF are Database-First and Code-First.
- Database-First: You start with an existing database, and EF creates the entity classes.
- Code-First: You start by defining entity classes, and EF creates the corresponding database tables.
Advantages of EF Core over ADO.NET
- EF Core (a newer version of EF) is lightweight, faster, and more efficient.
- EF Core works seamlessly with dependency injection.
- EF Core offers a more modern and intuitive approach to working with databases.
Advantages of LINQ over EF
- LINQ (Language Integrated Query) can be used with any data source (including in-memory objects, XML, and databases).
- EF relies on LINQ for querying data from relational databases.
- LINQ provides a more flexible and expressive way to write queries than traditional SQL.
throw vs throw ex
- throw: Re-raises the current exception, preserving the original stack trace.
- throw ex: Re-raises the exception, but without the original stack trace.
IIS
- Internet Information Services (IIS) is a Web server developed by Microsoft for hosting web applications, especially .NET applications.
- It is responsible for handling request and response interactions with clients.
Kestrel
- Kestrel is a lightweight and cross-platform Web server used in ASP.NET Core applications.
- It can be used directly on a server (without IIS).
Kestrel vs IIS
- IIS runs on Windows, is robust, and provides features like authentication and authorization.
- Kestrel is cross-platform, lightweight, and more performant, it's the default in ASP.NET Core.
Synchronous vs Asynchronous Programming
- Synchronous: Operations are executed sequentially, one after another.
- Asynchronous: Operations can run concurrently, allowing for greater responsiveness and efficiency.
Stored Procedure, View, and Function
- Stored Procedure: Precompiled SQL statements and procedural logic stored in the database.
- View: A virtual table based on a stored SELECT query, used for data abstraction and security.
- Function: A reusable set of SQL statements that accept parameters and return a value or table variable.
Primary Key vs Unique Key
- Primary Key: A unique identifier for each row in a table.
- Unique Key: Ensures that the values in one or more columns are unique within the table. A table can have more than one unique key.
DELETE, DROP, and TRUNCATE
- DELETE: Removes rows from a table that meet certain criteria.
- DROP: Removes a table, including its data and structure.
- TRUNCATE: Removes all data from a table, without affecting its structure.
Cookies in ASP.NET
- Session Cookies: Stored in the browser's memory and valid until the user closes the window.
- Persistent Cookies: Saved on the user's computer and can be set to expire after a certain time period.
View Controller vs APIs
- View Controller: A controller in MVC that handles actions that render views (HTML) in a web application.
- API (Application Programming Interface): Interfaces that expose data and logic to be used by other applications or systems through protocols like HTTP.
Caching in ASP.NET
- Caching is a technique for improving performance by storing frequently accessed data in memory.
- It enables faster retrieval of data without needing to access the underlying source (like a database).
Dispose and Finallize
- Dispose: Invoked manually to free up resources (like files or network connections) to prevent leaks.
- Finalize: Automatically called by the garbage collector (generally when the garbage collector determines an object is no longer reachable). It's used for cleaning up unmanaged resources.
Functions in SQL
- Encapsulate common computations or transformations
- Used in calculations, data transformations, and queries
- Accept input parameters, perform operations, and return values
Primary Key vs. Unique Key in SQL
- Primary Key - Uniquely identifies each row in a table
- Unique Key - Ensures uniqueness of a column or combination of columns, but doesn't necessarily identify rows
DELETE, DROP, and TRUNCATE in SQL
- DELETE - Removes rows from a table
- DROP - Removes an entire table, including data and schema
- TRUNCATE - Removes data from a table without deleting the table itself
Types of Cookies in ASP.NET
- Persistent Cookies - Stored on the user's computer and persist after the browser is closed.
- Session Cookies - Stored in memory and expire when the browser closes.
View Controller vs. APIs in ASP.NET
- View Controller - Manages the user interface, interacts with the user, and updates the view.
- APIs - Allow different software systems to communicate over the internet via HTTP requests.
Caching in .NET
- Improves application performance by storing frequently accessed data in temporary storage.
- Reduces the need to repeatedly fetch data from slow sources.
- In-Memory Caching - Stores data in the application's memory.
- Distributed Caching - Stores data across multiple servers to improve scalability.
Dispose and Finalize in .NET
- Dispose - Explicitly releases unmanaged resources and cleans up operations.
- Finalize - Releases unmanaged resources before garbage collection.
- Dispose is called manually by developers, while Finalize is called by the garbage collector.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Test your knowledge on the key features of .NET Core and foundational concepts of C# programming. This quiz covers topics like OOP principles, access modifiers, and garbage collection. Challenge yourself to see how well you understand these critical programming concepts!