You are on page 1of 23

FUNDAMENTALS OF COMPUTER PROGRAMMING

SNS COLLEGE OF tECHNOLOGY


COIMBATORE 35

DEPARTMENT OF COMPUTER SIENCE AND ENGINEERING (UG & PG)


Final Year Computer Science and Engineering, 1th Semester

2 Marks Question and Answer Subject Code & Name: Fundamentals of computer programming
UNIT 1 INTRODUCTION TO COMPUTERS

1. Define Computer The computer is an electronic device which converts raw data into valid or meaningful information. 2. What is Program? A device to manipulate the data according to the programmed instructions. An intelligent machine that solves problems by accepting data, performing certain operation and producing the result under the direction of step by step instruction called program. 3. Define Data Data is information that has been translated into a form that is more convenient to process. 4. What is an Information? The processed data is called the information. 5. The Information Processing Cycle Using a computer to convert data into useful information is referred to as information processing (also called data processing). Processing data into information involves four basic functions: Input data entered into a computer for processing Processing the manipulation of data according to program instructions Output the creation of information resulting from processing Storage the retention of processed data on a storage medium for future use

Collectively, these steps are known as the information processing cycle.

SNSCT Department of Compute Science and Engineering

Page 1

FUNDAMENTALS OF COMPUTER PROGRAMMING

6. What are the Characteristics of Computers? Some of the characteristics of computers, which make them an essential part of every emerging technology. 1. 2. 3. 4. 5. 6. 7. Speed Accuracy Diligence Reliability Storage capability versatility Resource sharing

7. Write about various speed levels in computer. 1 nano seconds = 1 X 10-9 Sec 1 pico seconds = 1 X 10-12 Sec Computer process data at an extremely fast rate - Millions of instructions per second. The speed of a computer is calculated in MHz (Megahertz), that is one million instructions per second. Present computer can perform billions of operations in just one second 1 milli seconds = 1 X 10-3 Sec 1 micro seconds = 1 X 10-6 Sec 1 nano seconds = 1 X 10-9 Sec 1 pico seconds = 1 X 10-12 Sec 8. What do u mean by Accuracy? Besides efficiency, Computers are accurate as well. The level of accuracy depends on the instructions and the type of machine being used. Computers are extremely accurate when accurate programs and data are entered and processed correctly. The popular expression garbage-in, garbage-out (GIGO) means that if inaccurate programs and data are entered into a computer for processing, the resulting output will also be SNSCT Department of Compute Science and Engineering Page 2

FUNDAMENTALS OF COMPUTER PROGRAMMING


inaccurate 9. What do u mean by Diligence: A computer does not suffer from the human traits of tiredness and lack of concentration. If 4 million calculations have to be performed, then the computer will perform the last fourmillionth calculation with the same accuracy and speed as the first calculation. 10. What do u mean by Reliability: It is the measurement of performance of a computer, which is measured against some predetermined standard for operation without any failure. Computer have built in diagnostic capabilities, which help in continuous monitoring of the system 11 What is a Storage Capacity? Computers can store large amounts of data and can recall the required information Main memory of the computer is relatively small and it can hold only a certain amount of information, therefore the data is stored on secondary storage devices such as magnetic tape or disks. Small Sections of the data ca be accessed quickly and brought into the storage devices, as and when required for processing 12. What is Versatility? Computes are quite versatile in nature. They can perform multiple tasks simultaneously with great ease. For example, at one moment it can be used to draft a letter, another moment it can be used to play music and in between, one can print a document as well.

13. What do u mean by Resource Sharing? In the initial stages of development, computers used to be isolated machines. Sharing of costly resources like printers are possible Apart from device sharing, data and information can also be shared among groups of computers 14 What is a No Feeling? It does not have feelings ,

SNSCT Department of Compute Science and Engineering

Page 3

FUNDAMENTALS OF COMPUTER PROGRAMMING


it does not get tired even after long hours of work. No IQ (intelligence quotient) Computer is a dumb machine and it cannot do any work without instruction from the user and it cannot take its own decision as you can 15 Difference between Computer and human S.NO 1 2 3 4 5 6 7. Characteristics Speed Accuracy Performance Instructions Remember Different Situations Diligence Computer Fast and excellent Makes no error Very good Follow perfect Accurate and exact Makes good High Human Very slow High possibility of errors Poor Chance for imperfect inaccurate difficult low

