Wednesday, December 4, 2013

Nitheen Kumar

C Language Interview Questions 11

151. Difference between pass by reference and pass by value?
Pass by reference passes a pointer to the value. This allows the callee to modify the variable directly.Pass by value gives a copy of the value to the callee. This allows the callee to modify the value without modifying the variable. (In other words, the callee simply cannot modify the variable, since it lacks a reference to it.)

152. What are enumerations?
They are a list of named integer-valued constants. Example:enum color { black , orange=4,yellow, green, blue, violet };This declaration defines the symbols “black”, “orange”, “yellow”, etc. to have the values “1,” “4,” “5,” … etc. The difference between an enumeration and a macro is that the enum actually declares a type, and therefore can be type checked.

153. Are pointers integer?
No, pointers are not integers. A pointer is an address. It is a positive number.

154. What is static memory allocation?
Compiler allocates memory space for a declared variable. By using the address of operator, the reserved address is obtained and this address is assigned to a pointer variable. This way of assigning pointer value to a pointer variable at compilation time is known as static memory allocation.

155. What is dynamic memory allocation?
A dynamic memory allocation 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 function are assigned to pointer variables, such a way of allocating memory at run time is known as dynamic memory allocation.

156. What 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

157. What is a 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 the larger program. Such sub programs are called functions.

158. Difference between formal argument and actual argument?


Formal arguments are the arguments available in the function definition. They are preceded by their own data type. Actual arguments are available in the function call. These arguments are given as constants or variables or expressions to pass the values to the function.

159. what are C tokens?
There are six classes of tokens: identifier, keywords, constants, string literals, operators and other separators.

160. What are C identifiers?
These are names given to various programming element such as variables, function, arrays.It is a combination of letter, digit and underscore.It should begin with letter. Backspace is not allowed.

161. Difference between syntax vs logical error?
Syntax Error
These involves validation of syntax of language.
compiler prints diagnostic message.
Logical Error
logical error are caused by an incorrect algorithm or by a statement mistyped in such a way that it doesn’t violet syntax of language.
difficult to find.

162. What are the facilities provided by preprocessor?

file inclusion
substitution facility
conditional compilation

163.What do the functions atoi(), itoa() and gcvt() do?
atoi() is a macro that converts integer to character.
itoa() It converts an integer to string
gcvt() It converts a floating point number to string

164. What is FILE?
FILE is a predefined data type. It is defined in stdio.h file.

165. What is a file?

A file is a region of storage in hard disks or in auxiliary storage devices.It contains bytes of information .It is not a data type.

Prv 1 2 3 4 5 6 7 8 9 10 11 Next

Subscribe to get more Posts :