Vous êtes sur la page 1sur 25

GE2112 FUNDAMENTALS OF COMPUTING AND PROGRAMMING

UNIT I
INTRODUCTION TO COMPUTERS

1. Define Computer. Give its expansion. Computer is fast operating device, which automatically accepts and store input data, process them and produce result under the direction of step by step. COMPUTER: Commonly oriented machine particularly used for trade and education research. 2. Define storing. Storing is the process of saving or retaining the data or information or instruction, so that the user can retain and retrieve it whenever required. 3. Define Data and Information. Data: It is nothing but the fact or raw material for the information processing. Information: The processed data is called information. 4. Give the basic computer functional units? Input Unit Central Processing Unit Output Unit 5.What are characteristics of computers? The characteristic of the computers are speed, accuracy, automation, endurance, storage, versatility, cost reduction, no intelligent quotient(IQ). 5. List out the operations performed by the central processing unit. It performs all calculation and all decisions. It controls and co-ordinates all unit of the computer. It interprets instruction of a program. It stores data temporarily and monitors external request. 6. Define Hardware. The term Hardware is applied to any physical equipment in the computer system, such as machinery.

7. Define software.(R) 1

Software is basically the set of instructions grouped into programs that make the computer to function in the desired way. It is a collection of programs to perform a particular task. 8. Define operating system. A collection of programs used to control and co-ordinate the computer system is called operating system. Operating system manages and coordinates the functions performed by the computer system hardware, I/O devices, including the CPU, secondary storage devices, communication and network equipment. 9. Basic Operations of a computer The computer have the following five basic operations to carry out any task. They are 1.Input 2.Process 3.Output 4.Storing 5.Controlling 10.Define type of RAM Masked ROMS PROM EPROM EEPROMS Flash ROMS.

11. Differentiate between static and dynamic RAM .


S.No Static RAM Dynamic RAM

1. 2. 3. 4.

Retain its content as long as power is available. Constantly maintained data. Less number of chip used. Very fast.

Its has short data life. Need to be refreshed to maintain data in it. More number of chips used. Slow compared to Static RAM.

12. Differentiate between RAM and ROM.


S.No ROM RAM

1. 2. 3. 4. 5.

It is a non-volatile memory The content are permanent Available in high storage capacity Processor speed is low Cost effective

It is a volatile memory The content are temporary Available in small storage capacity Processor speed is high Cost is very high

6.

Generally the operating system supporting programs can be stored

User defined program can be stored at any time

13. Define cache memory? A small memory between CPU and main memory is called cache memory. The access time is closer to the processing speed of the CPU. Cache memory acts as a high speed buffer between CPU and main memory. It is used to temporarily store active data and instructions during processing.

14. Specify the advantages of magnetic tape? Non-volatile memory Voluminous data can be stored These tapes are easily transportable, they are compact in size, light weight, easily removable and easy to handle. 15. List out the cables used to connecting computers with peripherals? Power cord Monitor cable Mouse cable Keyboard cable Printer cable UNIT II COMPUTER SOFTWARE 1. List out some application software? Adobe Photoshop Adobe PageMaker Word processing Spreadsheet package Presentation package 2. What is meant by software piracy? Software piracy is a illegal distribution and/or reproductions of any software applications or fonts for business or personal use. 3. Define electronic mail? Electronic mail is one of the most popular uses of the internet once you have an email account you can send an electronic message to just about anyone else with an email account so as long as you know their email address.

4 Define Software Categories?.

Software divided into two categories: systems software : Includes the operating system and all the utilities that enable the computer to function. applications software : Includes programs that do real work for users. For example, word processors, spreadsheets, and database management systems fall under the category of applications software. 5. What you mean System Software? System Software: It helps in running the computer hardware and the computer system. System software is a collection of operating systems; devise drivers, servers, windowing systems and utilities. System software helps an application programmer in abstracting away from hardware, memory and other internal complexities of a computer. 6. What you mean Application Software? Application Software: It enables the end users to accomplish certain specific tasks. Business software, databases and educational software are some forms of application software. Different word processors, which are dedicated for specialized tasks to be performed by the user, are other examples of application software.
7 .Use of System Software?

System software helps run the computer hardware and computer system. It includes:

device drivers, operating systems, servers, utilities, windowing systems,

The purpose of systems software is to unburden the applications programmer from the details of the particular computer complex being used, including such accessory devices as communications, printers, readers, displays, keyboards, etc. And also to partition the computer's resources such as memory and processor time in a safe and stable manner. 8. Define Programming software Programming software usually provides tools to assist a programmer in writing computer programs, and software using different programming languages in a more convenient way. The tools include:

compilers, debuggers, interpreters, linkers, 4

text editors,

9. Need for Application software Application software allows end users to accomplish one or more specific (not directly computer development related) tasks. Typical applications include:

industrial automation, business software, computer games, telecommunications, (i.e. the internet and everything that flows on it) databases, educational software, medical software,

10 Define Phases of Software Development Steps? i. ii. iii. iv. v. Requirement Analysis Design Development Testing Implementation and Maintenance

11. Define WWW? The World Wide Web is a collection of interconnected documents and other resources, linked by hyperlinks and URLs. The WWW is merely a service accessible via internet, along with many other services including e mail .file sharing etc..

12. Define Web page? A web page or webpage is a resource of information that is suitable for the World Wide Web and can be accessed through a web browser. This information is usually in HTML or XHTML format, and may provide navigation to other web pages via hypertext links. 13. Define Web Browser? A web browser is a software application which enables a user to display and interact with text, images, videos, music, games and other information typically located on a Web page at a website on the World Wide Web or a local area network. ...

14. Define IP

DEFINITION: The Internet Protocol (IP) is the method or protocol by which data is sent from one computer to another on the Internet. Each computer (known as a host) on the Internet has at least one IP address that uniquely identifies it from all other computers on the Internet. When you send or receive data (for example, an e-mail note or a Web page), the message gets divided into little chunks called packets. Definition continues below. 15. Define URL? The unique address of any Web document. The URL tells the browser where a file is and how to deal with it. The URL is like a path leading to a particular file on a particular website on a particular server. On your screen, the URL is displayed near the top of a webpage in the address bar. 16. Define Domain name system? Definition: The DNS translates Internet domain and host names to IP addresses. DNS automatically converts the names we type in our Web browser address bar to the IP addresses of Web servers hosting those sites. DNS implements a distributed database to store this name and address information for all public hosts on the Internet. DNS assumes IP addresses do not change (are statically assigned rather than dynamically assigned).

17 Define TELNET? Telnet (Telecommunication network) is a network protocol used on the Internet or local area network (LAN) connections. ... A network protocol that enables one computer to communicate with another via the Internet; the program that acts as the client in this situation ... An Internet protocol that allows the user to connect to a remote computer. The Internet standard protocol for remote login (terminal connection) service. TELNET allows a user at one site to interact with a remote ...

UNIT III
PROBLEM SOLVING AND OFFICE AUTOMATION

1. What is Algorithm? Algorithm means the logic of program. It is a step-by-step description of how to arrive at a solution of a given problem 2. Define flowchart. Flowchart is a pictorial representation of an algorithm, it is the layout and visual representation of the plan to be followed by the corresponding algorithm. 3. What is a decision table? A Decision table is a table containing the selection of conditions to be tested and how those conditions should be nested to arrive at the proper action. 4. What is Pseudocode? Pseudo means imitation of false and code refers to the instruction written in a programming language. Pseudocode is programming analysis tool that is used for planning program logic. 5. Define types of programming languages. Machine Language: It uses only 0s and 1s to represent data and the instructions. Assembly Language: It uses only mnemonic codes to represent data and the information. High-Level Language: These Languages are written using a set of words and symbols by accessing specific rules and syntax.

6. Define compiler. It is a program, which is used to convert the high-level language programs into machine language. 7. Define Assembler. It is a program, which is used to convert the assembly level language programs into machine language. 8. Define Interpreters. It is a program, it takes one statement of high-level language program, translates it into machine language instruction and the immediately executes the resulting machine language instruction and so on. 9. Diffrentate between Compiler and Interpreters.
S.No Compiler Interpreters

1.

A compiler is used to compiler an entire program and an executable program is generated through the 7

An interpreter is used to translate each line of the program code immediately as it is entered.

