Saturday, October 20, 2007

.NET Assemblies

Introduction :
You must have heard the word assembly many times in .NET documentation. In this article I will share some thing about .NET assemblies
.

What is an assembly?

The assembly which is used only by a single application is called as private assembly. Suppose you created a DLL which encapsulates your business logic. This DLL will be used by your client application only and not by any other application. In order to run the application properly your DLL must reside in the same folder in which the client application is installed. Thus the assembly is private to your application.
Suppose that you are creating a general purpose DLL which provides functionality which will be used by variety of applications. Now, instead of each client application having its own copy of DLL you can place the DLL in 'global assembly cache'. Such assemblies are called as shared assemblies.


What is assembly manifest?
Assembly manifest is a data structure which stores information about an assembly
This information is stored within the assembly file (DLL/EXE) itself
The information includes version information, list of constituent files etc.

Wednesday, October 17, 2007

single link_list program in c++

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>


class list
{
struct node
{
int data;
node *link;
}*p;
public:
void inslast(int);
void insbeg(int);
void insnext(int,int);
void delelement(int);
void delbeg();
void dellast();
void disp();
int seek(int);
list(){p=NULL;}
~list();
};

void list::inslast(int x)
{
node *q,*t;
if(p==NULL)
{
p=new node;
p->data=x;
p->link=NULL;
}
else
{
q=p;
while(q->link!=NULL)
q=q->link;
t=new node;
t->data=x;
t->link=NULL;
q->link=t;
}
cout<<"Inserted successfully at the end..";
disp();
}

void list:: insbeg(int x)
{
node *q;
q=p;
p=new node;
p->data=x;
p->link=q;
cout<<"
Inserted successfully at the begining..";
disp();
}


void list::delelement(int x)
{
node *q,*r;
q=p;
if(q->data==x)
{
p=q->link;
delete q;
return;
}
r=q;
while(q!=NULL)
{
if(q->data==x)
{
r->link=q->link;
delete q;
return;
}
r=q;
q=q->link;
}
cout<<"
Element u entered "<<x<<" is not found..";
}

void list:: delbeg()
{
cout<<" The list before deletion:";
disp();
node *q;
q=p;
if(q==NULL)
{
cout<<" No data is present..";
return;
}
p=q->link;
delete q;
return;
}


void list:: dellast()
{
cout<<"
The list before deletion:";
disp();
node *q,*t;
q=p;
if(q==NULL)
{
cout<<"
There is no data in the list..";
return;
}
if(q->link==NULL)
{
p=q->link;
delete q;
return;
}

while(q->link->link!=NULL)
q=q->link;
q->link=NULL;
return;
}

list::~list()
{
node *q;
if(p==NULL) return;
while(p!=NULL)
{
q=p->link;
delete p;
p=q;
}
}

void list::disp()
{
node *q;
q=p;
if(q==NULL)
{
cout<<" No data is in the list..";
return;
}
cout<<" The items present in the list are :";
while(q!=NULL)
{
cout<<" "<<q->data;
q=q->link;
}
}

void list :: insnext(int value,int position)
{
node *temp,*temp1;
temp=p;
if(temp1==NULL)
{
temp1= new node;
temp1->data=value;
temp1->link=NULL;
p=temp1;
return;
}
for(int i=0;((i<position)&&(temp->link!=NULL)) ;i++)
{
if(i==(position-1))
{
temp1= new node;
temp1->data= value;
temp1->link=temp->link;
temp->link=temp1;
}
temp=temp->link;
}
//cout<<" Inserted successfully at the position.."<<position;
disp();
}


int list::seek(int value)
{
node *temp;
temp=p;
int position=0;
while(temp!=NULL)
{
if(temp->data==value)
return position+1;
else
{
temp=temp->link;
position=position+1;
}
}
cout<<" Element "<<value<<" not found";
return 0;
}


