Questions on C Language Introduction
Questions on C Language Introduction
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 a Programming language?
Programming language is any language that computer system can understand directly or indirectly to can perform the actions asked by the programmer as set of instructions in form of a computer program. A program is written as a series of human understandable computer instructions that can be read by a compiler and linker and translated into machine code so that a computer can understand and run it.
3. What is history of C Language?
C is a programming language which born at “AT & T’s Bell Laboratories” of USA in 1972. It was written by “Dennis Ritchie”. This language was created for a specific purpose that is to design UNIX operating system which is used on many computers. From the beginning C was intended to be useful to allow busy programmers to get things done because C is such a powerful, dominant and supple language, its use quickly spread beyond Bell Labs in the late 70’s.
4. Why name ‘C’ was given to language?
The C language is called so because of a very simple reason. It was named after the language that was called B. The very first UNIX systems were written in low level assembler language. These systems were built for working with PDP-7, the minicomputer, which was introduced in 1965. Ken Thompson developed a compiler for high level language, which was called B. This was a new approach in computer programming. The B language helped to avoid thousands of pages of delicate and strict assembler programming. It enabled the possibility to express given task in only a few lines of code. The development of B language helped to improve UNIX system much faster. The programming became convenient, fast and creative.
The 16-bit microcomputer PDP-11 was released in 1970. After this computer has arrived at Bell Laboratories, Dennis Ritchie started working with it. He worked with B language to create a new language. He called this high level language as C. This name is very concise and easy to remember. But the reason why C became so popular is its functionality and very well developed structure.
5. What is the purpose of C language?
• In C one can write programs like that of high level languages as in COBOL, BASIC, FORTRAN etc. as well as it permits very close interaction with the inner workings of the computer.
• It is a general purpose programming language. It is usually called system programming language but equally suited to writing a variety of applications.
• It supports various data types
• It follows the programming style based on fundamental control flow constructions for structured programming.
• Functions may be pre–defined or user defined and they may return values of basic types, structures, unions or pointers.
6. What type of language is C?
C is a general purpose, structured programming language. Its instructions consist of terms that resemble algebraic expressions, augmented by English Keywords such as if, else, for, do and while. In this respect C resembles other high-level structured programming languages such as Pascal and FORTRAN. C also contains certain additional features that allow it to be used at a lower level thus bridging the gap between machine language and the more conventional high-level languages. This flexibility allows C to be used for systems programming (E.g.: writing operating systems) as well as for applications programming.
7. Why C is called Middle level language?
C programming bridges gap between traditional Machine Understandable Machine level language and more conventional High level languages. User can use C Language to do system programming for writing operating system as well as application programming. Middle Level programming languages are closely related to Machine as well as Human being.
• C programming supports Inline Assembly Language programs.
• Using inline assembly language feature in C we can directly access system registers.
• C programming is used to access memory directly using pointer.
• C programming also supports high level language features.
• It is more User friendly as compare to previous languages so C programming is Middle level language.
8. Is C Case Sensitive Language?
Yes … in capital letter and lower letter have different meaning in c language. So C language is a case sensitive language.
9. What are the advantages of C language?
• Easy to write
• Rich set of operators and functions that are built–in
• Support for bit–wise operation
• Flexible use of pointers
• Direct control over the hardware
• Ability to access BIOS/DOS routines
• Interacting using Interrupts
• Ability to write TSR programs
• Ability to create .COM files
• Ability to create library files (.LIB)
• Ability to write interface programs
• Incorporating assembly language in C program.
10. What are the disadvantages of C language?
• There is no runtime checking.
• There is no strict type checking (for ex: we can pass an integer value for the floating data type).
• As the program extends it is very difficult to fix the bugs.
11. What are the steps of executing a C Program?
The steps involved in executing a C Program are:
• Creating and Editing
• Executing program
Creating and Editing: Writing or creating and editing a source program is a first step in c language. Source code is written in c programming language according to the type of problem or requirement, in any text editor.
Compiling: Computer does not understand c programming language. It understands only 0 and 1 means machine language. So c programming language code is converted into machine language. The process of converting source code in to machine code is called compiling.
Linking: There are many built in library functions available in c programming language. These functions are stored in different header files.
Executing program: Execution is the last step. In this step program starts execution. Its instructions start working and output of the program display on the screen.
12. What is a compiler?
A computer program which reads source code and outputs assembly code or executable code is called a compiler. A program that translates software written in source code into instructions that a computer can understand software used to translate the text that a programmer writes into a format the CPU can use. A piece of software that takes third-generation language code and translates it into a specific assembly code, compilers can be a quite complicated piece of software.
Example: C Compiler.
13. What is an interpreter?
In computing, an interpreter is a computer program that reads the source code of another computer program and executes that program. Because it is interpreted line by line, it is a much slower way of running a program than one that has been compiled but is easier for learners because the program can be stopped, modified and rerun without time-consuming compiles.
14. Differences between Compiler & Interpreter?
Compiler Vs Interpreter:
We give the complete program as input to the compiler. Our program is in the human readable format. Human readable format undergoes many passes and phases of the compiler and is finally converted into the machine understandable format. However interpreter takes every single line of the code as input at a time and will execute that line. It will terminate the execution of the code as soon as it finds an error. Memory requirement is less in case of an interpreter as no object code is created in case of an interpreter.
15. Differences between Source code & Object code?
Source code is in the form of a Text and is Human Readable. Source code is generated by Human and it is input given to the compiler.
Object code is in the form of Binary numbers and it is in Machine Readable format. Object code is generated by the Compiler and it is the output of the Compiler.