Top C Programming Interview Questions & Answers. last updated March 19, /13 . In C programming, source codes are saved with the file extension.C, while object codes are saved with the file .. Download PDF · Facebook Twitter. Learning C Language is the first important step that a science student take in the journey of their education. C language comprises of several. C Interview Questions and Answers for Freshers or Experienced Pdf. These C programming language was developed at Bell Laboratories in by Dennis.
|Language:||English, Spanish, Arabic|
|Distribution:||Free* [*Registration Required]|
The C programming language is a standardized programming language Visit osakeya.info for more Interview Questions with Answers. Page 2. C language allows the use of the prefix register in primitive variable declarations. Such variables are called Read Top C programming interview questions and answers. Download C programming interview questions PDF. + Basic C Interview Questions and Answers, Question1: What are volatile systems etc offers individuals with great number of Basic C jobs for freshers as Look for Basic C jobs interview questions and answers page and understand the .
The strcat function. It takes two parameters, the source string and the string value to be appended to the source string.
Text files contain data that can easily be understood by humans. It includes letters, numbers and other characters. On the other hand, binary files contain 1s and 0s that only computers can interpret. Yes, it is possible to create a customized header file. Just include in it the function prototypes that you want to use in your program, and use the include directive followed by the name of your header file. Dynamic data structure provides a means for storing data more efficiently into memory.
Using dynamic memory allocation, your program will access memory spaces as needed. This is in contrast to static data structure, wherein the programmer has to indicate a fix number of memory space to be used in the program.
Explain How would you place this character as part of the output on the screen? For example, you can write printf?
Storing data on the heap is slower than it would take when using the stack. Explain However, the main advantage of using the heap is its flexibility. Slowness in the heap can be compensated if an algorithm was well designed and implemented. Preprocessor directives are placed at the beginning of every C program. This is where library files are specified, Explain Which would depend on Explain What functions are to be used in the program.
Another use of preprocessor directives is the declaration of constants. Preprocessor directives begin with the symbol. Just the same, s! Order of precedence determines Explain Which operation must first take place in an operation statement or conditional statement.
On the top most level of precedence are the unary operators! Instead, use the strcpy function. To get the length of a string value, use the function strlen. This is because C language is rich in features that make it behave like a high level language while at the same time can interact with hardware using low level methods. The use of a well structured approach to programming, coupled with English-like words used in functions, makes it act as a high level language.
On the other hand, C can directly access memory structures similar to assembly language routines. Question 9.
Define Static Identifier In C? This value can be used between function calls. The default value of an uninitialized static variable is zero. A function can also be defined as a static function, which has the same scope of the static variable. Question What Are The Auto Variables? Where Are They Stored? The auto variables are stored in the main memory of the system.
The keyword 'auto' is optional. Many of the variables used by the program or application are 'auto' variables, being the main memory is faster.
These variables are stored in the memory runtime stack. It is de-allocated at the completion of its block execution.
It is a local variable which is allocated and deallocated automatically when the program flow enters and leaves the variable's scope. The difference between arrays and linked lists are: A set of named integer constants is known as an enumeration. The enumeration type declaration includes the name of the enumeration tag and the definition of a set of named integers.
Variables of enumeration type persists one of the existing values of the enumeration set. The enum type variables could be utilized in indexing expressions, as operands of all arithmetic and relational operators. ANSI C enum expressions are always have int type, which occupies the memory space that occupied by the int type.
The identifier sunday is explicitly assigned with 0. The remaining identifiers are given values 1 through 5 by default. The scope of a variable is specified by its storage allocation.
This is specified by the keywords — auto, extern, static and register. The keyword typedef is used for defining user defined data types. A new definition of existing data types is created by using typedef. It is used to define user defined identifiers which can be used in substitution of type specifiers such as int, float etc.
It does not reserve memory space. The names defined by typedef are synonyms for the data types. If Possible How? The fgets function is safer to use. It checks the bounds, i. The gets function does not check the bounds. The gets function is an insecure and careless use can lead to errors.
The function strcpy will not allocate the memory space to copy. A pointer to the string to copy and a pointer to place to copy it to should be given. This memory space needs to be freed up later when it is of no use anymore. For char array, such size is not accepted by the compiler.
Define Void Pointer? A void pointer is pointer which has no specified data type. It is also known as a generic pointer. The void pointer can be pointed to any type. If needed, the type can be cast.
A void pointer is generally used as function parameters, when the parameter or return type is unknown. What Is A Const Pointer?
A const pointer is not the pointer to constant, it is the constant. In the above example it is not, Hence it is not the pointer to constant. The ptr can not be used to point to another integer. The integer pointed by ptr can be changed. The const pointer can not be changed to point to other memory location, because the pointer is constant. Explain Memory Leak? An unwanted increase in programs is referred to as a memory leak is C language. The intake of the program increases in the memory by an unintentional consumption of the memory.
If the program is getting corrupted and results in errors, it means the memory leak. In case there is a leak by any program, the function of the system may stop and violate operating system files. It is the gradual loss of available computer memory when a program repeatedly fails to return memory that it has obtained for temporary use. It becomes exhausted and the program becomes no longer to perform properly.
It is the result of a program bug. Static Memory Allocation: Memory is allocated for the declared variable by the compiler. The memory is allocated during compile time.
Since most of the declared variables have static memory, this kind of assigning the address of a variable to a pointer is known as static memory allocation. Dynamic Memory Allocation: Allocation of memory at the time of execution run time is known as dynamic memory allocation. The functions calloc and malloc support allocating of dynamic memory. Dynamic allocation of memory space is done by using these functions when value is returned by functions and assigned to pointer variables.
The execution of the program always starts with main function. A define is used as immediate constant or as a macro. Where as the constant is a variable whose value can not change. Pointer can be declared to a constant, but not for define. Where as the constant can be global. There are four storage classes in C.
One of the instructions in the function is a call to the function itself, usually the last statement. In some ways it is similar to looping. The process of calling a function by itself is known as recursion.
Recursion is generally used when the result of the current function call is the input to the successive call of itself. By definition, the factorial of the current digit is the factorial of its previous digit and the digit. In order to get the factorial of the previous digit, the same function should return the factorial. Thus the result of the previous execution of the function is one of the inputs of the current execution.
The process continues until an exit condition returns true. Question 5. Answer : Static variable is available to a C application, throughout the life time.
At the time of starting the program execution, static variables allocations takes place first. In a scenario where one variable is to be used by all the functions which is accessed by main function , then the variable need to be declared as static in a C program. The value of the variable is persisted between successive calls to functions. One more significant feature of static variable is that, the address of the variable can be passed to modules and functions which are not in the same C file.