Interview Questions on C Introduction
1. What is C?
‘C’ language is a general-purpose computer programming language with features economy of expression, modern flow control and data structures, and rich set of operators developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. C is considered to be the mother language of all high level languages. In recent years C has been used as a general-purpose language because of its popularity with programmers.
2. Why to use C language?
C language was initially used for system development work in particular the programs that make-up the operating system. C was adopted as a system development language because it produces code that runs nearly as fast as code written in assembly language.
Use of C language might be in the following areas: Operating Systems, Language Compilers, Assemblers, Text Editors, Print Spoolers, Network Drivers, Modern Programs, Data Bases, Language Interpreters, and Utilities.
3. What is a history of C language?
C is a successor of B language which was introduced around 1970. In 1972, Dennis Ritchie at Bell Labs wrote C and in 1978 the publication of The C Programming Language by Kernighan & Ritchie caused a revolution in the computing world. By 1973, UNIX OS almost was totally written in C. In 1983, the American National Standards Institute (ANSI) established a committee to provide a modern, comprehensive definition of C. The resulting definition, the ANSI standard, or “ANSI C”, was completed late 1988. Today C is the most widely used System Programming Language.
4. Why C language is still Useful?
C provides efficiency, high performance, and high quality softwares, flexibility and power, many high-level and low-level operations like middle level, stability and small size code, provide functionality through rich set of function libraries, and gateway for other professional languages like C, C++, and Java.
5. Where C language is used?
C is used for system software Compilers, Editors, embedded systems, data compression, graphics and computational geometry, utility programs, and databases, operating systems, device drivers, system level routines. There are zillions of lines of C legacy code. It is also used in application programs.
6. How many stages are there in development of C language?
There are four stages in development with C.
Editing: Writing the source code by using some IDE or editor.
Preprocessing or libraries: Already available routines.
Compiling: Translates or converts source to object code for a specific platform source code -> object code.
Linking: Resolves external references and produces the executable module.
7. How C language is different from Assembly language?
Compared to assembly, C is high level (C has functions, while and for loops, etc.) and portable (only C compiler must be ported for each platform, all applications stay the same).
8. How many keywords are there in C language?
The C programming language contains only 32 keywords. This makes it a small language when compared to others. It is also very stable, fast, and has been so widely used that the syntax is the basis for many other languages such as c#, c++, and Perl. In addition, C is considered one of the easiest languages to learn because of one basic philosophy: Programmers know what they are doing.
9. Why C language is called as compiled language?
C language is called as a compiled language because once you write your C program, you must run it through a C compiler to turn your program into an executable that the computer can run (execute). The C program is the human-readable form, while the executable that comes out of the compiler is the machine-readable and executable form. To write and run a C program, you must have access to a C compiler.
10. What is a program?
A program is a set of instructions for performing a particular task. These instructions are just like English words. The computer interprets the instructions as 1’s and 0’s. This program can be written in assembly language as well as in high-level language. This written program is called the source program. The source program is to be converted to the machine language, which is called as an object program. A translator is required for such a translation.
11. What is program translator?
Program translator translates source code of programming language into machine language-instruction code. Generally, computer programs are written in languages like COBOL, C, BASIC and ASSEMBLY LANGUAGE, which should be translated into machine language before execution.
12. How many types of programming language translators are there?
The programming language translators are classified as follows:
13. What is an Assembler?
An assembler translates the symbolic codes of programs of an assembly language into machine language instructions. The symbolic language is translated to the machine code in the ratio of one is to one symbolic instructions to one machine code instructions. Such types of languages are called low-level languages. The assembler programs translate the low-level language to the machine code. The translation job is performed either manually or with a program called assembler.
14. What is a Compiler?
Compilers are the translators, which translate all the instructions of the program into machine codes, which can be used again and again. The program, which is to be translated, is called the source program and after translation the object code is generated. The source program is input to the compiler. The object code is output for the secondary storage device. The entire program will be read by the compiler first and generates the object code. However, in interpreter each line is executed and object code is provided. An example of interpreter is M-BASIC. High-level languages such as C, C++ and Java compilers are employed. The compiler displays the list of errors and warnings for the statements violating the syntax rules of the language. Compilers also have the ability of linking subroutines of the program.
15. What is an Interpreter?
Interpreters help the user to execute the source program with a few differences as compared to compilers. The source program is just like English statements in both interpreters and compilers. The interpreter generates object codes for the source program. Interpreter reads the program line by line, whereas in compiler the entire program is read by the compiler, which then generates the object codes. Interpreter directly executes the program from its source code. Due to this, every time the source code should be inputted to the interpreter. In other words, each line is converted into the object codes. It takes very less time for execution because no intermediate object code is generated.
16. What is linking in C language?
C language provides a very large library, which contains numerous functions. In some applications of C, the library may be a very large file. Linker is a program that combines source code and codes from the library. Linking is the process of bringing together source program and library code.
The library functions are re-locatable. The addresses of various machine codes are defined absolutely and only the offset information is kept. When the source program links with the standard library functions, offset of the memory addresses is used to create the actual address.
C Language Interview Questions