16 Comparison between computer and calculator S.NO 1. 2. Characteristics Speed Performance Calculator Fast Simple calculation Computer Much fast and Complex problem and non numeric processing

numeric processing 3. Memory

Less internal memory and Large internal memory and no permanent storage, large available Electronic Device Arithmetic and logical permanent storage

temporary storage only 4 5. Machine Operation Electronic Device Arithmetic

17 Name some Applications of computer 1. In business 2. in industry 3. in home 4. in education

SNSCT Department of Compute Science and Engineering

Page 4

FUNDAMENTALS OF COMPUTER PROGRAMMING


5. in training 6. for entertainment 7. in science and engineering 8. in mathematics 9. In Medicine and Health care. 18 When to use a computer? 1. When accuracy to be improved 2. When delays are to be minimized 3. When high volume of data is required to store 4. When efficiency and economy is required 19 Evolution of computers: Abacus: Napier device:

Slide rule:
Pascaline: Stepped Reckoner. Charles Babbages Engines Holleriths Card reading machine: Mark I digital Computers: ENIAC EDVACEDSAC UNIVAC LARC Machine Microprocessor VLSI VLSI Very Large Scale Integration design

20. Generations of computers: In computer terminology the word generation is described as a stage of technological development or innovation.

SNSCT Department of Compute Science and Engineering

Page 5

FUNDAMENTALS OF COMPUTER PROGRAMMING


According to technology used there are 5 generations of computers Vacuum Tube transistor

Integrated Circuit Microprocessor

Super Large Scale Integrated (SLSI) 21 Classification of Computers Computers also differ based on their data processing abilities. Based on physical size, performance and application areas we generally divide computers into four major categories i. Micro Computers ii. Mini Computers iii. Mainframe Computers iv. Super Computers

22 What is a Micro Computers A Micro computer is a small, low cost digital computer, Which usually consists of a micro processor, a storage unit, an input channel and an output channel all of which may be on one chip inserted into one or several PC Boards. The addition of a power supply and connecting cables, appropriate peripherals (keyboard, monitor, printer and disk drivers ), an operating system and other software programs can provide a complete micro computer system Examples IBM-PC, Pentium 100, IBM-PC Pentium 200 and Apple macintosh Micro computers includes a) Desktop Computer b) Laptop c) Hand-held 23 Desktop Computer Also known as Personal Computer(PC) Standalone system used by an individual These are the most common type of micro computers Page 6

SNSCT Department of Compute Science and Engineering

FUNDAMENTALS OF COMPUTER PROGRAMMING


They consist of a system unit, a display monitor, a keyboard, internal hard disk storage and peripheral devices Main reason behind the importance of the PCs is that they are not very expensive for the individuals or the small businesses. Some of the major personal computer manufacturers are APPLE, IBM, Del.

24 What do u mean by portable computers A portable computer, that is, a user can carry it around. Since the laptop computer resembles a notebook, it is also known notebook Small computers which enclosing all the basic features of a normal computers. Advantage: i) Can use anywhere and at anytime, especially when one is traveling. ii) They do not need external power supply as a rechargeable battery is completely self contained in them desktop as

Disadvantage: i) Expensive compared to desktop computers

25 Hand-Held Computer A hand-held, also called personal digital assistant (PDA) is a computer that can conveniently be stored in a pocket (of sufficient size) and used while the user is holding it. They are slightly bigger than the common calculators. A PDA user generally uses a pen or electronic stylus instead of keyboard for input. Since these computers are easily fitted on the palm, they are also known as palmtop computers. They usually have no disk drive, rather they use small cards to store programs and data. However they can be connected to printer or a disk drive to generate output or store data.

SNSCT Department of Compute Science and Engineering

Page 7

FUNDAMENTALS OF COMPUTER PROGRAMMING


