GE 2115 FOC 2 MARKS WITH ANSWER

TWO MARKS
UNIT I
1.WHAT IS  COMPUTER ?
          Computer is a data processing device which automatically accepts and stores input data, processes them and produces results under the direction of a detailed step by step program.
2.Characteristics of a computers :
Ø  Speed
Ø  Accuracy
Ø  Automatic
Ø  Endurance
Ø  Versatility
Ø  Storage
Ø  Reduction in cost
Ø  No Intelligent Quotient
Ø  Resource Sharing
3.Five generations of computers:
1.      First Generation (1940-56)-Vacuum Tubes.
2.      Second Generation (1956-63)-Transistors.
3.      Third Generation (1964- Early 1970’s) -Integrated Circuits.
4.      Fourth Generation (Early 1970’s-Till date) -Microprocessors.
5.      Fifth Generation (Present and Beyond) -Artificial Intelligence.
4.Advantages of  First Generation computer:
1.      Vacuum tubes were only electronic components available at that time.
2.      These computers were the fastest calculating device of their time.
3.      These computers could perform calculations in milliseconds.
5.Disadvantages of  First Generation computer:
1.      Very big in size.
2.      Occupies large space.
3.      High heat production.
4.      High power consumption.
5.      High cost.

6.Advantages of  Second Generation computer:
1.  Small in size.
2.  Better reliability.
3.  Computational time is Micro Seconds.
4.  Less heat generated.
5.  Better speed.
7.Disadvantages of  Second  Generation computer:
1.  Frequent Maintenance required.
2.  Need Air conditioning.
3.  Manual Assembly of individual components into a functioning unit was required.
4.  High cost.
5.  Commercial production was difficult.
8.Advantages of  Third Generation computer:
1.     Small in size.
2.     More reliability.
3.     Less heat is generated.
4.     Computational time is nanoseconds.
5.     Less hardware failure.
6.     Low Maintenance cost.
7.     Easily portable.
8.     General purpose computers.
9.     Less power required.
10. Commercial production was easier and cheaper.
9.Disadvantages of  Third  Generation computer:
1.   Need Air conditioning.
2.  Highly sophisticated Technology required for the manufacture of IC chips
10.Advantages of  Fourth Generation computer:
1.    Small in size.
2.    Very cheap.
3.    More reliability.
4.    Less Hardware failures.
5.    Large and Faster primary and secondary storage.
6.    Object oriented languages are supported.
11.Disadvantages of  Fourth  Generation computer:
1.      Highly sophisticated Technology is required for the manufacture of LSI chips.
12.Advantages of  Fifth  Generation computer:
1.  Consumes less power.
2.  User Friendly.
3.  Supports parallel programming.
4.  Supports wide operating system environment.
5.  Having much faster and large primary storage capacity.
13.Types of computer based on Hardware Design:
Based on hardware Design computers are classified as follows
v  Analog
v  Digital
v  Hybrid
14.Types of computer based on Utility:
      Based on utility, the computers can be classified into
a)      General purpose computer
b)     Special purpose computer
15.Types of computer based on size and capacity:
Based on size and capacity, computers are classified into the following

a)      Micro computer
b)     Mini computer
c)      Mainframe computer
d)     Super computer
16.Types of computer based on Mode of Use:
Based on Mode of Use, computers are classified into the following
a) Palmtop PCs
b) Laptop PCs
c) Personal computer
d) Work station
e) Mainframe system
f) Clients and Server
17.Analog Devices:
In Analog computer, the input data is continuously changing electrical or non electrical information. Computations are carried out with physical quantities such as Voltage, Length, Current; Temperature etc. The devices measuring such quantities are called Analog Devices.
18.Analog Signals:
An Analog Signal is a continuous variable electromagnetic wave and it consumes an infinite number of voltage or current values.
19.Difference between Analog and Digital computer:


Analog computers

Digital computers

