Pages

C3 Health Services

Visit Official Website 9278982994

Expert Healthcare at Your Doorstep

Wednesday, 5 June 2013

C Advanced Interview Questions and Answers For Experienced Developers

C Advanced Interview Questions and Answers For Experienced Developers

I have compiled a list of advanced C interview questions and answers for experienced developers. There are 49 C interview questions and answers in this list. If you are going for C/C++ interview, you must read following list of C interview questions and answers. I have covered the various C concepts in these interview questions like memory allocation and deallocation using malloc and calloc, difference between printof and sprintof, linked lists, static variables and functions, storage classes, hashing, pointers, arguments, text and binary modes, linker, difference between switch and if and OOPS concepts like polymorphism, function and operator overloading etc. Lets have a look at following list of C advanced interview questions and answers: 

1. What is C language?

The C programming language is a standardized programming language developed in the early 1970s by Ken Thompson and Dennis Ritchie for use on the UNIX operating system. 

It has since spread to many other operating systems, and is one of the most widely used programming languages. C is prized for its efficiency, and is the most popular programming language for writing system software, though it is also used for writing applications.

2. What is the output of printf("%d")?

A. When we write printf("%d",x); this means compiler will print the value of x. But as here, there is nothing after %d so compiler will show in output window garbage value.

B. When we use %d the compiler internally uses it to access the argument in the stack (argument stack). Ideally compiler determines the offset of the data variable depending on 

the format specification string. Now when we write printf("%d",a) then compiler first accesses the top most element in the argument stack of the printf which is %d and depending on the format string it calculated to offset to the actual data variable in the memory which is to be printed. Now when only %d will be present in the printf then compiler will calculate the correct offset (which will be the offset to access the integer variable) but as the actual data object is to be printed is not present at that memory location so it will print what ever will be the contents of that memory location.

C. Some compilers check the format string and will generate an error without the proper number and type of arguments for things like printf(...) and scanf(...).

3. What is the difference between "calloc(...)" and "malloc(...)"?

1. calloc(...) allocates a block of memory for an array of elements of a certain size. By default the block is initialized to 0. The total number of memory allocated will be (number_of_elements * size).

malloc(...) takes in only a single argument which is the memory required in bytes. malloc(...) allocated bytes of memory and not blocks of memory like calloc(...).

2. malloc(...) allocates memory blocks and returns a void pointer to the allocated space, or NULL if there is insufficient memory available.

calloc(...) allocates an array in memory with elements initialized to 0 and returns a pointer to the allocated space. calloc(...) calls malloc(...) in order to use the C++ set_new_mode function to set the new handler mode.

4. What is the difference between "printf(...)" and "sprintf(...)"?

sprintf(...) writes data to the character array whereas printf(...) writes data to the standard output device.

5. How to reduce a final size of executable?

Size of the final executable can be reduced using dynamic linking for libraries.

6. Can you tell me how to check whether a linked list is circular?

Create two pointers, and set both 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");
}}

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, its either 1 or 2 jumps until they meet.

7. What is the output of the following program? Why?

#include
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);
}

8. What does static variable mean?

There are 3 main uses for the static.

1. If you declare within a function:
It retains the value between function calls

2.If it is declared for a function name:
By default function is extern..so it will be visible from other files if the function declaration is as static..it is invisible for the outer files

3. Static for global variables:
By default we can use the global variables from outside files If it is static global..that variable is limited to with in the file 

9. What are the advantages of a macro over a function?

Macro gets to see the Compilation environment, so it can expand __ __TIME__ __FILE__ #defines. It is expanded by the preprocessor.

For example, you can’t do this without macros
#define PRINT(EXPR) printf( #EXPR “=%d\n”, EXPR)

PRINT( 5+6*7 ) // expands into printf(”5+6*7=%d”, 5+6*7 );

You can define your mini language with macros:
#define strequal(A,B) (!strcmp(A,B))

Macros are a necessary evils of life. The purists don’t like them, but without it no real work gets done.

10. What are the differences between malloc() and calloc()?

There are 2 differences.

First, is in the number of arguments. malloc() takes a single argument(memory required in bytes), while calloc() needs 2 arguments(number of variables to allocate memory, size in bytes of a single variable).

Secondly, malloc() does not initialize the memory allocated, while calloc() initializes the allocated memory to ZERO.

11. What are the different storage classes in C?

C has three types of storage: automatic, static and allocated. Variable having block scope and without static specifier have automatic storage duration.

Variables with block scope, and with static specifier have static scope.

Global variables (i.e, file scope) with or without the static specifier also have static scope.

Memory obtained from calls to malloc(), alloc() or realloc() belongs to allocated storage class.

12. What is the difference between strings and character arrays?

A major difference is: string will have static storage duration, whereas as a character array will not, unless it is explicity specified by using the static keyword. Actually, a string is a character array with following properties:

* the multibyte character sequence, to which we generally call string, is used to initialize an array of static storage duration. The size of this array is just sufficient to contain these characters plus the terminating NULL character.

* it not specified what happens if this array, i.e., string, is modified.

* Two strings of same value[1] may share same memory area. For example, in the following declarations:

char *s1 = “Calvin and Hobbes”;
char *s2 = “Calvin and Hobbes”;

The strings pointed by s1 and s2 may reside in the same memory location. But, it is not true for the following:

char ca1[] = “Calvin and Hobbes”;
char ca2[] = “Calvin and Hobbes”;

[1] The value of a string is the sequence of the values of the contained characters, in order.

13. What is the difference between const char* p and char const* p?

In const char* p, the character pointed by ‘p’ is constant, so u cant change the value of character pointed by p but u can make ‘p’ refer to some other location.

In char const* p, the ptr ‘p’ is constant not the character referenced by it, so u cant make ‘p’ to reference to any other location but u can change the value of the char pointed by ‘p’.

14. What is hashing?

To hash means to grind up, and that’s essentially what hashing is all about. The heart of a hashing algorithm is a hash function that takes your nice, neat data and grinds it into some random-looking integer.

The idea behind hashing is that some data either has no inherent ordering (such as images) or is expensive to compare (such as images). If the data has no inherent ordering, you can’t perform comparison searches.

If the data is expensive to compare, the number of comparisons used even by a binary search might be too many. So instead of looking at the data themselves, you’ll condense 