Disadvantage: It has limited memory and are less powerful as compared to desktop computers 26 Mini Computers In the early 1960s, Digital Equipment Corporation (DEC) started shipping its PDP series computer, which the press described and referred as mini computers. The mini computer is a small digital computer whose process and storage capacity is lesser than that of a mainframe, but more than that of micro computer. Its speed of processing data is in between that of a mainframe and a micro computer. Examples: Apple newton, casio cassiopeia and franklin eBookMan

27 Mainframe Computer A mainframe is an ultra-high performance computer made for high-volume, processor-intensive computing. It consists of a high-end computer processor, with related peripheral devices, capable of supporting large volumes of data processing, high performance online transaction processing systems, and extensive data storage and retrieval. It is able to process and store more data than a mini computer and far more than a micro computer. It is designed to perform at a faster rate than a mini computer and at even more faster rate than a micro computer. Mainframes are the second largest (in capability and size) of the computer family, he largest being super computers. Mainframes can usually execute many programs simultaneously at a high speed

28 What do u mean by Super Computers? Super computers are the special purpose machines, which are specially designed to maximize the numbers of FLOPS (Floating Point Operation per Second). Any computer below one gigaflop / sec is not considered a super computer. A super computer can process a great deal of information and make extensive calculations very quickly. 29 What are the Basic Computer Organization? A computer performs basically five major operations or functions irrespective of their size and make. 1. Input

SNSCT Department of Compute Science and Engineering

Page 8

FUNDAMENTALS OF COMPUTER PROGRAMMING


2. Storage 3. Processing 4. Output 5. Controlling 30 Write about Input Unit Data and instructions are entered into the memory of a computer through input devices. It captures information and translates it into a form that can be processed by CPU. Computer accepts input in two ways 1. Manually 2. Directly Manually: The user enters data into the computer by hand. E.g. Keyboard, mouse etc Directly: Information is fed into the computer automatically from a source document(like barcode.). 31 Write about Storage Unit The process of saving data and instructions permanently is known as storage. Data has to be fed into the system before the actual processing starts. It is because the processing speed of Central Processing Unit (CPU) is so fast that the data has to be provided to CPU with the same speed. Therefore the data is first stored in the storage unit for faster access and processing.

The storage unit performs the following major functions: Data and instructions required for processing (received from input devices)
Intermediate results of processing Final results of processing, before they are released to an output device

32 What do u mean by Primary storage? Also known as main memory. Used to hold running program instructions Used to hold data, intermediate results, and results of ongoing processing of job(s) Fast in operation SNSCT Department of Compute Science and Engineering Page 9

FUNDAMENTALS OF COMPUTER PROGRAMMING


Small Capacity Expensive Volatile (looses data on power dissipation) Primary memory can be further classified into 1. RAM (Random Access Memory) 2. ROM (Read only Memory) 33 what is Secondary storage?

Also known as auxiliary memory or external memory. Used to hold stored program instructions Used to hold data and information of stored jobs Slower than primary storage Large Capacity Lot cheaper that primary storage Non volatile (Retains data even without power)

34 write about Arithmetic and logic unit Arithmetic Unit: Contains circuitry that is responsible for performing the actual computing and carrying out the arithmetic calculations such as addition, subtraction, multiplication and division. It can perform these operations at a very high speed. Logic Unit: Perform logical operation based on the instruction. The operations are logical comparisons between data items. This unit can compare numbers, letters or special characters. Logic unit can test for 3 conditions: equal-to condition, Less-than condition and Greater-than condition. 35 Control unit (Controlling) This unit checks the correctness of sequences of operations. It fetches program instruction from primary storage unit known as fetching, interpret them and ensure correct execution of the program known as decoding. The time required to fetch and decode an instruction is called instruction time, or I-time. It also controls the input/output devices and directs the overall functioning

SNSCT Department of Compute Science and Engineering

Page 10

FUNDAMENTALS OF COMPUTER PROGRAMMING

36 Draw process of Central processing unit:

The Central Processing Unit (CPU) takes data and instructions from the storage unit and makes all sorts of calculations based on the instructions given and the type of data provided. It is then sent back to the storage unit. The CPU consists of a control unit, an arithmetic/logic unit (ALU), and registers. CPU, the brain of any computer system.