2.

object program. The executable program is stored in a disk for future use or to run it in another computer. Most of the languages use compiler

3.

The executable program is generated in RAM and the interpreter is required for each run of the program. A very few languages use interpreters

10 Define office automation? Application of information technology to the typical clerical and secretarial tasks such as communication, correspondence, documenting, and filing. 11. What is office automation? The term office automation refers to all tools and methods that are applied to office activities which make it possible to process written, visual, and sound data in a computeraided manner. Office automation is intended to provide elements which make it possible to simplify, improve, and automate the organisation of the activities of a company or a group of people (management of administrative data, synchronisation of meetings, etc.). Considering that company organizations requires increased communication, today, office automation is no longer limited to simply capturing handwritten notes. In particular, it also includes the following activities: 1. Exchange of information 2 Management of administrative documents 3. Handling of numerical data 4. Meeting planning and management of work schedules 12. Define Program A Program is a set of instructions written to carryout a particular task 13. Define the waterfall method The basis for most systems analysis and design methodologies is the system development life cycle or SDLC). It is sometimes called the waterfall method because the model visually suggests work cascading from step to step like a series of waterfalls.

Key terms Analysis To attack a problem by breaking it into sub-problems. The second step in the system development life cycle (following problem definition) during which the responsible people determine exactly what must be done to solve the problem. Boundary An entity that serves to delimit or separate a system from its environment. Control An expected value that can be compared with feedback. If the feedback suggests a deviation from the expected value (the control), the system reacts by attempting to adjust itself. Design The third step in the system development life cycle (following analysis and preceding development) during which the responsible people determine how the problem will be solved by specifying the systems physical components. Development The fourth step in the system development life cycle (following design and preceding testing) during which the system is created. Feedback The return of a portion of the systems output to its input. Implementation The sixth step in the system development life cycle (following testing and preceding maintenance) during which the system is installed and released to the user. Information system A set of hardware, software, data, human, and procedural components intended to provide the right data and information to the right person at the right time. Interface A mechanism or point of interaction between two or more system components. Maintenance The final step in the system development life cycle (following implementation) intended to keep the system functioning at an acceptable level. Methodology A body of practices, procedures, and rules used by those who work in a discipline or engage in an inquiry. Often implemented as a set of well-defined steps or phases, each of which ends with a clear, measurable set of exit criteria. Problem definition

The first step in the system development life cycle during which the problem is identified, its cause determined, and a strategy for solving it developed. Process An activity that changes a system in some way. Suprasystem A systems environment. System A set of interrelated components that function together in a meaningful way. System development life cycle (SDLC) A set of steps for solving information system problems; the basis for most systems analysis and design methodologies. System life cycle A model that stresses the stages of system usefulness. The stages are birth, development, growth, maturity, and death. Testing The fifth step in the system development life cycle (following development and preceding implementation) intended to ensure that the system does what it was designed to do.

UNIT IV
INTRODUCTION TO C

1. Who developed C language? C is one of the most popular programming languages. It was developed by Dennis Richie at Bell Laboratory at USA in 1972. 2. Give any four features of C language? 1. C is a general purpose structured programming language. 2. C is powerful, efficient, compact and flexible. 3. C is highly portable. 4. C is a robust language whose rich set of built in functions and operators can be used to write any complex program. 3. What is meant by global declaration section? The variables that are used in more than one function throughout the program are called global variables and declared outside of all the function that is before main(). 10

4. Define commands? Commands are very helpful in identifying the program features and under laying logic of the program. This line begins with /* and ends with / are known as command lines. These are not executable the complier is ignored anything in between /*and */. 5. What are programming rules should follow while writing the C program? 1. All statements in C program should be written in lowercase letters. Uppercase letters are only used for symbolic constants. 2. Blank spaces may be inserted between the words. It is not used while declaring a variable, keyword, constant and function. 3. The program statement can write any where between the two braces following the declaration part 4. The user can also write one or more statements in one line separating them with a semicolon. 6. Define logical and data errors? Logical error: These are the errors in which conditional and control statements cannot end there match after some sequential execution. Data errors: These are the errors in which the input data given is not in proper syntax as specified in input statements.

