QUOTE

welcome

welcome to our college social blog
we have lot of information about our college fest and events etc
all of our college members join in this site .
to add to this blog
click on follow then select google
after that log in with your gmail id
thank you
KARTHIK REDDY.

Thursday, March 22, 2012

Network Security: 30 Questions



Network Security: 30 Questions


1. What does your network/security architecture diagram look like?
The first thing you need to know to protect your network and systems is
what you are protecting. You must know:
The physical topologies
Logical topologies (Ethernet, ATM, 802.11, VoIP, etc.)
Types of operating systems
Perimeter protection measures (firewall and IDS placement, etc.)
Types of devices used (routers, switches, etc.)
Location of DMZs
IP address ranges and subnets
Use of NAT
In addition, you must know where the diagram is stored and that it is
regularly updated as changes are made.

2. What resources are located on your DMZ?
Only systems that are semi-public should be kept on the DMZ. This
includes external web servers, external mail servers, and external DNS.
A split-architecture may be used where internal web, mail, and DNS are
also located on the internal network.

3. What resources are located on your internal network?
In addition to internal web, mail, and DNS servers, your internal network
could also include databases, application servers, and test and
development servers.

4. Where is your organization’s security policy posted and what is in it?
There should be an overall policy that establishes the direction of the
organization and its security mission as well as roles and
responsibilities. There can also be system-specific policies to address
for individual systems. Most importantly, the policies should address the
appropriate use of computing resources. In addition, policies can
address a number of security controls from passwords and backups
to proprietary information. There should be clear procedures and
processes to follow for each policy. These policies should be included in
the employee handbook and posted on a readily accessible intranet site.

9. What type of remote access is allowed?
Remote access should be tightly controlled, monitored, and audited. It
should only be provided over a secure communication channel that uses
encryption and strong authentication, such as an IPSEC VPN. Desktop
modems (including applications such as PCAnywhere), unsecured
wireless access points, and other vulnerable methods of remote access
should be prohibited.

10. What is your wireless infrastructure?
Part of knowing your network architecture includes knowing the location
of wireless networks since they create another possible entry point for
an attacker. You must also confirm whether they are being used for
sensitive data and are they secured as best as possible.

11. How is your wireless infrastructure secured?
Wireless access must at least use WEP with 128-bit encryption.
Although this provides some security, it is not very robust, which is why
your wireless network should not be used for sensitive data. Consider
moving to the 802.11i standard with AES encryption when it is finalized.

12. What desktop protections are used?
Desktops should have a combination of anti-virus software, personal
firewall, and host-based intrusion detection. Each of these software
packages must be regularly updated as new signatures are deployed.
They must also be centrally managed and controlled.

13. Where, when, and what type of encryption is used?
VPNs should be used for remote access and other sensitive
communication. IPSEC is a great choice for this purpose. Strong
encryption protocols such as 3DES and AES should be used whenever
possible. Web access to sensitive or proprietary information should be
protected with 128-bit SSL. Remote system administration should use
SSH. Sometimes file system encryption is also used to protect stored
data.

14. What is your backup policy?
A good backup policy includes weekly full backups with incremental
backups performed daily. This includes all critical systems. In addition,
the backups should be stored at an offsite location. Since backups
include very valuable, easily accessible information, only trusted
individuals should be performing them and have access to them. An
organization should also encourage users to perform local backups as
well.

15. How is sensitive information disposed?
Hard copies of sensitive information should be destroyed by pulping,
shredding, or incinerating. Sensitive information on hard drives and disks
should be completely erased using special software, or the disks
destroyed. Simply deleting a file is not sufficient to prevent attackers
from undeleting the file later. If you are disposing of a computer system,
be sure to erase all sensitive files from the hard drive by using a wipeout
utility.

16. What is included in your disaster recovery plan?
Your disaster recovery plan (DRP) should include recovery of data
centers and recovery of business operations. It should also include
recovery of the accrual physical business location and recovery of the
business processes necessary to resume normal operations. In addition,
the DRP should address alternate operating sites.

17. How often is your disaster recovery plan tested?
The plan is no good unless it is tested at least once a year. These tests
will iron out problems in the plan and make it more efficient and
successful if/when it is needed. Testing can include walkthroughs,
simulation, or a full out implementation.

18. What types of attacks are you seeing?
Typically an organization sees a constant stream of port scan attacks.
These are a regular occurrence on the Internet as a result of attackers
and worms. An organization should not be seeing many substantial
attacks such as compromises, backdoors, or exploits on systems. This
would indicate that the security defenses are weak, patching may not be
occurring, or other vulnerabilities exist.

19. How often are logs reviewed?
Logs should be reviewed every day. This includes IDS logs, system
logs, management station logs, etc. Not reviewing the logs is one of the
biggest mistakes an organization can make. Events of interest should
be investigated daily. It can be a very tedious task for a single person to
do this job as their only assignment (unless they really enjoy it). It is
better to have a log review rotation system amongst the security team.

20. How often are you performing vulnerability scanning?
An organization should be performing vulnerability scanning as often as
possible, depending on the size of the network. The scanning should be
scheduled to allow adequate time to review the reports, discover
anything that has changed, and mitigate the vulnerability.

21. What physical security controls are in place in your organization?
Physical security is a large area that must be addressed by an
organization. Examples of physical controls includes physical access
controls (signs, locks, security guards, badges/PINs, bag
search/scanning, metal detectors), CCTV, motion detectors, smoke and
water detectors, and backup power generators.

22. What are your critical business systems and processes?
Identifying your critical business systems and processes is the first step
an organization should take in order to implement the appropriate
security protections. Knowing what to protect helps determine the
necessary security controls. Knowing the critical systems and processes
helps determine the business continuity plan and disaster recovery plan
process. Critical business systems and processes may include an ecommerce
site, customer database information, employee database
information, the ability to answer phone calls, the ability to respond to
Internet queries, etc.

23. What are the specific threats to your organization?
In addition to identifying the critical business systems and processes, it
is important to identify the possible threats to those systems as well as
the organization as a whole. You should consider both external and
internal threats and attacks using various entry points (wireless,
malicious code, subverting the firewall, etc.). Once again, this will assist
in implementing the appropriate security protections and creating
business continuity and disaster recovery plans.

24. What are the tolerable levels of impact your systems can have?
An organization must understand how an outage could impact the ability
to continue operations. For example, you must determine how long
systems can be down, the impact on cash flow, the impact on service
level agreements, and the key resources that must be kept running.

25. Are you performing content level inspections?
In addition to the content level inspection performed by the IDS,
specific content inspections should also be performed on web server
traffic and other application traffic. Some attacks evade detection by
containing themselves in the payload of packets, or by altering the
packet in some way, such as fragmentation. Content level inspection at
the web server or application server will protect against attacks such as
those that are tunneled in legitimate communications, attacks with
malicious data, and unauthorized application usage.

26. How often are your systems patched?
Systems should be patched every time a new patch is released. Many
organizations don’t patch regularly and tend to not patch critical systems
because they don’t want to risk downtime. However, critical systems are
the most important to patch. You must schedule regular maintenance
downtime to patch systems. As vulnerabilities are discovered, attackers
often release exploits even before system patches are available.
Therefore, it is imperative to patch systems as soon as possible.

27. How are you protecting against social engineering and phishing
attacks?
The best way to protect against social engineering and phishing attacks
is to educate the users. Employees should attend security awareness
training that explains these types of attacks, what to expect, and how to
respond. There should also be a publicly posted incidents email address
to report suspicious activity.
28. What security measures are in place for in-house developed
applications?
Any development that is taking place in house should include security
from the beginning of the development process. Security needs to be a
part of standard requirements and testing procedures. Code reviews
should be conducted by a test team to look for vulnerabilities such as
buffer overflows and backdoors. For security reasons, it is not a good
idea to subcontract development work to third parties.

29. What type of traffic are you denying at the firewall?
There should be a default deny rule on all firewalls to disallow anything
that is not explicitly permitted. This is more secure than explicitly denying
certain traffic because that can create holes and oversights on some
potentially malicious traffic.