(hash) the data to an integer (its hash value) and keep all the data with the same hash value in the same place. This task is carried out by using the hash value as an index into an array.

To search for an item, you simply hash it and look at all the data whose hash values match that of the data you’re looking for. This technique greatly lessens the number of items you have to look at. If the parameters are set up with care and enough storage is available for the hash table, the number of comparisons needed to find an item can be made arbitrarily close to one.

One aspect that affects the efficiency of a hashing implementation is the hash function itself. It should ideally distribute data randomly throughout the entire hash table, to reduce the likelihood of collisions. Collisions occur when two different keys have the same hash value. 

There are two ways to resolve this problem. In open addressing, the collision is resolved by the choosing of another position in the hash table for the element inserted later. When the hash table is searched, if the entry is not found at its hashed position in the table, the search continues checking until either the element is found or an empty position in the table is found.

The second method of resolving a hash collision is called chaining. In this method, a bucket or linked list holds all the elements whose keys hash to the same value. When the hash table is searched, the list must be searched linearly.

15. How can you determine the size of an allocated portion of memory?

You can’t, really. free() can , but there’s no way for your program to know the trick free() uses. Even if you disassemble the library and discover the trick, there’s no guarantee the trick won’t change with the next release of the compiler.

16. Can static variables be declared in a header file?

You can’t declare a static variable without defining it as well (this is because the storage class modifiers static and extern are mutually exclusive). A static variable can be defined in a header file, but this would cause each source file that included the header file to have its own private copy of the variable, which is probably not what was intended.

17. Can a variable be both const and volatile?

Yes. The const modifier means that this code cannot change the value of the variable, but that does not mean that the value cannot be changed by means outside this code.

18. Can include files be nested?

Yes. Include files can be nested any number of times. As long as you use precautionary measures , you can avoid including the same file twice. In the past, nesting header files was seen as bad programming practice, because it complicates the dependency tracking function of the MAKE program and thus slows down compilation. Many of today’s popular compilers make up for this difficulty by implementing a concept called precompiled headers, in which all headers and associated dependencies are stored in a precompiled state.

Many programmers like to create a custom header file that has #include statements for every header needed for each module. This is perfectly acceptable and can help avoid potential problems relating to #include files, such as accidentally omitting an #include file in a module.

19. When does the compiler not implicitly generate the address of the first element of an array?

Whenever an array name appears in an expression such as

- array as an operand of the sizeof operator
- array as an operand of & operator
- array as a string literal initializer for a character array

Then the compiler does not implicitly generate the address of the address of the first element of an array.

20. What is a null pointer?

There are times when it’s necessary to have a pointer that doesn’t point to anything. The macro NULL, defined in , has a value that’s guaranteed to be different from any valid pointer. NULL is a literal zero, possibly cast to void* or char*. Some people, notably C++ programmers, prefer to use 0 rather than NULL.

The null pointer is used in three ways:

1) To stop indirection in a recursive data structure
2) As an error value
3) As a sentinel value

21. What is the difference between text and binary modes?

Streams can be classified into two types: text streams and binary streams. Text streams are interpreted, with a maximum length of 255 characters. With text streams, carriage return/line feed combinations are translated to the newline n character and vice versa. Binary streams are uninterrupted and are treated one byte at a time with no translation of characters. Typically, a text stream would be used for reading and writing standard text files, printing output to the screen or printer, or receiving input from the keyboard.

A binary text stream would typically be used for reading and writing binary files such as graphics or word processing documents, reading mouse input, or reading and writing to the modem.

22. What is static memory allocation and dynamic memory allocation?

Static memory allocation: The compiler allocates the required memory space for a declared variable.By using the address of operator,the reserved address is obtained and this address may be assigned to a pointer variable.Since most of the declared variable have static memory,this way of assigning pointer value to a pointer variable is known as static memory allocation. memory is assigned during compilation time.

Dynamic memory allocation: It uses functions such as malloc( ) or calloc( ) to get memory dynamically.If these functions are used to get memory dynamically and the values returned by these functions are assingned to pointer variables, such assignments are known as dynamic memory allocation.memory is assined during run time.

23. When should a far pointer be used?

Sometimes you can get away with using a small memory model in most of a given program. There might be just a few things that don’t fit in your small data and code segments. 

When that happens, you can use explicit far pointers and function declarations to get at the rest of memory. A far function can be outside the 64KB segment most functions are shoehorned into for a small-code model. (Often, libraries are declared explicitly far, so they’ll work no matter what code model the program uses.) A far pointer can refer to information outside the 64KB data segment. Typically, such pointers are used with farmalloc() and such, to manage a heap separate from where all the rest of the data lives. If you use a small-data, large-code model, you should explicitly make your function pointers far.

24. How are pointer variables initialized?

Pointer variable are initialized by one of the following two ways

- Static memory allocation
- Dynamic memory allocation

25. What is the difference between arrays and pointers?

- Pointers are used to manipulate data using the address. Pointers use * operator to access the data pointed to by them

- Arrays use subscripted variables to access and manipulate data. Array variables can be equivalently written using pointer expression.

26. Is using exit() the same as using return?

No. The exit() function is used to exit your program and return control to the operating system. The return statement is used to return from a function and return control to the calling function. If you issue a return from the main() function, you are essentially returning control to the calling function, which is the operating system. In this case, the return statement and exit() function are similar.

27. What is a method?

Method is a way of doing something, especially a systematic way; implies an orderly logical arrangement (usually in steps). 

28. What is indirection?

If you declare a variable, its name is a direct reference to its value. If you have a pointer to a variable, or any other object in memory, you have an indirect reference to its value.

29. What is modular programming?

If a program is large, it is subdivided into a number of smaller programs that are called modules or subprograms. If a complex problem is solved using more modules, this approach is known as modular programming.

30. How many levels deep can include files be nested?

Even though there is no limit to the number of levels of nested include files you can have, your compiler might run out of stack space while trying to include an inordinately high number of files. This number varies according to your hardware configuration and possibly your compiler.

31. What is the difference between declaring a variable and defining a variable?

Declaring a variable means describing its type to the compiler but not allocating any space for it. Defining a variable means declaring it and also allocating space to hold the variable. You can also initialize a variable at the time it is defined.

32. What is an lvalue?

