B.B.A.
(CA) CA-604 :DOT Net Framework
(Semester-VI) (CBCS)
Q1) Attempt any Eight of the following : [8 × 2 = 16]
a) How to declare a constant?
In [Link] we declare a constant using the Const keyword, name, type, and value, for example:
Const PI As Double = 3.14159.[1][2]
Once declared, a constant’s value cannot be changed at run time.[1]
b) What is garbage collection?
In .NET, garbage collection is the automatic process by which the CLR finds objects in the managed
heap that are no longer referenced by the application and reclaims their memory.[3]
This frees developers from manual memory management and helps prevent memory leaks and
fragmentation.[3]
c) Enlist any four errors in [Link].
Typical categories of errors in [Link] include:
• Syntax errors (violating language grammar, caught at compile time).
• Compile‑time errors (missing references, wrong types, etc.).
• Run‑time errors (exceptions like divide‑by‑zero, null reference).
• Logical errors (program runs but gives incorrect results).
(Any four such categories earn full marks.)
d) Define MSIL.
MSIL (Microsoft Intermediate Language), also called CIL, is the platform‑independent, low‑level
bytecode produced when .NET source code (C#, [Link], etc.) is compiled.[4]
At run time the JIT compiler translates MSIL into native machine code for execution on the target
platform.[4]
e) List any 4 properties of form.
Common [Link] form properties include:
• Text – caption displayed in the form’s title bar.[5]
• BackColor – background color of the form.[5]
• ForeColor – color of text displayed on the form.[6]
• FormBorderStyle – style of the form’s border (fixed, sizable, none, etc.).[6]
f) What is CLS?
CLS (Common Language Specification) is a set of rules and restrictions defined by the CLR that all
.NET languages must follow to ensure cross‑language interoperability.[7]
Code that follows these rules is called CLS‑compliant and can be used across different .NET
languages.[7]
g) What is method overloading?
Method overloading is a form of compile‑time polymorphism where multiple methods in the same
class share the same name but differ in parameter list (number, type, or order of parameters).[8]
The compiler selects which overloaded method to call based on the arguments supplied at the call
site.[8]
h) What is destructor?
In C#, a destructor (finalizer) is a special method prefixed with ~ClassName that is called by the garbage
collector before an object’s memory is reclaimed.[9]
It is used to release unmanaged resources, but its execution time is not under direct programmer
control.[9]
i) What is event? List any two mouse events in [Link].
An event is a notification that something has happened (such as a mouse click or key press) so that
event‑handler methods can respond to it.[10]
Two mouse events in [Link] are MouseDown (mouse button pressed) and MouseUp (mouse button
released); others include MouseMove, MouseEnter, MouseLeave, and MouseWheel.[10]
j) Explain any two properties of data grid.
For a .NET DataGrid/DataGridView, typical properties include:
• DataSource – specifies the data source (like DataTable/DataSet) whose data is displayed in the grid.[11]
• AllowUserToAddRows/AllowUserToDeleteRows – control whether users can add or delete rows
interactively.[11]
(You can also mention Columns, ReadOnly, SelectedItem, etc. depending on the exact control used.)
Q2) Attempt the following (any 4): [4 × 4 = 16]
a) Explain features of Dot Net.
Key features of the .NET framework include:
• CLR (Common Language Runtime): Provides services such as memory management,
garbage collection, security, and exception handling.[12][3]
• Language interoperability: Different .NET languages (C#, [Link], F#, etc.) can work
together using common types and MSIL.[12][7]
• Base Class Library (BCL): A rich set of reusable classes for I/O, collections, networking, GUI,
XML, etc., which simplifies development.[12]
• Support for OOP and multithreading: Inheritance, interfaces, overloading, and explicit
free threading allow building scalable, object‑oriented applications.[12]
b) Explain scrollbar control with its property and methods.
In [Link], the HScrollBar and VScrollBar controls provide horizontal and vertical scrolling capabilities for
forms or containers when content is larger than the visible area.[13]
Important properties include:
• Minimum and Maximum – define the scrollable range of values.[13]
• Value – current position of the scroll box.[13]
• LargeChange and SmallChange – how much Value changes for large and small moves.[13]
Important methods/events include:
• OnScroll / Scroll event – fired when the user moves the scroll box.[13]
• OnValueChanged / ValueChanged – occurs when the Value property changes.[13]
c) What are the [Link] components?
The main [Link] components are:[14][15]
• Connection (SqlConnection, OleDbConnection): establishes a link between the application and the
data source.[14]
• Command (SqlCommand, OleDbCommand): executes SQL statements or stored procedures against
the data source.[16][14]
• DataAdapter (SqlDataAdapter): acts as a bridge between the data source and a DataSet, filling it
and updating changes back.[14]
• DataSet/DataTable: in‑memory, disconnected representations of data used for binding and
manipulation.[14]
d) Design GUI and write a code using Rich Text Box
i) Add font size in combobox
ii) Select size and change text size in textbox.
Concept: Form contains a RichTextBox (rtbText) and a ComboBox (cmbSize) pre‑filled with sizes like 8, 10,
12, 14, 16, 18, etc. Code example:
Public Class Form1
Private Sub Form1_Load(...) Handles [Link]
[Link](New Object() {8, 10, 12, 14, 16, 18, 20})
[Link] = 2 ' e.g. 12
End Sub
Private Sub cmbSize_SelectedIndexChanged(...) Handles [Link]
Dim size As Single = CSng([Link])
Dim currentFont As Font = [Link]
[Link] = New Font([Link], size, [Link])
End Sub
End Class
When the user chooses a size in the combo box, the font size of the text in the RichTextBox changes
accordingly.
e) Write a [Link] program to display the numbers continuously in textbox by
clicking on button.
Simple example with a TextBox (txtNum) and a Button (btnStart); use a Timer to “continuously” update:
Public Class Form1
Dim n As Integer = 0
Private Sub btnStart_Click(...) Handles [Link]
[Link] = 1000 ' 1 second
[Link]()
End Sub
Private Sub Timer1_Tick(...) Handles [Link]
n += 1
[Link] = [Link]()
End Sub
End Class
When the button is clicked, the timer starts and the textbox shows increasing numbers every second.
Q3) Attempt the following (any 4): [4 × 4 = 16]
a) Write a [Link] program to accept a character from the keyboard and
check whether it is vowel or consonant.
Example (Console or Windows; here Console):
Module Module1
Sub Main()
[Link]("Enter a character: ")
Dim ch As Char = [Link]()(0)
ch = [Link](ch)
If "aeiou".IndexOf(ch) >= 0 Then
[Link](ch & " is a vowel")
Else
[Link](ch & " is a consonant")
End If
[Link]()
End Sub
End Module
This checks membership in the string "aeiou" to decide vowel vs consonant.
b) Write a program in c#.Net to find the sum of all elements of the array.
using System;
class SumArray
{
static void Main()
{
int[] arr = { 10, 20, 30, 40, 50 };
int sum = 0;
for (int i = 0; i < [Link]; i++)
{
sum += arr[i];
}
[Link]("Sum = " + sum);
[Link]();
}
}
This program declares an integer array, loops through all elements, and accumulates the sum.
c) Write a c#.Net program to display fibonacci series.
using System;
class FibonacciSeries
{
static void Main()
{
int n = 10; // number of terms
int first = 0, second = 1, next;
[Link](first + " " + second + " ");
for (int i = 2; i < n; i++)
{
next = first + second;
[Link](next + " ");
first = second;
second = next;
}
[Link]();
}
}
This prints the first 10 Fibonacci numbers iteratively.[17]
d) Write a c#.Net program to find given number is prime or not.
using System;
class PrimeCheck
{
static void Main()
{
[Link]("Enter a number: ");
int n = Convert.ToInt32([Link]());
bool isPrime = n > 1;
for (int i = 2; i <= [Link](n) && isPrime; i++)
{
if (n % i == 0)
isPrime = false;
}
if (isPrime)
[Link](n + " is a prime number");
else
[Link](n + " is not a prime number");
[Link]();
}
}
This checks divisibility up to √𝑛 to decide primality.[18]
e) Write a [Link] program to find given number is perfect or not.
A perfect number equals the sum of its proper divisors (excluding itself). Example:
Module Module1
Sub Main()
[Link]("Enter a number: ")
Dim n As Integer = CInt([Link]())
Dim sum As Integer = 0
For i As Integer = 1 To n \ 2
If n Mod i = 0 Then
sum += i
End If
Next
If sum = n Then
[Link](n & " is a perfect number")
Else
[Link](n & " is not a perfect number")
End If
[Link]()
End Sub
End Module
Q4) Attempt the following (any 4): [4 × 4 = 16]
a) Explain various built in dialog boxes.
Common built‑in dialog components in [Link] WinForms include:
• MessageBox: displays messages, warnings, or confirmations with buttons like OK/Cancel,
Yes/No.[19]
• OpenFileDialog: allows the user to browse and select a file to open.[19]
• SaveFileDialog: lets the user specify a file name and location to save data.[19]
• ColorDialog / FontDialog: used to choose colors and fonts interactively.[19]
These dialogs encapsulate standard Windows dialogs, improving usability and consistency.
b) Explain [Link] life cycle events.
An [Link] page passes through several events during its life cycle:[20]
• PreInit: set master page, themes, and dynamic controls; occurs very early.[20]
• Init / InitComplete: controls are initialized and can use view‑independent settings.[20]
• Load: page and controls are loaded with view state and postback data; typically where main
page logic executes.[20]
• Control events: events like button clicks are handled after Load.[20]
• PreRender / PreRenderComplete: last chance to modify page before rendering.[20]
• SaveStateComplete, Render: page output is generated and sent to the client.[20]
• Unload: cleanup of resources on server after response is sent.[20]
c) What is validation in [Link]? Explain any 2.
Validation in [Link] is the process of checking user input for correctness, completeness, and type
before processing it or saving it to a database.[21]
[Link] provides validation controls that run both on client and server. Two examples:
• RequiredFieldValidator: ensures the associated input control is not left empty; commonly
used for mandatory fields like username or password.[21]
• RangeValidator: checks that the value entered falls within a specified numeric, date, or string
range (for example, age between 18 and 60).[21]
d) Write a [Link] program for blinking an image.
Concept: use a PictureBox (PictureBox1) and a Timer (Timer1):
Public Class Form1
Private Sub Form1_Load(...) Handles [Link]
[Link] = 500 ' half a second
[Link]()
End Sub
Private Sub Timer1_Tick(...) Handles [Link]
[Link] = Not [Link]
End Sub
End Class
The timer toggles the Visible property of the picture box to produce a blinking effect.
e) Write a c#.Net program to sort the given array.
using System;
class SortArray
{
static void Main()
{
int[] arr = { 40, 10, 50, 20, 30 };
[Link](arr); // ascending
[Link]("Sorted array:");
foreach (int x in arr)
{
[Link](x + " ");
}
[Link]();
}
}
Here [Link] sorts the array elements in ascending order.
Q5) Write a short note on (any 2): [2 × 3 = 6]
a) Crystal Reports
Crystal Reports is a reporting tool integrated with Visual Studio .NET that allows developers to design,
generate, and view formatted reports based on various data sources (such as databases and [Link]
datasets).[22]
It provides a visual designer, formula editor, grouping, charts, and parameters to build complex
reports, and viewers for Windows and Web forms.[22]
In .NET applications, developers usually bind a ReportDocument to a CrystalReportViewer control and set
its ReportSource to display reports.[22]
b) Conductor (treated as Constructor, which fits .NET syllabus)
In .NET languages like C# and [Link], a constructor is a special method with the same name as the
class that runs automatically when an object is created.
Constructors are used to initialize fields, allocate resources, or set up default state for the object.
They can be overloaded (multiple constructors with different parameters), and if no constructor is
defined explicitly, a default parameterless constructor is supplied by the compiler.
c) Command object
In [Link], a Command object (SqlCommand, OleDbCommand, etc.) represents an SQL statement or
stored procedure that will be executed against a data source.[16][14]
It is associated with a Connection and can have parameters; key methods include ExecuteNonQuery (for
INSERT/UPDATE/DELETE), ExecuteScalar (for a single value), and ExecuteReader (for result sets).[16][14]
Command objects are central to performing CRUD operations and are often used together with
DataAdapter or DataReader to work with database data.