7. List out the characteristic of a program? Clarity Integrity Simplicity Efficiency Generality 8. What is meant by C character set? The character set is a fundamental raw material of any language and they are used to represent information like natural languages, computer language will also have well defined character set, which is used to built the programs. 9. What is meant C tokens? The programs are usually referred as individual text and punctuation in a passage of text. The C language program can contain the individual units called C tokens 10. Define identifiers? Identifiers are names given to various program elements such as variable, functions and arrays etc. 11. Define data types? Data type is the type of the data that are going to access within the program. C supports different data types each data type may have pre-defined memory requirement and storage representation.

11

12. What are different data types available in C? int float character and double. 13. What are keywords? Keywords are certain reserved words that have standard and pre-defined meaning in C. These keywords can be used only for their intended purpose. 14. What is meant by variables? A variable is an identifier that is used to represent some specified type of information within a designated portion of the program. 15. What is meant by local variables? A variable which are defined inside a function block or inside a compound statement of a function subprogram are called local variables. 16. Define constants? The items whose value cannot be changed during a execution of a program are called constants. 17. What are the types of numeric constants? Integer constant: Integer constant formed with the sequence of digits. There are three type of integer constants which forms different number system Real constant: Real constant is made up of a sequence of numeric digits with presence of decimal point. It serves as a good purpose to represent quantities that vary continuously such as distance, height, temperature etc. 18. Define statements? Statements can be defined as set of declaration or sequence of action. Statement causes the computer to perform some action. 19. What is a operator and an operand? An operator is a symbol that specifies an operations to be performed on operands. e.g. +, -, *, / are called arithmetic operators. The data items that operators act upon are called operands. e.g. a+b. In this a and b are called operands. 20. Difference string constant. A string constant is a sequence of characters enclosed in a double quotes, the characters may be letters , numbers , special characters and blank space etc, at the end of the string \0 is automatically placed. 21. What are the types of operators? Arithmetic operators Relational operators Logical operators 12

Assignment operators Increment and decrement operators Conditional operators ( Ternary operator ) Bit wise operators Special operators

22. What is ternary operator? Ternary operator is a conditional operator with symbol ? and : Syntax: variable = exp1? exp2: exp3 If the exp1 is true variable takes the value of exp2. If the exp1 is false variable takes the value of exp3. 23. What are the bit wise operators available in c? & - Bit wise AND | - Bit wise OR ~ - Ones complement >> - Right shift << - Left shift ^ - Bit wise XOR are called bit field operators. 24. What is the logical operator available in c? The logical operators in C are && || ! - Logical AND - Logical OR - Logical NOT

25. What is difference between logical AND and bit wise AND? Logical AND only used in conjunction with two expressions to test more than one condition. If both the condition are true then returns one, if false then return zero. Bit wise AND only used in bit wise manipulation. It is an unary operator. 26. What is difference between = and = = operator? Where = is an assignment operator and = = is a relational operator. 27. Define expression An expression represents data item such as variables, constants and are Interconnected with operators as per the syntax of the language. An expression is evaluated using assignment operators. 28. What are types of I/O statement available in C? There are two types I /O statements available in C: Formatted I/O statement Un formatted I/O statement 29. Define single character input getch ( ) function.

13

The getch ( ) function is written in standard I/O library. It reads a single character from a standard input device. This function does not require any arguments, through a pair of empty parenthesis, must follow the statement getch ( ). 30. Define single character output 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 a single character input function. 31. Define scanf ( ) statement. The scanf ( ) function is used to read information from the standard input device ( key board ). Scanf ( ) function starts with the string argument and may contain additional argument. Syntax: scanf(control string,&var1,&var2,..,&varn); 32. Define printf ( ). Output data or result of an operation can be displayed from the computer to a standard output device using the library function printf ( ). This function is used to output any combination of data. Syntax: printf(control string,var1,var2,..,varn); 33. What is conversion specification? The conversion specification are used to accept or display the data using the INPUT / OUTPUT statements.

34. What is the difference between scanf( ) and gets( )? In scanf( ) when there is a blank was typed, the scanf( ) assumes that it is an end. gets( ) assumes the enter key as end, that is gets() gets a new line ( \ n ) terminated string of characters from the keyboard and replaces the \n with \0 .
DECISION MAKING