An lvalue is an expression to which a value can be assigned. The lvalue expression is located on the left side of an assignment statement, whereas an rvalue is located on the right side of an assignment statement. Each assignment statement must have an lvalue and an rvalue. The lvalue expression must reference a storable variable in memory. It cannot be a constant.

33. Differentiate between an internal static and external static variable?

An internal static variable is declared inside a block with static storage class whereas an external static variable is declared outside all the blocks in a file.An internal static variable has persistent storage, block scope and no linkage.An external static variable has permanent storage,file scope and internal linkage.

34. What is the difference between a string and an array?

An array is an array of anything. A string is a specific kind of an array with a well-known convention to determine its length. There are two kinds of programming languages: those in which a string is just an array of characters, and those in which it’s a special type. In C, a string is just an array of characters (type char), with one wrinkle: a C string always ends with a NUL character.

The “value” of an array is the same as the address of (or a pointer to) the first element; so, frequently, a C string and a pointer to char are used to mean the same thing.

An array can be any length. If it’s passed to a function, there’s no way the function can tell how long the array is supposed to be, unless some convention is used. The convention for strings is NULL termination; the last character is an ASCII NULL (‘’) character.

35. What is an argument? Differentiate between formal arguments and actual arguments?

An argument is an entity used to pass the data from calling function to the called function. Formal arguments are the arguments available in the function definition. They are preceded by their own data types. Actual arguments are available in the function call.

36. What are advantages and disadvantages of external storage class?

Advantages of external storage class

1)Persistent storage of a variable retains the latest value
2)The value is globally available

Disadvantages of external storage class

1)The storage for an external variable exists even when the variable is not needed
2)The side effect may produce surprising output
3)Modification of the program is difficult
4)Generality of a program is affected

37. What is a void pointer?

A void pointer is a C convention for a raw address. The compiler has no idea what type of object a void Pointer really points to. If you write int *ip; ip points to an int. If you write void *p; p doesn’t point to a void! 

In C and C++, any time you need a void pointer, you can use another pointer type. For example, if you have a char*, you can pass it to a function that expects a void*. You don’t even need to cast it. In C (but not in C++), you can use a void* any time you need any kind of pointer, without casting. (In C++, you need to cast it). 

A void pointer is used for working with raw memory or for passing a pointer to an unspecified type. Some C code operates on raw memory. When C was first invented, character pointers (char *) were used for that. Then people started getting confused about when a character pointer was a string, when it was a character array, and when it was raw memory.

38. When should a type cast not be used?

A type cast should not be used to override a const or volatile declaration. Overriding these type modifiers can cause the program to fail to run correctly. A type cast should not be used to turn a pointer to one type of structure or data type into another. In the rare events in which this action is beneficial, using a union to hold the values makes the programmer’s intentions clearer.

39. When is a switch statement better than multiple if statements?

A switch statement is generally best to use when you have more than two conditional expressions based on a single variable of numeric type.

40. What is a static function?

A static function is a function whose scope is limited to the current source file. Scope refers to the visibility of a function or variable. If the function or variable is visible outside of the current source file, it is said to have global, or external, scope. If the function or variable is not visible outside of the current source file, it is said to have local, or static, scope.

41. What is a pointer variable?

A pointer variable is a variable that may contain the address of another variable or any valid address in the memory.

42. What is a pointer value and address?

A pointer value is a data object that refers to a memory location. Each memory location is numbered in the memory. The number attached to a memory location is called the address of the location.

43. What is a modulus operator? What are the restrictions of a modulus operator?

A Modulus operator gives the remainder value. The result of x%y is obtained by (x-(x/y)*y). This operator is applied only to integral operands and cannot be applied to float or double.

44. Differentiate between a linker and linkage?

A linker converts an object code into an executable code by linking together the necessary build in functions. The form and place of declaration where the variable is declared in a program determine the linkage of variable.

45. What is a function and built-in function?

A large program is subdivided into a number of smaller programs or subprograms. Each subprogram specifies one or more actions to be performed for a large program. such subprograms are functions. The function supports only static and extern storage classes. By default, function assumes extern storage class. functions have global scope. Only register or auto storage class is allowed in the function parameters. Built-in functions that predefined and supplied along with the compiler are known as built-in functions. They are also known as library functions.

46. Why should I prototype a function?

A function prototype tells the compiler what kind of arguments a function is looking to receive and what kind of return value a function is going to give back. This approach helps the compiler ensure that calls to a function are made correctly and that no erroneous type conversions are taking place.

47. What is Polymorphism?

'Polymorphism' is an object oriented term. Polymorphism may be defined as the ability of related objects to respond to the same message with different, but appropriate actions. In other words, polymorphism means taking more than one form. Polymorphism leads to two important aspects in Object Oriented terminology - Function Overloading and Function Overriding. Overloading is the practice of supplying more than one definition for a given function name in the same scope. The compiler is left to pick the appropriate version of the function or operator based on the arguments with which it is called.

Overriding refers to the modifications made in the sub class to the inherited methods from the base class to change their behavior. 

48. What is Operator overloading?

When an operator is overloaded, it takes on an additional meaning relative to a certain class. But it can still retain all of its old meanings. 

Examples:

1) The operators >> and << may be used for I/O operations because in the header, they are overloaded.

2) In a stack class it is possible to overload the + operator so that it appends the contents of one stack to the contents of another. But the + operator still retains its original meaning relative to other types of data.

49. What is the difference between goto and longjmp() and setjmp()?

A goto statement implements a local jump of program execution, and the longjmp() and setjmp() functions implement a nonlocal, or far, jump of program execution.

Generally, a jump in execution of any kind should be avoided because it is not considered good programming practice to use such statements as goto and longjmp in your program. 

A goto statement simply bypasses code in your program and jumps to a predefined position. To use the goto statement, you give it a labeled position to jump to. This predefined position must be within the same function. You cannot implement gotos between functions.

When your program calls setjmp(), the current state of your program is saved in a structure of type jmp_buf. Later, your program can call the longjmp() function to restore the program’s state as it was when you called setjmp().Unlike the goto statement, the longjmp() and setjmp() functions do not need to be implemented in the same function.

However, there is a major drawback to using these functions: your program, when restored to its previously saved state, will lose its references to any dynamically allocated memory between the longjmp() and the setjmp(). This means you will waste memory for every malloc() or calloc() you have implemented between your longjmp() and setjmp(), and your program will be horribly inefficient.