30. How are you monitoring for Trojans and backdoors?
In addition to periodic vulnerability scanning, outgoing traffic should
be inspected before it leaves the network, looking for potentially
compromised systems. Organizations often focus on traffic and
attacks coming into the network and forget about monitoring
outgoing traffic. Not only will this detect compromised systems with
Trojans and backdoors, but it will also detect potentially malicious
or inappropriate insider activity.























Advanced Data Strctures:

1. What is data structure?
A data structure is a way of organizing data that considers not only the items stored, but also their relationship to each other. Advance knowledge about the relationship between data items allows designing of efficient algorithms for the manipulation of data.
2. List out the areas in which data structures are applied extensively?
  1. Compiler Design,
  2. Operating System,
  3. Database Management System,
  4. Statistical analysis package,
  5. Numerical Analysis,
  6. Graphics,
  7. Artificial Intelligence,
  8. Simulation
3. What are the major data structures used in the following areas : RDBMS, Network data model and Hierarchical data model.
  1. RDBMS = Array (i.e. Array of structures)
  2. Network data model = Graph
  3. Hierarchical data model = Trees
4. If you are using C language to implement the heterogeneous linked list, what pointer type will you use?
The heterogeneous linked list contains different data types in its nodes and we need a link, pointer to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is capable of storing pointer to any type as it is a generic pointer type.
5. Minimum number of queues needed to implement the priority queue?
Two. One queue is used for actual storing of data and another for storing priorities.
6. What is the data structures used to perform recursion?
Stack. Because of its LIFO (Last In First Out) property it remembers its 'caller' so knows whom to return when the function has to return. Recursion makes use of system stack for storing the return addresses of the function calls.
Every recursive function has its equivalent iterative (non-recursive) function. Even when such equivalent iterative procedures are written, explicit stack is to be used.
7. What are the notations used in Evaluation of Arithmetic Expressions using prefix and postfix forms?
Polish and Reverse Polish notations.
8. Convert the expression ((A + B) * C - (D - E) ^ (F + G)) to equivalent Prefix and Postfix notations.
  1. Prefix Notation: - * +ABC ^ - DE + FG
  2. Postfix Notation: AB + C * DE - FG + ^ -
9. Sorting is not possible by using which of the following methods? (Insertion, Selection, Exchange, Deletion)
Sorting is not possible in Deletion. Using insertion we can perform insertion sort, using selection we can perform selection sort, using exchange we can perform the bubble sort (and other similar sorting methods). But no sorting method can be done just using deletion.
10. What are the methods available in storing sequential files ?
  1. Straight merging,
  2. Natural merging,
  3. Polyphase sort,
  4. Distribution of Initial runs.
5.      11. List out few of the Application of tree data-structure?
  1. The manipulation of Arithmetic expression,
  2. Symbol Table construction,
  3. Syntax analysis.
9.      12. List out few of the applications that make use of Multilinked Structures?
  1. Sparse matrix,
11.Index generation.
11.  In tree construction which is the suitable efficient data structure? (Array, Linked list, Stack, Queue)
Linked list is the suitable efficient data structure.
12.  What is the type of the algorithm used in solving the 8 Queens problem?
Backtracking.
13.  In an AVL tree, at what condition the balancing is to be done?
If the 'pivotal value' (or the 'Height factor') is greater than 1 or less than -1.
16. What is the bucket size, when the overlapping and collision occur at same time?
One. If there is only one entry possible in the bucket, when the collision occurs, there is no way to accommodate the colliding value. This results in the overlapping of values.
17. Classify the Hashing Functions based on the various methods by which thekey value is found.
Direct method,
Subtraction method,
Modulo-Division method,
Digit-Extraction method,
Mid-Square method,
Folding method,
Pseudo-random method.
18. What are the types of Collision Resolution Techniques and the methods used in each of the type?
Open addressing (closed hashing), The methods used include: Overflow block.
Closed addressing (open hashing), The methods used include: Linked list, Binary tree.
19. In RDBMS, what is the efficient data structure used in the internal storage representation?
B+ tree. Because in B+ tree, all the data is stored only in leaf nodes, that makes searching easier. This corresponds to the records that shall be stored in leaf nodes.
20. What is a spanning Tree?
A spanning tree is a tree associated with a network. All the nodes of the graph appear on the tree once. A minimum spanning tree is a spanning tree organized so that the total edge weight between nodes is minimized.
21. Does the minimum spanning tree of a graph give the shortest distance between any 2 specified nodes?
No. The Minimal spanning tree assures that the total weight of the tree is kept at its minimum. But it doesn't mean that the distance between any two nodes involved in the minimum-spanning tree is minimum.
22. Which is the simplest file structure? (Sequential, Indexed, Random)
Sequential is the simplest file structure.
23. Whether Linked List is linear or Non-linear data structure?
According to Access strategies Linked list is a linear one.
According to Storage Linked List is a Non-linear one.

14.  How do you find out if a linked-list has an end? (i.e. the list is not a cycle)

You can find out by using 2 pointers. One of them goes 2 nodes each time. The second one goes at 1 nodes each time. If there is a cycle, the one that goes 2 nodes each time will eventually meet the one that goes slower. If that is the case, then you will know the linked-list is a cycle.
15.  What is the difference between realloc() and free()?

The free subroutine frees a block of memory previously allocated by the malloc subroutine. Undefined results occur if the Pointer parameter is not a valid pointer. If the Pointer parameter is a null value, no action will occur. The realloc subroutine changes the size of the block of memory pointed to by the Pointer parameter to the number of bytes specified by the Size parameter and returns a new pointer to the block. The pointer specified by the Pointer parameter must have been created with the malloc, calloc, or realloc subroutines and not been deallocated with the free or realloc subroutines. Undefined results occur if the Pointer parameter is not a valid pointer.
16.  What is function overloading and operator overloading?
Function overloading: C++ enables several functions of the same name to be defined, as long as these functions have different sets of parameters (at least as far as their types are concerned). This capability is called function overloading. When an overloaded function is called, the C++ compiler selects the proper function by examining the number, types and order of the arguments in the call. Function overloading is commonly used to create several functions of the same name that perform similar tasks but on different data types.
Operator overloading allows existing C++ operators to be redefined so that they work on objects of user-defined classes. Overloaded operators are syntactic sugar for equivalent function calls. They form a pleasant facade that doesn't add anything fundamental to the language (but they can improve understandability and reduce maintenance costs).
17.  What is the difference between declaration and definition?

The declaration tells the compiler that at some later point we plan to present the definition of this declaration.
E.g.: void stars () //function declaration
The definition contains the actual implementation.
E.g.: void stars () // declarator
{
for(int j=10; j > =0; j--) //function body
cout << *;
cout << endl; }
18.  What are the advantages of inheritance?

It permits code reusability. Reusability saves time in program development. It encourages the reuse of proven and debugged high-quality software, thus reducing problem after a system becomes functional.
19.  How do you write a function that can reverse a linked-list?

