Академический Документы
Профессиональный Документы
Культура Документы
The Copyright law protects the original work of autorship and it applies automatically to an original work from
the day it is created until 50 years after the owner's death. Copyright protection means that the owner of the
copyright has the exclusive right to make, use, and sell the original work.
2.A software trademark is any word, name symbol, device or any combination thereof adopted and used by a
manufacturer or merchant to identify its goods and to distinguish them from the goods manufactured or sold by
others.
3.Bit: 0 or 1; Byte: typically 8 bits; Word:machine dependent, a number of bytes.
4. 1kb=1024 bytes; 1MB=1024kb; 1GB=1024MB
12kB=12*1024 bytes=12.288 bytes
3GB=3*1024MB=3.072MB=3.072*1024kb=3.145.728 kb=3.145.728*1024bytes=3.221.225.472 bytes
128MB=128*1024kb=131.072kb=131.072*1024bytes=134.217.728bytes
5.An Interactive Development Environment consists of text editors, translators (assemblers,compilers,interpreters)
and the debugger.
6.The stages needed to produce an executable program from sources are: compilation (the source code is
transformed into relocatable object code), linking (many relocatable binaries are made into one relocatable binary
with all external references satisfied), loading (the relocatable is transformed into absolute binary with all code and
data references bound to the adresses occupied in memory) and execution (control is transferred to the first
instruction of the program).
7. The stages of the compilation process are:
-Lexical analysis (scanning),when the source text is broken into tokens.
-Syntactic analysis (parsing),when the tokens are combined to form syntactic structures, typically represented by a
parse tree. The parser may be replaced by a syntax-directed editor, which directly generates a parse
tree as a product of editing.
-Semantic analysis, when the intermediate code is generated for each syntactic structure.The type checking is also
performed in this phase.
-Machine-independent optimization,when the intermediate code is optimized
to improve efficiency.
-Code generation,when the intermediate code is translated to relocatable
object code for the target machine.
-Machine-dependent optimization,when the machine code is optimized.
On some systems (e.g., C under Unix), the compiler produces assembly
code, which is then translated by an assembler.
8.
-preprocessor-(Source w/Substitutions)-Parser-(Parse tree)-Translation-(Assembly)-Assembler- - ...-(Object file)Linker-(Exe File)-DISK-(Exe File)-OS Exe Loader-(Memory Image)
19. During program maintenance one must make changes for error correction discovered during program usage,
make changes in order to adapt to new requierments. Program documentation is especially important for this stage
and this documentation must be continually updated to reflect changes.
20. Given both the problem and the device, an algorithm is the precise characterization of a method of solving the
problem, presented in a language comprehensible to the device. An algorithm should have the following properties:
application of the algorithm to a particular input set or problem description results in a finite sequence of actions,
the sequence of actions has a unique initial action, each action in the sequence has a unique successor, the
sequence must terminate with either a solution to the problem, or a statement that the problem is unsolvable for
that set of data.
21. The general requirements for an algorithm are the following: finiteness (potential realizability), which means
that the algorithm must terminate after a finite number of stepts, well-defined, meaning that each of the steps is
expressed non-ambiguously, effectiveness, which refers to the fact that the running time should be as short as
possible, and the memory requirements as low as possible and universality in order to allow for a class of problems
to be solved using it.
22. Flowcharts graphically depict the logical steps to carry out a task and show how the steps relate to each other.
They are made using geometric symbols connected by arrows and within each symbol is a phrase presenting the
activity at that step.The shape of a symbol indicates the type of operation
that is to take place. Flowcharts ensure a good presentation of tasks and are easy to follow, but they are timeconsuming to write and update.
23. Pseudocode uses English-like statements which outline a particular task
or process. It is considered to be a short version of the actual computer code, which can be easily translated into a
programming language, it is compact and looks a lot like the final code.
24. Hierarchy charts are similar to a company's organization chart and they display the overall program structure,
describe what each module does and the relations between modules. It is mainly used for initial planning of a
program by creating independent parts and it is read from top to bottom and from left to right,
25.A control structure is a programming language construct which specifies a
departure from the sequential execution patternThe types of control structures used in describing algorithms are:
sequence, decision and loop.
26.Selection is a control structure allowing for the selection of one of many possible alternatives and it can be
achieved by using more decision controls.
case (expression) of
c1,{c1}:sequence1;
c2,{c2}:sequence2;
...
cn,{cn}:sequence n;
rest:sequence_rest; {optional}
endcase;
( expression is of ordinal type)
The first step is to evaluate the expression "expression". Then execute the label ci equal to the value of the
expression and then execute the statement following the block case-endcase. If no label has the value of the
expression, execute the optional sequence labeled rest and then the statements following the block case-endcase.
If neither condition
The first step is for the condition to be evaluated. If result is false, the loop execution is ended, otherwise the
sequence is executed and then go back to the first step. The loop may never be executed if the condition is initially
false and in order for the loop to terminate, the sequence must contain statements which alter the value of
condition.
27. A loop expresses a group of statements which are repeatedly executed,
depending on a condition or a counter.
The first step is to execute the sequence. Then the condition is evaluated. If the result is false then it goes back to
the first step, otherwise the execution is continued with statements following this control. The loop body is
executed at least once.
repeat
sequence
until (condition)
Notes
Control variable is of ordinal type
Initial and final expression are evaluated only
once
Loop body may never get executed
For the downto variant
Test becomes: control_var>=e2
The control variable is decremented
29. The formal parameters are given as:
in identifier {, in identifier}:type
out identifier {, out identifier}:type
inout identifier {, inout identifier}:type
in parameters are input parameters for the procedure,
whose values cannot be changed inside the procedure
body, or, if changed, is not passed to the caller
out parameters are output parameters for the procedure,
whose values is computed inside the procedure body, and
is returned to the caller
inout parameters are parameters whose values are
changed inside the procedure body, the old value is lost,
and the computed value is passed back to the caller.
30. Programming style is a set of general rules concerning the form of a program, and its implementation details. It
is characterized by marking out the structure of a program, program modularity, data abstraction, program clarity,
ease of further changes, error handling, generality of the solution.
31. Some reccomendations for a good programming style are the following: choosing meaningful names for
variables, constants, functions, etc., use comments and indenting to relieve flow control, avoid forced exit from
loops, avoid using globals and use as few auxiliary variables as possible, avoid changing a for loop control variable
inside the loop body. Furthermore, one shouldnt use un-initialized variables, should check ranges for variables,
avoid unclear tricks, use symbolic constants, follow the algorithm when coding and postpone formatting of output
until you get the output correct, but it must not be forgotten.
32. A program is composed of one or more functions, of which one is mandatory: function main. The other defined
functions are user-defined. A C program has the following form:
- Preprocessor Commands
- Type definitions
- Function prototypes -- declare function types and variables passed to a function.
- Variables
- Functions
33. Integer Type Sizes (bits)
type
linux on a pc ibm pc windows xp/nt ansi c minimum
char
8
8
8
int
32
32
16
short
16
16
16
long
32
32
32
long long
64
64
64
MEANING
Alert (ANSI C)
Backspace
Form feed
New line
Carriage return
Horizontal tab
Vertical tab
Single quotation mark
\"
\\
\?
\ ooo
\x hh
39. Conditional compilation facilitates development, mainly testing. Conditional compilation can be
achieved with the help of conditional compilation symbols which can be used to affect compilation.
(1) #if expr
text
#endif
#if expr
text1
#else
text2
#endif
expr=constant expression which can be evaluated by the preprocessor
text, text1, text2=portions of a source code
effect: if expr is not 0 text(text1) are compiled (not text2), otherwise only text2(for second form)
and processing continues after #endif
#ifdef name
text1
#else
text2
#endif
name=a constant which is tested if defined
text, text1, text2=portions of a source code
effect: if name is defined text(text1) are compiled (not text2), otherwise only text2 (for second
form) and processing continues after #endif
(3) #ifndef name
text
#endif
#ifndef name
text1
#else
text2
#endif
name=a constant which is tested if not defined
text, text1, text2=portions of a source code
effect: if name is undefined text(text1) are compiled (not text2), otherwise only text2 (for second
form) and processing continues after #endif
#ifdef and #ifndef are used to avoid multiple inclusions. Thus at the beginnig of each header file sequence
similar to the following can be present (except from stdio.h)
40. A preprocessor define directive directs the preprocessor to replace all subsequent occurrences of a
macro with specified replacement tokens. The #define directive can be used to create a name for a
numerical, character, or string constant.
#define name character_sequence
During preprocessing, name is replaced by character_sequence. The #define directive causes the compiler
to substitute character_sequence for each occurrence of name in the source file. The name is replaced
only when it forms a token. That is, name is not replaced if it appears in a comment, in a string, or as part
of a longer identifier.This replacement continues until a directive #undef name or the EOF is met.
41. Macros are essentially shorthand representations of arbitrary sections of the source code, which
makes the source code succinct, while its (the macro template's) expansion replaces each of its presence
prior to compilation. Whatever is there to do with Macros, it is done by the preprocessor, so that the
source code is ready for compilation. Function is a calling routine, whence a large program is divided into
separate portions, each portion doing a separate job, and proper calling of these portions in different
places combines the works done by them into the required complete output. Thus functions have nothing
to do with the preprocessing period, they are just compiled.
Function invocation involves a call and execution of statements of function body and, upon function
invocation, parameter type is also considered. Macro invocation means expansion, replacement of
invocation with macro text. Thus statements in a macro are generated for each invocation and compiled.
Hence, macros should be used for small size computations. Upon macro invocation, a formal parameter
is replaced by the character sequence corresponding to the actual parameter. Formal-actual parameter
correspondence is purely positional. Processing time is shorter when using macros (function
invocation requires overhead.
42. #ifndef is a directive for conditional compiling.
#ifndef name
text
#endif
#ifndef name
text1
#else
text2
#endif
name=a constant which is tested if not defined
text, text1, text2=portions of a source code
effect: if name is undefined text(text1) are compiled (not text2), otherwise only text2 (for second
form) and processing continues after #endif
#ifdef and #ifndef are used to avoid multiple inclusions of header files in C. Thus at the beginning of each
header file sequencessimilar to the following can be present:
#ifndef _STDIO_H_
#define _STDIO_H_
......
#endif
There exist a number of predefined names:
__MSDOS__ if operating system is MSDOS
__DATE__ date of compilation
__CDECL__ -indicates that function calls follow C conventions
__STDC__ - defined if strict C ANSI rules must be followed
__FILE__ - name of currently compiled file
44. A functional algorithm must be finite, that is the algorithm must terminate after a finite number of
steps. Even if an algorithm satisfies the above criterion it may not be a practical way of solving a
problem. While an algorithm may execute in a finite time it is not much use if that finite time is so large
as to make solution completely impractical. Thus there is a lot of interest in finding `good' algorithms
which generate correct solutions in a short time compared with other algorithms.
46. A constant has a type and a value which cannot be changed during run time.
Integer constants:
- Decimal: string of decimal digits optionally preceded by a sign.
To indicate length and signed ness:
L, l: long
U, u: unsigned
77.
#ifdef and #ifndef are used to avoid multiple inclusions of header files in C. Thus at the beginning of each
header file sequencessimilar to the following can be present:
#ifndef _STDIO_H_
#define _STDIO_H_
......
#endif
There exist a number of predefined names:
__MSDOS__ if operating system is MSDOS
__DATE__ date of compilation
__CDECL__ -indicates that function calls follow C conventions
__STDC__ - defined if strict C ANSI rules must be followed
__FILE__ - name of currently compiled file
82. The comma operator (,) is used to separate two or more expressions that are included where only one
expression is expected. When the set of expressions has to be evaluated for a value, only the rightmost
expression is considered. In case of the coma operator, the expressions are avaluated strictly from left to
right and their values discarded, except for the last one, whose type and value determine the overall
expression.
90. The statements in C which can cause a program to become unstructured are: goto, continue, break (in
loops) and exit. Thus, their usage is not recommended.
91. The exit standard function is used for forced termination of program execution. A return code of zero
means normal termination and other values mean errors. The prototype for exit is found in stdlib.h and
process.h: void exit (int code);
n=scanf(%d%d%f%f,&i,&j,&a,&b);
If (n!=4) exit(1); /forced exit with code 1/
92. One can achieve forced program termination by using the exit standard function.