DOT-NET-FAQ
Short Questions
1 In C#, Constructor can return the value. Justify.
The purpose of a constructor is to initialize fields or properties of an object, not to return a
value.
2 What are the different data types supported by C#?
Value Types:
Integral Types: byte, sbyte, short, ushort, int, uint, long, ulong
Floating-Point Types: float, double
Decimal Type: decimal (used for financial calculations)
Character Type: char
Boolean Type: bool
🔹 Reference Types:
string
object
Arrays (e.g., int[])
Class, Interface, Delegate
3 Explain following [Link] objects with their method. (a) Connection (b) DataAdapter.
(a) Connection: In [Link], the Connection object is used to establish a connection between
an application and a data source such as SQL Server.
(b) DataAdapter: The DataAdapter acts as a bridge between a database and a DataSet in
[Link].
4 What is Dialog? Explain following FolderBrowserDialog with its usage.
Dialog: In C#, a Dialog is a special type of window used to interact with the user and get input,
such as opening a file, saving a file, or selecting a folder.
FolderBrowserDialog: It is a built-in dialog in C# used to let the user browse and select a
folder from the file system. It provides a simple interface to choose directories, not files.
5 Define namespace with example.
In C#, a namespace is used to organize and group related classes, interfaces, and other types
under a single name. It helps avoid name conflicts and makes code easier to manage.
6 We can overload indexer. (True/False). Justify.
True.
Justification:
In C#, indexers can be overloaded by changing the number or type of parameters they take.
This means a class can have multiple indexers with different parameter lists, similar to
method overloading.
7 Give points of difference between ASP and [Link].
Point ASP (Classic ASP) [Link]
Technology Scripting-based Compiled framework
Language Support VBScript, JavaScript C#, [Link], J#
Performance Slower (interpreted) Faster (compiled code)
Object-Oriented Not fully supported Fully supports OOP
8 Compare Repeater and Data-List control with example.
Feature Repeater DataList
Layout Control Full control using templates Moderate control with layout options
Performance Faster (no built-in layout features) Slightly slower (has built-in styling)
Built-in Styles No Yes (like RepeatDirection, RepeatLayout)
Item Selection Not supported directly Supports selection (SelectedItem)
Use Case Best for custom, lightweight display Better for tabular or styled layout
9 State any four services offered by CLR.
Memory Management: Automatic allocation and deallocation of memory via garbage
collection.
Type Safety: Ensures that variables are used according to their data types to prevent errors.
Exception Handling: Provides a structured mechanism for managing runtime errors (try-
catch).
JIT Compilation: Converts Intermediate Language (IL) code to native code at runtime for
better performance.
10 Which namespace needs to be imported for using brush, pen and color?
using [Link];
11 What is debugging and error handling in Dot Net Technology?
Debugging
Debugging is the process of identifying, diagnosing, and fixing errors (bugs) in the code. In
.NET, Visual Studio provides powerful debugging tools
Error Handling
Error handling in .NET refers to managing runtime errors to prevent program crashes and
ensure smooth execution. This is done using try-catch-finally blocks
12 Explain usage of following [Link] objects: (a) Dataset (b) SqlDataAdapter
(a) DataSet
A DataSet is an in-memory representation of data from a data source. It can hold multiple
DataTables and supports relationships between them.
b) SqlDataAdapter
SqlDataAdapter is used to fill a DataSet or DataTable with data from a database and update
the database with changes made to the data.
13 What is difference between a checkbox control and a radiobutton control?
Feature Checkbox RadioButton
Selection Multiple selections allowed Only one selection allowed in a group
Usage Used for multiple independent choices Used for a single choice from a group
Square box that can be Circular button that can be
Appearance
checked/unchecked selected/deselected
14 Define: (a) Postback (b) Viewstate.
a) Postback
Postback refers to the process of submitting a page back to the server from the client. In web
applications like [Link], when a user interacts with the page (e.g., clicking a button), the
page is sent back to the server for processing.
b) ViewState
ViewState is a mechanism in [Link] that allows the state of a page’s controls to be
persisted across postbacks.
Long Questions
1 What is the .NET Framework and how does it relate to various Windows operating systems?
The .NET Framework is a software development platform developed by Microsoft that
provides a runtime environment, libraries, and tools for building and running applications on
Windows.
Key Features of the .NET Framework:
1. Common Language Runtime (CLR): Manages the execution of code, providing services
like garbage collection, type safety, exception handling, and more.
2. Class Libraries: Provides a large set of pre-built classes and APIs for tasks like file I/O,
networking, database access, and more.
3. Language Interoperability: Supports multiple programming languages like C#, [Link],
and F#.
Relationship to Windows Operating Systems:
The .NET Framework is tightly integrated with Windows and is designed to work on
various versions of the Windows operating system.
Compatibility: The .NET Framework ensures that applications built with it can run across
these different versions of Windows, with backward compatibility.
Windows Components: The .NET Framework relies on components of the Windows OS for
memory management, hardware access, and other system resources.
2 What are namespaces in .NET, and why are they important for organizing code?
In .NET, namespaces are used to organize classes, functions, and other types into groups
based on their functionality. They help avoid naming conflicts when different parts of a
program have classes with the same name.
Namespaces also make the code more manageable, especially as your project grows. They
allow you to organize related components together, such as all file handling classes in
[Link] and networking classes in [Link].
In short, namespaces keep the code organized, prevent conflicts, and make it easier to
manage and read.
3 What is an assembly in .NET, and what are its components?
In .NET, an assembly is the fundamental building block of the application. It is a compiled
code library used for deployment and security.
Components
Manifest:
Contains metadata about the assembly, such as its version, name, culture, and
security information.
Metadata:
Provides information about the types, methods, properties, and other components
contained in the assembly.
IL Code (Intermediate Language):
The actual code written by the developer is compiled into Intermediate Language (IL),
which is platform-independent.
Resources:
Assemblies can also contain non-code data such as images, text files, or other
resources
Types:
Assemblies contain types (classes, structs, enums, etc.) that define the behavior of
the application.
4 Differentiate between static and dynamic assemblies in .NET.
IN Mobile
5 What is End to DLL Hell?
"DLL Hell" refers to a set of issues that arose with Dynamic Link Libraries (DLLs) in Windows-
based applications. These issues mainly occur due to the management of different versions
of the same DLL on a system, causing compatibility problems when applications expect one
version but find another. This results in conflicts, crashes, and incorrect behavior in
applications.
6 Discuss the purpose and usage of satellite assemblies in .NET applications.
Satellite assemblies in .NET are used to separate localized resources (like strings and images)
from the main application code. This allows for efficient localization of applications to
support multiple languages and cultures without modifying or rebuilding the core application.
The ResourceManager helps load these resources dynamically based on the user's locale
Usage
Support Multiple Languages: They allow an application to support multiple languages without
rebuilding or modifying the core application.
Store Localized Resources: Satellite assemblies store language-specific resources separately
from the main application.
Dynamic Loading: The appropriate satellite assembly is loaded at runtime based on the user's
language.
7 What is a constructor in C#? Explain its characteristics and its purpose in object-oriented
programming.
In C#, a constructor is a special method in a class that is called automatically when an object
of that class or struct is created. Its main purpose is to initialize the object.
Characteristics of a Constructor:
Same Name as the Class:
A constructor must have the same name as the class or struct it is associated with.
No Return Type:
Constructors do not have a return type, not even void.
Called Automatically:
The constructor is called automatically when we create an object.
Purpose of a Constructor
1. Object Initialization:
The main purpose of a constructor is to initialize an object. It ensures that the object
starts with a valid state.
2. Automatic Setup:
Constructors allow for automatic setup when an object is created, so the programmer
doesn’t have to explicitly set initial values
8 What is a destructor in C#? Explain its purpose and characteristics. How is it different from a
constructor?
In C#, a destructor is a special method that is called automatically when an object is
destroyed or garbage-collected.
Characteristics of a Destructor:
Same Name as the Class:
A destructor has the same name as the class, but it is preceded by a tilde (~) symbol.
No Parameters:
Destructors cannot take parameters or have any return type, including void.
Called Automatically:
The destructor is called automatically by the garbage collector when an object is no longer in
use.
Purpose of a Destructor in C#:
Resource Cleanup:
The primary purpose of a destructor is to clean up resources that are not automatically
handled by the .NET runtime.
Finalization:
Destructors help in finalization, which is the process of cleaning up before an object is
removed from memory.
9 Describe the concept of function overloading in C#. Provide an example demonstrating
function overloading.
Function overloading in C# refers to the ability to define multiple methods in the same class
with the same name but with different parameters (either in number, type, or both).
Example in mobile
10 Explain the concept of inheritance in C#. How does C# support inheritance, and what are its
key characteristics?
Inheritance is a fundamental concept in Object-Oriented Programming (OOP) that allows one
class (the derived class) to inherit the properties and methods of another class.
How C# Supports Inheritance:
In C#, inheritance is supported using the colon (:) symbol. A derived class inherits all the
accessible members of its base class, but it does not inherit the constructor, destructor, or
static members of the base class.
Key Characteristics of Inheritance in C#:
Single Inheritance:
C# supports single inheritance, meaning a class can inherit from only one base class.
However, a class can implement multiple interfaces.
Code Reuseability:
Inheritance promotes code reuse by allowing derived classes to inherit functionality from
base classes.
11 What is operator overloading in C#? Provide an example demonstrating operator
overloading for a user-defined class
Operator overloading in C# allows you to define or modify the behavior of operators (such as
+, -, *, ==, etc.) for user-defined types (classes or structs).
Example in mobile
12 What are some key features of the C# programming language that differentiate it from
other languages, and how do these features contribute to its simplicity and modernity?
Garbage Collection: C# uses automatic garbage collection to manage memory. The .NET
runtime automatically handles memory allocation and deallocation
Type Safety: C# is a type-safe language, meaning that the type of a variable is checked at
compile time.
Object-Oriented Programming (OOP) Support: C# is a fully object-oriented language that
supports all the major OOP principles such as inheritance, encapsulation, polymorphism, and
abstraction.
Interoperability with Other Languages: C# is highly interoperable with other .NET languages
like Visual Basic and F#.
13 What is a debugger in programming, and what are its basic functions?
A debugger is a tool used by programmers to test and debug their code by allowing them to
monitor the execution of a program, inspect its state, and identify issues such as bugs or
errors. It provides control over the execution of the program.
Functions
Set Breakpoints: Pause the program at specific points to inspect the state.
Step Through Code: Execute the program line-by-line or function-by-function.
Inspect Variables: View the values of variables during execution.
.Handle Exceptions: Pause execution when an error occurs to identify the issue.
14 Explain the purpose of Stack and Queue classes in C#. How do they differ in functionality?
Stack Class:
Purpose: A Stack is a collection that follows the Last In, First Out (LIFO) principle,
meaning that the last element added to the stack is the first one to be removed.
Usage: It's commonly used in scenarios where you need to keep track of function
calls.
Queue Class:
Purpose: A Queue follows the First In, First Out (FIFO) principle, meaning the first element
added to the queue is the first one to be removed.
Usage: It’s commonly used for tasks like managing requests in a server, scheduling tasks in
order.
15 List down various windows form controls. Explain any three of them briefly.
Button
Label
TextBox
ComboBox
ListBox
RadioButton
CheckBox
GroupBox
Button:
Purpose: A Button control is used to create a clickable button in a form. When clicked,
it triggers an event or performs an action.
Usage: It’s commonly used to submit data, execute commands
Label:
Purpose: A Label control is used to display text on a form. It’s primarily for presenting
information to the user, such as titles or descriptions.
Usage: Labels are often used to describe the messages to the user.
TextBox:
Purpose: A TextBox control is used for user input, where users can type text. It is
commonly used for forms that collect data, such as names, email addresses, or
messages.
Usage: The TextBox can be single-line or multi-line.
16 Explain in brief ASP .NET Page Life cycle.
Page Request: The page request is made by the user. [Link] determines whether the
page needs to be compiled or can be served from cache.
Start: Initialization of page properties like Request, Response, and IsPostBack occurs.
Initialization: All server controls are initialized. Each control is assigned a unique ID.
Load: Page and all controls are loaded with data (such as from view state or postback). This
is where you access user input.
Postback Event Handling: If the request is a postback, any event handlers (like button clicks)
are called.
Rendering: The page calls Render() method for each control, and HTML is generated and
sent to the browser.
Unload: Final cleanup is done. This stage is used to release resources, but no page or
control access is allowed.
17 Explain the concept of master pages in [Link] with example.
Master Pages in [Link] allow you to create a consistent layout for multiple pages in a web
application. They act like templates where we define the common structure.
Purpose:
To maintain uniform look and feel across all pages.
To avoid code duplication for common UI elements.
To make updates easier by changing the layout in a single master file.
18 Differentiate between Master Page and Theme Page in [Link].
Aspect Master Page Theme Page
Defines a common layout for Defines the visual style and appearance
Purpose
multiple pages of controls
Theme is a folder, includes .skin and CSS
File Extension .master
files
Used to maintain consistent Used to apply consistent design (colors,
Usage
structure (header, footer, menu) fonts, styles)
Focus Area Focuses on layout and structure Focuses on look and feel
Applied Set using MasterPageFile in .aspx Applied via Theme or StyleSheetTheme
Through page in [Link] or page directive
Provides content sections for child Styles all controls uniformly without
Customization
pages to fill altering layout
19 Explain session concept in web applications with example.
A session is a way to store user data across multiple pages in a web application. When a user
visits a website, the server creates a session object for that user, allowing the application to
remember information like user login, shopping cart items, or preferences during their visit.
Key Points:
A session is unique to each user.
Data is stored on the server-side, and a unique Session ID is stored in the user’s
browser
Session data lasts until the user closes the browser, logs out, or the session times out.
20 What is Web Service? Create a web service to add two numbers. Also give code to consume
it.
A Web Service is a software component that allows applications to communicate over the
internet using standard protocols like HTTP. In [Link], web services enable data exchange
between different platforms or systems using XML-based messages, commonly via SOAP.