Unit 1
Q1. Explain .NET Framework Architecture
Answer:
The .NET Framework is a software platform developed by Microsoft. It
provides a runtime environment and a rich set of libraries to build, run,
and manage applications on Windows.
Points:
1. CLR (Common Language Runtime): Manages execution of .NET
programs.
2. BCL (Base Class Library): Provides pre-written classes & functions.
3. CLS (Common Language Specification): Ensures interoperability
between different .NET languages.
4. CTS (Common Type System): Defines rules for data types.
5. Languages: Supports C#, VB.NET, F#, etc.
6. ASP.NET: Used to build dynamic web applications.
7. ADO.NET: Used for database connectivity.
8. Tools: Visual Studio IDE provides development environment.
9. Security: Provides features like code access security & authentication.
Conclusion:
The .NET Framework architecture provides a complete environment for
developing secure, scalable, and cross-language applications.
Q2. Short Note on Type Casting
Answer:
Type Casting in .NET is the process of converting one data type into
another. It is used to make data compatible when working with different
variables, objects, or classes.
Points:
1. Definition: Converting one data type into another.
2. Types of Casting:
Implicit Casting (Type Conversion): Automatic conversion (small → big
type).
Explicit Casting (Type Casting): Manual conversion using cast operator ( ).
3. Example of Implicit:
int a = 10;
double b = a; // int automatically converted to double
4. Example of Explicit:
double x = 9.8;
int y = (int)x; // double explicitly converted to int
5. Boxing: Converting value type → object type.
6. Unboxing: Converting object type → value type.
7. Safe Casting: Using as and is operators to avoid errors.
8. Use Case: Helps in data processing, mathematical operations, and
database interactions.
Conclusion:
Type casting ensures data compatibility in .NET applications and allows
smooth interaction between different data types.
Q3. Assembly and its Types
Answer:
In .NET, an Assembly is the smallest deployable unit of an application. It
contains compiled code and resources used by the CLR for execution.
Points:
1. Definition: Collection of compiled code (.exe or .dll) in .NET.
2. Contains: MSIL code, metadata, resources, and manifest.
3. Manifest: Provides assembly version, culture, and references.
4. Private Assembly: Used by a single application, stored in app folder.
5. Shared Assembly: Used by multiple applications, stored in Global
Assembly Cache (GAC).
6. Satellite Assembly: Stores resources for localization (multiple
languages).
7. Dynamic Assembly: Created and executed at runtime.
8. Role in Security: Provides versioning, strong naming, and prevents code
conflicts.
9. Deployment: Simplifies application deployment and updates.
Conclusion:
Assemblies are the building blocks of .NET applications, providing code
organization, versioning, and reusability.
Q4. Delegates (Short Note)
Answer:
A Delegate in .NET is a type that holds a reference to a method. It is used
to call methods indirectly and implement event-driven programming.
Points:
1. Definition: Object that represents a method reference.
2. Similar to Function Pointer but type-safe.
3. Declaration: delegate returntype delegateName(parameters);
4. Single-cast Delegate: Refers to one method.
5. Multi-cast Delegate: Refers to multiple methods.
6. Events: Delegates are base for event handling in C#.
7. Anonymous Methods: Delegates can be assigned inline methods.
8. Lambda Expressions: Modern way to use delegates with =>.
9. Use Case: GUI event handling (button click, etc.).
Conclusion:
Delegates make .NET applications flexible by supporting callbacks, events,
and asynchronous programming.
Unit 2
Q5. AD Rotator Control
Answer:
The AD Rotator Control in ASP.NET is a web server control used to display
a sequence of banner ads randomly or in rotation.
Points:
1. Definition: Displays rotating ads on a webpage.
2. File Used: Needs an XML file containing ad details.
3. Properties: AdvertisementFile, TargetFrame, KeywordFilter.
4. AdvertisementFile: Stores image, alternate text, and URL.
5. Random Display: Ads are chosen randomly from file.
6. Weight Property: Controls frequency of ad display.
7. Hyperlinks: Clicking banner redirects to target URL.
8. Customization: Different ads can be shown on different pages.
9. Use Case: Commonly used in websites to display sponsors/ads.
Conclusion:
AD Rotator simplifies displaying dynamic advertisements and managing
them easily in ASP.NET websites.
Q6. Functionality of Web Controls (Radio Button, Checkbox, Button,
Textbox)
Answer:
ASP.NET provides Web Controls to create interactive user interfaces.
Common controls are Radio Button, Checkbox, Button, and Textbox.
Points:
1. Radio Button:
Allows user to select only one option from a group.
Example: Gender selection (Male/Female).
2. Checkbox:
Allows user to select multiple options.
Example: Selecting hobbies or interests.
3. Button:
Executes an action when clicked.
Example: Submit, Reset, Login buttons.
4. Textbox:
Used to enter text input.
Example: Username, password fields.
5. Server-side Processing: Each control sends data to server for
processing.
6. Properties: Text, Checked, Enabled, Visible.
7. Events:
CheckedChanged for Checkbox/Radio.
Click for Button.
TextChanged for Textbox.
8. Validation: Often combined with validation controls to check correct
input.
9. Use Case: Essential for form design and user interaction in web apps.
Conclusion:
Web controls simplify user input and interaction in ASP.NET applications by
providing ready-to-use UI components.
Q7. Validation Controls
Answer:
Validation controls in ASP.NET are used to ensure that user input is correct
before processing or storing it in the database.
Points:
1. Definition: Controls that check user input for accuracy.
2. RequiredFieldValidator: Ensures field is not empty.
3. RangeValidator: Checks if value is within a given range.
4. CompareValidator: Compares input with another value or control.
5. RegularExpressionValidator: Validates using patterns (e.g., email,
phone).
6. CustomValidator: Allows user-defined validation logic.
7. ValidationSummary: Displays all validation errors together.
8. Properties: ErrorMessage, ControlToValidate.
9. Use Case: Prevents invalid data entry and improves security.
Conclusion:
Validation controls improve reliability and data integrity in ASP.NET web
applications.
Q8. Types of State Management (Page State & Session State)
Answer:
In ASP.NET, State Management is used to preserve user data between
requests because HTTP is a stateless protocol.
Points
1. State Management: Technique to maintain user data.
2. Types:
Client-Side State (ViewState, Cookies, Query Strings).
Server-Side State (Session State, Application State).
3. Page State (ViewState):
Stores data of controls between postbacks.
Stored in hidden field in page.
4. Session State:
Stores user-specific data on the server.
Maintains data across multiple pages.
5. Application State: Shared data for all users.
6. Cookies: Store small data on client browser.
7. Query Strings: Pass data via URL.
8. Advantages: Maintains continuity in user experience.
9. Disadvantages: May increase memory usage and complexity.
Conclusion:
State management techniques ensure smooth data flow and user session
tracking in ASP.NET applications.