It operates by measuring
It operates by counting
It requires physical analog
It functions on discrete numbers
The calculations are first converted to equation and later converted to equation and later converted into electrical signals.
The calculations are converted into binary numbers(1’s and 0’s)
The output in the form of graph.
The output in the form of discrete values.
Less accurate
More accurate.
Less speed
High Speed
Limited memory
More memory
Lack of flexibility
Highly flexible

20.Three units of the block diagram of the computer:
·         Input unit
·         Central Processing unit
·         Output unit
21.Uses of Input unit
Ø  Send information or instructions or commands to the computer.
Ø  Data received from the input unit is immediately stored in main memory and then processed.
22.Uses of Output  unit
·         Output Unit is the communication between the user and the computer.
·         Devices used to get the response or result of a process from the computer is called output.
·         The output Unit of a computer provides the information and results of a computation to the outside world.
UNIT II
1.      How did the internet works?
a.       Fig: Internet Connection Sharing
2.      What is network ARPANET?
The network had to connect four computers running on four different operating systems. They are called network ARPANET.
3.      What is web page?
            A web page or webpage is a document or resource of information that is suitable for the World Wide Web and can be accessed through a web browser and displayed on a computer screen.
4.      What is Website?
A website (or web site) is a collection of related web pages, images, videos or other digital assets that are addressed with a common domain name or IP address in an Internet Protocol-based network.
5.      Define Homepage ?
Ø  The homepage (often written as home page) is the URL or local file that automatically loads when a web browser starts or when the browser's "home" button is pressed. You can turn this feature off and on, as well as specify a URL for the page to be loaded.
Ø  The term is also used to refer to the front page, web server directory index, or main web page of a website of a group, company, organization, or individual.
6.      Define Web browser ?
Ø  A web browser is a software application for retrieving, presenting, and traversing information resources on the World Wide Web.
Ø  An information resource is identified by a Uniform Resource Identifier (URI) and may be a web page, image, video, or other piece of content.
Ø  Hyperlinks present in resources enable users to easily navigate their browsers to related resources