It is highly recommended that you avoid using functions such as longjmp() and setjmp() because they, like the goto statement, are quite often an indication of poor programming practice.

Tuesday, 4 June 2013

WPF Prism EventAggregator: Subscribe, Publish and CompositePresentationEvent

WPF Prism EventAggregator: Subscribe, Publish and CompositePresentationEvent

EventAggregator is the integral part of Prism and is used to raise the events from one loosely coupled module to another using subscribe, publish and CompositePresentationEvent class.

PRISM is designed for large applications with lots of different teams working on different modules decoupled from each other. Prism is a complex concept and should never be used for small scale applications. To work with Prism, you should have knowledge about Commands, Message Bus, MVVM, Unity, MEF in order to get started with the framework.

You can download Prism from Microsoft Website.
For using EventAggregator, you need following DLLs from Prism

Microsoft.Practices.Composite.Events
Microsoft.Practices.Composite.Presentation.Events

What is Prism EventAggregator

As the name suggests, event aggregator in prism, aggregates or collects the events from various modules in the composite WPF application and make it accessible from various modules by subscribing and publishing the methods. In a composite application, the events are frequently shared between multiple modules, so they are defined in a common place.

In this way you can call methods of one module from another module. So by this approach, dependency between different moudules on an application decreases and they become loosely coupled.

CompositePresentationEvent class

CompositePresentationEvent class is a generic class that maintains the list of Subscribers and Publishers and connects them.

public class LoadEvent : CompositePresentationEvent<string>{}

Subscribe Events

For subscribing, you should mention a callback method which will be invoked.

eventAggregator.GetEvent<LoadEvent>().Subscribe(MyMethod);

Publish Events

Publishers raise an event by retrieving the event from the EventAggregator and calling the Publish method.

eventAggregator.GetEvent<LoadEvent>().Publish(“StringParameter”);

Unsubscribe Events

If your subscriber no longer wants to receive events, you can unsubscribe by using your subscriber's handler or you can unsubscribe by using a subscription token.

Subscribing Using Strong References

If you are raising multiple events in a short period of time and have noticed performance concerns with them, you may need to subscribe with strong delegate references—and therefore manually unsubscribe from the event when disposing the subscriber—instead of the default weak delegate references maintained by CompositePresentationEvent.

By default, CompositePresentationEvent maintains a weak delegate reference to the subscriber's handler and filter on subscription. This means the reference that CompositePresentationEvent holds to the subscriber will not prevent garbage collection of the subscriber. Using a weak delegate reference relieves the subscriber from the need to unsubscribe to enable proper garbage collection. However, maintaining this weak delegate reference is slower than a corresponding strong delegate reference. For most applications, this performance will not be noticeable, but if your application publishes a large number of events in a short period of time, you may need to use strong delegate references with CompositePresentationEvent to achieve reasonable performance. If you do use strong delegate references, your subscriber should unsubscribe to enable proper garbage collection of your subscribing object when it is no longer used.

Advantages of EventAggregators

1. Ease of adding new features.
2. Strong typing allows publishers and subscribers for a particular event to be quickly determined.
3. Event filtering means a subscriber that is not interested in every instance can ignore those it is uninterested in. Also the filtering is done in the Event Aggregator.
4. Fine grain control of what thread the processing should take place.
5. A central place for instrumentation.

Disadvantages of EventAggregators

1. Registration: Having listeners do the registration adds repetitive code to each listener.
2. Discoverability/Traceability: Event aggregation is a form of indirection, which makes the system harder to understand.
3. Serious memory leak issues since the EventAggregator maintains references to subscribers.
4. Does not support Event Latching, meaning cannot ignore events at times, and then support updates.
5. Event ordering is not guaranteed.
6. Getting the event through the GetEvent<T>() method to publish or subscribe is considered a bit clunky.

Sunday, 2 June 2013

Online Marketing and Advertising Strategies / Ideas / Tips for Starting a Small Business

Online Marketing and Advertising Strategies / Ideas / Tips for Starting a Small Business

Do you want to start your own small business? Do you want to become self-employed? Congratulations!!! Great Thinking!! In this article, I will try to give you some tips and ideas on setting up and starting your small business, running your business, promoting your business online, marketing and advertising strategies and ideas for your small business. Social media marketing and advertising on the internet is a great way to market and promote your small business online. So, we will also have some discussion on social media business marketing strategies.

Self employment is on rise because of following reasons:

1. There is lack of good and comfortable jobs in market which satisfies you.

2. Salary is the main issue. Its common thinking that a salaried person cannot become rich because he has to look for the end date of month to get money in his pocket and serve his family with that fixed amount. He has to wait for a year to get mere 10-15 percent hike in his salary. He has to wait many years to get promotion. Working for long hours under pressure frustrates you.

3. If you think you are well qualified and experienced, then why to work for others, why to give benefits to your boss, open your own small business and put all your effort there.

Shifting from an Employee to a Business Man

If you have decided to quit your job and start your own small business, decide the structure of your business. Will you be the sole owner of your business? Will be do your business in partnership? Will you open a limited company? From where will you arrange the funds? If you are planning to start a limited company, do you have directors for it. Do you have Technical, Finance, Legal and HR persons in you contact? 

Online Marketing and Advertising Strategies for Your Business

After setting up your business, you have promote it so that people come to know about your business. You have a lot of options available for online marketing and advertising your business. I have listed down some online marketing strategies for your business promotion which might help you to increase your sales.

Setup your Business Website:

Creating a website for your business is the great online marketing and advertising strategy which can multi-fold your sales. Create a website which reflects your business to the internet world. Your website will open in all around the world. So with your website, you can deal with a vast range of people in different localities. Put you contact details on the website such as Telephone Number, Email Address, Fax Address and Geographical Address so that online people can contact you and can place orders from your website. Write genuine contents and articles about your business, services and products.

Google Adwords: 

You can contact google which will make online advertisement and marketing of your business. Your business and product ads will appear on number of websites over the internet which have similar content like you.

Social Networking Websites:

Today, all the businessmen are using socail networking sites like Facebook, Twitter, Google Plus, Linkedin to online market and advertise their business. Almost whole world uses these social networking sites, so you can take benefit of this fact to promote your business to a lot of online people. You can create a social page for your business where you can highlight your business and products and give a link to your website.

