Q1: What is .NET Framework?
Explain its components with proper
diagram.
Q2: Di erence Between Website and Web Application
The .NET Framework is a software development framework developed by
Microsoft. It provides a controlled environment for developing, building, Website Web Application
deploying, and running applications. .NET applications can range from A collection of interlinked web An interactive application
desktop applications to web-based services, web applications, and more. pages that provide information. designed for user interaction.
Usually simpler, providing static More complex, providing
Components of .NET Framework:
content. dynamic, interactive
1. Common Language Runtime (CLR): - The core runtime engine for .NET functionality.
applications. It manages memory, handles execution of code, and provides Limited to navigation and Users can perform actions (e.g.,
services like exception handling, garbage collection, and security. viewing content. log in, submit forms).
2. Base Class Library (BCL):- A set of libraries that provide basic Mostly informational or Functional, allows users to
functionality for tasks like input/output, string manipulation, database promotional. interact (e.g., shopping,
connectivity, and more. banking).
Can use basic Uses frameworks like ASP.NET,
3. ASP.NET:- A framework for building web applications and services. It
HTML/CSS/JavaScript. back-end logic, databases.
includes components for building websites, web APIs, and more.
A blog, news website. A banking system, e-commerce
4. Windows Forms:- A graphical user interface (GUI) framework used for store.
building rich desktop applications. There is the possibility of losing There is less possibility of key
5. ADO.NET:- A framework for data access. It enables communication the key that renders the loss, as the key is held publicly.
between .NET applications and data sources like SQL Server, Oracle, etc. systems void.
The private key is to be shared The public key can be used by
6. Windows Presentation Foundation (WPF):- A modern framework for
between two parties. anyone.
building desktop applications with rich user interfaces.
The Performance testing checks The Load testing checks the
.NET Framework Diagram: the reliability, scalability, and sustainability of the system.
speed of the system.
The recipient’s private key The recipient’s public key
decrypts the message. encrypts the message.
The private key is used in The public key is used in
algorithms such as AES 128, algorithms such as RSA, DSA,
AES 192 and AES 256. etc.
It is used to protect disk drives It is used to secure web
and other data storage devices. sessions and emails.
The recipient’s private key The recipient’s public key
decrypts the message. encrypts the message.
Q4: Explain both Grid Layout and Liquid Layout with proper diagram.
Q3: Explain Visual Studio IDE with menus and all. Grid Layout:- The grid layout divides the page into a fixed grid system. It
uses rows and columns, and the content is placed in specific grid cells.
Visual Studio is an Integrated Development Environment (IDE) for Grid layouts provide precise control over the layout but can be less flexible.
.NET and other languages like C++, Python, etc. It o ers many
Key Features: Rows and Columns: Defines a grid structure with rows and
tools for developers to write, edit, test, and debug their code. columns, each having customizable properties like width, height, and
Key Features: spacing.
Cell Spanning: Allows elements to span multiple rows or columns,
- Solution Explorer: Displays project files, code files, and
creating dynamic and adaptive layouts.
references.
- Toolbox: Contains components and controls you can drag and
drop into your UI design.
- Properties Window: Allows you to modify the properties of
selected objects (forms, controls, etc.).
- Output Window: Displays logs, build output, and debugging
information.
Liquid Layout:- A liquid layout adjusts its width and size based on the
Menus: browser window. It’s designed to be responsive and fill the space on the
screen proportionally. This is common in responsive web design.
1. File Menu: Manage projects, solutions, and files (Open, Close,
Save, etc.). Key Features: Relative Units: Utilizes relative units like percentages and
ems to express element sizes, allowing them to scale proportionally with
2. Edit Menu: Provides options for editing code like Find, Replace, the container's dimensions.
Go To, and Code Refactoring.
Flexible Box Model: Leverages the CSS Flexible Box Model to
3. View Menu: Allows you to toggle between di erent windows achieve fluid layouts by distributing available space among elements
like Solution Explorer, Team Explorer, Output, etc. based on their flex properties.
4. Debug Menu: O ers debugging controls like Start Debugging, Di erence Between:
Step Into, Step Over, and Breakpoints. Features Grid Layout Liquid Layout
Layout Structure Grid-based Dynamically adjusts
5. Build Menu: Options to build, rebuild, or clean the solution or Element Positioning Precise control over Relative units and flex
project. rows and columns properties
Best Use Cases Complex layouts with Responsive designs
6. Tools Menu: Access additional tools like NuGet Package fixed grid structures that adapt to di erent
Manager, Extensions, and IDE settings. screen sizes
Q5: Explain the features of C# .NET Programming Q.9 What do you mean by Master Page? Explain with example.
1. Object-Oriented: C# supports all OOP principles like A master page in ASP.NET is a template that defines the common
encapsulation, inheritance, and polymorphism. layout and structure of multiple web pages. It provides a
consistent look and feel across your website, making it easier to
2. Type Safety: C# enforces strict type checking, reducing the manage and update.
risk of runtime errors.
Example Master Page:
3. Automatic Memory Management: The CLR handles
<%@ Master Language="C#" AutoEventWireup="true"
memory management with garbage collection, reducing
CodeBehind="Site.master.cs"
memory leaks.
Inherits="WebApplication1.SiteMaster" %>
4. Rich Library Support: C# provides a vast set of libraries
<!DOCTYPE html> <div>
through the .NET framework (BCL).
<html> <asp:ContentPlaceHolder
5. Delegates and Events: It supports powerful event handling ID="ContentPlaceHolder1"
mechanisms with delegates and events. <head
runat="server">
runat="server">
6. LINQ (Language Integrated Query): Allows querying
collections like databases or arrays in a clean and readable <title></title> </asp:ContentPlaceHolder>
way. </head> </div>
7. Asynchronous Programming: Built-in support for <body> </form>
asynchronous operations with `async` and `await`.
<form id="form1" </body>
8. Cross-Platform Development: With .NET Core, C# can be runat="server">
</html>
used for cross-platform development.
Content Page:
9. Interoperability: C# can work with code written in other
languages like C++. <%@ Page Title="" Language="C#"
MasterPageFile="~/Site.master" AutoEventWireup="true"
10. Properties and Indexers: C# allows the use of properties
CodeBehind="Default.aspx.cs"
and indexers to encapsulate data. Inherits="WebApplication1.Default" %>
11. Exception Handling: Comprehensive support for <asp:Content ID="Content1"
handling runtime errors with `try`, `catch`, `finally` blocks. ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
This is the content page.</asp:Content>
Q.10 What is Exception Handling? Explain with proper Q.11 Write a note on Type Conversion in C#.
example. Type conversion in C# refers to the process of converting a value
Exception handling in C# is a mechanism for handling errors that from one data type to another. There are two types of conversion:
occur during program execution. It helps prevent your program implicit and explicit.
from crashing and provides a way to gracefully recover from
Implicit conversion: This occurs automatically when a
unexpected situations.
value can be safely converted to a larger data type without
Example: losing information. For example, an int can be implicitly
converted to a double.
try
Explicit conversion: This requires a cast operator to
{ int numerator = 10;
explicitly convert a value to a smaller data type. This can
int denominator = 0; potentially lead to loss of precision or data. For example, a
int result = numerator / denominator; double can be explicitly converted to an int, but any decimal
part will be truncated.
Console.WriteLine("Result: " + result);}
Example:
catch (DivideByZeroException ex)
|| int x = 10; || double y = x; // Implicit conversion || int z = (int)y; //
{Console.WriteLine("Error:
Explicit conversion ||
Division by zero.");
Console.WriteLine(ex.Message);}
finally
{Console.WriteLine("Finally block executed.");}
In this example, the try block contains the code that might throw
an exception (dividing by zero). If an exception occurs, the catch
block is executed, and the error message is displayed. The finally
block is always executed, regardless of whether an exception
occurred.