7.       What is start page?
Ø  A start page is a website or page meant to organize links or information for the user when a web browser starts. Start pages generally consist of information like news, weather, games, and other web widgets and web gadgets.
Ø  Examples of Start pages include iGoogle, NetVibes, Sthrt, and Pageflakes
8.      What is URL?
Ø   Uniform Resource Locator, the global address of documents and other resources on the World Wide Web.
Ø   The first part of the address is called a protocol identifier and it indicates what protocol to use and the second part is called a resource name and it specifies the IP address or the domain name where the resource is located. The protocol identifier and the resource name are separated by a colon and two forward slashes.
Ø   For example, the two URLs below point to two different files at the domain pcwebopedia.com.
9.      What is ISP ?
Ø    Internet Service Provider, a company that provides access to the Internet. For a monthly fee, the service provider gives you a software package, username, password and access phone number. Equipped with a modem, you can then log on to the Internet and browse the World Wide Web and USENET, and send and receive e-mail.
Ø    In addition to serving individuals, ISPs also serve large companies, providing a direct connection from the company's networks to the Internet. ISPs themselves are connected to one another through Network Access Points (NAPs).
Ø    ISPs are also called IAPs (Internet Access Providers).
10.  Define HTTP ?
Ø HTTP stands for Hyper Text Transfer Protocol.
Ø It is the primary protocol of the World Wide Web (WWW).
Ø HTTP has an ability to transfer Web pages, graphics and any other type of media that is used on the Web in Hyper Text Markup Language (HTML), the internal format of Web pages.
11.  Draw a hierarchy of Internet:
12.  Define            Webserver:
Ø  A computer that delivers (serves up) Web pages. Every Web server has an IP address and possibly a domain name.
o   For example, if you enter the URL http://www.pcwebopedia.com/index.html in your browser, this sends a request to the server whose domain name is pcwebopedia.com. The server then fetches the page named index.html and sends it to your browser.
Ø  There are many Web server software applications, including public domain software from NCSA and Apache, and commercial packages from Microsoft, Netscape and others.
13.  Define Download:
Ø  To copy data (usually an entire file) from a main source to a peripheral device.
Ø  The term is often used to describe the process of copying a file from an online service or bulletin board service (BBS) to one's own computer.
Ø  Downloading can also refer to copying a file from a network file server to a computer on the network.
14.  Define Upload:
Ø  The opposite of download is upload, which means to copy a file from your own computer to another computer.
Ø  To transmit data from a computer to a bulletin board service, mainframe, or network.
Ø   For example, if you use a personal computer to log on to a network and you want to send files across the network, you must upload the files from your PC to the network.
15.  What is the use of router?                         
A router is useful in the following ways.
·         It ensures that information doesn’t go where it’s not needed. This is crucial for keeping large volumes of data from clogging the connections of “innocent bystanders”.
·         It makes sure that information does not make it to the indented destination.
16.  Define Routers:
Ø The routers determine where to send information from one computer to another.
Ø Routers are specialized computers that send your messages and those of every other internet user speeding to their destinations along thousands of path ways.
17.  Define Backbones:
Ø  Backbones are typically fiber optic trunk lines.
Ø  The trunk lines has multiple fiber optic cables combined together to increase the capability.
Ø  Today there are many companies that operate their own high capacity backbones and all of them are interconnected at various NAPs around the world.
18.  Define World Wide Web (www):
Ø  The world web wide is the name given to the entire part of the internet.
Ø  The World Wide Web consists of millions of web sites (google, yahoo…) and web pages.
Ø  Web page is a kind of word processing document except it can contain pictures, sounds, movies along with the text.
Ø  Anyone who knows HTML can make a web page.
19.  Define Electronic mail or e-mail or mail:
Ø  Electronic mail is one of the most popular uses of internet.
Ø  If you have an e-mail account you can send an electronic message to anyone by knowing their e-mail address.
Ø  If you have an internet service provider (ISP) or commercial online service that you already have and know your e-mail address. Example Rajaas4u@redifmail.com
20.   Define Chat:
Ø  Online conversations in which you are immediately able to send the messages back and forth to one another are called chat.
Ø  Here chatting can be done without using the telephone.
Ø  Online chat doesn’t cost anything extra, as long as you have an internet connection.
21.  Define Remote Access:
Ø  The internet allows computer users to connect to other computer.
Ø  This is encouraging new days of working from home, collaboration and information sharing in many countries.
Ø  For example an accountant sitting at the home can audit the books on a server suited in another country that maintained remotely by IT specialist in a forth.
22.  Define File Transfer Protocol (FTP):
Ø  FTP is a network protocol which is used to transfer data from one computer to another through a network.
Ø  Transfer Protocol (TP) is a file transfer protocol for exchanging the files over any TCP/IP based network.
Ø  There are many FTP client and server Programs.FTP servers can be set up anywhere between game servers, voice servers, internet host, and other physical servers.
23.  Define Voice Telephony (VoIP):
Ø  VoIP stands for Voice over IP (Internet Protocol) that underlies all internet communications.
Ø  This phenomenon began as an optimal two way extension to some of instant messaging systems.
Ø  The benefit is that, as the internet carries the actual voice traffic, VoIP can be free of cost much less than a normal telephone call.
Ø  Currently few of the VoIP’s provides an emergency services but it is not universally available.
24.  Define Telnet (Telecommunication Network):
Ø  Telnet is a network protocol used on the internet or local area network (LAN) connections.
Ø  The term telnet also refers to software which implements the client part of the protocol.
Ø  TELNET clients have been available on most UNIX systems for many years.
Ø  Most network equipment and OSs with a TCP/IP stack support some kind of TELNET service server for their remote configuration.
25.    Define Internet Protocol: IP address
Ø  Every machine on the internet has a unique identify number, called an IP address.
Ø  The IP address stands for Internet Protocol, which is the language that computers use to communicate over the internet.
Ø  A protocol is a predefined way that someone who wants to use a service talks with the service.
Ø  A typical IP address look like this:
10.10.0.255
27. Hardware
            Hardware represents physical components of the computer. The hardware performs all operation in the computer such as accepting and sorting data, performing calculations and displaying or printing etc.
            Some of the physical devices are Monitor, Floppy disk drive, Hard disk drive, Keyboard, Printer etc.
