Qus. 01: Write down briefly the history and importance of C language.
Ans. : History of C : C language is one of the most popular computer languages today because it is a structured, high level, machine independent language. It allows software developers to develop software without worrying about the hardware platforms where they will be implemented.
The following flowchart shows the history of ANSI C .
Kernighan & Ritchie
Importance of C : C is a very important language because of its many useful features. The increasing popularity of C is due to its many desirable qualities. It is a robust language whose rich set of built in functions and operators can be used to write any complex program. It allows software developers to develop software without worrying about the hardware platforms where they will be implemented. The C compiler combines the capabilities of an assembly language with the features of a higher level language and therefore it is well suited for both system software and business packages. Else these,
(i) C language is efficient and fast.
(ii) C is highly portable.
(iii) C language is well suited for structured programming.
(iv) C is a machine independent language.
(v) C has the ability to extend itself.
Qus. 02 : Define preprocessor, function, compile time, run time.
Ans. : Preprocessor : It is a program that process the source code before it passes through the compiler.
Function : A function is a subroutine that may include one or more statements designed to perform specific tasks. For C programming functions are as building blocks.
Compile time : Compile time refers to the event that occur during the compilation process.
Run time : Run time refers to the event that occur while the program is actually executing.
Ans. : #include directive : C programs are divided into modules or functions. Some functions are written by users and some are stored in C library. Library functions are grouped category wise and stored in different files known as header files. To access the file stored in the library, it is necessary to tell the compiler about the files to be accessed. This is achieved by the preprocessor directive #include as follows,
Filename is the name of the library file that contains the required function definition. Preprocessor directives are placed at the beginning of the program.
Qus. 04: Write down the basic structure of C programming.
Ans. : Basic structure of C programming : To write a C program, we first create functions and then put them together. A C program may contain one or more sections. They are illustrated below.
Global declaration section
main () Function section
i) Documentation section : The documentation section consists of a set of comment lines giving the name of the program, the author and other details, which the programmer would like to use later.
ii) Link section : The link section provides instructions to the compiler to link functions from the system library.
iii) Definition section : The definition section defines all symbolic constants.
iv) Global declaration section : There are some variables that are used in more than one function. Such variables are called global variables and are declared in the global declaration section that is outside of all the functions. This section also declares all the user-defined functions.
v) main () function section : Every C program must have one main function section. This section contains two parts; declaration part and executable part.
(a) Declaration part : The declaration part declares all the variables used in the executable part.
(b) Executable part : There is at least one statement in the executable part.
These two parts must appear between the opening and closing braces. The program execution begins at the opening brace and ends at the closing brace. The closing brace of the main function is the logical end of the program. All statements in the declaration and executable part end with a semicolon.
vi) Subprogram section : The subprogram section contains all the user-defined functions that are called in the main () function. User-defined functions are generally placed immediately after the main () function, although they may appear in any order.
All section, except the main () function section may be absent when they are not required.
Qus. 05: What is #define directive ?
Ans. : #define directive :
(i) A #define is a preprocessor compiler directive and not a statement.
(ii) #define should not end with a semicolon.
(iii) Symbolic constants are generally written in uppercase so that they can be easily distinguished from the lowercase variable names.
(iv) #define instructions are usually placed at the beginning before the main() function.
Qus. 06: Write down about ‘executing a C program’.
Ans. : Executing a C program : Executing a C program involves a series of steps. They are,
i) Creating the program.
ii) Compiling the program.
iii) Linking the program with functions that are needed from the C library.
iv) Executing the program.
Although these steps remain the same irrespective of the operating system, system command for implementing the steps and conventions for naming files may differ on different system.
Qus. 07: What is operating system ?
Ans. : Operating system : An operating system is a program that controls the entire operation of a computer system. All input/output functions are channeled through the operating system. The operating system which is the interface between the hardware and the user, handles the execution of user programs.
Qus. 08: Draw the flow chart of the process of compiling and running a C program?
Ans. : The flow chart of process of compiling and running a C program is as follows,
ক্রেডিট : তন্ময় চক্রবর্তী