DISHA NIRDESHAN

Enlightens your career

Wednesday, June 8, 2011

Basic Questions of C





 What are the features of C? or What is C language ?
The features of 'C' language are:-
1) It is a modular language... i.e. A large problem can be divided into many sub problems(modules) and tnen can be solved individually... Finally with all the solutions ready one can integrate them and find the final solution to that so called large problem...

c-can be used for systems programming and general purpose programs,
applications of c-language
unix operating system(kernal was implemented by c),games,device driver,editor,compiler
very important of c-language is modularity.through which re-usability,

What are the applications and advantages of C-language?
1.'C' is the only intermediate programming language in between low level and high level programming language.

2.All applications written in "C" will be executed fast.

3.All aeronautical applications , mission critical applications are written in "C".

4.Embedded programming is written in "C".

What is the difference between compile time error and run time error?
Compile time is semantic and syntax error, whereas run time is memory allocation error e.g. segmentation fault.If the program has the compile time error then the program wont execute. Eg: syntax or semantic errors.

If the program has the runtime error then the program would compile successfully with no erros. But the out put was not desired.
eg: dividing with zero.

Can you write a c program without using main function?
The compilation process always starts from the first line of your source code and the compiler checks only syntax, if you don't have a main() not at all a problem. But if you want to execute that you need main(). Check how we are going to create a header file are we going to place a main() in a header file.
we can write the code without main() function. The code will gets compiled and during compilation it won't show any error but while executing it show an error saying LINKER ERROR.
What will the preprocessor do for a program?
The C preprocessor is used to modify your program according to the preprocessor directives in your source code. A preprocessor directive is a statement (such as #define) that gives the preprocessor specific instructions on how to modify your source code. The preprocessor is invoked as the first part of your compiler program?s compilation step. It is usually hidden from the programmer because it is run automatically by the compiler.

The preprocessor reads in all of your include files and the source code you are compiling and creates a
preprocessed version of your source code. This preprocessed version has all of its macros and constant
symbols replaced by their corresponding code and value assignments. If your source code contains any
conditional preprocessor directives (such as #if), the preprocessor evaluates the condition and modifies your source code accordingly.

preprocessor do:1>macro substitution
2>multiple spaces into one
3>including all header files
4>include all conditional compilations
5>removing the comment lines


What is :- Asembler , compiler , Preprocessor , laxical analysis , parsing ?
Assembler:It converts the assembly language into machine level.
Compiler:It converts the high level program into machine level.
Preprocessor: Already defined using #define and used later in the program.
Lexical analysis:It analyze the expression from left to right and separate into tokens.
Parsing:It groups the token collected from the lexical analyser and constructs parse tree.



Is the c is procedure oriented?
yes, C is procedure oriented language because large program is divided into modules.And it is also called structured oriented language.




 C is a structural or highlevel or middle level language which one is correct answer ?
C is a middle level language.

Because this language contains both the features of both high level language

and low level languages.

Also can be called as structured programming language.






0 comments :