28.Software
                        The set of instruction grouped into programs that make the computer to function in the desired way. It is a collection of programs, to perform a particular task.
29. DIFFERENCE BETWEEN SOFTWARE AND HARDWARE
SL.NO
SOFTWARE
HARDWARE
1.
It is the collection of program to bring the computer hardware system into operation.
It is the physical components of the computer system.
2.
It consists of numbers, alphabets, alphanumeric, symbols, identifiers, keywords etc.
It consists of electronic components like IC’s, diodes, resistors, crystals, boards, insulators etc.
3.
This should be prepared according to the type of the computer.
The design can be modified according to the category.
4.
It will vary as per the computer and its built-in function and programming language.
It is almost construct for all types of computer system.

30. TYPES OF SOFTWARE

The Software is widely available and it may be vast and variety of software’s is there Software’s are categorized into the following.
Fig: Types of Software

31. System Software
·         A System Software is a collection of programs designed to operate, control and extended processing capabilities of computer and which makes the operation of a computer system more efficiently
32. Functions of Operating System
            The below abstraction layer shows a collection of interacting hardware and software elements, functioning at different levels
Fig: Functioning at different levels of Operating System
33.Software Piracy
       Software piracy is the unauthorized copying of an organization internally developed software or the illegal duplication of commercially available software.
34.Types of Software Piracy
       There are six basic forms of software piracy.
1.      Soft loading
2.      Software Counterfeiting
3.      Renting
4.      Hard Disk Loading
5.      License Misuse                

           

UNIT III:

1.Application software:
                Application software is a set of program that are used to perform some specific task, such as word processing, drawing figures, maintaining database etc.

2.commonly used office packages
1.      Word Processing.
2.      Spread sheet.
3.      Graphics Packages.
4.      Personal Assistance Packages.
3.Features of Word Processor:
           The following are the main features of a Word Processor
1.      Fast
2.      Editing Features
3.      Permanent Storage.
4.      Formatting Features.
5.      Graphics.
6.      OLE(Object Linking and Embedding)
7.      Spell check.
8.      Tables.
9.      Revise without Retyping.
10.  Mail Merge.


4.Options provided by MS-Word are
1.      Entering and Editing Text.
2.      Viewing Documents.
3.      Formatting Text.
4.      Formatting Documents.
5.      Tables.
6.      Graphics.
7.      Mail Merge and Labelling.
8.      Printing.
5. Spread sheet:
·         An Electronic Spread sheet or a Spread sheet is a table of rows and columns into which data is entered
·         Spread sheet software makes it possible to enter data into a task format, manipulate, store, print and create reports and graphics using them.
6.Parts of Spread sheet:
·         Columns.
·         Rows.
·         Cells.
·         Cell Pointer.
7. Features of Spread sheet:
1.      Complicated calculation can be performed easily.
2.      The result of the calculation is accurate.
3.      The Worksheet can be edited.
4.      Data can be viewed as graph.
5.      The information stored in a work sheet can be transferred to other software programs.
8.Graphics Packages:
             Graphics package is a collection program which enables us to create, edit, View, Store, Retrieve and Print, Drawings, Pictures, Graphs and anything that can be drawn using computer system.


9.Features of Graphics Packages:
1.      Draw Designs.
2.      Computer Aided Design / Drafting(CAD/ CADD)
3.      Paint Drawing and Pictures.
4.      Present Graphs.
5.      Graphics in Medical Technology
6.       Presentation Graphics.
10.Application of Computer Graphics Packages:
               Some of the application of Computer Graphics Packages are
·         Computer Aided Design / Drafting(CAD/CADD)
·         Desktop Publishing.
·         Computer Art.
·         Graphical User Interface(GUI)
·         Computer Aided Learning(CAL)
·         Geographical Information System(GI)
·         Internet.
11.Personal Assistance Package:
·                         Personal assistance package is to use personal computers for storing and retrieving their personal information, planning, managing their schedules, contacts, finances etc. It commonly supports business people to know the current status of the company.
12.Features of Personal Assistance Package:
     Some of the commonly used activities for the business persons are
