Saturday, October 1, 2022

4. C Programming [Theory Questions/Answers]

 4. C Programming

 

Structured programming

The programming that follows a top- down approach, on which developers separate the overall program structure into different sub selection, is called structured programming.

 

Advantages of structured programming

a)     It is easy to design code and test the program modules independently

b)     It is possible to use a single module in different in different places which reduces program codes.

 

C language
C language is a structured programming language that divides program into many functions.

Dennis Ritchie at Bell telephone laboratory developed C-language in 1972 AD. 

C is called middle level language because it combines elements of high level language with some features of assembler.

C is mostly used to write system program such as operating system, language, compiler, text editor, language interpreters, utilities, etc.

Data types used in C
Data type are means to identify the type data and associated operation of handling it.

 

Data types used in C language

a) char       b) int   c) float  d) double

Characteristics of C language

a)     It is a high level language with some features of low level language.

b)     It is mostly used to prepare system software.

c)     It has enough number of inbuilt functions and operators.

d)     It occupies less memory space.

Advantages of C language

a)     It is machine independent programming language

b)     It is easy to learn and implemented C language

c)     It can be implemented from mobile device to mainframe computers.

d)     It is the mother of all modern programming language like python, pearl 5 and PHP

Disadvantages of C language

a)     There is no runtime checking. It has poor errors detection system.

b)     On large programs , it is hard to find errors.

c)     There is no strict type checking int data type to float variables.

d)     It does not support modern programming methodologies oriented programming language.

Counter

Counter is a variable which controls the loop statement and provides the track to run the loop statement in certain number times.

Accumulator

Accumulator is a numeric variable which accumulates the values in a loop statement.

Variable

A variable is a location in the memory of a computer whose value may change during the execution of program.

Constant

Constant are the values that do not change during the execution of a program.

Operator [SQE 2075K]

Operators are special symbols that are meant for specific tasks or operators.

The different types of C operators are:- Arithmetic operators, Assignment operators, Unary operators,  Relational operators, Logical operators and Conditional operators.

Arithmetic operators are the operators that are used for manipulating arithmetic data and performs arithmetic operation. The arithmetic operators are:-   +,     - ,      * ,    / and   %

The operator that operate on one operand variable or constant is called urinary operator. E.g. ++, - -

Logical Operator [SEE 2075]

The operators used for logical operation is called logical operator.

Selection statement.

Selection statement is a statement that allows the selective execution o statements depending on the value of an an expression. The selection statements of C program are:-  If statement and Switch statement

Loop

A set of statements which is used to repeat a block of statements for a specific number of times or as long as the condition is true/false is called loop.

The looping statements provided by care:-For loop, While loop and Do.....while loop

No comments:

Post a Comment