Business Directories:

Business directories are good source of online marketing of your business. Submit your website to multiple web business directories. These directories list down all the business site and drive high traffic to your website and increase your sales. Let me give you an example: MANTA.COM. This is a website which lists your business in an appropriate category and publish it.

Classified Websites:

You can put ads to various classified websites which are also a great source of online marketing and advertising. These classified websites have high google rank, so the ads put by you on these websites will appear on top of google search.

SEO Companies:

There are a lot of SEO companies today which can provide you a lot of online marketing and advertsing strategies to help your website perform better over the internet world.

I think this article on Online Marketing and Advertising Strategies for Your Small Business might be helpful to you to some extent. There are a lot of online marketing business articles available on the internet which you can browse and get ideas from there. Thanks for reading!!!

Online Associate, Bachelors and Master Degree Programs offered by DeVry University

Online Associate, Bachelors and Master Degree Programs offered by DeVry University

At DeVry University, you have a lot of options to choose any online Associate, Bachelors and Master Degree Programs. You can opt for more than one online degree programs with DeVry University. DeVry University provides online education and degrees in various streams like Engineering, Medical, Law, Arts, Commerce, Accounting, Web, Networking and many more. Beside this, you can also earn scholarship in DeVry university as they provide a lot of opportunities to thrive.

With DeVry Online Degree Programs, you can attend classes from home over the internet. You can interact with your class mates and professors online anytime. DeVry university online classes are very flexible and supportive as per your needs. DeVry university faculty is very hard working and are always ready to help you to achieve your goals.

DeVry University Accredition

DeVry University is accredited by The Higher Learning Commission  and is a member of the North Central Association of Colleges and Schools (HLC/NCA). The University's Keller Graduate School of Management is included in this accreditation.

Locations of DeVry University

DeVry University has 95 locations in major metropolitan areas in US and Canada. So, it becomes very easy for you to find the nearest location of DeVry university where you live and where you do your job.

Online Degrees offered by DeVry University

Business & Management
Engineering & Information Sciences
Network & Communications Management
Health Sciences and Healthcare Administration
Liberal Arts & Sciences
Media Arts & Technology.
Accounting and Finance
Game & Simulation Programming
Law and Justice Administration
Multimedia Design & Development

Saturday, 1 June 2013

Commonly Asked BizTalk Server Technical Interview Questions and Answers

Commonly Asked BizTalk Server Technical Interview Questions and Answers

I have compiled a list of Commonly Asked BizTalk Server Technical Interview Questions and Answers. If you are preparing for BizTalk interview, following BizTalk interview questions would be useful to you to crack the interview. In my opinion, every BizTalk developer must know these interview questions. These BizTalk interview questions are based basic introduction of BizTalk, Message Types, Transaction Types, Rule Engines, BizTalk Schemas, BizTalk Properties, Property Promotion, Binding Modes in BizTalk Server, Synchronous and Asynchronous Communication, Dehydration, Rehydration, Correlation, Convoy, Business WorkFlows, Security Groups in BizTalk, Message and Content Routing, BizTalk Installation Guide, Persistence Points etc.

Lets have a look into this list on commonly asked BizTalk interveiw questions and answers.

1. What is BizTalk?

BizTalk is a middleware that sits in the middle of any two softwares who wish to communicate with each other and agree on some specified communication pattern. It uses SQL Server as back end database.

2. What is a BizTalk Application?

A BizTalk application is a logical grouping of the items, called "artifacts", used in a BizTalk Server business solution. Artifacts include the following:

1. BizTalk assemblies and the BizTalk-specific resources that they contain – orchestrations, pipelines, schemas, and maps

2. .NET assemblies that do not contain BizTalk-specific resources

3. Policies

4. Send ports, send port groups, receive locations, and receive ports

5. Other items that are used by the solution, such as certificates, COM components, and scripts

3. What is a Message Type (i.e. BTS.MessageType) and how is it used in BizTalk?

Message Type is a BizTalk System property that is promoted inside a Pipeline. It is made up of Document Name Space Root # Node Name.

4. What is the lifecycle of a Message in BizTalk server?

A message is received through a receive location defined in a given receive port. This message is processed by the pipeline associated with the receive location, and if there are any inbound maps associated with the receive port they are executed. The resulting message is then published to the MessageBox database. The MessageBox evaluates active subscriptions and routes the message to those orchestrations, and send ports with matching subscriptions. Orchestrations may process the message and publish messages through the MessageBox to a send port where it is pushed out to its final destination.

5. What is BAM used for?

BAM is used to monitor business milestones and key metrics in near real-time throughout a process in BizTalk.

6. What is the Rules Engine?

Rules are used to provide highly efficient, easily changeable business rules evaluation to Business Processes. This allows rules to be changed without rebuilding and redeploying .net assemblies. The Business Rules Engine (BRE) can also be called from any .net component through the API’s.

7. What are different types of BizTalk Schemas?

1. XML schema: An XML schema defines the structure of a class of XML instance messages. Because this type of schema uses XML Schema definition (XSD) language to define the structure of an XML instance message, and this is the intended purpose of XSD, such schemas use XSD in a straightforward way.

2. Flat file schema: A flat file schema defines the structure of a class of instance messages that use a flat file format, either delimited or positional or some combination thereof. Because the native semantic capabilities of XSD do not accommodate all of the requirements for defining the structure of flat file instance messages—such as the various types of delimiters that might be used for different records and fields within the flat file—BizTalk Server uses the annotation capabilities of XSD to store this extra information within an XSD schema. BizTalk Server defines a rich set of specific annotation tags that can be used to store all of the required additional information.

3. Envelope schema: An envelope schema is a special type of XML schema. Envelope schemas are used to define the structure of XML envelopes, which are used to wrap one or more XML business documents into a single XML instance message. When you define an XML schema to be an envelope schema, a couple of additional property settings are required, depending on such factors as whether there are more than one root record defined in the envelope schema.

4. Property schema: A property schema is used with one of the two mechanisms that exist within BizTalk Server for what is known as property promotion. Property promotion is the process of copying specific values from deep within an instance message to the message context. From the message context, these values are more easily accessed by various BizTalk Server components. These components use the values to perform actions such as message routing. Promoted property values can also be copied in the other direction, from the more easily accessible message context back into the depths of the instance message, just before the instance message is sent to its destination. A property schema is a simple version of a BizTalk schema that plays a role in the process of copying promoted properties back and forth between the instance message and the message context.