1.      Personal Information.
2.      Address Book.
3.      Investment Book.
4.      Inventory Book.
5.      Purchase order.
6.      Purchase return.
7.      Sales.
8.      Sales return.
9.      Remuneration.
13.Personal Assistance Package:
                Personal assistance package is to use personal computers for storing and retrieving their personal information, planning, managing their schedules, contacts, finances etc. It commonly supports business people to know the current status of the company.

14.Pseudo code
          Pseudo code  is a format design tool. Developed with the structured programming .It is a visual, narrative and more easily used for structured design. It is a programming analysis tool.
“Pseudo” means initiation or false, ”Code” means the set of statements or instructions  written in a programming language. Pseudo code   is also called “Program Design Language (PDL)”.
15.Rules for writing Pseudo code
         The following rules used for writing pseudo code
·         Write one statement per line.
·         Capitalize initial keywords.
·         Indent to show hierarchy.
·         End multiline structure.
·         Keep statements language independent.
16.Advantages and Disadvantages of Pseudo code
Advantages
a)      It can be done easily in any word processor.
b)      It can be easily modified as compared to flowchart.
c)      Its implementation is very useful in structured design elements.
d)     It  can be written easily.
e)      It can be read and understood easily.
f)       Converting a pseudo code to programming language is very easy as compared with converting a flowchart to programming language.
Disadvantages
a)      It is  not visual
b)      We do not get a picture of the design.
c)      There is no standardized style or format, so one pseudo code may different from another.
d)     For a Beginner, it is more difficult to follow the logic or write pseudo code as compared to flowchart.
17.Sequence logic:
                      The sequence logic is used for performing instructions one after another. Thus the pseudo code instruction of sequence logic are written in an order in which they are to be performed. The logic flow of pseudo code is top to bottom approach.

18.Selection logic:
                   The selection logic is used for decisions and also known as decision logic. It is used for selecting the suitable ports out of the two or more parts in logic of the program. It is usually depicted as an IF….THEN or IF…..THEN….ELSE or a CASE structures.

19.Iteration logic(looping)

                        This logic is used for producing loops in program logic, when one or more instructions may be executed several times or depending on some condition. It uses two structures called the WHILE and the DO…WHILE, both of these structures are used for looping. The looping continues until the condition becomes true.

 20.Algorithm

       Algorithm is defined as a sequence of executable instructions that forms a solution to a particular problem. It is also defined as a procedural solution to solve a problem.
21.CHARACTERISTICS OF ALGORITHMS:
1)      Algorithm’s each and every instructions should be precise.
2)      Algorithm’s each and every instructions should be unambiguous.
3)      Instructions should not be repeated infinitely.
4)      Algorithm should terminate ultimately.
5)      Algorithm should be  in sequence.
6)      V should look like normal English.
7)      The desired output should be obtained only after the algorithm terminates.

22.REPRESENTATION OF ALGORITHM
Algorithm is represented in following ways.
1)      Normal English
2)      Flowchart
3)      Pseudo code
4)      Decision table
5)      Program



23.FLOWCHARTS
Ø  A flowchart is a diagrammatic representation that illustrates the sequence of operation to be performed to arrive the desired solution.
Ø  It is a pictorial representation of an algorithm.

24.NEED FOR FLOWCHARTS:
Ø  Flowchart has a standardized meaning,  that makes the program logic easy.
Ø  It is easy to read and interrupt.

25.ADVANTAGES OF FLOWCHART:
Ø  Better communication.
Ø  Effective analysis.
Ø  Effective synthesis.
Ø  Effective coding.
Ø  Proper program documentation.
Ø  Systematic debugging.
Ø  Systematic testing.



UNIT IV

1.Data
            Data refers to a collection of facts, or numbers or symbols. 

2.Data types
            Data type is a term that refers to the kind of data in a program
 C++ data types can be classified as