void reverselist(void)
{
if(head==0)
return;
if(head->next==0)
return;
if(head->next==tail)
{
head->next = 0;
tail->next = head;
}
else
{
node* pre = head;
node* cur = head->next;
node* curnext = cur->next;
head->next = 0;
cur-> next = head;

for(; curnext!=0; )
{
cur->next = pre;
pre = cur;
cur = curnext;
curnext = curnext->next;
}

curnext->next = cur;
}
}
20.  What do you mean by inline function?
The idea behind inline functions is to insert the code of a called function at the point where the function is called. If done carefully, this can improve the application's performance in exchange for increased compile time and possibly (but not always) an increase in the size of the generated binary executables.
21.  Write a program that ask for user input from 5 to 9 then calculate the average
#include "iostream.h"
int main() {
int MAX = 4;
int total = 0;
int average;
int numb;
for (int i=0; i<MAX; i++) {
cout << "Please enter your input between 5 and 9: ";
cin >> numb;
while ( numb<5 || numb>9) {
cout << "Invalid input, please re-enter: ";
cin >> numb;
}
total = total + numb;
}
average = total/MAX;
cout << "The average number is: " << average << "\n";
return 0;
}
22.  Write a short code using C++ to print out all odd number from 1 to 100 using a for loop
for( unsigned int i = 1; i < = 100; i++ )
if( i & 0x00000001 )
cout << i << \",\"; 
23.  What is public, protected, private?
Public, protected and private are three access specifier in C++.
Public data members and member functions are accessible outside the class.
Protected data members and member functions are only available to derived classes.
Private data members and member functions can’t be accessed outside the class. However there is an exception can be using friend classes.
Write a function that swaps the values of two integers, using int* as the argument type.
void swap(int* a, int*b) {
int t;
t = *a;
*a = *b;
*b = t;
}
24.  Tell how to check whether a linked list is circular.
Create two pointers, each set to the start of the list. Update each as follows:
while (pointer1) {
pointer1 = pointer1->next;
pointer2 = pointer2->next; if (pointer2) pointer2=pointer2->next;
if (pointer1 == pointer2) {
print (\"circular\n\");
}
}
25.  OK, why does this work?
If a list is circular, at some point pointer2 will wrap around and be either at the item just before pointer1, or the item before that. Either way, it’s either 1 or 2 jumps until they meet.
26.  What is virtual constructors/destructors?
Answer1
Virtual destructors:
If an object (with a non-virtual destructor) is destroyed explicitly by applying the delete operator to a base-class pointer to the object, the base-class destructor function (matching the pointer type) is called on the object.
There is a simple solution to this problem declare a virtual base-class destructor.
This makes all derived-class destructors virtual even though they don’t have the same name as the base-class destructor. Now, if the object in the hierarchy is destroyed explicitly by applying the delete operator to a base-class pointer to a derived-class object, the destructor for the appropriate class is called. Virtual constructor: Constructors cannot be virtual. Declaring a constructor as a virtual function is a syntax error.

Answer2
Virtual destructors: If an object (with a non-virtual destructor) is destroyed explicitly by applying the delete operator to a base-class pointer to the object, the base-class destructor function (matching the pointer type) is called on the object.
There is a simple solution to this problem – declare a virtual base-class destructor. This makes all derived-class destructors virtual even though they don’t have the same name as the base-class destructor. Now, if the object in the hierarchy is destroyed explicitly by applying the delete operator to a base-class pointer to a derived-class object, the destructor for the appropriate class is called.
27.  Virtual constructor: Constructors cannot be virtual. Declaring a constructor as a virtual function is a syntax error. Does c++ support multilevel and multiple inheritance?
Yes.
28.  What are the advantages of inheritance?
• It permits code reusability.
• Reusability saves time in program development.
• It encourages the reuse of proven and debugged high-quality software, thus reducing problem after a system becomes functional.
29.  What is the difference between declaration and definition?
The declaration tells the compiler that at some later point we plan to present the definition of this declaration.
E.g.: void stars () //function declaration
The definition contains the actual implementation.
E.g.: void stars () // declarator
{
for(int j=10; j>=0; j--) //function body
cout<<”*”;
cout<<endl; }
30.  What is the difference between Mutex and Binary semaphore?
semaphore is used to synchronize processes. where as mutex is used to provide synchronization between threads running in the same process. 
31.  In C++, what is the difference between method overloading and method overriding?
Overloading a method (or function) in C++ is the ability for functions of the same name to be defined as long as these methods have different signatures (different set of parameters). Method overriding is the ability of the inherited class rewriting the virtual method of the base class.
32.  What methods can be overridden in Java?
In C++ terminology, all public methods in Java are virtual. Therefore, all Java methods can be overwritten in subclasses except those that are declared final, static, and private.
33.  What are the defining traits of an object-oriented language?
The defining traits of an object-oriented langauge are:
* encapsulation
* inheritance
* polymorphism
34.  Write a program that ask for user input from 5 to 9 then calculate the average
int main()
{
int MAX=4;
int total =0;
int average=0;
int numb;
cout<<"Please enter your input from 5 to 9";
cin>>numb;
if((numb <5)&&(numb>9))
cout<<"please re type your input";
else
for(i=0;i<=MAX; i++)
{
total = total + numb;
average= total /MAX;
}
cout<<"The average number is"<<average<<endl;

return 0;
}
35.  Assignment Operator - What is the diffrence between a "assignment operator" and a "copy constructor"?
Answer1.
In assignment operator, you are assigning a value to an existing object. But in copy constructor, you are creating a new object and then assigning a value to that object. For example:
complex c1,c2;
c1=c2; //this is assignment
complex c3=c2; //copy constructor

Answer2.
A copy constructor is used to initialize a newly declared variable from an existing variable. This makes a deep copy like assignment, but it is somewhat simpler:

There is no need to test to see if it is being initialized from itself.
There is no need to clean up (eg, delete) an existing value (there is none).
A reference to itself is not returned.
36.  RTTI - What is RTTI?
Answer1.
RTTI stands for "Run Time Type Identification". In an inheritance hierarchy, we can find out the exact type of the objet of which it is member. It can be done by using:

1) dynamic id operator
2) typecast operator

Answer2.
RTTI is defined as follows: Run Time Type Information, a facility that allows an object to be queried at runtime to determine its type. One of the fundamental principles of object technology is polymorphism, which is the ability of an object to dynamically change at runtime.
37.  STL Containers - What are the types of STL containers?
There are 3 types of STL containers:

1. Adaptive containers like queue, stack
2. Associative containers like set, map
3. Sequence containers like vector, deque
38.  What is the need for a Virtual Destructor ?
Destructors are declared as virtual because if do not declare it as virtual the base class destructor will be called before the derived class destructor and that will lead to memory leak because derived class’s objects will not get freed.Destructors are declared virtual so as to bind objects to the methods at runtime so that appropriate destructor is called.
39.  What’s the output of the following program? Why?
#include <stdio.h>
main()
{
typedef union
{
int a;
char b[10];
float c;
}
Union;

Union x,y = {100};
x.a = 50;
strcpy(x.b,\"hello\");
x.c = 21.50;

printf(\"Union x : %d %s %f \n\",x.a,x.b,x.c );
printf(\"Union y :%d %s%f \n\",y.a,y.b,y.c);
}

Given inputs X, Y, Z and operations | and & (meaning bitwise OR and AND, respectively)
What is output equal to in
output = (X & Y) | (X & Z) | (Y & Z)
40.  Why are arrays usually processed with for loop?
The real power of arrays comes from their facility of using an index variable to traverse the array, accessing each element with the same expression a[i]. All the is needed to make this work is a iterated statement in which the variable i serves as a counter, incrementing from 0 to a.length -1. That is exactly what a loop does.
41.  What is an HTML tag?
Answer: An HTML tag is a syntactical construct in the HTML language that abbreviates specific instructions to be executed when the HTML script is loaded into a Web browser. It is like a method in Java, a function in C++, a procedure in Pascal, or a subroutine in FORTRAN.
42.  Explain which of the following declarations will compile and what will be constant - a pointer or the value pointed at: * const char *
* char const *
* char * const


Note: Ask the candidate whether the first declaration is pointing to a string or a single character. Both explanations are correct, but if he says that it’s a single character pointer, ask why a whole string is initialized as char* in C++. If he says this is a string declaration, ask him to declare a pointer to a single character. Competent candidates should not have problems pointing out why const char* can be both a character and a string declaration, incompetent ones will come up with invalid reasons.
43.  You’re given a simple code for the class Bank Customer. Write the following functions:
* Copy constructor
* = operator overload
* == operator overload
* + operator overload (customers’ balances should be added up, as an example of joint account between husband and wife)


Note:Anyone confusing assignment and equality operators should be dismissed from the interview. The applicant might make a mistake of passing by value, not by reference. The candidate might also want to return a pointer, not a new object, from the addition operator. Slightly hint that you’d like the value to be changed outside the function, too, in the first case. Ask him whether the statement customer3 = customer1 + customer2 would work in the second case.
44.  What problems might the following macro bring to the application?
#define sq(x) x*x
45.  Anything wrong with this code?
T *p = new T[10];
delete p;

Everything is correct, Only the first element of the array will be deleted”, The entire array will be deleted, but only the first element destructor will be called.
46.  Anything wrong with this code?
T *p = 0;
delete p;


Yes, the program will crash in an attempt to delete a null pointer.
47.  How do you decide which integer type to use?
It depends on our requirement. When we are required an integer to be stored in 1 byte (means less than or equal to 255) we use short int, for 2 bytes we use int, for 8 bytes we use long int.

A char is for 1-byte integers, a short is for 2-byte integers, an int is generally a 2-byte or 4-byte integer (though not necessarily), a long is a 4-byte integer, and a long long is a 8-byte integer.
48.  What does extern mean in a function declaration?
Using extern in a function declaration we can make a function such that it can used outside the file in which it is defined.

An extern variable, function definition, or declaration also makes the described variable or function usable by the succeeding part of the current source file. This declaration does not replace the definition. The declaration is used to describe the variable that is externally defined.

If a declaration for an identifier already exists at file scope, any extern declaration of the same identifier found within a block refers to that same object. If no other declaration for the identifier exists at file scope, the identifier has external linkage.
49.  What can I safely assume about the initial values of variables which are not explicitly initialized?
It depends on complier which may assign any garbage value to a variable if it is not initialized.
50.  What is the difference between char a[] = “string”; and char *p = “string”;?
In the first case 6 bytes are allocated to the variable a which is fixed, where as in the second case if *p is assigned to some other value the allocate memory can change.
51.  What’s the auto keyword good for?
Answer1
Not much. It declares an object with automatic storage duration. Which means the object will be destroyed at the end of the objects scope. All variables in functions that are not declared as static and not dynamically allocated have automatic storage duration by default.

For example
int main()
{
int a; //this is the same as writing “auto int a;”
}

Answer2
Local variables occur within a scope; they are “local” to a function. They are often called automatic variables because they automatically come into being when the scope is entered and automatically go away when the scope closes. The keyword auto makes this explicit, but local variables default to auto auto auto auto so it is never necessary to declare something as an auto auto auto auto.
52.  What is the difference between char a[] = “string”; and char *p = “string”; ?
Answer1
a[] = “string”;
char *p = “string”;

The difference is this:
p is pointing to a constant string, you can never safely say
p[3]=’x';
however you can always say a[3]=’x';

char a[]=”string”; - character array initialization.
char *p=”string” ; - non-const pointer to a const-string.( this is permitted only in the case of char pointer in C++ to preserve backward compatibility with C.)

Answer2
a[] = “string”;
char *p = “string”;

a[] will have 7 bytes. However, p is only 4 bytes. P is pointing to an adress is either BSS or the data section (depending on which compiler — GNU for the former and CC for the latter).

Answer3
char a[] = “string”;
char *p = “string”;

for char a[]…….using the array notation 7 bytes of storage in the static memory block are taken up, one for each character and one for the terminating nul character.

But, in the pointer notation char *p………….the same 7 bytes required, plus N bytes to store the pointer variable “p” (where N depends on the system but is usually a minimum of 2 bytes and can be 4 or more)……
53.  How do I declare an array of N pointers to functions returning pointers to functions returning pointers to characters?
Answer1
If you want the code to be even slightly readable, you will use typedefs.
typedef char* (*functiontype_one)(void);
typedef functiontype_one (*functiontype_two)(void);
functiontype_two myarray[N]; //assuming N is a const integral

Answer2
char* (* (*a[N])())()
Here a is that array. And according to question no function will not take any parameter value.
54.  What does extern mean in a function declaration?
It tells the compiler that a variable or a function exists, even if the compiler hasn’t yet seen it in the file currently being compiled. This variable or function may be defined in another file or further down in the current file.
55.  Describe PRIVATE, PROTECTED and PUBLIC – the differences and give examples.
class Point2D{
int x; int y;

public int color;
protected bool pinned;
public Point2D() : x(0) , y(0) {} //default (no argument) constructor
};

Point2D MyPoint;

You cannot directly access private data members when they are declared (implicitly) private:

MyPoint.x = 5; // Compiler will issue a compile ERROR
//Nor yoy can see them:
int x_dim = MyPoint.x; // Compiler will issue a compile ERROR

On the other hand, you can assign and read the public data members:

MyPoint.color = 255; // no problem
int col = MyPoint.color; // no problem

With protected data members you can read them but not write them: MyPoint.pinned = true; // Compiler will issue a compile ERROR

bool isPinned = MyPoint.pinned; // no problem
56.  What is namespace?
Namespaces allow us to group a set of global classes, objects and/or functions under a name. To say it somehow, they serve to split the global scope in sub-scopes known as namespaces.
The form to use namespaces is:
namespace identifier { namespace-body }
Where identifier is any valid identifier and namespace-body is the set of classes, objects and functions that are included within the namespace. For example:
namespace general { int a, b; } In this case, a and b are normal variables integrated within the general namespace. In order to access to these variables from outside the namespace we have to use the scope operator ::. For example, to access the previous variables we would have to put:
general::a general::b
The functionality of namespaces is specially useful in case that there is a possibility that a global object or function can have the same name than another one, causing a redefinition error.
57.  What is a COPY CONSTRUCTOR and when is it called?
A copy constructor is a method that accepts an object of the same class and copies it’s data members to the object on the left part of assignement:

class Point2D{
int x; int y;

public int color;
protected bool pinned;
public Point2D() : x(0) , y(0) {} //default (no argument) constructor
public Point2D( const Point2D & ) ;
};

Point2D::Point2D( const Point2D & p )
{
this->x = p.x;
this->y = p.y;
this->color = p.color;
this->pinned = p.pinned;
}

main(){
Point2D MyPoint;
MyPoint.color = 345;
Point2D AnotherPoint = Point2D( MyPoint ); // now AnotherPoint has color = 345
58.  What is Boyce Codd Normal form?
A relation schema R is in BCNF with respect to a set F of functional dependencies if for all functional dependencies in F+ of the form a-> , where a and b is a subset of R, at least one of the following holds:
* a- > b is a trivial functional dependency (b is a subset of a)
* a is a superkey for schema R
59.  What is virtual class and friend class?
Friend classes are used when two or more classes are designed to work together and need access to each other's implementation in ways that the rest of the world shouldn't be allowed to have. In other words, they help keep private things private. For instance, it may be desirable for class DatabaseCursor to have more privilege to the internals of class Database than main() has.
60.  What is the word you will use when defining a function in base class to allow this function to be a polimorphic function?
virtual 
61.  What do you mean by binding of data and functions?
Encapsulation.




DBMS:

1.What is a Database?
Ans: A database is a collection of related data .A database is a logically coherent
collection of data with some inherent meaning.

2. What is DBMS?
Ans: Database Management system is a collection of programs that enables user to create and maintain a database.
Thus a DBMS is a general purposed s/w system that facilitates the process of defining constructing and manipulating a database for various applications. (Defining a data base involves specifying the data types, structures and constraints for the data to be stored in the data database.
Constructing a data base is the process of storing data itself on some storage medium that is controlled by DBMS. Manipulating a database includes such functions as querying the data base to retrieve specific data, updating the database to reflect the changes in the mini-world.

3. What is a Catalog?
Ans: A catalog is a table that contain the information such as structure of each file ,
the type and storage format of each data item and various constraints on the data .
The information stored in the catalog is called Metadata . Whenever a request is
made to access a particular data, the DBMS s/w refers to the catalog to determine
the structure of the file.

4. What is data ware housing & OLAP?
Ans: Data warehousing and OLAP (online analytical processing ) systems are the
techniques used in many companies to extract and analyze useful information
from very large databases for decision making .

5. What is real time database technology?
Ans: These are all the techniques used in controlling industrial and manufacturing
processes.

6. What is program-data independence?
Ans: Unlike in the traditional file sys. the structure of the data files is stored in the
DBMS catalog separately from the access programs . This property is called
program-data independence.i.e. We needn’t to change the code of the DBMS if the
structure of the data is changed .Which is not supported by traditional file sys .

7. What is ORDBMS?
Ans: Object oriented RDBMS is a relational DBMS in which every thing is treated as
objects. User can define operations on data as a part of the database definition.

8. What is program-operation independence?
Ans: An operation is specified in two parts .
1. Interface (operation name and data types of its arguments).
2. Implementation (the code part)
The implementation part can be changed without affecting the interface. This is called
program-operation independence.

9. What is a view?
Ans: A view may be a subset of the database or it may contain virtual data that is
derived from the database files but is not explicitly stored .

10. What is OLTP?
Ans: Online transaction processing is an application that involve multiple database accesses
from different parts of the world . OLTP needs a multi-user DBMS s/w to ensure that concurrent
transactions operate correctly.

11. What is the job of DBA?
Ans: A database administrator is a person or a group responsible for authorizing access to the
database, for coordinating and monitoring its use, and for acquiring s/w and h/w resources as needed.

12. Who are db designer?
Ans: Data base designers are responsible for identifying the data to be stored in the database and for
choosing appropriate structure to represent and store this data .

13. What are different types of end users?
Ans:
1. Casual end-users
2. Naive or parametric end users
3. Sophisticated end users
4. Stand alone users.

14. What are the advantages of using a dbms?
Ans:
1. Controlling redundancy.
2. Restricting unauthorized access.
3. Providing persistent storage for program objects and data structures.
4. Permitting inferencing and actions using rules.
5. Providing multi-user interfaces.
6. Representing complex relationships among data.
7. Enforcing integrity constraints.
8. Providing backups and recovery.

15. What are the disadvantages of using a dbms?
Ans:
1. High initial investments in h/w, s/w, and training.
2. Generality that a DBMS provides for defining and processing data.
3. Overhead for providing security, concurrency control, recovery, and integrity functions.

16. What is a data model?
Ans: It is a collection of concepts that can be used to describe the structure of a database. It provides necessary means to achieve this abstraction. By structure of a database we mean the data types, relations, and constraints that should hold on the data.

17. What are different categories of data models?
Ans:
1. High-level or conceptual data models.
2. Representational data models.
3. Low-level or physical data models.
High level data models provide the concepts that are close to the way many users perceive data.
Representational data models are provide concepts that provide the concepts that may be understood by end users but that are not too far removed from organization of data in the database.
Physical data models describe the details of how data is stored in the computers.

18. What is schema?
Ans: The description of a data base is called the database schema , which is specified during database design and is not expected to change frequently . A displayed schema is called schema diagram .We call each object in the schema as schema construct.

19. What are types of schema?
Ans:
1. internal schema.
2. Conceptual schema.
3. External schemas or user views.

20. What is Data independency?
Ans: Data independency is defined as the capacity to change the conceptual schema without having to change the schema at the next higher level. We can define two types of data independence:
1. Logical data independence.
2. Physical data independence.
LDI is the capacity to change the conceptual schema without having to change external schemas or application programs.
PDI is the capacity to change the internal schema without having to change conceptual (or external) schemas.

21. What are different DBMS languages?
Ans:
1. DDL (Data definition language)
2. SDL (Storage definition language)
3. VDL (View definition language)
4. DML (Data manipulation language)

22. What are different types of DBMS?
Ans:
1. DBMS
2. RDBMS (Relational)
3. ORDBMS (Object Relational)
4. DDBMS (Distributed)
5. FDBMS (Federated)
6. HDDBMS (Homogeneous)
7. HDBMS (Hierarchical)
8. NDBMS (Networked)

23. What is an entity?
Ans: An entity is a thing in the real world with an independent existence.

24. What are attributes?
Ans: These are the particular properties that describe an entity.

25. What are diff. types of attributes?
Ans:
1. Composite Vs simple attributes.
2. Single valued Vs multi-valued attributes.
3. Stored Vs derived attribute.
4. Null valued attributes.
5. Complex attributes.

26. What is difference between entity set and entity type?
27. What is domain value or value set of an attribute?
Ans: It is the set of values that may be assigned to that attribute for each individual entities .

28. What is degree of a relationship?
Ans: The no of entities participating in that relation .

29. What is recursive relationship?
Ans: It is the relationship where both the participating entities belong to same entity type .

30. What are relationship constraints?
Ans:
1. Cardinality ratio.
2. Participation constraints.
31. What is Cardinality ratio?
Ans: The cardinality ratio for a binary relationship specifies the number of relationship instances that an entity can participate in.

32. What is a Participation constraint?
Ans: The participation constraint specifies whether the existence of an entity depends on its being related to another entity via the relationship type. This is of two types:
1. Total participation.
2. Partial participation.

33. What is a weak entity types?
Ans: The entity types that do not have key attributes of their own are called weak entity types.
Rests are called strong entity types .The entity that gives identity to a weak entity is called owner entity. And the relationship is called identifying relationship. A weak entity type always has a total participation constraint with respect to its identifying relationship.

34. What is an ER Diagram?
Ans:
This data model is based on real world that consists of basic objects called entities and of relationship among these objects. Entities are described in a database by a set of attributes.

35. What is an EER?
Ans:
==

36. What is specialization?
Ans: It is the process of defining a set of subclasses of an entity type where each subclass contain all the attributes and relationships of the parent entity and may have additional attributes and relationships which are specific to itself.

37. What is generalization?
Ans: It is the process of finding common attributes and relations of a number of entities and defining a common super class for them.

38. What are constraints on generalization and specialization?
Ans:
1. disjoint ness constraints.
2. Completeness constraints.
Disjointness constraint specifies that the subclasses of the specialization must be disjoint .i.e. an entity can be a member of at most one of the subclasses of the specialization. The reverse of it is overlapping.
Completeness constraint is a participation constraint which may be
1. Total
2. Partial
Total specialization constraint tells that each entity in the super class must be a member of some subclass in the specialization. And partial specialization constraint allows an entity not to belong to any of the subclasses .Thus we do have the following 4 types of constraints on specialization:
1. Disjoint, total
2. Disjoint, partial
3. Overlapping, total
4. Overlapping, partial

39. What is a ternary relationship?
Ans: A relationship with a degree 3 is called a ternary relationship.

40. What is aggregation and association?
Ans: Aggregation is an abstraction concept for building composite objects from their component objects. The abstraction of association is used to associate objects from several independent classes.

41. What is RAID Technology?
Ans: Redundant array of inexpensive (or independent) disks. The main goal of raid technology is to even out the widely different rates of performance improvement of disks against those in memory and microprocessor. Raid technology employs the technique of data striping to achieve higher transfer rates.

42. What is Hashing technique?
Ans: This is a primary file organization technique that provides very fast access to records on certain search conditions. The search condition must be an equality condition on a single field, called hash field of the file.
1. Internal hashing
2. External hashing
3. Extendible hashing
4. Linear hashing
5. Partitioned hashing

43. What are different types of relational constraints?
Ans:
1. Domain constraints
2. Key constraints
3. Entity integrity constraints
4. Referential integrity constraints
Domain constraints specify that the value of each attribute must be an atomic value from the domain of the attributes.
Key constraints tell that no two tuples can have the same combination of values for all their attributes.
Entity integrity constraint states that no primary key value can be null.
Referential integrity constraints states that a tuple in one relation that refers to another relation must refer to an existing tuple in that relation it is specified between two relations and is used to maintain the consistency among tuples of the two relations.

44. What is difference between a super key, a key, a candidate key and a primary key?
Ans: A super key specifies a uniqueness constrain that no two distinct tuples in a state
can have the same value for the super key. Every relation has at least one default super key.
A key is a minimal super key or the subset of the super key which is obtained after
removing redundancy. A relation schema may have more than one key .In this case
each key is called a candidate key. One of the candidate key with minimum number
of attributes is chosen as primary key.

45. What is a foreign key?
Ans: A key of a relation schema is called as a foreign key if it is the primary key of
some other relation to which it is related to.

46. What is a transaction?
Ans: A transaction is a logical unit of database processing that includes one or more
database access operations.

47. What are the properties of transaction?
Ans:
1. Atomicity
2. Consistency preservation
3. Isolation
4. Durability (permanence)

48. What are the basic data base operations?
Ans:
1. Write_item(x)
2. Read_item(x)

49. What are the disadvantages of not controlling concurrency?
Ans:
1. Lost update problem
2. Temporary update(Dirty read) problem
3. Incorrect summary problem

50. What are serial, non serial?
Ans: A schedule S is serial if, for every transaction T participating in the schedule, all the operations of T is executed consecutively in the schedule, otherwise, the schedule is called non-serial schedule.

51. What are conflict serializable schedules?
Ans: A schedule S of n transactions is serializable if it is equivalent to some serial schedule of the same n transactions.

52. What is result equivalent?
Ans: Two schedules are called result equivalent if they produce the same final state of the data base.

53. What are conflict equivalent schedules?
Ans: Two schedules are said to be conflict equivalent if the order of any two conflicting operations is the same in both schedules.

54. What is a conflict serializable schedule?
Ans: A schedule is called conflict serializable if it is conflict equivalent to some serial schedule.

55. What is view equivalence?
Ans: Two schedules S and S’ are said to be view equivalent if the following three conditions hold :
1. Both S and S’ contain same set of transactions with same operations in them.
2. If any read operation read(x) reads a value written by a write operation or the original value of x the same conditions must hold in the other schedule for the same read(x) operation.
3. If an operation write1(y) is the last operation to write the value of y in schedule S then the same operation must be the last operation in schedule S’.

56. What is view serializable?
Ans: A schedule is said to be view serializable if it is view equivalent with some serial schedule.

57. What are the various methods of controlling concurrency?
Ans:
1. Locking
2. Time stamp
Locking data item to prevent multiple transactions from accessing the item concurrently.
A time stamp is a unique identifier for each transaction, generated by the system.

58. What is a lock?
Ans: A lock is a variable associated with a data item that describes the status of the item with respect to the possible operations that can be applied to it.

59. What are various types of locking techniques?
Ans:
1. a binary lock
2. Shared/Exclusive lock
3. Two phase locking

60. What is a binary lock?
Ans: A binary lock can have two states or values:
1. locked (1)
2. unlocked(0)
If locked it cannot be accessed by any other operations, else can be.

61. What is shared or exclusive lock?
Ans: It implements multiple-mode lock. Allowing multiple accesses for read operations but exclusive access for write operation.

62. Explain two phase locking?
Ans: All the locking operations must precede the first unlock operation in the transaction .It does have two phases:
1. expanding phase (Locks are issued)
2. Shrinking phase (Locks are released)

63. What are different types of two phase lockings (2pl)?
Ans:
1. Basic
2. Conservative
3. Strict
4. Rigorous
this is the basic technique of 2pl described above.
Conservative 2pl requires a transaction to lock all the items it accesses before the transaction begins its execution, by pre-declaring it’s read-set and write-set.
Strict 2pl guarantees that a transaction doesn’t release any of its exclusive locks until after it commits or aborts.
Rigorous guarantees that a transaction doesn’t release any of its locks (including shared locks) until after it commits or aborts.

64. What is a deadlock?
Ans: Dead lock occurs when each transaction T in a set of two or more transactions is waiting for some item that is locked by some other transaction T’ in the set. Hence each transaction is in a waiting queue, waiting for one of the other transactions to release the lock on them.

65. What are triggers?
Ans: Triggers are the PL/SQL blocks definining an action the database should take when some database related event occurs. Triggers may be used to supplement declarative referential integrity, to enforce complex business rules, or to audit changes to data
.

UML:

1.      hat is UML?
Answer - UML is Unified Modeling Language. .....
2.      Define modeling in UML and it advantages.
Answer - Model is a simplification of reality, blueprint of the actual system.....
3.      What are the different views in UML?
Answer - Use Case view - Presents the requirements of a system......
4.      Define SDLC
Answer - SDLC of a system included processes like Use case driven, Architecture centric, Iterative and Incremental......
5.      Explain the types of diagrams in UML.
Answer - We have nine types of diagram in UML.....
6.      What are the advantages of using UML?
Answer - UML breaks the complex system into discrete pieces that can be understood easily......
7.      Building blocks of UML.
Things
Relationship
Diagram
8.      Relationship in the UML
Dependancy
Association
Generalization
Realisation
9.      Diagrams in the UML
Class Diagram
Object Diagram
Use case Diagram
Sequence Diagram
Collaboration Diagram
State Chart Diagram
Activity Diagram
Componant Diagram
Deployment Diagram
10.  QUESTION - What are the three types of modeling in UML?
ANSWER -
Structural, behavioral, and architectural.
11.  QUESTION - What is Architecture?
ANSWER -
Takes care structural and behavioral aspect of a software system.
Includes software usage, functionality, performance, reuse, economic and technology constraints.
12.  QUESTION - What are Messages?
ANSWER -
Specification of a communication.
  1.  What is modeling? What are the advantages of creating a model? Modeling is a proven and well-accepted engineering technique which helps build a model. Model is a simplification of reality; it is a blueprint of the actual system that needs to be built. Model helps to visualize the system. Model helps to specify the structural and behavior of the system. Model helps make templates for constructing the system. Model helps document the system.
  2.  What are the different views that are considered when building an object-oriented software system? Normally there are 5 views. Use Case view - This view exposes the requirements of a system. Design View - Capturing the vocabulary. Process View - modeling the distribution of the systems processes and threads. Implementation view - addressing the physical implementation of the system. Deployment view - focus on the modeling the components required for deploying the system.
  3.  What are diagrams? Diagrams are graphical representation of a set of elements most often shown made of things and associations.
  4.  What are the major three types of modeling used? Major three types of modeling are structural, behavioral, and architectural.
  5.  Mention the different kinds of modeling diagrams used? Modeling diagrams that are commonly used are, there are 9 of them. Use case diagram, Class Diagram, Object Diagram, Sequence Diagram, statechart Diagram, Collaboration Diagram, Activity Diagram, Component diagram, Deployment Diagram.
  6.  What is Architecture? Architecture is not only taking care of the structural and behavioral aspect of a software system but also taking into account the software usage, functionality, performance, reuse, economic and technology constraints.
  7.  What is SDLC? SDLC is Software Development Life Cycle. SDLC of a system included processes that are Use case driven, Architecture centric and Iterative and Incremental. This Life cycle is divided into phases. Phase is a time span between two milestones. The milestones are Inception, Elaboration, Construction, and Transition. Process Workflows that evolve through these phase are Business Modeling, Requirement gathering, Analysis and Design, Implementation, Testing, Deployment. Supporting Workflows are Configuration and change management, Project management.
  8. What are Relationships? There are different kinds of relationships: Dependencies, Generalization, and Association. Dependencies are relations ships between two entities that that a change in specification of one thing may affect another thing. Most commonly it is used to show that one class uses another class as an argument in the signature of the operation. Generalization is relationships specified in the class subclass scenario, it is shown when one entity inherits from other. Associations are structural relationships that are: a room has walls, Person works for a company. Aggregation is a type of association where there is a has a relation ship, That is a room has walls, ño if there are two classes room and walls then the relation ship is called a association and further defined as an aggregation.
  9. How are the diagrams divided? The nine diagrams are divided into static diagrams and dynamic diagrams.
  10.  Static Diagrams (Also called Structural Diagram): Class diagram, Object diagram, Component Diagram, Deployment diagram.
  11.  Dynamic Diagrams (Also called Behavioral Diagrams): Use Case Diagram, Sequence Diagram, Collaboration Diagram, Activity diagram, Statechart diagram.
  12.  What are Messages? A message is the specification of a communication, when a message is passed that results in action that is in turn an executable statement.
  13.  What is an Use Case? A use case specifies the behavior of a system or a part of a system, óse cases are used to capture the behavior that need to be developed. It involves the interaction of actors and the system.

      26. Can you explain use case diagrams?

Use case diagram answers what system does from the user point of view. Use case answer ‘What will the system do?’. Use cases are mainly used in requirement document to depict clarity regarding a system. There are three important parts in a use case scenario, actor and use case.
26.  Scenario: A scenario is a sequence of events which happen when a user interacts with the system.
27.  Actor: Actor is the who of the system, in other words the end user.
28.  Use Case: Use case is task or the goal performed by the end user. Below figure ‘Use Case’ shows a simple scenario with ‘Actor’ and a ‘Use Case’. Scenario represents an accountant entering accounts data in the system. As use case’s represent action performed they are normally represented by strong verbs.
29.  Actor’s are represented by simple stick man and use case by oval shape as shown in figure ‘Use Case’ below.
30. 
31.  Figure: Use Case

(I)                Can you explain primary and secondary actors?

32.  Actors are further classified in to two types primary and secondary actors. Primary actors are the users who are the active participants and they initiate the user case, while secondary actors are those who only passively participate in the use case.

(I)                How does a simple use case look like?

33.  Use case’s have two views of representation in any requirement document. One is the use case diagrams and the other is a detail step table about how the use case works. So it’s like a pair first an over view is shown using a use case diagram and then a table explaining the same in detail. Below is a simple ‘login’ use case shown diagrammatically and then a detail table with steps about how the use case is executed.Figure: Login Use Case
  1. Use Case
Rel001
  1. Use Case Name
Login
  1. Description
This uses depicts the flow of how user will log-in into the chat application.
  1. Primary Actor
Simple chat user.
  1. Trigger
User types chat application on URL of the browser.
  1. Pre-condition
NA
  1. Assumption
No password is currently present for the system
Rooms will remain constant as explained in the assumption section of
this document
  1. Failed End conditions
Duplicate user name is not allowed in the chat application.
  1. Action

User clicks on the log-in button.
  1. Main Scenario
User types chat application on URL of the browser which in turn opens the main page.
In the main page of application user is popped up with ‘Enter user name’ option and various ‘rooms’ option drop down menu.
    User then types the name and selects one of the room from drop down      
     menu and then clicks on the ‘Log-in’ button.

Application then checks whether the user name is unique in the system if not then user is popped up with error message that “user already exist”.
After entering the unique name the user is finally logged in the application.
  1. Action
NA
  1. Alternate Scenario
NA
  1. Success Scenarios
1. Opens page of a selected room in that other user names and their messages can be seen.
  1. Note and Open Issues
NA
48.  Table: Login use case table
49.  Note: You must be wondering why we have this pair why not just a use case table only. Use case diagrams are good to show relationship between use case and they also provide high over view. The table explanation of a use case talks details about the use case. So when a developer or a user is reading a requirement document, he can get an overview by looking at the diagram if he is interested he can read the use case tables for more details.

(I)                Can you explain ‘Extend’ and ‘Include’ in use cases?

50.  ‘Extend’ and ‘Include’ define relationships between use cases. Below figure ‘Extend and Include’ shows how these two fundamentals are implemented in a project. The below use case represents a system which is used to maintain customer. When a customer is added successfully it should send an email to the admin saying that a new customer is added. Only admin have rights to modify the customer. First lets define extend and include and then see how the same fits in this use case scenario.
51.  Include: Include relationship represents an invocation of one use case by the other. If you think from the coding perspective its like one function been called by the other function.
52.  Extend: This relationship signifies that the extending use case will work exactly like the base use case only that some new steps will inserted in the extended use case.
53.  Below figure ‘Extend and Include’ shows that ‘add customer’ is same as the ‘add discounted customer’. The ‘Add discounted customer’ has an extra process, to define discount for the discounted customer which is not available for the simple customer. One of the requirements of the project was that when we add a customer, the system should send an email. So after the customer is added either through ‘Add simple customer’ use case or ‘Add discounted customer’ use case it should invoke ‘send a email’ use case. So we have defined the same with a simple dotted line with <<include>> as the relationship.
Figure: Extend and Include
54.  Note: One of the points to be noted in the diagram ‘Extend and Include’ is we have defined inheritance relationship between simple and admin user. This also helps us defining a technical road map regarding relationships between simple and admin user.

(I)                Can you explain class diagrams?

55.  Class diagram
Class is basically a prototype which helps us create objects. Class defines the static structure of the project. A class represents family of an object. By using Class we can create uniform objects.
56.  In the below figure you can see how the class diagram looks. Basically there are three important sections which are numbered as shown in the below. Let’s try to understand according to the numbering:
  1. Class name: This is the first section or top most section of the Class which represents the name of the Class (clsCustomer).
  2. Attributes: This is the second section or the middle section of the class which represents the properties of the system.
  3. Methods: This section carries operation or method to act on the attributes.
Figure: Three sections of the class
60.  Now in the next section we will have a look on Association relationship between these classes.

(B) How do we represent private, public and protected in class diagrams?

In order to represent visibility for properties and methods in class diagram we need to place symbols next to each property and method as shown in figure ‘Private, Public and Protected’. ‘+’ indicates that it’s public properties/methods. ‘-‘indicates private properties which means it can not be accessed outside the class. ‘#’ indicate protected/friend properties. Protected properties can only be seen within the component and not outside the component.
Figure: Private, public and protected

(I)                what does associations in a class diagram mean?

61.  Associations in Class diagrams

A single Class cannot represent the whole module in a project so we need one or more classes to represent a module. For instance, a module named ‘customer detail’ cannot be completed by the customer class alone , to complete the whole module we need customer class, address class, phone class in short there is relationship between the classes. So by grouping and relating between the classes we create module and these are termed as Association. In order to associate them we need to draw the arrowed lines between the classes as shown in the below figure.
62.  In the figure ‘Order is paid by payments class’, we can see Order class and the Payment class and arrowed line showing relationship that the order class is paid using payment class in other words order class is going to be used by payment class to pay the order. The left to right marked arrow basically shows the flow that order class uses the payment class.
In case payment class using the order class then the marked arrow should be right to left showing the direction of the flow.
Figure:- Order is paid by Payments class
63.  There are four signs showing the flow:-
Figure: Direction signs in UML

64.  Multiplicity

Multiplicity can be termed as classes having multiple associations or one class can be linked to instances of many other classes. If you look at the below figure the customer class is basically associated with the address class and also observes the notations (*, 0 and 1).If you look at the right hand side the (1….*) notation indicates that at least one or many instance of the address class can be present in the customer class. Now towards left hand side we have (0….*) notation indicating that address class can exist without or many customer class can link him.
In order to represent multiplicity of classes we have to show notations like (1….*), (0….*) as shown in below figure.
65.  Note: ‘*’ means “many” where as ‘(0, 1)’ means “(zero or at least one)” respectively.
Figure: Multiplicity in Classes

(I)                Can you explain aggregation and composition in class diagrams?

In this Association there are two types mainly Aggregation Association and Composition Association.
66.  Aggregation Association signifies that the whole object can exist without the Aggregated Object. For example in the below figure we have three classes university class, department class and the Professor Class. The university cannot exist without department which means that university will be closed as the department is closed. In other words lifetime of the university depend on the lifetime of department.
67.  In the same figure we have defined second Association between the department and the Professor. In this case, if the professor leaves the department still the department continues in other words department is not dependent on the professor this is called as Composition Association.
68.  Note: The filled diamond represents the aggregation and the empty diamond represents the composition. You can see the figure below for more details.
Figure: Aggregation and composition in action

(A)   What are composite structure diagram and reflexive association in class diagrams?

69.  Composite structure diagram

When we try to show Aggregation and Composition in a complete project the diagram becomes very complicated so in order to keep it simple we can use Composite structure diagram. In the below figure we have shown two diagrams one is normal diagram other is Composite structure diagram and the simplicity can easily be identified. In the composite diagram the aggregated classes are self contained in the main class which makes it simpler to read.
Figure: Composite Structure diagram

70.  Reflexive associations

In many scenarios you need to show that two instances of the same class are associated with each other and this scenario is termed as Reflexive Association. For instance in the below figure shows Reflexive Association in the real project. Here you can see customer class has multiple address class and addresses can be a Head office, corporate office or Regional office. One of the address objects is Head office and we have linked the address object to show Reflexive Association relationship. This is the way we can read the diagram Regional address object is blocked by zero or one instance of Head office object.
Figure: Reflexive association

(I)                Can you explain business entity and service class?

Business entity objects represent persistent information like tables of a database. Just making my point clearer they just represent data and do not have business validations as such. For instance below figure ‘Business entity and service’ shows a simple customer table which with three fields ‘Customer Code’,’ Customer Address’ and ‘Phone Number’. All these fields are properties in ‘ClsCustomer’ class. So ‘ClsCustomer’ class becomes the business entity class. The business entity class by itself can not do anything it’s just a place holder for data. In the same figure we have one more class ‘ClsServiceCustomer’. This class aggregates the business entity class and performs operations like ‘Add’,’ Next’ (Move to next record), ‘Prev’ (Move to previous record) and ‘GetItem’ (get a customer entity depending on condition).
71.  With this approach we have separated the data from the behavior. The service represents the behavior while the business entity represents the persistent data.
Figure:-Business entity and service

(I)                Can you explain System entity and service class?

System entity class represents persistent information which is related to the system. For instance in the below figure ‘System entity and service class’ we have a system entity class which represents information about ‘loggedindate’ and ‘loggedintime’ of the system registry. System service class come in two flavors one is it acts like a wrapper in the system entity class to represent behavior for the persistent system entity data. In the figure you can see how the ‘ClsAudit’ system entity is wrapped by the ‘ClsAuditSytem’ class which is the system service class. ‘ClsAuditSystem’ adds ‘Audit’ and ‘GetAudit’ behavior to the ‘ClsAudit’ system entity class.
Figure: System entity and service class
72.  The other flavor of the system service class is to operate on non-persistent information. The first flavor operated on persistent information. For instance the below figure ‘Non-persistent information’ shows how the class ‘ClsPaymentService’ class operates on the payment gateway to Check is the card exists , Is the card valid and how much is the amount in the card ?. All these information are non-persistent. By separating the logic of non-persistent data in to a system service class we bring high reusability in the project.
Figure: Non-persistent information
73.  Note: The above question can be asked in interview from the perspective of how you have separated the behavior from the data. The question will normally come twisted like ‘How did you separate the behavior from the data?’.

(B) Can you explain generalization and specialization?

74.  Generalization and Specialization

In Generalization and Specialization we define the parent-child relationship between the classes. In many instance you will see some of the classes have same properties and operation these classes are called super class and later you can inherit from super class and make sub classes which have their own custom properties. In the below figure there are three classes to show Generalization and Specialization relationship. All phone types have phone number as a generalized property but depending upon landline or mobile you can have wired or simcard connectivity as specialized property. In this diagram the clsphone represent Generalization whereas clslandline and clsmobile represents specialization.
Figure: Generalization and Specialization

(B) How do we represent an abstract class and interface UML?

Interface is represented by <<type>> in the class diagram. Below figure ‘Interface in action’ shows we have defined an interface ‘IContext’. Note the ‘<<type>>’ represents an interface. If we want to show that the interface is used in a class we show the same with a line and a simple circle as shown in figure ‘Interface in Action’ below.
Figure: Interface in action
75.  Abstract classes are represented by ‘{abstract}’ as shown in figure ‘Abstract classes in action’.
76. 
77.  Figure: Abstract classes in action.

(B) How do we achieve generalization and specialization?

78.  By using inheritance.

(I)                Can you explain object diagrams in UML?

79.  Class represents shows the static nature of the system. From the previous question you can easily judge that class diagrams shows the types and how they are linked. Classes come to live only when objects are created from them. Object diagram gives a pictorial representation of class diagram at any point of time. Below figure ‘Object diagram’ shows how a class looks in when actual objects are created. We have shown a simple student and course relationship in the object diagram. So a student can take multiple courses. The class diagram shows the same with the multiplicity relationship. We have also shown how the class diagram then looks when the objects are created using the object diagram. We represent object with Object Name: Class Name. For instance in the below figure we have shown ‘Shiv : ClsStudent’ i.e ‘Shiv’ is the object and ‘ClsStudent’ the class. As the objects are created we also need to show data of the properties, the same is represented by ‘PropertyName=Value’ i.e. ‘StudentName=Shiv’.
Figure: Object diagrams
80.  The diagram also states that ‘ClsStudent’ can apply for many courses. The same is represented in object diagram by showing two objects one of the ‘Computer’ and the other of ‘English’.
81.  Note: Object diagrams should only be drawn to represent complicated relationship between objects. It’s possible that it can also complicate your technical document as lot. So use it sparingly.

(I)                Can you explain sequence diagrams?

Sequence diagrams

Sequence diagram shows interaction between objects over a specific period time.
82.  Below figure 'Sequence diagram' shows how a sequence diagram looks like. In this sequence diagram we have four objects 'Customer','Product','Stock' and 'Payment'. The message flow is shown vertically in waterfall manner i.e. it starts from the top and flows to the bottom. Dashed lines represent the duration for which the object will be live. Horizontal rectangles on the dashed lines represent activation of the object. Messages sent from a object is represented by dark arrow and dark arrow head. Return message are represented by dotted arrow. So the figure shows the following sequence of interaction between the four objects:
  1. Customer object sends message to the product object to request if the product is available or not.
  2. Product object sends message to the stock object to see if the product exists in the stock.
  3. Stock object answers saying yes or No.
  4. Product object sends the message to the customer object.
  5. Customer object then sends a message to the payment object to pay money.
  6. Payment object then answers with a receipt to the customer object.
89.  One of the points to be noted is product and stock object is not active when the payment activity occurs.
90. 
91.  Figure: Sequence diagram

92.  Messages in sequence diagrams

93.  There are five different kinds of messages which can be represented by sequence.

94.  Synchronous and asynchronous messages

95.  Synchronous messages are represented by a dark arrow head while asynchronous messages are shown by a thin arrow head as shown in figure ‘Synchronous and Asynchronous’.
96. 
97.  Figure: Synchronous and Asynchronous

98.  Recursive message

99.  We have scenarios where we need to represent function and subroutines which are called recursively. Recursive means the method calling himself. Recursive messages are represented by small rectangle inside a big rectangle with an arrow going from the big rectangle to the small rectangle as shown in figure ‘Recursive message’.
Figure: Recursive message

100.                      Message iteration

Message iteration represents loops during sequences of activity. Below figure ‘message iteration’ shows how ‘order’ calls the ‘orderitem’ objects in a loop to get cost. To represent loop we need to write ‘For each <<object name>>’. In the below figure the object is the ‘orderitem’. Also note the for each is put in a box to emphasize that it’s a loop.
Figure: Message iteration

101.                      Message constraint

If we want to represent constraints it is put in a rectangle bracket as shown in figure ‘message constraint’. In the below figure ‘message constraint’ the ‘customer’ object can call ‘book tickets’ only if the age of the customer is greater than
Figure: Message constraint

102.                      Message branching

103.                      Below figure ‘message branching’ shows how ‘customer’ object have two branches one is when the customer calls save data and one when he cancels the data.
Figure: Message branching

104.                      Doing Sequence diagram practically

Let’s take a small example to understand sequence diagram practically. Below is a simple voucher entry screen for accounts data entry. Following are the steps how the accountant will do data entry for the voucher:-
Accountant loads the voucher data entry screen. Voucher screen loads with debit account codes and credit account codes in the respective combo boxes.
Accountant will then fill in all details of the voucher like voucher description, date, debit account code, credit account code, description, and amount and then click ‘add voucher’ button.
Once ‘add voucher’ is clicked it will appear in the voucher screen below in a grid and the voucher entry screen will be cleared and waiting for new voucher to be added. During this step voucher is not added to database it’s only in the collection.
  1. If there are more vouchers to be added the user again fills voucher and clicks ‘add voucher’.
  2. Once all the vouchers are added he clicks ‘submit voucher’ which finally adds the group of vouchers to the database.
107.                      Below figure ‘Voucher data entry screen’ shows pictorially how the screen looks like.
Figure: Voucher data entry screen
108.                      Figure ‘Voucher data entry sequence diagram’ shows how the sequence diagram looks like. Below diagram shows a full sequence diagram view of how the flow of the above screen will flow from the user interface to the data access layer. There are three main steps in the sequence diagram, let’s understand the same step by step.
109.                      Step 1:- The accountant loads the voucher data entry screen. You can see from the voucher data entry screen image we have two combo boxes debit and credit account codes which are loaded by the UI. So the UI calls the ‘Account Master’ to load the account code which in turn calls the data access layer to load the accounting codes.
110.                      Step 2:- In this step the accountant starts filling the voucher information. The important point to be noted in this step is that after a voucher is added there is a conditional statement which says do we want to add a new voucher. If the accountant wants to add new voucher he again repeats step 2 sequence in the sequence diagram. One point to be noted is the vouchers are not added to database they are added in to the voucher collection.
111.                      Step 3:- If there are no more vouchers the accountant clicks submit and finally adds the entire voucher in the database. We have used the loop of the sequence diagram to show how the whole voucher collection is added to the database.
Figure: Voucher data entry sequence diagram

No comments:

Post a Comment

JNTU WORLD

Add This Transparent Notification Bar To Your Blog Transparent Notification Bar

X