35. Define simple if statement? The if statement is a decision making statement. It is used to control the flow of execution of the statements and also used to test logically whether the condition is true or false. Syntax: if(expression) { statements; } 36. What is meant by looping? The loop is defined as the block of statements which are repeatedly executed for certain number of times. 37. Define if-else statement?

14

It is basically two way decision-making statement and always used in conjunction with condition. It is used to control the flow of execution and also used to carry out the logical test and then pick up one of the two possible actions depending on the logical test. Syntax: if(expression) { statements; else statements; } 38. Define for loop? The for loop is another repetitive control structure and is used to execute set of instructions repeatedly until the condition becomes false. 39. What are the differences between while and dowhile loop? While dowhile This is top tested loop This is the bottom tested loop The condition is first tested if the It executes the body once after it check condition is true then the block is executed the conditions if it is true the body of until the condition becomes false. the loop is executed until the condition become false. Loop will not be executed if the condition Loop is executed atleast once is false. even though the condition is false.

40. What is meant by switch statement? The switch statement is used to pick up or execute a particular group of statements from several available group of statements. It allows us to make a decision from the number of choices. 41. Define nested for loop? The loop within the loop is called nested loop. In nested for loop one or more for statements are included in the body of the loop. The number of iterations in this type of structures will be equal to the number of iterations in the outer loop multiplied by the number of iterations in the inner loop. 42. What is meant by break statement? The break statement is used to terminate the loop when the keyword break is used inside any c loop control automatically transferred to the first statement after the loop. Break is usually associated with an if statement. 43. Define goto statement? The goto statement transfer control unconditionally from one place to another place in the program. 44. What is meant by continuous statement?

15

If we want to take the control to the beginning of the loop by passing the statements inside the loop which have not yet been executed, for this purpose the continue is used. When the statement continue is encountered inside any C loop control automatically passes to the beginning of the loop

UNIT-V FUNCTIONS AND POINTERS 1. What is Function? A Function is a self-contained program segment that carries out some specific, well-defined task. A function will process information that is passed to it from the calling portion of the program, and return a single value. Information is passed to the function via special identifiers called arguments (also called Parameters), and returned via the return statement. 2. How to define a Function? A Function definition has two principal components: the first line (including the argument declarations), and the body of the function. The first line of a function definition contains the type specification of the value returned by the function followed by the function name, and (optionally) a set of arguments, separated by commas and enclosed in parentheses. The remainder of the function definition is a compound statement that defines the action to be taken by the function. 3. How to Access a function? A function can be accessed (i.e., called) by specifying its name, followed by a list of arguments enclosed in parentheses and separated by commas. 4. What is a meant by actual arguments and formal arguments? The arguments appearing in the function call are referred to as actual arguments, in contrast to the formal arguments that appear in the first line of the function definition. Actual argument must be of the same data type as its corresponding formal argument. The value of each actual argument that is transferred into the function and assigned to the corresponding formal argument. 5. Define Call by value or Pass by value? Value is passed to a function via an actual argument, the value of the actual argument is copied in to the function. Therefore, the value of the corresponding formal argument can be altered within the function, but the value of the actual argument within the calling routine will not change. This procedure for passing the value of an argument to a function is known as passing by value. 6. Define call by reference? Call by reference is another way of passing parameters to the function. Here the address of arguments are copied in to the parameters inside the function, the address is used to access the actual arguments used in the call. Hence changes made in the arguments are permanent.

16

7. Define recursion? Recursion is a process by which a function calls itself repeatedly, until some specified condition has been satisfied. The process is used for repetitive computations in which each action is stated in terms of a previous result. Many iterative (i.e. repetitive) problems can be written in this form. 8. What is meant by storage class? Storage class refers to the permanence of a variable, and its scope within the program. 9. What is meant by automatic (local) variable? Automatic variables are always declared within a function and are local to the function in which they are declared; that is their scope is confined to that function. Automatic variables defined in different functions will therefore be independent of one another even though they may have the same name. 10. What is meant by static variable? The static variable may be an internal or external type, depending upon where it is declared. If declared outside the function body, it will be static or global. 11. What is meant by external (global) variable? External variable in contrast to automatic variables, are not confined to single functions. Their scope extends from the point of definition through the remainder of the program. Hence they usually span two or more functions, and often an entire program. They are often referred to as global variables. External variables are recognized globally, they can be accessed from any function that falls within their scope. They retain their assigned values within the scope. 12. Define register variable? Registers are special storage areas within a computers central processing unit. The actual arithmetic and logical operation that comprise a program are carried out within these register. 13. What is meant by library functions? C language provides built in functions or intrinsic functions called Library Functions. The complier itself evaluates these functions. 14. List some library functions? sqrt(x) log(x) abs(x) fabs(x) exp(x) pow(x,y)