It is just like brain that takes all major decisions, makes all sorts of calculations and directs different parts of the computer functions by activating and controlling the operations. 37. Convert Binary to Decimal Conversion:

1010112

=> 1 0 1 0 1

1 x x x x x

20 21 22 23 24

= = = = = 32

1 2 0 8 0

25

---4310 38. Convert Decimal to Binary conversion:

SNSCT Department of Compute Science and Engineering

Page 11

FUNDAMENTALS OF COMPUTER PROGRAMMING

39. convert Octal to Decimal 7248 => 2 7 x 4 x 82 = x 80 81 = 448 --------46810 40.Convert Decimal to octal: = 4 16

41. Convert Hexadecimal to Decimal

ABC16

=> B A

C x x

160 161 =

12

x1 =

=12 176

11 x 16 = 2560

162

10 x 256

---------274810 42. Convert Decimal to Hexadecimal

SNSCT Department of Compute Science and Engineering

Page 12

FUNDAMENTALS OF COMPUTER PROGRAMMING

43. Convert octal to Binary

Convert 518 to binary:


58 = 1012 18 = 0012 Thus: 518 = 101 0012 44. Binary to octal Technique Group bits in threes, starting on right Convert to octal digits

For instance, convert binary 1010111100 to octal:


001 1 010 2 111 7 100 4

Thus 10101111002 = 12748

SNSCT Department of Compute Science and Engineering

Page 13

FUNDAMENTALS OF COMPUTER PROGRAMMING

Prepared UNIT 2
COMPUTER SOFTWARE 1. What is a Software? Software refers to the instructions or programs that tell the hardware what to do. It is responsible for controlling, integrating and managing the hardware components of a computer and to accomplish specific tasks. In other words software tells the computer what to do and how to do it. Eg: The operating system is a software that manages our computer and the device connected to it. Software guides the computer at every step where to start and stop during a particular job. The process of software development is called programming. 2. What do you mean by Computer program? Computer needs to be instructed to perform any tasks. These instructions are given in the form of Computer programs, which are written in computer programming languages. 3. What is Software Packages? Set of program or software (independent software), which are specifically written to provide the user a precise functionality like solving a specific problem is termed as a software package. Ex. Microsoft Office Package. Ms Office contain software like Microsoft Word document, Microsoft powerpoint presentation, Microsoft Access.. 4. What are the types of Software? a) System Software b) Application Software 5. What is an System Software? System software acts as an interface between the hardware of the computer and the software applications. SNSCT Department of Compute Science and Engineering Page 14

FUNDAMENTALS OF COMPUTER PROGRAMMING


The purpose of this software is to help the user to run the computer system. System software consists of several programs, which are directly responsible for controlling , integrating and managing the individual hardware components of the computer system. System software is more transparent and less noticed by the users, they usually interact with the hardware or the application and not with the user. 6.Write Functions of System Software? They provide basic functions like 1. File management 2. Visual display 3. keyboard input 7.Give Examples of System Software ? Operating System Device Drivers Language Translators System Utilities

8.What is an Operating System? 8. Operating system (OS) is an interface between hardware and user. 9. Operating system is the first layer of software loaded into computer memory. 10. All other software that gets loaded for various common core service. In other words System Software provides the software platform, on top of which other programs can run (system software is the base for other software to run). 9. What are all the common core service of operating System? Disk access Memory management Configuring and controlling peripheral devices Managing essential file operations, including formatting or copying disks, and renaming or deleting files Monitoring system performance ( Security management) Providing a user interface

SNSCT Department of Compute Science and Engineering

Page 15

FUNDAMENTALS OF COMPUTER PROGRAMMING