8. What is the difference between a Document Schema and a Property Schema?

A document schema is used to define a message. It is a definition on an Xml message with optional extensions for flat files, EDI file, etc that enable the parsers to convert the native format into Xml.

A property schema is used to define message context properties. These can be of type MessageDataPropertyBase (the property value is promoted or demoted from/to the message itself) or MessageContextPropertyBase(property value only exists within the message context and can be set by adapters, pipelines or within orchestrations).

If you wish to promote a field from a message into the message context then you need to define a document schema and property schema. In the document schema you promote the required field using the property schema to define the property type that will be used in the message context.

9. What is the difference between a Distinguished field and a Promoted Property?

• Distinguished fields are light weight and can only be used inside an Orchestration.

• Promoted Properties are defined inside a property schema, are tracking in SQL, can be tracked in HAT, and can be used for content based routing.

10. What is Property Promotion and why is it required?

Biztalk provides you with a really smart routing feature that allows the engine to decide where to send which message. For example, If you receive a message with the EmployeePaySlip schema, and it has the approved flag to true, it should be redirected to the Finance system Orchestration for making the payments and to the HR system Orchestration for keeping the records. This built in intelligence for the Biztalk engine allows it to route the messages simply based on some content within the messages.

In order to achieve this, the Biztalk engine obviously needs to understand the fields based on which the routing decisions can be taken. To simplify and optimize this working, Biztalk has introduced the notion of “promoted properties”. The Biztalk engine can get easy access to the promoted properties without knowing the entire message and hence it can save loads of time and complexity when dealing with routing. To route a message, the Biztalk engine simply reads its promoted properties and does not care about other contents in the message.

11. Can an envelope schema consist of more than one schema type?

Yes. XML envelopes serve two purposes within XML instance messages sent and received by Microsoft BizTalk Server:

XML envelopes can contain data that supplements the data within the XMLdocuments. This data can be promoted into the message context by the XML disassembler to provide easier access from a variety of BizTalk Server components. For outbound XML instance messages, the XML assembler can demote values from the message context into an envelope for inclusion in the instance message transmission.

XML envelopes can be used to combine multiple XML documents into a single, valid XML instance message. Without an envelope to wrap multiple documents within a single root tag, an XML instance message containing multiple documentswould not qualify as well-formed XML.

12. What are different types of binding modes in BizTalk Server?

BizTalk offers four binding models, each with different characteristics. Each model is really a set of higher level abstractions of the basic BizTalk subscription mechanisms. One of these models is called 'Direct Binding'. The term 'direct binding' is used to suggest that the techniques involved are all about binding one orchestration port directly to another. In fact, this is just one possibility when using this model. I find the term confusing, myself, as other binding models are used to 'directly' bind orchestration ports to messaging Send ports. Binding models are really differentiated by the following characteristics:

• support for external binding configuration
• use of static and dynamic messaging Send ports. NB., Receive ports do not support a dynamic model.
• auto-generation of configured messaging ports at deployment time

The four models are:

• 'Direct' binding

In this model, orchestration ports do not automatically use or exploit BTS.SPID, BTS.ReceivePortID or other related properties. BizTalk therefore does not manage the binding of orchestration ports to messaging Receive and Send ports. Instead, it is entirely up to developers to control subscriptions and message context in order to route messages.

Developers are free, if they wish, to route messages to other orchestration ports. External binding configuration cannot be used with directly bound orchestration ports. Direct binding is the most flexible model, but at a cost. You cannot configure your orchestration ports using binding files, and you generally need to do more programming in order to fully exploit the flexibility on offer.

• 'Specify later' binding

In this model, orchestration ports are bound to messaging ports using BTS.SPID, BTS.ReceivePortID or other related properties. Outgoing messages are always routed through
static Send ports. Binding configuration can be managed in deployed solutions using binding files or by writing WMI/ExplorerOM code. This is probably the most common model, but is significantly less flexible than direct binding. You have much less control over subscription and 'promoted' properties, and can only use this approach to bind orchestration ports to messaging ports.

• 'Specify now' binding

This model is similar to the 'Specify later' model. However, BizTalk collects transport information at design time, together with pipeline information, and uses this to auto-generate messaging Receive and static Send ports at deployment time. Orchestration ports are then bound to these ports. Binding files can be used, if required, to amend binding configuration on a live system.

• 'Dynamic' binding

This model has similarities to the 'Specify now' model in that BizTalk collects pipeline information at design time and auto-generates messaging Send ports. Receive ports are not generated, as there is no concept of a 'dynamic' Receive port. However, transport information is not configured in the same way. Instead, developers create expressions in orchestrations to assign transport location URIs using the 'address' property of orchestration ports. The auto-generated messaging Send ports are dynamic, rather than static.

Messages passing from an orchestration through dynamic Send and Send-Receive ports are routed solely on the basis of the orchestration port's address property which is used to create BTS.OutboundTransportType and BTS.OutboundTransportLocation 'promoted' context properties. When a dynamic messaging Send port is enlisted, it creates a set of subscriptions, with one subscription for each adapter. Each subscription tests that the BTS.OutboundTransportLocation property exists, and that the BTS.OutboundTransportType property contains a value identifying the adapter. Hence, not only can dynamic binding route messages to any location based on the address, but also via any registered adapter.

13. What is the difference between static, dynamic and direct binding?

Static binding specifies particular port address,
Dynamic gives address of the port at runtime,
Direct binding sends messages to messagebox.

14. What are different Transaction types in BizTalk Server?

The classical definition of a transaction is – an atomic unit of work which results in moving the system from one consistent state to a new consistent and durable state. A transaction can either be “committed” or “rolled back” depending on various conditions. Note that a transaction which cannot be rolled back needs to be “compensated”. This means that if an operation ‘f(x)’ has been performed on some data, in order to revert it back we need to perform an operation ‘f(y)’, which essentially performs an undo operation, this is known as “compensation” in simple terms.

A non-transactional orchestration cannot have ‘scope’ shapes set to either “Atomic” or “Long Running”.

If an orchestration’s transaction type is set to “Atomic”, then the orchestration cannot have any other transactions within its ‘scope’ shapes.

