Вы находитесь на странице: 1из 26

c c c c c 

c

  c  c


c cccc

Packet-switched describes the type of network in which relatively small units of data called packets are
routed through a network based on the destination address contained within each packet. (Or)

A piece of a message transmitted over a packet-switching network. One of the key features of a packet
is that it contains the destination address in addition to the data. In IP networks, packets are often called
©   

Ôc cc c

A Process is the instance of an application that resides in the main memory and is in an executable
state. (Or)

A process is a program that is running on your computer. This can be anything from a small background
task, such as a spell-checker or system events handler to a full-blown application like Internet Explorer
or Microsoft Word. All processes are composed of one or more threads.

Gc cc c c  c ccccc c

^irtual Private Network (^PN) is the technology that uses the advantage of both public Internet and
private Intranet

Working: A ^PN is a secure, private communication tunnel between `two or more devices across a public
network (like the Internet). These ^PN devices can be either a computer running ^PN software or a
special device like a ^PN enabled router. It allows your home computer to be connected to your office
network or can allow two home computers in different locations to connect to each over the Internet.

Œc cc !"c c

The GET method is the most frequently used method. It is used by default to get static content. This
method can also be used to submit data from a HTML web page to the server. In GET method, the data
submitted will be sent as part of the URL.

-c cc#"c c

A POST method is used to send data as part of the HTTP message body. In certain cases, the client may
need to send megabytes of information. In these situations, POST method is the right choice.

c
Dc cc$  c! $ c

Symmetric Encryption is traditional scheme of encryption where the same secret key is used for
encryption and decryption. The sender and the receiver share the same secret key.

[c cc%$  c! $ c

Asymmetric Encryption is known as public key encryption. It uses two keys

×c A Public Key: this can be distributed to all users.

×c A Private Key: this corresponds to the Public Key and is possessed only by the owner of the file.

The public and Private Keys are related in such a way that when the Public Key is used to encrypt
messages, only the corresponding private key can be used to decrypt them.

##c
cc$c c&$c c

Inheritance is the process of creating new classes, called derived classes, from existing
classes or base classes. The derived class inherits all the capabilities of the base class,
but can add embellishments and refinements of its own.

Ôcc$c c&$c  c c

Multiple inheritance refers to a feature of some object-oriented programming languages in which a class
can inherit behaviors and features from more than one superclass.(or) Multiple inheritance allows a
class to take on functionality from multiple other classes.

3.cc c& cc

Any class that contain one are more abstract methods must also be declared as an abstract, there can
be no object of an abstract class, and we cannot directly instantiate the abstract classes. A.C can contain
concrete methods.

4.ccc$c c&$c& c cc

When an instance method declaration includes an abstract modifier, that method is said to be an
abstract method. Although an abstract method is implicitly also a virtual method, it cannot have the
modifier virtual.
5.cccc

A Class ͻ Is a blue print used to create objects.

ͻ Is a software template that defines the methods and variables to be included in a particular kind of
Object.

Dcc&'c

In object-oriented programming, an object is an instance (or instantiation) of a class. The class object
contains a combination of data and the instructions that operate on that data, making the object
capable of receiving messages, processing data, and sending messages to other objects. Objects have
state, behavior, and identity.

State of object is represented by the member variable.

The behaviour of an object is represented by the method in the object.

7.ccc(c cc c c

Method Overloading (Compile time polymorphism)

Define two or more methods within the same class (or) subclass that share the same name and their
parameter declarations are different then the methods are said to be overloaded. Overloaded methods
must differ in number of parameters & return type.c

× Overloaded methods are not required to have the same return type or the list of thrown exceptions.

× Overloading is particularly used while implementing several methods that implement similar
behavior but for different data types.c

Method overriding: When a method in a subclass has the same name, return type and parameters as
the method in the super class then the method in the subclass is override the method in the super class.

8.ccc& c

Abstraction is nothing but representing the essential futures without including background details.

)ccc c

Wrapping of data and function into a single unit called encapsulation.

10.cccc * cc c$c

Access specifier gives access privileges to outside of application (or) others, they are Public, Protected,
Private, Defaults .
Access Specifiers o A.S gives access privileges to outside of application (or) others, they are Public,
Protected, Private, Defaults o A.M which gives additional meaning to data, methods and classes, final
cannot be modified at any point of time.

Access specifiers specify the accessibility of member variables and .member methods
Private: Accessible only within the class.
Public: Accessible externally (and also within the class).
Protected: Similar to private under normal circumstances.

ÿ(+c

,  
Class diagrams are the backbone of almost every object oriented method, including UML. They describe
the static structure of a system.

#&',  
Object diagrams describe the static structure of a system at a particular time. They can be used to test
class diagrams for accuracy.

ÿ
,  
Use case diagrams model the functionality of systemusing actors and usecases.

-,  
Sequence diagrams describe interactions among classes in terms of an exchange of messages over time.

& ,  
Collaboration diagrams represent interactions between objects as a series of sequenced messages.
Collaboration diagrams describe both the static structure and the dynamic behavior of a system.

 ,  
Statechart diagrams describe the dynamic behavior of a system in response to external stimuli.
Statechart diagrams are especially useful in modeling reactive objects whose states are triggered by
specific events.

 ,  
Component diagrams describe the organization of physical software components, including source code,
run-time (binary) code, and executables.

, $ ,  c
Deployment diagrams depict the physical resources in a system, including nodes, components, and
connections.
* c, c($c
c c cc** c cc *c c
The phases of waterfall model are: System Engineering, Requirement analysis, Designing, Coding,
Testing and Deployment.

Ôc cc$ c ccc


System Engineering deals with gathering the customer͛s requirements which includes functional and
non functional requirements. Functional requirements specify the inputs to the system, the outputs
from the system and the behavioural relationship between them. Non functional requirements specify
the overall attributes to the system like fast access, good user interface, etc.

Gc ccc cc.c/-  c$c c


The structured system analysis method which uses process model and data model is used in
Requirement analysis phase. The process model is used to understand different business process that
will make up the system. The data model is used to understand the design of the data that is to be used.

Œc cc/c
SRS (Software Requirements Specification) is a document with list of requirements, scope of the project
and the analysis done with the models. It is the output of the Requirement analysis phase.

-c c ccc cc *c c


System test plan and Acceptance test plan are the test plans in Waterfall model. System test plan tests
how the software interacts with various entities of the system and is done by domain expert.
Acceptance testing is done by the customer. System testing and acceptance testing are used to ensure
that the software meets the functional and non-functional requirements.

Dc ccc c


The structure of the program that will constitute the software will be created in this phase.
Design phase consists of:
1.c Software Architecture which identifies all the modules that makes up the system.
2.c Procedural detail transforms the modules identified into the description of the business processes
identified when requirements were analysed.
3.c Data design focuses on the data that is accessed and processed by the modules.
4.c Interface design describes the communication with the systems that interoperate with the software.

[c ccc"cc
A test case is a set of inputs to test a program that it is giving required output with particular parameters
already set.

c c cc** c$ c*cc c


The different types of code reviews are: Self review, Peer review, and Formal review.

)c cccc  c


A test script is a program which automates the steps identified for test.
0cc$ cc
After all modules are unit tested and integrated, the software as a whole is tested to ensure proper
functionality. This testing is called System testing.

cc&ccc $ c c


In the deployment phase the software is packaged, installed and delivered to the customer.

Ôcc&ccc c c


In the maintenance phase, if the customer faces any problems with our delivered software, we have to
fix them.

Gc ccccc*c *c c


The advantages of waterfall model are:
It is simple.
There is logical structuring of different activities in a software project.
This model is best suitable for projects with well defined requirements.
The disadvantages are:
The entire project moves only one step at a time, i.e. it will be slow.
If the customer asks for more requirements later, it will be difficult to include again in the already
documented SRS (Software Requirements Specification).

Œcccc*c $ c ccc c $cc *c c


In waterfall model, if the customer later asks for more requirements then it is difficult to include again in
SRS. But Prototype model is of iterative type where new requirements can be added later and designed
again.

-c ccc$ c*c $ c c


The two types of prototype model are:
Throwaway model: Once all the requirements are ensured by the customer, it is discarded and waterfall
model can be used.
Evolving model: Here we will be refining (changing according to added requirements) the model every
time when requirements are clearer.

Dc cc c*ccc $ c c


The steps in prototype model are:
a.c Communication with the customer.
b.c Quick plan according to requirements as told by the customer.
c.c Modelling a quick design for the requirements.
d.c Constructing a prototype for the quick design.
e.c The prototype is checked by the customer and is either deployed or feedback is taken and whole
process is again iterated.

[c ccccc*c $ c c


The advantage is that the technical risk is reduced, but the disadvantage is that it takes a long time to
complete the project if every time we go on modelling quick design based on customers new
requirements.
$ccc  c ccc(c c
The spiral model couples the iterative nature of the prototyping model and the controlled systematic
aspect of the waterfall model. So, it is called as Meta model.

)c cc* c- c*c  c c


The four quadrants are:
Planning: This stage involves determination of objectives, alternatives and constraints.
Risk analysis: Identification of risks and plans to minimize the risks.
Engineering: Development and verification of products.
Customer Evaluation: customer͛s assessment of the results and modifications.

Ô0c c,c1c,  c


The Data Flow Diagrams are graphical representation of processes that form a complete system. In DFD,
the flow of data is represented by labelled arrows and processes are represented by circles

Ôcc2cc*c,1,c
The context level of DFD represents the system as a whole, defining the external entities to the system.
The refinement of context level each time increases simplicity of each process in the previous level.

ÔÔcc,c c
In the data model the analyst defines all the data objects that are processed with in the system and the
relation between them.

ÔGcccc&'c
A data object (entity) is a representation of any composite information that must be understood by the
software that is being created.

Ԍccc &c
A data attributes defines the properties of a data object, with respect to the system being built.

Ô-ccc!/c  c
An ER (Entity Relation) diagram is a graphical tool used to model data. Some notations are:
Entity set: An entity set is an object or concept about which we want to store information.
Attributes: Attributes are the properties of an entity.
Relationships: Relationships illustrate how two entities are related.

ÔDc cc cc&c*cc!/c  c


The steps followed are:
1.c Identify Entities.
2.c Identify Relationships.
3.c Identify primary attributes.
4.c Identify other relevant attributes.
5.c Draw the ER diagram.
Ô[cc,c, $c
A data dictionary defines the basic organisation of data. It contains information for managing data.
Ôccc&cc*c#&'c# c% c
The basic idea of Object Oriented Approach is that data and the processes are viewed as one unit and
called as Object.

Ô)ccc cc
A code with no proper sequence in the executable statements is called Spaghetti code.
30.cWhat will be done if errors are found during Unit testing?
The errors found in Unit testing are logged in Defect Tracking System and then tracked till they are fixed.

Gcc"c
Testing is analysing software for its correctness.

GÔccc!  3c13cc1 c


An error is incorrect implementation of system. Fault is an incorrect behaviour of the system and Failure
occurs due to Fault in the system.
GGc c c c*c. c
The several approaches of Integration are:
1.c Bottom up approach: This approach integrates the units at lowest level first and then the units above
it. It uses dummy units called Drivers while integration.
2.c Top up approach: This approach integrates the units at the top level first and then the levels below. It
uses dummy units called Stubs during integration.
3.c Sandwich approach: In this approach a target layer is identified and then integrates making use of
both top up and bottom up approaches.
4.c Big-Bang approach: It puts all the unit-tested modules together and tests them at a time. It has more
probability for failing.

GŒc cccccc$ cc


System Testing involves:
1.c Functional Testing, which traps errors in implementation of requirements.
2.c Performance Testing considers speed, response time and how far ti can handle problems.

G-c cc cc  * cc


Performance testing can be categorised as:
Load Testing: It is conducted to check whether the system is capable of handling an anticipated load.
Endurance Testing: This testing deals with the reliability of the system.
Stress Testing: It is to identify the number of users the system can handle at a time before breaking
down.
Spike Testing: This test is to ensure that the system will be stable and responsive under an unexpected
surge in load.

GDccc  c*c/ c"c


The purpose of Regression Testing is that, whenever the system is updated for new version, the updated
system should not fail any test that the older version of the system passed.

G[cc *ccc
^erification refers to activities which ensure that the software correctly implements the specific
function. ^alidation refers to a different set of activities to ensure that software that has been built is
traceable to the customer requirements.
Gcc4c&2cc
Testing the system with out worrying about the internal functioning of the product is called Black box
testing.

G)ccc&2cc
Testing the system by knowing the internal functioning of the system, ensuring that all the internal
components and operations are exercised ʹ this is white box testing.

Œ0cc $c&2cc
If the user has some knowledge about the system while testing then it is called Grey box testing.
Πc c c*cccc
Random generation, Equivalence partitioning, Boundary value analysis, Logic coverage are some test
case design methodologies.

ŒÔcc% cc
The software testing conducted in the developer͛s environment by the end-users is called Alpha testing.

ŒGcc4cc
The Software testing conducted in the end-users environment is called Beta testing.

ŒŒ,*c $c*cc c


Quality of a product is define as the presence of all features that a customer requires and the absence of
those features that a customer does not want.

Œ-c ccc$c*c  c-$cc


The two ways of recording quality costs are:
1.c Process analysis.
2.c Prevention, Appraisal and Failure model (PAF) model.

ŒDcc** c&c.#cc
((c
International Quality Standard is a standard applicable for all types of industries and it does not specify
the activities that have to be done for quality improvement.
Capability Maturity Model is software specific standard and mandates many tasks that need to be done
to improve quality.

Œ[c c** cc*c


((c
There are five levels of CMM:
Level1-initial: Companies in this level have no defined processes and success of project is completely
dependent on the people working in the project.
Level2-Repeatable: The focus area of this level is ͚Project management͛. Processes are followed at
project level but there are no standardized processes across the organization.
Level3-Defined: The focus area of this level is ͚Standardized processes and systematically sharing best
practices͛.
Level4-Managed: The data available for processes are collated and the capabilities for processes are
quantitatively established and published.
Level5-Optimizing: The focus area of this level is ͚Continuous Improvement͛ of the process capabilities.

c
c
,** c&c $cc  c
Pointers are used to manipulate data using the address. Pointers use * operator to
access the data pointed to by them.
Arrays use subscripted variables to access and manipulate data. Array variables can be
Equivalently written using pointer expression.
c
Ô% c  c ccccccccccccccccccccccccccccccccc
Pointers are not integers. A pointer is an address. It is merely a positive number and not an
integer.
c
G5c c  c &c6c
Pointer variable are initialized by one of the following two ways
1.Static memory allocation
2.Dynamic memory allocation
c
Œccc  cccc% cc
A pointer value is a data object that refers to a memory location. Each memory location is numbered in
the memory. The number attached to a memory location is called the address of the location.

-ccc  c &c


A pointer variable is a variable that may contain the address of another variable or any valid address in
the memory.
c
Dccc   $ccc$ c   $ccc
c   $c: The compiler allocates the required memory space for a declared
variable. By using the address of operator, the reserved address is obtained and
this address may be assigned to a pointer variable. Since most of the declared variable
have static memory, this way of assigning pointer value to a pointer variable is known as static memory
allocation. Memory is assigned during compilation time.
,$ c   $c: It uses functions such as malloc( ) or calloc( ) to get memory
dynamically. If these functions are used to get memory dynamically and the values returned by these
functions are assigned to pointer variables, such assignments are known as dynamic memory allocation.
Memory is assigned during run time.

7.cccc  c*c cc


The function realloc(ptr,n) uses two arguments. the first argument ptr is a pointer to a block of
memory for which the size is to be altered. The second argument n specifies the new size. The size may
be increased or decreased. If n is greater than the old size and if sufficient space is not available
subsequent to the old region, the function realloc( )may create a new region and all the old data are
moved to the new region.

ccc  c*c ccc


The function main( ) invokes other functions within it. It is the first function to
be called when the program starts execution.
i)It is the starting function
ii)It returns an int value to the environment that called the program
iii)Recursive call is allowed for main( ) also.
iv)It is a user-defined function
v)Program execution ends when the closing brace of the function main( ) is reached.
vi)It has two arguments 1)argument count and 2) argument vector (represents strings passed).
Any user-defined name can also be used as parameters for main( ) instead of argc and argv
c
)c ccc*cc &cc
1)The same auto variable name can be used in different blocks
2)There is no side effect by changing the values in the blocks
3)The memory is economically used
4)Auto variables have inherent protection because of local scope
c
c cccc*c2 c cc
Answer Advantages of external storage class
1)Persistent storage of a variable retains the latest value
2)The value is globally available
Disadvantages of external storage class
1)The storage for an external variable exists even when the variable is not needed
2)The side effect may produce surprising output.

cc cccc c c &cc


Answer A storage class is an attribute that changes the behavior of a variable. It controls
the lifetime, scope and linkage. There are five types of storage classes
1) auto
2) static
3) extern
4) register
5) typedef

c cc  c*c $cc


c
Answer1) An array holds elements that have the same data type
2) Array elements are stored in subsequent memory locations
3) Two-dimensional array elements are stored row by row in subsequent memory locations.
4) Array name represents the address of the starting element
5) Array size should be mentioned in the declaration. Array size must be a constant
expression and not a variable.
c
,** c&cc cccc
Answer A linker converts an object code into an executable code by linking together the
necessary build in functions. The form and place of declaration where the variable is declared in a
program determine the linkage of variable

ccc*cc&7c*cc
Answer A large program is subdivided into a number of smaller programs or subprograms. Each
subprogram specifies one or more actions to be performed for a large program. such subprograms are
functions. The function supports only static and extern storage classes. By default, function assumes
extern storage class. functions have global scope. Only register or auto storage class is allowed in the
function parameters. Built-in functions that predefined and supplied along with the compiler are known
as built-in functions. They are also known as library functions.

.cc& cccc  cccc $c*c3c ccc& ccc


ccc&  c $c c
Answer It͛s easier for a C compiler to generate good code for pointers than for subscripts.
array as a string literal initializer for a character array Then the compiler does not implicitly generate the
address of the address of the first element of an array.

$c88c2c* cc8c
Answer The expression n++ requires a single machine instruction such as INR to carry out the increment
operation whereas, n+1 requires more

c2 c$c  c cc$c  c*c


Answer expression if (a=0) always return false expression if (a=1) always return true
instructions to carry out this operation

.cc &cc2cccc* cc   c2cc cc


*cc
Answer The standard C library provides a function named atexit() that can be used to perform ͞cleanup͟
operations when your program terminates. You can set up a set of functions you want to perform
automatically when your program exits by passing function pointers to the at exit() function.

ccc** c&cc ccc $c


Answer An array is an array of anything. A string is a specific kind of an array with a well-known
convention to determine its length. There are two kinds of programming languages: those in which a
string is just an array of characters, and those in which it͛s a special type. In C, a string is just an array of
characters (type char), with one wrinkle: a C string always ends with a NUL character. The ͞value͟ of an
array is the same as the address of (or a pointer to) the first element; so, frequently, a C string and a
pointer to char are used to mean the same thing. An array can be any length. If it͛s passed to a
function, there͛s no way the function can tell how long the array is supposed to be, unless some
convention is used. The convention for strings is NUL termination; the last character is an ASCII NUL (͚͛)
character.

cccc*c
Answer A static function is a function whose scope is limited to the current source file.
Scope refers to the visibility of a function or variable. If the function or variable is visible
outside of the current source file, it is said to have global, or external, scope. If the
function or variable is not visible outside of the current source file, it is said to have
local, or static, scope.

.cc2cc cccc  c


Answer The exit() function is used to exit your program and return control to the operating system. The
return statement is used to return from a function and return control to the calling function. If you issue
a return from the main() function, you are essentially returning control to the calling function, which is
the operating system. In this case, the return statement and exit() function are similar

cc6*c   c&ccccc6c*cc $c ccc*?


Answer There͛s no way to tell, at runtime, how many elements are in an array parameter just by looking
at the array parameter itself. Remember, passing an array to a function is
exactly the same as passing a pointer to the first element.

$cc.c $ cc*c


Answer A function prototype tells the compiler what kind of arguments a function is looking to receive
and what kind of return value a function is going to give back. This approach helps the compiler ensure
that calls to a function are made correctly and that no erroneous type conversions are taking place

5cc$c cc c


Answer The safest way is to use printf() (or fprintf() or sprintf()) with the %P
specification. That prints a void pointer (void*). Different compilers might print
a pointer with different formats. Your compiler will pick a format that͛s right for your environment. If
you have some other kind of pointer (not a void*) and you want to be very safe, cast the pointer to a
void*: printf( ͞%Pn͟, (void*) buffer );

cccc  c
Answer There is times when it͛s necessary to have a pointer that doesn͛t point to anything. The macro
NULL, defined in , has a value that͛s guaranteed to be different from any valid pointer. NULL is a literal
zero, possibly cast to void* or char*. Some people, notably C++ programmers, prefer to use 0 rather
than NULL. The null pointer is used in three ways:
1) To stop indirection in a recursive data structure
2) As an error value
3) As a sentinel value

.cc& ccc c cc


Answer Both the malloc() and the calloc() functions are used to allocate dynamic memory. Each
operates slightly different from the other. malloc() takes a size and returns a pointer to a chunk of
memory at least that big: void *malloc( size_t size );
calloc() takes a number of elements, and the size of each, and returns a pointer to a chunk
of memory at least big enough to hold them all: void *calloc( size_t numElements, size_t
sizeOfElement ); There͛s one major difference and one minor difference between the two functions. The
major difference is that malloc() doesn͛t initialize the allocated memory. The first time malloc() gives
you a particular chunk of memory, the memory might be full of zeros. If memory has been allocated,
freed, and reallocated, it probably has whatever junk was left in it. That means, unfortunately, that a
program might run in simple cases (when memory is never reallocated) but break
when used harder (and
when memory is reused). calloc() fills the allocated memory with all zero bits. That means that anything
there you͛re going to use as a char or an int of any length, signed or
unsigned, is guaranteed to be zero. Anything you͛re going to use as a pointer is set to all
zero bits. That͛s usually a null pointer, but it͛s not guaranteed.Anything you͛re going to use as a float or
double is set to all zero bits; that͛s a floating-point zero on some types of
machines, but not on all. The minor difference between the two is that calloc() returns an array of
objects; malloc() returns one object. Some people use calloc() to make clear that they want an array.

ccc** c&c9c:*;cc9c<*=c
Answer When writing your C program, you can include files in two ways. The first way is to surround the
file you want to include with the angled brackets < and >. This method of inclusion tells the preprocessor
to look for the file in the predefined default location. This predefined default location is often an
INCLUDE environment variable that denotes the path to your include files. For instance, given the
INCLUDE variable
INCLUDE=C:\COMPILER\INCLUDE;S:\SOURCE\HEADERS;
using the #include version of file inclusion, the compiler first checks the
C:\COMPILER\INCLUDE
directory for the specified file. If the file is not found there, the compiler then checks the
S:\SOURCE\HEADERS directory. If the file is still not found, the preprocessor checks the current
directory. The second way to include files is to surround the file you want to include with double
quotation marks. This method of inclusion tells the preprocessor to look for the file in the current
directory first, then look for it in the predefined locations you have set up. Using the #include ͞file͟
version of file inclusion and applying it to the preceding example, the preprocessor first checks the
current directory for the specified file. If the file is not found in the current directory, the
C:COMPILERINCLUDE
directory is searched. If the file is still not found, the preprocessor checks the S:SOURCEHEADERS
directory. The #include method of file inclusion is often used to include standard
headers such as stdio.h or stdlib.h. This is because these headers are rarely (if ever) modified, and they
should always be read from your compiler͛s standard include file directory.
The #include ͞file͟ method of file inclusion is often used to include nonstandard header files that you
have created for use in your program. This is because these headers are often modified in the current
directory, and you will want the preprocessor to use your newly modified version of the header rather
than the older, unmodified version.

5c $cc*c  cc$cc


Answer The answer depends on what you mean by ͞levels of pointers.͟ If you mean ͞How many levels
of indirection can you have in a single declaration?͟ the answer is ͞At least 12.͟
int i = 0;
int *ip01 = & i;
int **ip02 = & ip01;
int ***ip03 = & ip02;
int ****ip04 = & ip03;
int *****ip05 = & ip04;
int ******ip06 = & ip05;
int *******ip07 = & ip06;
int ********ip08 = & ip07;
int *********ip09 = & ip08;
int **********ip10 = & ip09;
int ***********ip11 = & ip10;
int ************ip12 = & ip11;
************ip12 = 1; /* i = 1 */
The ANSI C standard says all compilers must handle at least 12 levels. Your compiler might support
more.

ccc** c&cc c $c  $ccc   $c $c   $cccc


c&cc
Answer The strcpy() function is designed to work exclusively with strings. It copies each byte of the
source string to the destination string and stops when the terminating null character () has been moved.
On the other hand, the memcpy() function is designed to work with any type of data. Because not all
data ends with a null character, you must provide the memcpy() function with the number of bytes you
want to copy from the source to the destination.

cc   c
AnswerThe preprocessor is used to modify your program according to the preprocessor directives in
your source code. Preprocessor directives (such as #define) give the preprocessor specific instructions
on how to modify your source code. 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.
The preprocessor contains many features that are powerful to use, such as creating acros,
performing conditional compilation, inserting predefined environment variables into your code, and
turning compiler features on and off. For the professional programmer, in-depth knowledge of the
features of the preprocessor can be one of the keys to creating fast, efficient programs.

ccc-c c ccc


Answer A binary search, such as bsearch() performs, is much faster than a linear search. A hashing
algorithm can provide even faster searching. One particularly interesting and fast method for searching
is to keep the data in a ͞digital trie.͟ A digital trie offers the
prospect of being able to search for an item in essentially a constant amount of time,
independent of how many items are in the data set. A digital trie combines aspects of binary searching,
radix searching, and hashing. The term ͞digital trie͟ refers to the data structure used to hold the items
to be searched. It is a multilevel data structure that branches N ways at each level.

ccc&*c*ccc* c cc


Answer The benefit of using the const keyword is that the compiler might be able to make optimizations
based on the knowledge that the value of the variable will not change. In addition, the compiler will try
to ensure that the values won͛t be changed inadvertently. Of course, the same benefits apply to
#defined constants. The reason to use const rather than #define to define a constant is that a const
variable can be of any type (such as a struct, which can͛t be represented by a #defined constant). Also,
because a const variable is a real variable, it has an address that can be used, if needed, and it resides in
only one place in memory

ccc-c c ccc


Answer The answer depends on what you mean by quickest. For most sorting problems, it just doesn͛t
matter how quick the sort is because it is done infrequently or other operations take significantly more
time anyway. Even in cases in which sorting speed is of the essence, there is no one answer. It depends
on not only the size and nature of the data, but also the likely order. No algorithm is best in all cases.
There are three sorting methods in this author͛s ͞toolbox͟ that are all very fast and that are useful in
different situations. Those methods are quick sort, merge sort, and radix sort.
The Quick Sort
The quick sort algorithm is of the ͞divide and conquer͟ type. That means it works by reducing a sorting
problem into several easier sorting problems and solving each of them. A ͞dividing͟ value is chosen from
the input data, and the data is partitioned into three sets: elements that belong before the dividing
value, the value itself, and elements that come after the dividing value. The partitioning is performed by
exchanging elements that are in the first set but belong in the third with elements that are in the third
set but belong in the first Elements that are equal to the dividing element can be put in any of the three
setsͶthe algorithm will still work properly.
The Merge Sort
The merge sort is a ͞divide and conquer͟ sort as well. It works by considering the data to be sorted as a
sequence of already-sorted lists (in the worst case, each list is one element long). Adjacent sorted lists
are merged into larger sorted lists until there is a single sorted list containing all the elements. The
merge sort is good at sorting lists and other data structures that are not in arrays, and it can be used to
sort things that don͛t fit into memory. It also can be implemented as a stable sort.
The Radix Sort
The radix sort takes a list of integers and puts each element on a smaller list, depending on the value of
its least significant byte. Then the small lists are concatenated, and the process is repeated for each
more significant byte until the list is sorted. The radix sort is simpler to implement on fixed-length data
such as ints.

i%%c
c

2   
  


  

    c

cx   
          
x 
                   
 
       x          
   x      
 

 
        

2      




 
c

c                  
             x
  
                    
 

å  



   
c

c2                     
        2              
   
               
  
         

 
 
 
 c

c                  


       
         
          
2     

 c

c cc
c  c c c cc c c  c c cc cc
 c cc
cc cc cccc

å 
  
 
  c

c     !


    "         
      
 #  
       
               

                c

2   
  
 
   
 c

cx              
               
#    
 
x                  
    
   
#    

R 
 
        



  


   ! 
 
  
"   c

cà @  


    #   
  
   
  
à
@
 
              
    
    x
         
     
à


      #  
  
            
 

         #          
 
2             
 
       
     # c

2 
    c

cx   "  $    


  x
              
    x         
       
x    
       
  
     


2  
#c

cR                   
   "                
R          
         
          x    
               
     
 
          
                  


2 
c

cx    "        x    
 
        %    
  
   
  

2  
    c
           
&      &
 

'( 
 R   R  ) $%

& 2       


  
 c

 @    *     &+R  ,&

'( 
 R   R  ) $%

& 2     


   c

 @       

'( 
 R   R  ) $%

& 2 
  R 
   
  c

 @        &+R  ,&

'( 
 R   R  ) $%
& 2    
 R 
 

 c

  R      


       # -$-..   
         

'( 
 R   R  ) $%

& 
 
 

  

 
 R 
 

    
c
   *  

'( 
 R   R  ) $%

&   

    

 


 c

 @     /      *   


  
   
  +@  ,"         

'( 
 R   R  ) $%

& 2 
 

  

 

    
 
  c
 -0xRR@x @x  
  

'( 
 R   R  ) $%

& '

 
   

 c

 %     2                


 1  #             
   
                
    

'( 
 R   R  ) $%

& '
 
 
  c

 +                  
    

'( 
 R   R  ) $%
& å
 #
 !
2 c

 +       1 

'( 
 R   R  ) $%

& '
  !(   2 )  !  

c
 J     #      +      1 
   x  1               
    

'( 
 R   R  ) $%

& 2  '  !


*
'  ! 
c

 x #  "     ,"   ,"      " 


(  ,"      
#   "    #            
  "        J,"     
 2   R   
 3
4  #  "    (  ,"       -, 
    # 2     #  "    
    
         
"              

#    "       R   "JJ* ,"     
R  x  3- #  "          
(   "      ,   

$%

& 2 $ 


c

 2               
         
        
2     
#             
                   

         
 

$%
& 2   


  c

 ÷   
  0 
  

   
  

÷ 

à    ’         
         #   ’

x                
   #    ’
     

   
          x   
   ’

 

0    ’      #       
 
            #    

           ’

              ’
   
   
           

    ’0   # 
     #  

        #         
      #    
  
     *           
   
      

    ’x      "    

 x     
    
  c


$ #       


c

c
 
 2             

                   

2  
c

cR             


    
 
   

  
 # c

c                   R    
      J JR       
      
    

2     c

c

             
 
            -  5  


2  
   c

c         


   
     
      
 x    
 
     *          x    
                    
     x          
  "   

2    ! 


c

c- #  "         


      
J,"     # ,"   

   +,
 +,   
   c

c   


#       
# 
  

'
 
      c

cx                 

            
  
 
                   
    
               #
     
  cc
c
x                
 x   
 x -  "J          
            cc
c
  
  
     
   # 

                     
           
   
    ’


2   


 å' 

 
c

c2   # 5*-         6cc


c
R 76(     
 6cc

-+ 8&
     8&9c

R :6+       6c

-    ;5
    -      9c
R <6+-  !  6c

R  ;-   R 8&  = x*0,+x ,8&9c

R >6,"   ! 6c

  "  4 9c

,4(c

2  

x c
xc ccc
c
  c

 cc c c c  c   c  c
 c
cccc c 
cc c c c c c ccc

c
c

2 


x c
c 
cc
 c
c  c

cc 
c
c  c  cc 
c
c 
 c  c
   c
c  c
c c
c

   

x c
 cc ccc 
 c

c 
cc c ccc 
 c
c c cc c

c 
cc c ! c  ccc 
 c
c  c cc c c c
 c  c   c  c c c

ccc c   ccc 
 c
c c cc c c

 

x c
 cc c"  cc

c  c"  c  c  c  cc


  c c  cc
c c"  c  c  c# c$c
 cc cc  ccc cc
 c$ccc c  c

2   

x c
xcc cc  cccc c c  ccc c  cc  cc! c c c c
 c cc  cc c cc c  cc c" c cc cc c
 cc  c
c c cc  cc   cccc c c c
 c
% c c 
 ccc cc  c
c cc c cc
 c  c
c c c
cc 
 c c c c c c&
c

 cc
c
 c  
cc

2 
  

x c
xc

 cc

 c cc
 c c c   c c  
c c

   c

2  

x c
" ccc
cc  c c c  c
 cc c c#
 c' 
c
(#')c c cc c
c c c

c*  + c 


c

c*  + c   c  c c c  c

2 
 

x c
xc#
 c 
cc  cc,c-c  c c cc  c,c c-c  cc
 ccc
cc
   c c cc c  c
 c cc  c  cccc c

   ccc c c c .c c /c ccc .0,1c2c /0,1c  c c c .0-1c2c /0-1c c
 c ccc,c
   ccc c 3c   c ccc
   c-cc

2  ! " 

x c
 c  cc  c  c
c c  
c( c )cc

2  

x c
" ccc c

 ccc
 c 
cxc
 c 
c,c-ccc

 c 
cc cc c  cxc c,c  c  c c 
cc  c
c c c

2 #  

x c
xc  c
 ccc c/ #cc cc c. #c cc  4 c  cxc cccc

 c  c c cc

2 $  

x c
xc  c
 ccc c5 #cc cc c/ #c ccc#'c,cxc cc c cc c

c,ccc4ccc

cxccc c  ccc

" c cccc  c c  cc  4   c  c c cc

2 

A program in a database that gets called each time a row in a table is INSERTED UPDATED or DELETED.
Triggers allow you to check that any changes are correct or to fill in missing information before it is
commited. Triggers are normally written in PL/SQL or Java


c

c
c

Вам также может понравиться