<xmp> <body> </xmp> C programming language


C / Programming Languages

Q1. What is the difference between a local and a global variable ?

A1. A local variable is visible only to the routine it is declared in. It is created on entry to the sub-routine and is destroyed on exit from the routine. A global variable is visible to all the routines in a program.

Q2. What is the call by value method ?

A2. A variable passed by value cannot be modified by the sub-routine and the new value reflected back in the calling code.

Q3. What are the advantages of laying out code to a company standard ?

A3. There is no fixed answer to this but readability and maintainability should get mentioned somewhere.

Q4. What is the name of the entry function to every C program ?

A4. main

Q5. What are the arguments commonly passed to main ? What do they hold ?

A5. argc is the number of command line argument, argv is a pointer to an array holding the command line arguments.

Q6. What routines are used to program signal handling into a C program.

A6 signal() and sigset().

Q7. Name three types of inter-process communication mechanisms available to C programmers ?

A7. Pipes, Semaphores , Shared Memory, Message Queues.