17

ARRAYS 15. Define array? An array is a group of related data items that share a common name. While the complete set of values is referred to as an array, the individual values are called elements. 16. Write the classification of array? Arrays can be classified into

One-dimensional arrays Two-dimensional arrays Three-dimensional arrays

17. Define One-dimensional arrays? A list of items can be given one variable name using only one subscript and such a variable is called a single-subscripted variable or a one-dimensional array. 18. Declaration of arrays? Arrays must be declared before they are used. The general form of array declaration is type variable-name[size] The type specifies the type of element that will be contained in the array, such as int, float, or char and the size indicates the maximum number of elements that can be stored inside the array. For example, float height[50]; 19. What is meant by Two-dimensional arrays? Two-dimensional arrays are used in situation where a table of values needs to be stored in an array. These can be defined in the same fashion as in one dimensional array, except separate pair of square brackets is required for each subscript. 20. Define passing array to functions? An entire array can be passed to a function as an argument. To pass an array to a function, the array name must appear by itself, without brackets or subscripts, as an actual argument within the function call. 21. What are the ways to initialize array? The values can be initialized to an array, when they are declared like ordinary variables, otherwise they hold garbage values. The array can be initialized in the following two ways: At compile time At run time. 22. What are multi-dimensional arrays?

18

Multi-dimensional arrays are defined in much the same manner as onedimensional arrays, except that a separate pair of square brackets is required for each subscript. Thus a two-dimensional array will require two pairs of square brackets; a threedimensional array will require three pairs of square brackets and so on. In general terms a multi-dimensional array definition can be written as storage-class data-type array[expression 1][expression 2]..[expression n].

23. Define string? In C language the array 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. Ex: char name[] = {b,a,c} 24. How to declare and initialize string variables? A string variable is any valid C variable name and is always declared as an array. The general form of declaration of a string variable is Char string_name[size]; The size determines the number of characters in the string name Character arrays may be initialized when they are declared. C permits a character array to be initialized in either of the following two forms: Static char city[9]= NEW YORK; Static char city[9]= {N.E,W,Y,K} 25. List some string functions? strlen( ) strcpy( ) strcat( ) strcmp( ) strlwr( ) strrev( ) 26. Define enumeration data types? The C provides user defined data type which is called enumerated data type i.e, the programmer can create their own data type and define what values the variables of these data types can hold. It is defined as follows: Syntax: Enum tagname { enum 1; enum 2; . . enum n; };

19

27. What are the three elements of user defined function? Function definition Function declaration Function POINTERS 1. What is a pointer? A pointer is a variable it may contain the memory address of another variable. Pointer can have any name that is legal for other variable. It is declared in the same manner like other variable. It is always denoted by * operator. 1. What is meant by null pointer? A pointer is said to be a null pointer when its right value is 0. A null pointer can never point to a valid data. For checking a pointer , if it is assigned to 0, then it is a null pointer and is not valid. Example: int *a; int *b; b=a=0; Hence b and a become null pointers after the integer value of 0 is assigned to them. 2. Compare call by value and call by reference
Call by Value Call by Reference

Different memory locations are occupied by formal and actual arguments Any alteration in the value of the arguments passed is local to the function and is not accepted in the calling program. The usual method to call a function in which only the value of the variable is passed as an argument.

Same memory location occupied by formal and actual arguments and there is a saving of memory location. Any alteration in the value of the argument passed is accepted in the calling program. The address of the variable is passed as an argument.