Atomic transactions cannot contain nested transactions or catch exception blocks. However, they can have compensation blocks.

Long running transactions cannot be isolated from other transactions. However they can contain other atomic transactions and can have catch exception and compensation blocks.

Batch: A boolean value that determines if this transaction can be batched with other transactions across multiple instances of the orchestration. The default value is “true”. It may
improve performance with the possibility of losing isolation data.

Isolation level: This property defines the degree of isolation between the state changes performed by different atomic transactions. This is not applicable for Long-Running transactions. BizTalk supports three isolation levels. These are ‘Read Committed’, ‘Repeatable Read’ and ‘Serializable’. The last one being the default value.

Retry: A boolean value which specifies that the atomic transaction can be retried in the event of a failure. Perform the following for Retry-”throw an instance of Microsoft.XLANGs.BaseTypes.RetryTransactionException” within the transaction boundary. 


15. What is atomic Transaction?

It follows full ACID properties Atomicity, Consistency, Isolation and Durability. If you require full ACID properties on the data—for example, when the data must be isolated from other transactions—you must use atomic transactions exclusively.

When an atomic transaction fails, all states are reset as if the orchestration instance never entered the scope.

16. What is long running transaction?
Long running transaction support CD properties of ACID. It is not practical to lock transaction for a long time. This transaction can run indefinitely and can be dehydrated also.

17 .Does BizTalk support synchronous communication?

BizTalk Server architecture is asynchronous for scalability reasons. However, the architecture of the BizTalk Messaging Engine enables exposing a synchronous message exchange pattern on top of these asynchronous exchanges. To do this, the engine handles the complex task of correlating the request and response messages across a scaled-out architecture by linking together a number of asynchronous message exchanges to expose a synchronous interface.

18. What is meant by Virtual Directory? Why do we use?

I assume that we are talking about publishing schemas or orchestration as web service or WCF service. The publishing wizard publishes service at IIS (isolated host) in the virtual directory (the directory at which schema reference is given and config file for this). this is also called as service end point where we receive messages.

19. What is correlation?

An Orchestration can have more than one instance running simultaneously. Even though each of those multiple instances perform the same action, it does it on different data contained within a message. Correlation is a process of associating an incoming message with the appropriate instance of an orchestration. For Example: If your orchestration issues a purchase order, receives an invoice, and sends a payment, the developer must make certain that the invoice message is received by the orchestration instance which corresponds to the orchestration that sent the Purchase Order. Without correlation, it would be possible to send out an invoice for thousands of items even though the purchase order is for one.

20. What is Dehydration?

When an orchestration has been idle for a while, the orchestration engine will save the state information of the instance and free up memory resources.

21. What is Rehydration?

When a message is received, or else when a timeout has expired, the orchestration engine can be automatically triggered to rehydrate the instance – it is at this point that the orchestration engine loads the saved instance of the orchestration into memory, restores the state, and runs its from the point it left off.

22. What are the execution modes in a pipeline Stage?

A stage in a pipeline has an execution mode of either “All” or “First Match”, which controls the components that get executed if more than one component is added to a stage.

For stages with a mode of “All”, each component is called to process the message in the order in which they are configured in the stage.

For stages with a mode of “First Match”, each component is polled to indicate that it is the right component until a match is found, at which point the component that matches is executed, while the remaining components do not get executed.

23. Which Interfaces do you need to implement in a disassembling custom pipeline component?

A disassembling pipeline component receives one message on input and produces zero or more messages on output. Disassembling components are used to split interchanges of messages into individual documents. Disassembler components must implement the following interfaces:

IBaseComponent.
IDisassemblerComponent.
IComponentUI.
IPersistPropertyBag.

24. What is a link in a Map?

A link specifies the basic function of copying data from an element or attribute in an input instance message to an element or attribute in an output instance. You create links between records and fields in the source and destination schemas at design time. This drives the creation, at run time, of an output instance message conforming to the destination schema from an input instance message conforming to the source schema.

25. How to route binary data?

To route binary data you can use pass-through pipelines on the receive location and send port. BizTalk will route (copy) the data from the source (receive location) to the destination (send port). If you want to route the binary data based on some information in the binary data then you write a custom Disassembler to promote the properties you need from the incoming message to route the binary data.

26. How do you call a Non-Serializable .Net helper class inside an Expression Shape?

• Add a reference to that class.
• Make sure your Orchestration is Long Running transactional.
• Add an Atomic scope.
• Create an Orchestration variable of that class inside the scope.
• Create an instance on that object inside the scope.
• Call the method.
• Bonus: Mention the class must be strongly signed and in the GAC.

27. How do you achieve First-In-First-Out message processing of messages received from multiple sources using an Orchestration?

• Use a Sequential Convoy to process the messages in the order they are received into the Message Box.

• Make sure Ordered Delivery is set to True inside the Orchestration Receive Port.

28. When working with Schemas, Maps, Pipelines, and Orchestrations, how should the projects be structured?

• Schemas and Maps in its own project
• Or Schemas and Maps together in its own project
• Orchestrations in its own project
• Pipelines in it own project

29. What are Persistence Points and what causes them?

• Persistence is when the state of a running Orchestration is stored into SQL.
• It is good enough to know various shape and actions cause persistence. More specifically, it occurs: end of a transactional scope, at a send shape, at a start Orchestration shape, during dehydration, if the system shuts down expectedly or unexpectedly, or the business process suspends or ends.

30. What group does a user need to belong to in order to submit messages to the message box?

The user needs to be a member of the hot group or isolated host group (assuming a default installation).

31. What user rights do you need to perform most actions in HAT?

BizTalk Server Administrator

32. When installing Biztalk in a multi-server configuration with a remote SQL and Analysis Services, what SQL components do you need on the Biztalk Server?

SQL Analysis Services Client Tools

33. When installing Biztalk and SQL on a Windows XP SP2 Desktop, what pre-requests are required?

 I always referrer to the most current updated installation guide from Microsoft.

34. Can an Envelope schema consist of more than one schema type?

Yes. Technically it is possible.

35. Can a flat file message be processed without a pipeline?

A Pipeline's job is to convert any external format into XML, be it a flat file or EDI or anything else.

36. Can multiple messages be processed or batched without an envelope schema?

It is possible to process multiple messages, without an envelope.

37. What is property promotion, why is it required?