void main()
{
list l;
int ch,v,p,ps;
do
{
clrscr();
cout<<" Operations on List..";
cout<<"
1.Insertion
2.Deletion
3.Display
4.Seek
5.Exit";
cout<<" Enter ur choice:";
cin>>ch;

switch(ch)
{
case 1:
cout<<"1.Insertion at begining 2.Insertion at the end";
cout<<"3.Insertion after the mentioned position";
cout<<" Enter ur choice:";
cin>>ps;
cout<<" Enter the value to insert:";
cin>>v;
switch(ps)
{
case 1:
l.insbeg(v);
break;
case 2:
l.inslast(v);
break;
case 3:
cout<<" Enter the position to insert the value:";
cin>>p;
l.insnext(v,p);
break;

default:
cout<<" The choice is invalid";
return;
}
break;

case 2:
cout<<"1.Delete the first element 2.Delete the last element";
cout<<"3.Enter the element to delete from the list";
cout<<" Enter ur choice:";
cin>>ps;
switch(ps)
{
case 1:
l.delbeg();
cout<<" The list after deletion:";
l.disp();
break;
case 2:
l.dellast();
cout<<" The list after deletion:";
l.disp();
break;
case 3:
l.disp();
cout<<" Enter the element to delete : ";
cin>>v;
l.delelement(v);
cout<<" The list after deletion:";
l.disp();
break;

default:
cout<<" The option is invalid...";
break;
}
break;

case 3:
l.disp();
break;

case 4:
l.disp();
cout<<" Enter the element to search:";
cin>>v;
cout<<" The position of the element "<< v<<" is "<<l.seek(v);
getch();
break;

case 5:
exit(1);

default:
cout<<" The option is invalid...";
return;
}
getch();
}
while(ch!=5);
getch();
return;
}

C-Programes


  1. WAP to find greatest among two rnumbers using conditional operators?

  2. WAP to find area of triangle using hero’s formula?
  3. Admission to PGDCA class is suspected to following condition:
    marks in matriculation >=50%
    marks in chemistry >=40%
    marks in physics >=45%
    total in all three subjects >=180
    Scan the marks from keyboard. Write a program to display list of eligible candidates.
  4. WAP that will read value of x & evaluate the following function:
    i. y = 5 if x>0
    ii. y = 0 if x=0
    iii. y = -5 if x<0
  5. WAP to find sum of digits?
  6. WAP to check if the given number is peridrom?
  7. WAP to print fibonaci series?
  8. WAP to find factorial of any number?
  9. WAP to check if the entered number is prime or not?
  10. WAP to Print
    *
    * *
    * * *
    * * * *
    * * * * *
  11. WAP a program to swap two numbers using pointers?
  12. WAP to Print
    *
    * *
    * * *
    * * * *
    * * * * *
  13. WAP to print
    1
    2 2
    3 3 3
    4 4 4 4
    5 5 5 5 5
  14. Write a recursion function to find factorial of n?
  15. Write a recursion function to print fibonaci series up to n terms?
  16. WAP to find sum of array elements?
  17. WAP to find product of two matrix?
  18. WAP to find transpose of a matrix?
  19. Write a function to print array elements using pointers?
  20. WAP to find greatest element in 2-D array?
  21. Write a function to find length of string?
  22. Write a function to reverse a string?
  23. WAP to compare two strings
  24. Design a structure named student to store data about a student which contains following info.:
    i. Data items type
    ii. Roll.no. int
    iii. Name char[20]
    iv. Class char[10]
    v. Marks int
    Assume that there are not more than 50 students .W.a.p to input data about students &
    Output stored items?
  25. Demonstrate concepts of nested structures.Consider employee, address, contact as structur

Monday, October 15, 2007

Data Structures using C++

  1. WAP to insert an element into Linear Array at specific position.
  2. WAP to delete an element into Linear Array at specific position.
  3. WAP to delete duplicates from a linear array.
  4. WAP to search largest and smallest element in a linear array.
  5. WAP to add, subtract and multiply matrices
  6. WAP to insert a node into simple linked list at the beginning.
  7. WAP to insert a node into a simple linked list at the end of the list.
  8. WAP to search an element from linked list.
  9. WAP to delete an element from a simple linked list.
  10. WAP to insert a node into the right of node in doubly linked list.
  11. WAP to insert a node into the left most node in doubly linked list.
  12. WAP to insert an element at particular location in doubly linked list.
  13. WAP to delete a node at particular location in doubly linked list.
  14. WAP to merge two-sorted single linked list.
  15. WAP to reverse a link list.
  16. WAP to sort an unsorted single linked list
  17. WAP to implement STACK using array.
  18. WAP to implement STACK using Linked List.
  19. WAP to check Parenthesis in an arithmetic expression using STACK
  20. WAP to convert completely parenthesized expression to postfix expression.
  21. WAP to implement QUEUE using Circular Array.
  22. WAP to implement QUEUE using Single Linked List.
  23. WAP to implement Linear Search
  24. WAP to implement Binary Search
  25. WAP to implement Bubble Sort.
  26. WAP to implement Insertion Sort.
  27. WAP to impalement QUICK Sort.
  28. WAP to implement Selection sort.
  29. Implement following operations on binary search tree
    · Insert a node
    · Delete a node
    · Traverse tree using recursion
    · Search a node
  30. Implement heap sort algorithm in C++.

