Tuesday, November 8, 2016

C VIVA QUESTIONS PART 2

C VIVA QUESTIONS PART 2

1. Structure of C Program.


2. Taxonomy of C.




3. Characteristics of C?
  • Small size
  • Extensive use of function calls
  • Loose typing - unlike PASCAL
  • Structured language
  • Low level (BitWise) programming readily available
  • Pointer implementation - extensive use of pointers for memory, array, structures and functions.

4. Applications of C Language?

1. C language is used for creating computer applications
2. Used in writing Embedded softwares
3. Firmware for various electronics, industrial and communications products which use micro-controllers.
4. It is also used in developing verification software, test code, simulators etc. for various applications and hardware products.
5. For Creating Compiles of different Languages which can take input from other language and convert it into lower level machine dependent language.
6. C is used to implement different Operating System Operations.
7. UNIX kernel is completely developed in C Language


5.  Advantages and disadvantages of  C Language.

Advantages of C Language
1. C language is a building block for many other currently known languages. C language has variety of data types and powerful operators. Due to this, programs written in C language are efficient, fast and easy to understand.
2. C is highly portable language. This means that C programs written for one computer can easily run on another computer without any change or by doing a little change.
3. There are only 32 keywords in ANSI C and its strength lies in its built-in functions. Several standard functions are available which can be used for developing programs.
4. Another important advantage of C is its ability to extend itself. A C program is basically a collection of functions that are supported by the C library this makes us easier to add our own functions to C library. Due to the availability of large number of functions, the programming task becomes simple.
5. C language is a structured programming language. This makes user to think of a problem in terms of function modules or blocks. Collection of these modules makes a complete program. This modular structure makes program debugging, testing and maintenance easier.

Disadvantages of C Language

1. C does not have concept of OOPs, that’s why C++ is developed.
2. There is no runtime checking in C language.
3. There is no strict type checking. For example, we can pass an integer value.
4. for the floating data type.
5. C doesn’t have the concept of namespace.
6. C doesn’t have the concept of constructor or destructor.

6. Files used in C Language?

1. Source Files:
Contains Source Program (  .C Extension)
2. Header Files:
A header file is a file with extension .h which contains C function declarations and macro definitions to be shared between several source files. There are two types of header files: the files that the programmer writes and the files that comes with your compiler.
3. Object Files( .o/.obj) :
Object files are generated by the compiler as a result of processing the source code file.
Object files contain compact binary code of function definitions. Linker uses these Object files  to produce an executable file (.exe).
4. Binary Executable files( .exe )
The Binary Executable file is generated by a Linker. The Linker links the various object files to produce binary files that can be directly executed.

7. Compiling and Executing(Running)?

In Linux:

Compiling:
cc program_name.c

Executing:

./a.out

Or


Compiling:
cc –o   object_file_name   program_name.c

Executing:

./object_file_name

 





8. What is a Token?

A Smallest individual Unit in C Program.
·         Keywords
·         Variables
·         Constants
·         Strings
·         Special Characters
·         Operators
9. what  is an Identifier?
Identifier refers to name given to entities such as variables, functions, structures etc.

Rules for writing an identifier

  1. A valid identifier can have letters (both uppercase and lowercase letters), digits and underscores.
  2. The first letter of an identifier should be either a letter or an underscore. However, it is discouraged to start an identifier name with an underscore.
  3. There is no rule on length of an identifier. However, the first 31 characters of identifiers are discriminated by the compiler.
10. Data Types in c?




11. What is Constant?

Constants are identifiers which values do not change.

12. Operators in C?

Operators are the symbols which tell the computer to execute certain mathematical or logical operations.
1.Arithmetic ( +,-,*,/,% )
2. Relational ( <,<=,>,>=,==,!= )
3. Logical ( &&,||,! )
4. Unary Operators  ( -)
5. Increment  /  Decrement  Operators  (  ++ , -- )
6. Conditional   /   Ternary Operator    ( ? : )
7. Bitwise Operators   (  & , | , ^  )
8. Shift Operators  ( <<  ,   >>  )
9. Assignment Operators  ( +=  , -= , *=  ,  /=  ,  %= )
10.Special Operators   ( comma, sizeof )

13. Define Precedence and Associativity?
Precedence :
Operator precedence determines which operator is performed first in an expression with more than one operators with different precedence. For example 10 + 20 * 30 is calculated as 10 + (20 * 30) and not as (10 + 20) * 30.
Associativity:
associativity is used when two operators of same precedence appear in an expression. Associativity can be either Left to Right or Right to Left. For example ‘*’ and ‘/’ have same precedence and their associativity is Leftto Right, so the expression “100 / 10 * 10” is treated as “(100 / 10) * 10”.


Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home