10. Examples of Operating systems are Windows 2000 Professional Windows 2000 Professional was designed for use with business computers and was the successor to Windows 98 for office environments. Windows XP Professional Microsofts Windows XP Professional was designed for the latest computers that are fast, powerful, and have lots of memory and hard disk space. It combined the more powerful features of Windows 2000. Windows XP contained many new and improved features and was extremely user-friendly. Windows Vista Windows Vista, released in 2007, improves and expands on Windows XPs capabilities. It provides much more robust security features than any earlier version.. 11 Give some features of OS? o o o o o o 12 Explain Device Driver? Device driver or software driver are system programs which are responsible for proper functioning of devices. Every device such as printer, monitor, mouse or keyboard, has a driver associated with it for its proper functioning. When ever a new device is added to the computer system, a new device driver ( Software for particular device) must be installed before the device is used. 13.What is Language Translator? Computer can understand a language consisting of 0s and 1s called machine language Special programming languages called high- level language were developed that resemble natural languages like English. Process Management ( program execution) Memory Management File management Device Management Security management User Interface

SNSCT Department of Compute Science and Engineering

Page 16

FUNDAMENTALS OF COMPUTER PROGRAMMING


Therefore, tool was required which could translate a program written in a programming language to machine language. Depending on the programming language used, language translators are divided into three major categories. o o o 14 Define Compiler? The program written in any high level language is converted into machine language using a compiler. Compiler translate source code (user written program) into object code (binary form) 15 What is an Interpreter? Interpreter analyses and executes the source code in line-by-line manner , without looking at the entire program. The advantage of interpreter is that they can execute a program spontaneously. Compiler requires some time before an executable program is formed because it looks at the whole source code. 16 What is an Assembler? Assembly language is closest to the machine code. Assembly language is fundamentally a symbolic representation of machine code. The assembly language program must be translated into machine code by a separate program called an assembler. The assembler program recognizes the character strings that make up the symbolic names of the various machine operations and substitutes the required machine code for the instruction. 17 List some System Utility?

Compiler Interpreter Assembler

System utility program perform day to day task related to the maintenance of the computer system.

They are used to support, enhance and secure existing programs and data in the computer system.

Some utility programs are usually provided along with the operating system, some are free while some need to be purchased from the 3rd party vendors.

Ex. For system utilities:


o

Disk checkers Disk cleaners

SNSCT Department of Compute Science and Engineering

Page 17

FUNDAMENTALS OF COMPUTER PROGRAMMING


o

Antivirus utilities Registry cleaners Network managers

18 Explain Application software:


Application software is used to accomplish specific tasks. It consist of a single program, such as Microsoft`s Notepad(for writing and

editing simple text)

It may also consist of a collection of programs, often called a software

package, which work together to accomplish a task, such as database management software.

Application software may also include a larger collection of related but

independent programs and packages which have a common user interface or shared data format, such as Microsoft office suite.

Application software is dependent on system software Application software is controlled by system software, which manages

hardware devices and performs back ground tasks for them.

Application

software ranges form games, calculators and

word

processors(text editor), paint(image Editor) 19 Name Some commonly used application software are
1) 2) 3) 4) 5) 6)

Word processors Spreadsheets Image editors Database management systems Presentation Applications Desktop Publishing Software

20 Explain Word Processors 1 Word processor is a software used to compose (create), format, edit and print electronic document. 2 Word processing is one of the earliest application for office productivity and personal computer

SNSCT Department of Compute Science and Engineering

Page 18

FUNDAMENTALS OF COMPUTER PROGRAMMING


3 It involves not only typing, but also checking the spelling and grammar of the text and arranging it correctly on a page. 4 A variety of different type-faces (Font Name, Font Style) is available for a variety of effects. 5 It is possible to include pictures, graphs, charts and many other things within the text of the document. It also allows for changes in margins, fonts and color. 6 Example of some well known word processors are Microsoft Word and WordPerfect

UNIT III

1. What is Algorithm? Algorithm means the logic of a program. It is a step by step description of a program. 2. List out the way how algorithm may be represented? Normal English Flow chart SNSCT Department of Compute Science and Engineering Page 19

FUNDAMENTALS OF COMPUTER PROGRAMMING


Pseudocode Decision table 3. What is a decision table? A decision table is a table containing the selection of condition to be tested and how those conditions should be nested to arrive at the proper action. 4. Define compiler. It is a program used to convert the high level language program into machine language. 5. Define Assembler. It is a program used to convert the assembly language program into machine language. 6. Define Interpreter. It is a program used to convert the high level language program into machine language line by line. 7. What are the types of programming language? Machine language Assembly language High level language 8. Define flow chart. Flow chart is the pictorial representation of a program. 9. List out the basic design structure? Sequence structure Selection structure Loop structure

10. List out the any three advantages of flowchart. Better communication Effective synthesis Effective analysis 11. What do u mean by Flow chart ?

SNSCT Department of Compute Science and Engineering

Page 20

FUNDAMENTALS OF COMPUTER PROGRAMMING


o A flowchart is a schematic representation of an algorithm or a stepwise process, showing the steps as boxes of various kinds, and their order by connecting these with arrows. Flowcharts are used in designing or documenting a process or program. o A flow chart, or flow diagram, is a graphical representation of a process or system that details the sequencing of steps required to create output. o A flowchart is a picture of the separate steps of a process in sequential order. 12. types of flow chart ? High level Flow chart

Detailed Flow chart

Matrix Flow chart

13. What is high level flow Chart ? A high-level (also called first-level or top-down) flowchart shows the major steps in a process. It illustrates a "birds-eye view" of a process, such as the example in the figure entitled High-Level Flowchart of Prenatal Care. It can also include the intermediate outputs of each step (the product or service produced), and the sub-steps involved. Such a flowchart offers a basic picture of the process and identifies the changes taking place within the process. It is significantly useful for identifying appropriate team members (those who are involved in the process) and for developing indicators for monitoring the process because of its focus on intermediate outputs.

14. What is Detailed Flowchart ? The detailed flowchart provides a detailed picture of a process by mapping all of the steps and activities that occur in the process. This type of flowchart indicates the steps or activities of a process and includes such things as decision points, waiting periods, tasks that frequently must be redone (rework), and feedback loops. This type of flowchart is useful for examining areas of the process in detail and for looking for problems or areas of inefficiency. For example, the Detailed Flowchart of Patient Registration reveals the delays that result when the record clerk and clinical officer are not available to assist clients.

15. What is Matrix Flow chart? A deployment flowchart maps out the process in terms of who is doing the steps. It is in the form of a matrix, showing the various participants and the flow of steps among these participants. It is chiefly useful in identifying who is providing inputs or services to whom, as SNSCT Department of Compute Science and Engineering Page 21

FUNDAMENTALS OF COMPUTER PROGRAMMING


well as areas where different people may be needlessly doing the same task. See the Deployment of Matrix Flowchart.

16. Name some Benifits of flowchart ? 1. Communication: Flowcharts are better way of communicating the logic of a system to all concerned. 2. Effective analysis: With the help of flowchart, problem can be analysed in more effective way. 3. Proper documentation: Program flowcharts serve as a good program documentation, which is needed for various purposes. 4. Efficient Coding: The flowcharts act as a guide or blueprint during the systems analysis and program development phase. 5. Proper Debugging: The flowchart helps in debugging process. 6. Efficient Program Maintenance: The maintenance of operating program becomes easy with the help of flowchart. It helps the programmer to put efforts more efficiently on that part 17. What is Shareware Shareware is software developed by an individual or software publisher who retains ownership of the product and makes it available for a small contribution fee. The voluntary fee normally entitles users to receive online or written product documentation and technical help. 18. What do u mean by Freeware Freeware is software that is provided free of charge to anyone wanting to use it. Hundreds of freeware programs are available, many written by college students and professors who create programs as class projects or as part of their research.

19. What is a Open Source Software An open source software program is software whose programming code is owned by the original developer but made available free to the general public, who is encouraged to experiment with the software, make improvements, and share the improvements with the user community 20. Application Software for Individual

SNSCT Department of Compute Science and Engineering

Page 22

FUNDAMENTALS OF COMPUTER PROGRAMMING


The thousands of application programs that individuals use to perform computing tasks at work and at home can be grouped into four types: a) Productivity software b) Software for household use c) Graphics and multimedia software d) Communication software 21. What is Word Processing A word processing program can be used to create almost any kind of printed document. Word processors are the most widely used of all software applications because

they are central to communication.: 22. What are the processes carried out in word processor Create (enter) text Edit the text Format the document Save and print the file

SNSCT Department of Compute Science and Engineering

Page 23