When a property is Promoted, it is exposed to the orchestration/send port filters etc.

38. In which scenarios would use a "promoted property" vs "distinguished fields"?

The rule here is, if you dont want the schema element to appear in send port filters/debugging information then make it a distinguished field.

39. What are un-typed messages, how does one create them?

A message created in BizTalk Orchestration is bound to a schema, this is a typed message. In un-typed messages, the message is bound to System.Xml.XmlDocument instead of a schema.

40. How does one enable subscriptions in BizTalk?

A filter on the Send Port is the first step to enable subscriptions in BizTalk.

41. What is the difference between a delay shape vs a listen shape?

A 'Delay' is very much similar to a sleep on the current thread. A 'Listen' shape is used to wait for an incoming resource, with a timeout period.

42. When you use Call Orchestration shape vs Start Orchestration shape?

A Call Orchestration returns the control back to the caller. A Start Ochestration shape starts the orchestration in a non-deterministic way.

43. What is the difference between a "Message Assignment" shape and an "Expression" shape?

A "Message Assignment" shape is used to create a new message and assign values to it. A Expression shape is used to assign values to variables and also write 'if' conditions.

44. Does BizTalk Orchestrations support recursion?

An Orchestration does NOT support recursion.

45. What is the purpose of the property "Activate" in a Receive shape?

It is used to invoke a new instance of an Orchestration.

46. Can an orchestration Start without an Activatable receive?

A Nested Orchestration can be started without an Activatable receive

47. Is it necessary for all .NET components being called from an Orchestration be Serializable?

Yes it is necessary. There are cases where a .NET component need not be Serializable.

48. When do we need set the property "Synchronized" = true for a scope?

This needs to be set, when a variable is shared across the branches of a parallel shape.

49. How does one enable Correlations in BizTalk?

First create a Correlation type and then create an instance of it.

50. In an Orchestration design, Orchestration "A" calls another Orchestration "B", and vice versa. Is it possible to implement this design?

It is NOT possible, since it forms a cyclic dependency.

51. List out the three important things to consider while designing a BizTalk orchestration!

The Incoming data format, The Business process and The Outgoing data format.

52. What are Host and Host Instance? Did you deploy BizTalk more than one machine?

Host is nothing but the logical container of host instance. from which we can create host instance. Host instance is a Win-NT service.

A BizTalk Server Host is a logical set of zero or more BizTalk Server run-time processes in which you deploy items such as adapter handlers, receive locations (including pipelines), and orchestrations.

A host instance is the process where the message processing, receiving, and transmitting occurs You install a host instance on each server running BizTalk Server 2006 that has one
or more hosts mapped to that server.

53. What is Message routing and Content routing?

When A message is passed through biztalk without being processed then it is called Message Routing. When A message is passed based on certain field value of schema, it is called content routing.

54. What are the security groups created by BizTalk?

SSO Administrators
SSO Affiliate Administrators
BizTalk Server Administrators
BizTalk Server Operators
BizTalk Application Users
BizTalk Isolated Host Users

55. What is the difference between Windows Workflow and BizTalk server? Explain the scenarios.

I want to put a definition around BizTalk to make it easier to compare to Windows Workflow.  BizTalk Server is an enterprise level workflow and message processing environment.  This environment is tried and tested (extremely rigorously over the last many years).  BizTalk also includes many adapters to connect to a variety of back end system.  Out of the box, BizTalk provides scalability, manageability, tracking, logging & administration tools.

Windows Workflow is an SDK for creating workflow based applications.  The tools are there to  build a host and to render a graphical workflow environment.  Scalability is possible with Windows Workflow but it is up to the developer to create a truly scalable solution.  In addition, there are administrative functions through runtime and tracking visibility but there is not an out of the box administration tool as this is also up to the host developer to create.

The message that I tell people is to use BizTalk when you want to target users/clients that want to span multiple applications whereas Windows Workflow would be used when you want to target users/clients that want workflow within an application.

So, to summarize, Windows Workflow is great for workflow within an application whereas BizTalk is great for workflow across applications.

56. Why do we need convoy?

When a group of correlated messages could potentially be received at the same time, a race condition could occur in which a correlation set in a particular orchestration instance must be initialized by one of the messages before the other messages can be correlated to that orchestration instance. To ensure that all of the correlated messages will be received by the same orchestration instance, BizTalk detects the potential for such a race condition and treats these messages as a convoy.

Convoy is a term which we use to describe a class of application protocols, specifically it is a set of application protocols which have a race condition as described above. Let’s take an example. Say you are a hospital and want to have a service which handles all information about each patient. For a given patient you have three types of messages, an admittance message, status messages, and a discharge message. If you look at your protocol, you will have built a service which just receives. Now let’s think about what could happen. Let’s say you send the patient admittance message and it goes through the system using maybe a synchronous protocol like HTTP. That means when you get the 202 back, you know the message has been delivered. But what if the BizTalkServer host which is actually supposed to process the message hasn’t started yet (ie the nt service is stopped). Maybe you had a power outage, maybe some intern decided to “hit this button”, who knows. So the orchestration instance which is supposed to handle all messages for patient X has not physically started. The message is in the database (MessageBox) and if you look in HAT you will see the orchestration is marked as ready to run, but it can’t start cause there is no where for it to start.

57. What are the challenges you have faced using Soap Adapter?
Twenty minutes timeout issue. You have to host webservices in the same machine. There is a way I heard but I didn’t do much reading on it.

58. Where and how did you use WebServices in Orchestration?

We can use webservices where we need to get data from multiple sources in one go. For e.g. getting price quote from 10 different vendors. You make one orchestration and use WS inside it.

59. What are the draw-backs of BizTalk?

Not a very good support with legacy system. Like we faced tons of issue which we had to solve it someway or the other but Microsoft could not come up with a very good answer.

What has been your most difficult challenge in implementing Biztalk applications in the real world?


I think with biztalk things were not THAT challenging but with legacy systems things were. Like calling a webservice from oracle, or getting a LARGE object from orchestration into a oracle. And things like that.

About the Author

I have more than 10 years of experience in IT industry. Linkedin Profile

I am currently messing up with neural networks in deep learning. I am learning Python, TensorFlow and Keras.

Author: I am an author of a book on deep learning.

Quiz: I run an online quiz on machine learning and deep learning.