Sunday, October 14, 2007

C++ Programmes

  1. WAP to find greatest of three numbers using conditional operator.
  2. WAP to find greatest of three numbers using if statement only.
  3. WAP to find sum of digit.
  4. WAP to check whether a given String is palindrome or not.
  5. WAP to store/show employee information (Name, age, address) in structure.
  6. WAP to demonstrator concept of nested structure.
  7. WAP to compare two strings using user defined functions.
  8. WAP to demonstrate how we can print structure value using pointers
  9. WAP to find length of a string using user defined function
  10. WAP to compare two strings using user defined function
  11. WAP to copy a string
  12. . WAP to demonstrate use of access specifier in classes
  13. . WAP to demonstrate an array of bank acc object where acc class consist of acno, name and balance as data members
  14. . WAP to demonstrate passing of an object by value
  15. WAP to demonstrate passing of an object by address
  16. WAP to add two matrices by returning as object form a function using classes and objects
  17. WAP that calculate total number of object created.
  18. WAP to enter time in hours, minutes and seconds and display time in universal format (2:00 pm =14:00)
  19. WAP to generate fibonacci series using object.
  20. WAP to calculate distance between two points using constructors. If (x1,y1) and (x2,y2) are two points then distance between them is:
    D=√(x2-x1)2+(y2-y1)2
  21. WAP to implement basic operation of stack using class
  22. WAP to add two times and display output in proper format
  23. Write a class Box with its data members width, length and height. Initialize data members using default, parameterized and copy constructors and calculate volume of the box.
  24. WAP to overload increment operator for prefix and postfix increment on time class
  25. WAP to overload comparison operator == for strings
  26. WAP to overload >= operator for date object
  27. WAP to demonstrate operator overloading for unary operator using friend functions
  28. WAP to demonstrate operator overloading for binary operator using friend functions
    29. WAP to demonstrate concept of friend functions
    30. WAP to demonstrate friend function act as bridge between two different classes
    31. WAP to show how we can create dynamic objects
    32. WAP to create an array of dynamic object
    33. WAP to demonstrate how to declare entire class as a friend of another class
    34. WAP to demonstrate the concept of overriding
    35. WAP to demonstrate public, private and protected inheritance
    36. WAP to calculate result of students using private inheritance
    37. WAP to demonstrate multilevel and multiple inheritance
    38. WAP to demonstrate hybrid inheritance
    39. WAP to show behavior of constructor in multiple and multilevel inheritance
    40. Design an application for hospital management system. For this create the following classes and members
    Person(name, dob, sex)
    Doctor(specialization)
    Patient(Caseno, disease, doadmin, dodis, billno)
    Write functions to input data from user and display data to user
  29. Design a railway traffic control system. Where TRAIN is a Base class for PASSENGER_TRAIN and GOODS_TRAIN classes. Each class contain following members:
    TRAIN( TrainNo, Source, Destination, NoOfBogies)
    PASSENGER_TRAIN(NoOfPassengerPerBogy)
    GOODS_TRAIN(LoadingCapacityPerBogy)
    Write functions to get data from user and display to user
  30. WAP to demonstrate the behavior of parameterized constructor in multilevel inheritance
  31. WAP to demonstrate #define, #include, #if, #else, #endif, #ifdef #undef
  32. WAP to sum of two number using #define

Digital Signature

A digital signature serves the same purpose as a handwritten signature.However, a handwritten signature is easy to counterfeit. A digital signature is superior to a handwritten signature in that it is nearly impossible to counterfeit, plus it attests to the contents of the information as well as the identity of the signer.

Digital signature creation

This consists of the following stages:
The signer first creates the message that he is desirous of digitally signing.
He then uses a hash function (say SHA1) to compute the hash result (also called message digest) of the message.
He then uses his private key to digitally sign the message digest.
The signer then sends the original message and the digitally signed message digest to the receiver.

Digital signature verification

This consists of the following stages:
The receiver receives the original message and the digitally signed message digest from the sender.
The receiver computes the message digest from the original message using the same hash function as used by the sender (SHA1 in this case). He then compares the message digest computed by him to the message digest sent to him by the sender. If they are the same it implies that the message has not been altered unauthorizedly.
The receiver then verifies whether the private key of the sender was actually used to sign the message digest. He does this using the public key of the sender