·         Basic (primitive) data types [ int, char, float, double]
·         User defined data types
·         Derived data types
3.User defined data types
            User defined data types are data types defined by the user
Ø  Enumeration (enum)
Ø  Typedefinition (typedef)
Ø  Structure (struct)
Ø  Union (union)
Ø  Class  (class)
4.Variable
            Variable is the address of a data that associates the reserved memory for data storage in the main memory (RAM) with a symbolic name.
             Reference variable
Reference variable is a variable which provides an alternative name for a previously defined variable.
                        Syntax     datatype  &reference name = variable name
                        Example   float a = 10;
                        float &b = a;
Here a is a variable and b is a reference variable.
5.Modifiers (Qualifiers)
             Modifiers (Qualifiers) are keywords that are prefixed with the basic data types and produce new extended data type.
Example: unsigned, signed, short, long.
6.Operator

             Operator is a symbol that is used to manipulate (operate) the data

7.Operand

            The data items that the operators can act upon are called operands i.e. Data is             otherwise called   operand

8.Unary and Binary operator
            The operator that uses a single operand is called a unary operator
Example:         a++
                        here ++ is an unary operator
            The operator that uses two operands is called binary operator
Example:         a+b
                        here + is the binary operator
9.Operators in C
·         The arithmetic operators

Binary Arithmetic
Unary Arithmetic
Operators
Operation
Operators
Operation
+
Addition
+
Unary plus
-
subtraction
-
Unary minus
*
multiplication
++
Increment
/
division
--
decrement
%
remainder


10.The equality and relational operators

Relational operator
Meaning
Equality Operator
Meaning
> 
Greater than

==

Equal to
>=
Greater than or equal to
< 
Less then
!=
Not equal to
<=

Less then or equal to



11.The logical operators

Binary logical operator
Operation
&&
Logical AND (AND gate operator)
||
Logical OR(OR gate operator)
Unary logical operator
operation
!
Logical NOT (NOT gate operator)

·         The simple assignment operator   =

·         The compound assignment operators
Operator
Usage
effect
+=
-=
*=
/=
%=
&=
|=
^=
<<=
>>=
a+=exp;
a-= exp;
a*= exp;
a/= exp;
a%= exp;
a&= exp;
a|= exp;
a^= exp;
a<<= exp;
a>>= exp;
a=a+(exp);
a=a-(exp);
a=a*(exp);
a=a/(exp);
a=a%(exp);
a=a&(exp);
a=a|(exp);
a=a^(exp);
a=a<<(exp);
a=a>>(exp);

12.The increment and decrement operators
++, - -

13.Conditional operator(Ternary Operator)

            An alternative method to using a simple if-else construct is the conditional expression operator ?:

Syntax
expression1 ?expression2 : expression3


14.Bitwise and bit shift operators
15.Expression
            Any valid combination of constants or operators or operands or variables is called an expression, A constant or a variable alone may allow be treated as an expression
            Example      a+b-c
16.Statement
            An expression followed by a semicolon (;) is called statement
            Example      a+b-c;

17. Unformatted I/O statements
v  This statements are used to I/O a single/group of characters from/ to the I/O devices.
v  The user cannot specify the type of the data that is going to be I/O.
18. putchar() function
·         The putchar() function is used to display one character at a time on the standard output device.
·         This function does the reverse operation of the single character input function as discussed above.
Syntax:

putchar(character variable);
           
Eg:

Char x;                //declaration statement
putchar();    //output statement
             


19. getc() function
This is used to accept a single character from the standard input to a character variable.

char variable=getc ();

Syntax:


Char x;          //declaration statement
X=getc();    //input statement
Eg:
           



20.putc() function
This is used to display a single character from the character variable to a standard output device.

putc(character variable);
Syntax:   
 Eg:
          

Char x;       //declaration statement
putc();      //output statement
 




21.gets() function
This is used to read the string (string is a group of character) from the standard input device(keyboard).

gets(char type of array variable);
Syntax:
           

22.puts() function
This is used to display/write string to a standard output device.
Syntax:

puts(char type of array variable);
 
23.Scanf() function
Input data can be entered into the computer using the standard input ‘C’ library function called scanf(). This function is used to enter any combination of input.

Syntax:

Scanf(“control string”,&var1,&var2,….&varn);
             

24. Rules for writing scanf () function:
a.       The control string must be preceded with & sign and must be within quotations.
b.      If there are a number of input data items, that items must be separated by commas & must be preceeded with & sign except for string input.
c.       The control string & the variables going to input should match with each other.
d.      It must have termination with the semicolon.
25. Rules for writing printf () function:
a.       Place appropriate headings in the output.
b.      If there are a number of input data items, that items must be separated by commas & must be preceeded with & sign except for string input.
c.       The control string and the variables must match in their order.
d.      The control string must be within quotations and there we can also use any other text to print with data.
e.       Provide blank space in between the members.
f.       Print special message, whenever occurs in output.
26. Branching statement:
                Branching  statement alter sequential execution of program statement. The following are the branching statements
Ø  If statement
Ø  If-else statement
Ø  Switch statement
Ø  Goto statement
27. If statement
o   If statement is a conditional statement it is used to execute or skip one statement or group of statementsfor a particular condition.
o   Syntax:
if(test-condition)
{
Statement block;
}
next statement;
28. if-else statement:
o   if-else statement is a conditional statement ,tit is used to execute one group of statements if the test-condition is true or other group if the test-conditon is false .
o   Syntax:

if(test-condition)
{
Statementblock1;
}
else
{
Statementblock2;
}
Next statement;
29. Switch statement
o   Switch statement is a conditional statement . It is an extension of if-else statement this permits any number of branches.
o   Syntax;

Switch(expression)
{
Case label 1:
                Statement block1;
                Break;
Case label 2:
                Statement block1;
                Break;
……………………………..
…………………………….

Case label n:
                Statement block1;
                Break;
}next statement;
30. Goto statement :
o   Goto is an unconditional branching statement. Goto statement is used to transfer the program control unconditionally from one point to another .
o   Syntax:

                                        goto Label;
label is the name given to the point where the control has to be transferred











UNIT V          
1.Function
            Function is a module (sub program) which performs a particular task (job/action). A large program is divided into a number of small programs called subprogram or module.
2.Parameter passing
  • Parameter passing is a mechanism for communication of data between the calling function(caller) and the called function(callee) 
  • A function that invokes(calls) another function is known as a calling function (caller)
  • A function which is invoked (called) by another function is known as a called function(callee) 

3.Methods (ways) of calling a function or parameter passing methods

1.      Call by Reference or pass by reference
2.      Call by Address or pass by address
3.      Call by Value or pass by value

4.Call by Value
            Call by value is a parameter passing method or method of calling a function by passing                    the value of an argument (parameter) to the function
  • When an argument is passed call by value ,a copy of the arguments value is made and passed to the called function
  • Change to the parameter within the function will effect only the copy(formal parameter) and will have no effect on the actual parameter.

5.Call by Address
            Call by Address is a parameter passing method or method of calling a function by passing the address of an argument to the function
  • When the argument is passed the address of the argument is copied instead of value
  • Changes to the parameter within the function will affect both the formal and actual parameter.

6.Call by Reference
            Call by reference value is a parameter passing method or method of calling a function which has the syntax of call by value and the functionality of call by address
            Any modification made through the formal parameter is also reflected in the actual parameter.

7.Strings

In “C” language the group of character,digits,and symbols enclosed within quotation marks are called as string otherwise strings are array of characters.Null character (‘\0’)is used to mark the end of the string.
Example :
                        Char name [ ] = {‘B’,’A’,’U’,’\0’}
Each character is stored in one byte of memory and successive characters of the string are stored in successive byte.
8. The strlen() function
            This function is used to count and return the number of characters present in a string.
Syntax
Var=strlen(string);
Description
Var          Is the integer variable which accepts           .               the length of the string

String       Is the string constant or string
                 variable,in which the length is going
                 to be found.the counting ends with
                 first null character   