3. Write advantages of using pointers? Pointers provides the following benefits a) Pointers are more compact and efficient code. b) Pointers can be used to achieve clarity and simplicity. c) Pointers provides a way to return multiple data items from a function using its function arguments. d) Pointers enables us to access the memory directly. 4. Write a program to print address and value of variable. /* program to print address of variable sno and value of variable sno */ #include<stdio.h> main() {

20

/*local definition*/ int sno =39; /*statements */ printf (Address of sno=%u, &sno); printf(Value of sno =%d,sno); }/*main*/

5. Define arrays of pointer? Array notation is a form of relative addressing. The compiler treats the subscripts as a relative offset from the beginning of the array. When a pointer variable is set to the start of an array and is incremented to find the next element, absolute addressing is being implemented. 6. Give a syntax of structure pointer? Pointer pointing to a structure is known as structure pointers Struct { member 1; member 2; }Variable, *ptr; 7. What is meant by dynamic memory allocation ? Dynamic allocation is a pretty unique feature to C. It enables us to create data types and structures of any size and length to suit our programs need within the program. The data items in every C program are dynamic in nature. ie , the data items in source program can be changed during the program execution. 8. List Dynamic memory allocation function? Function malloc() free() calloc() realloc() Meaning Used to allocate blocks of memory in required size of bytes. Used to release previously allocated memory space. Used to allocate memory space for an array of elements. Used to modify the size of the previously allocated memory space.

9.Define malloc() , calloc() function ? malloc() It is used to allocate block of memory .It allocates a block of memory of specified size and return a pointer of type void . calloc() It is used for allocating memory space during the program execution for derived data types such as arrays ,structures etc. 10. Define static memory allocation ?

21

It is allocated during compilation time when a variable is declared based on their type ,compiler allocates space in memory, these variables can be indirectly accessed with the help of pointer variable by assigning address of the variable to the pointer variable . 11. What is meant by dynamic memory allocation? Dynamic allocation is a pretty unique features of C. It enables us to create data types and structures of any size and length to suit our programs need within the program
STRUCTURES UNIONS AND FILE HANDLING

11.Define structure ? It contains one or more data items of different data type in which the individual elements are of different type. 12. Define structure declaration with example ? The structure can be declared with the keyword struct following the name and opening brace with data elements of different type then closing brace with semicolon, as shown below Syntax struct structure_name { struct_element 1; struct_element 2; struct_element n; }; struct structure_name v1,v2,..,vn; Here, v1,v2,..,vn are structure variables. Example struct std { int no; char name[10]; int marks; }; struct std s1,s2; 13. How structure elements can be accessed ? After declaring the structure type , variable members , the member of the can be accessed by using structure variable along with the dot operator.(.) Example: struct book { int no; char name[10]; }; struct book b1;

structure

For accessing the structure members from the above example 22

b1.no; b1.name; 14. Differentiate array and structure


Array

where b1 is the structure variable.

Structure

An array is a collection of similar data types It is derived data type It behaves like a built in data type An array can be increased or decreased

It is a collection of different data types It is user defined data type It must be declared and defined Structure elements can be added necessary

15. Define Union? Union is derived data type and it is declared like structure All the members of the union use the same location .A union may contain many members of different data type. 16. Differentiate Union and structure
Union Structure

All the members of union share the same location Key word union is used here Different interpretation for same memory location is possible

Each member is allocated their own memory Here struct keyword is used Any members can be accessed at any time without the loss of data

17. Define nested structure? If a structure contain more than one structure as its members is known as nested structure. Example struct address { char addr1[20]; char addr2[20]; char town[20]; ); This structure can be used as a member in another structure as struct employee { int code; char name[20]; struct address addr; }; struct employee emp1;

23

18. What is a self-referential structure? A structure consist of at least a pointer member pointing to the same structure is called as self referential structure 19. What is meant by files? A file is collection of related information that is permanently stored in a disk and allows us to access and alter the information whenever necessary 20. Define bits & bytes? Bits: Bits is known as binary digit. Each bit value can be 0 or 1 Byte :Bytes are most commonly made up of eight bits used to store a single character . 23. What is the difference between library function and user-defined function? Library functions are the function which are already written in some standard libraries. User-defined function means the function which are written or created by the user to perform a particular task.

24

25

Vous aimerez peut-être aussi