9. The strcpy() function
            This function is used to copy the contents of one string to another string,it almost works like string assignment operator.
             
Syntax
Strcpy(string1,string2);
Description
String1          is the destination operator.
String2          is the source operator.
                                                                                                                                                                                                                                                                                                                                                    
i.e.The contents of string2 is assigned to the contents of string1.

10. The strcmp() function
                        This is a function which compares two strings to find ou whether they are same or not.The two strings are compared character by character till the end of the string.If the two strings are identical strcmp() returns zero,else it returns a numeric difference between the first non matching characters.
Syntax
Strcat(string1,string2);
Description
String1 and string2 are character type arrays or string constants.

11. The Strrev() function
                        The strrev() function is used to reverse a string.This function takes only one argument and return one argument.The general form of strrev() function is
Syntax
Strrev(string1);
Description
String1 is character type arrays or string constants.

12.Structure :
            A structure is a user defined data type used to represent different types of data with a single name. The data items in a structure are called members of a structure.
Syntax:
Struct tag-field
{
datatype member1;
datatype member2;
…..
…..
datatype member n;
}
13.Union:
             Union is like a structure data type in which all the members share the same memory area.

Syntax;

Union tag-field
{
datatype member1;
datatype member2;
……
……
datatype membern;
}variable1 ,variable2,…variable n;
14.Uses of Union:
             Union needs less memory space than structure. Union can be used to store temporary variables of different data types i.e., They are useful for applications involving number of variables , where values need not be assigned to all elements at one time.

15.Difference between Union and structure
·         A union can provide storage for one member at a given time. But a structure can provide storage for all members.
·         The amount of space allocation for union is based upon the member which requires the largest memory space. But in structure each member is given memory space .
·         In Union at one time we can refer any one variable.but in structure we can refer all the variables.
16.Array:
            Array is the derived datatype that contains multiple values, sequence of finite data items of the same data type that share a common name.

17.Pointer:
            Pointer is the derived data types that contains the address of the variable.

18.What is preprocessor:
Preprocessor is a program that process our source program before compilation.
Ø  These are placed before the main() function in the source program.
Ø  The compiles examines the preprocessor for any preprocessor directives.
If there is any preprocessor directives, the appropriate action are taken and then the source program is moved for compilation

19.Preprocessor directives:

a)      File inclusion.
b)      Macro substitution.
c)       Conditional inclusion.

The preprocessor operates under the following preprocessor directives.



           
20. File inclusion:
Ø  This is used to include an external file, which contains functions or some other macro definitions  to our source program.


#include”file name” and
#include<filename>

Syntax:


                          
    
Example:

#include<stdio.h>
#include’loop.c”
 



21. Macro Substitutions:
Ø This is used to define symbolic  constants in the source program.
Ø The identifier or string define is replaced by macro substation.

#define identifier string/integer
Syntax:



22.Types of Macros:
v  Simple macros
v  Argumented macros
v  Nested macros

23. Simple macros

Ø  This is commonly used to define symbolic constants

#define   age 20
#define   CITY   “CHENNAI”
#define   g 9.8
#define   A 10


                          Examples:




Ø  The #define   A 10 macro substitutes ‘A’ with 10 in all occurrence in the source program.
24. Argumented macros

Ø  The argumented macros are used to define more complex form of replacement in the source program.

#define   identifier  (v1 v2 v5….v4) string/integer
Syntax:

25.Nested macros
Ø  The macros define in another macro called nested macros.

#define   A   5
#define   B A+2
 






26. Rules for defining preprocessor:
a)      Every processor must start with # symbol.
b)      The processor is always placed before main() function.
c)       The preprocessor cannot have termination with semicolon
d)      There is no argument operator in #define statement.
e)      The conditional macro must be terminated  (#ifdef, #endif)



























CSE @ CIT GE 2115 FOC NOTES

Comments

Popular posts from this blog

PROGRAMMING AND DATA STRUCTURES - 2 MARKS

CS2302 Computer Networks _16 Important Questions