You are on page 1of 96

B.

Sc (Computer Science ): I Year THEORY PAPER I 120 hrs (4hrs / week) PC SOFTWARE AND C PROGRAMMING
UNIT I Fundamentals of Computers Computer definitions Types of Computer Logical Organization of a Digital Computer Memory: Main Memory : Ram, Rom and Cache Secondary Memory Magnetic type, Floppy disk, Hard disk, Compact disk Input devices - Output devices Operating system : Definition, functions of an operating system, Types of Operating systems : Brief detais of batch processing, Multi Programming, multitasking, time sharing, real time operating systems Introduction to DOS, DOS interal commands, DOS External Commands Introductions to Windows, Desktop, File, Folder, My Computer, My documents, Recyclebin, Internet Explorer, Windows Explorer Types of Programming Languages. UNIT II MS WORD AND MS POWER POINT Word basics: Starting word, Creating a new document, Opening preexisting document, The parts of a word window, Typing text, Selecting text, Deleting text, Undo, Redo, Repeat, Inserting text, Replacing text, Foramatting text, Cut, Copy, Paste Printing. Formatting your text and Documents: Auto format, Line spacing, Margins, Borders and Shading. Working with Headers and Footers: Definition of headers and footers, creating basic headers and footers, creating different headers and footers for odd and even pages. Tables:creating a simple , creating a table using the table menu, Entering and editing text in a table, selecting in a table, adding rows, changing row heights, deleting rows, Inserting columns, Deleting columns, changing column width. Graphics: Importimg graphics, Clipart, Insert picture, Clip Art gallery, using words drawing features, drawing objects, text in drawing. Templates: Template types, using templates, exploring templates, modifieng templates. Macros: Macro, Recording macros, editing macros, running a macro. Mail Merge: Mail Merge concept , Main concept, Main document, data structures, merging data source and main document. Overview of word menu options word basic tool bar. Power Point: Basics, Terminology, getting started, Views, Creating presentations: Using auto content wizard, Using blank presentation option, Using design template option, adding slides, deleting a slide, importing Images from the outside world, drawing in power point, Transition and build effects, Deleting a slide, Numbering a slide, saving presentation, closing presentation, Printing presentation elements. Unit -3: MS Excel and MS Access MS Access Creating a simple Database and Tables: Creating a contacts Databases with the wiz, The access Table Wizard, Creating Database Tables without the wizard, Field Names, Data types and properties, Adding, deleting fields, renaming the fields in a table. Forms: The Form wizard, Saving Forms, Modifying forms, Entering and Editing Data: Adding Records, Duplicating previous entries without Retyping, Undo, Correcting Entries, Global Replacements, Moving from Record to Record in a table. Finding, Sorting and Displaying Data: Queries and Dynasets, Creating and using select queries, returning to the query Design, Multilevel Sorts, Finding incomplete matches, Showing All Records after a Query, Saving Queries. Crosstab Queries. Printing Reports: Simple table, Form and Database printing, Defining advanced Reports, Manual Reporting, properties in Reports, Saving Reports. Relational Databases: Flat Versus Relational, Types of Relationships, Viewing relationships, Defining and Redefining Relationships, Creating and Deleting Relationships. MS Excel Excel Basics: Overview of Excel features, Getting started, Creating a new work sheet, selecting cells, entering and editing text, entering and editing numbers, entering and editing formulas, Referencing cells, moving cells, copying cells, sorting cell data, inserting rows, inserting columns, inserting cells, Deleting parts of a worksheet, clearing parts of a worksheet. Formatting: page setup, changing column widths and Row heights, auto format, changing font sizes and Attributes, centering text across columns, using border buttons and Commands, changing colors and shading, hiding rows and columns. Introduction to functions: parts of a functions, functions Requiring Add-ins, The Function Wizard. Examples functions by category: Data and time functions, Engineering functions, Math and Trig functions, Statistical functions, Text functions.

Excel Charts: Chart parts and terminology, Instant charts with the chard wizard, creation of different types of charts, printing charts, deleting charts-Linking in Excel. Excel Graphics: Creating and placing graphic objects, Resizing Graphics, Drawing Lines and Shapes. Unit-4: 'C' Language fundamentals Introduction- 'C' Fundamentals: Programming- High Level Languages- compiling programs- Integrated Development Environments- Language Interpreters- Compiling your first program-Running your programunderstanding your first program- comments- variables, Data types, and Arithmetic Expressions working with variables- Understanding data types and constants- working with Arithmetic expressions- The Assignment operators- The printf function- the scanf functionDecission making: The if statement- the if else construct- Nested if statements- The else if construct- the switch statement- Boolean variables- The conditional operator- program Looping: The for statement- Relational operators- Nested for loops- the while statement- the do statement- the break statement- the continue statement- working with Arrays: Defining an array- Initializing Arrays- character Arrays- The const Qualifier- Multidimensional arrays- variable length Arrays. Working with Functions: Defining a function- Arguments and Local variablesReturning Functions Results- Function calling- Declaring Return Types and Argument types- Top Down programming Functions and Arrays- global variables- Automatic and static variables- Recursive Functions. Unit-5: Programming in 'C' 24 hrs Working with structures: Defining structure- Functions and structures- Initializing structures- Array of structuresstructures containing structuresStructures containing Arrays- Structure variants- Character strings: Array of Characters- variable length characters- Escape characters- character strings, structures and arrays character operations. Pointers: Defining a pointer variable- using pointers in Expressions- pointers and structures (Exclude Linked List) Pointer and Functions- pointers and Arrays- operations on pointers- pointers and Memory address. Operations on Bits: Bit operators- Bit fields The pre processor: The # define statement- The # # operator- The # include statement- conditional compilation. More on data types: Enumerated Data Types- The typedef statement- Data Type conversions. Input and Output Operators in 'C' : Character I/o- formatted I/O- Input and Output Operations with Files- Special functions for working with Files. Miscellaneous and Advanced features: The Goto statement, The null statement, working with unions- The comma operator- type qualifiers. Prescribed Books: 1. Peter Norton, Introduction to Computers, Sixth edition, Tata Mc Graw Hill(2007). 2. Ron Mansfield, Working in Microsoft Office, Tata McGraw Hill(2008) (Chapters: 4 to 9, 11,12,13,14,15,17, 18, 19,24,25,28,30,31,33,34,35). 3. Stephen G. Kochan, Programming in 'C', Third Edition, Pearson Education(2007) (Chapters: 1 to 14, 16, 17). Reference Books: 1. Michael Miller, Absolute beginners guide to Computer Basics, Fourth Edition, Pearson Education(2007). 2. Deborah Morley, Charles S. Parker, Under Standing Computer today and tomorrow, 11th Edition, Thomson(2007). 3. Ed Bott, Woody Leonhard, Using Microsoft Office 2007, Pearson Education(2007). 4. Beyron S Gottfried, Programming with 'C' , Second Edition, Tata Mc Graw Hill(2007). 5. Ashok N. Kamthane, Progrmming with ANSI and Turbo 'C' , Pearson Education(2008). 6. Rajaraman, Introduction to Information Technology ,PHI. 7. Balaguruswamy.E, Fundamentals of Computing, TMH(2008).

UNIT I Fundamentals of Computers

1. What is a computer? What are the characteristics of a computer?

Computer: Computer is an electronic devices which is used to accept the data as input and process the
data and gives the information as output.

Data: Data is a collection of facts and figures. It may include alphabets, numbers, alpha numerals and special
characters. Data is a word which is derived from DATUM, which means collection of something. Data processing: Converting the data into information is called Data processing. Information: Processed data is called as Information.

The characteristics of a computer are Speed: The computer is a high speed electronic device. We can perform millions of operations at a time. Computer processes the data at an unimaginable speed. The speed of the computer ranges up to nano seconds. Storage capacity: The memory capacity of a computer is measured in bits and bytes. Large amount of data can be stored in computer and retrieved. Memory capacity of the computer ranges in Giga bytes. Accuracy: The system do not make mistakes. Accuracy of the computer is very high. It performs calculations with greater accuracy in less time. Deligence: We can perform the same operation any number of times. The computer will not be bored and tired. Automation: A computer allows automation for any process designed in the form of a program. A program can be executed any number of times to repeat the process. Versatality: Computers can perform many kinds of jobs. They not process the data but also can be used for playing music, movies and printing jobs. It finds its applications in all most all the fields. Communication: We can communicate the computers by sending and receiving the data. We can also send movies and pictures. Disadvantages: Lack of common sense: Computers can work as human beings but there is a lot of difference between the machine and the man. The computer is only a tool. It can not think. It does not have common sense or intelligence as humans have. Inability to correct: When we give instructions to the computers we must give correct instructions. A computer cant correct wrong instructions. If there is a mistake in giving data to the computer the end results are wrong. Popularly this is termed as Garbage-In-Garbage-Out. Obedient to Human Instructions: Computers look as if they are very clever. Actually they are only tools. They cant do anything unless they are instructed by a man. A computer cant generate any information on its own. It can only do what it is instructed. Good environment should be provided: We must provide a clean and cool environment as there a chance to burn the computers sensitive parts quickly. It is somewhat expenditure to the users. 2. Draw a neat sketch of computer and describe its various components. Computer is a group of electronic devices used to process the data. It performs calculations or any other data processing. The block diagram of the computer is shown below.
ALU

Control Unit Input Unit Memory Unit Output Unit

1.Input Unit: The input unit is responsible for giving input to the computer.The information that is given to the computer is called input. The devices used for sending input to the computer are said to be input devices. Some of the input devices are keyboard, mouse, scanner and joystick. Keyboard is standard input device. Mouse is used to operate windows. 2.Output devices: The output unit is responsible for receiving output from the computer.The information that is received from the computer is output. The devices which are used for receiving output are said to be

CPU

output devices. Some of the output devices are monitor, printer, plotter and LCD Projectors. Monitor is standard output device. Printer and plotter are used for printing.

Central Processing Unit:

Central processing unit is the brain of the computer. It is responsible for performing all the operations i.e. processing. This unit divided into three sub units. Arithmetic and logical Unit Control Unit Main Memory Unit

ALU: Arithmetic and Logic Unit is responsible for performing arithmetic and logical operations such as adding, multiplying and uses operators like +, -, *, and, or, not etc. Control Unit: Control unit controls all the parts of the computer and the processing. It also controls the input and output. Control unit has the data bus which carries the data from one unit to another unit. It controls hardware devices also. Main Memory Unit: Main Memory unit is responsible for storing data. It has two sub units: Primary memory, Secondary Memory.

a) Primary memory: It is the built-in memory. It has two parts: RAM, ROM RAM: RAM stands for random access memory. The data what we store in RAM can be
changed by the user. It is volatile memory. The data in the RAM will be vanished when the power is switched off to the computer. It is temporary memory ROM: ROM stands for Read only memory. The data stored in ROM cannot be changed and it is static. It is permanent and non volatile memory. In ROM the manufacturers store the commands to start the computer. The memory will not be modified or deleted. Now a days there are various types of ROMs are available. PROM Programmable Read Only Memory EPROM Erasable Programmable Read Only Memory EEPROM Electrically Erasable Programmable Read Only Memory

Cache Memory: Cache memory also acts as primary memory. The cache memory is used to avoid the
mismatch between the speed of RAM and the speed of CPU. Generally the speed of RAM is less than the speed of CPU. To avoid this mismatch the cache memory included to increase the speed of the computer.

b) Secondary Memory: This is supporting memory for any computer. In this memory we can store the
information permanently. Large amount of data can be stored in the computers secondary memory. Basically the secondary memory two types 1) Magnetic type 2) Optical type In Magnetic type, the concentric magnetic fields are used to store the data It includes Floppy disk, Hard disk and magnetic tape In Optical type,It uses a laser beam to write data on the disks. It includes CD-ROM (Compact Disk Read Only Memory and DVD-ROM (Digital Video Display Read Only Memory 3. Explain the history of the computers?

HISTORY OF COMPUTERS:
The first calculating device was "ABACUS" invented by Chinese In 1600 B.C. ABACUS was one of the simplest device to do the arithmetic. ABACUS was like a frame with beads strung on wire or rods. Next one is Napier bones, John Napier , a Scottish mathematician invented this device to do the calculations. Bones are set of eleven rods with numbers marked on them, in such a way that by simply placing the rods side by side products and quotients of large numbers can be obtained. The Napier is also best known for the invention of logarithms. He also introduced the decimal point. Pascal Calculator: French Mathemetician Blaise Pascal in 1642 developed this calculator. He also invented syringe, Hydraulic press and Pascals law of pressure.

Jacquard loom: He is a weaver. He introduced the punched card loom in 1801. This device was a new type of loom for weaving cloth. Punched cards controlled its operation. Needles could pull threads through the cards where there were holes and not where there were no holes. Thus patterns were stored on punched cards. The pattern was determined by the placement of holes in a control card. Charles Babbage: He first introduced the Difference Engine in 1823 for solve the repeated formulas. After he invented the Analytical Engine in 1833, it contains many features of present day computers including punched card input, storage unit, Arithmetic unit, printing unit and controlled by a sequential program. 4

Holleriths Tabulating machine: It is invented by Dr. Herman Hollerith. He is a statistician with the U.S. bureau of census invented a machine to process the results of the census. It was electro magnetic counting machine to tabulate the data. Mark-I: Howard H. Aiken of Harvard University in 1944 designed a machine that could automatically perform a sequence of arithmetic operations. It was an electro mechanical device. ENIAC: ENIAC stands for Electronic Numeric Integrator And Calculator. In 1946, John Mauchley and Presper Eckert developed this machine. It was the first electronic calculator. It occupied a room (9x15 meters) and contained 18000 vacuum tubes.
Lady Augusta Lovelac (Mother of Computers) -> She developed first program on computer
4. Explain generations of computers. The development of Computers can be classified into five generations based on main processing device and storage media.

1. First generation Computers: (1945-1956)


The period of first generation computer is 1945-1956. In that period the Main processing device is Vacuum tubes and main Storage Media is Punched cards. There some advantages and disadvantages are there during the first generation computers. Advantages: It was the only electronic device. We can store the data and hold the memory. Disadvantages: It was too bulky i.e. large in size. Vacuum tubes were burning out frequently. They were producing very heat and there was maintenance problem. They consumed more power and they are very slow in operations. Second generation Computers: (1956-1963) In that period the Main processing devices are Transistors and the main Storage Media is Magnetic disk. The Advantages of the computers of this period are: The computers size is reduced considerably. They are very fast and very much reliable. The Disadvantages of second generation computers are They had less memory. They over heated quickly and there was the maintenance problems Third generation Computers: (1963-71) In the third generation Period the Main processing device is IC (Integrated Circuit). The Storage Media is Floppies. In that period the advantages are: ICs were very small in size. There was Improved performance and the Production cost was cheap. The Disadvantages are ICs are sophisticated that is complicated. Fourth generation Computers: (1971-2004) During this Period the Main processing device is IC with VLSI (very large scale integration). The Storage Media is Floppies, Hard disks and CDs. The Advantages of the fourth generation computers are they are very compact. There is very less power consumption and the Production cost becomes cheap. The Disadvantage of this period computers is there is no artificial intelligence

2.

3.

4.

1.

Fifth generation Computers: (2004-Present)

Present and beyond we are calling this period as fifth generation. The Main processing device of this period is ICs with parallel processing. The main Storage Media is videodisks and DVDs. The Advantages of this period are Artificial intelligence is included and the functioning of these systems like expert systems. 5. What are the applications of computers in various fields? Computer is a versatile tool. It can be used in various fields, as the functionality of the computer has been increased. Different fields in which computer is being used are given below.

Business: Business people and organizations use computers for different purposes. For example, to manage accounts or make presentations and store business data. Computers are used to create purchase orders, track expenses and income reports and issue bills. Medicine & Health care: Several medical applications use computers for storing scanning reports, and analysis of scanning etc. In ICU, Computers are used to monitor the patients condition. Education: In the filed of education, computers can be used for interactive learning. Students can learn something easily using CBTs. (Computer Based Tutors) Science & Engineering: Scientists use computers to simulate complex events such as predicting earthquakes. Satellites use computers for their proper functioning. Engineers use computers for CAD (Computer Aided Designing) and to solve complex problems. Manufacturing: Computer has increased its role in the field of manufacturing. They are used for automated operation of machines. Computers are used to monitor pressure and temperature. Law and Government: Police department uses MDT (Mobile data Terminals) in squad cars. Computers can be used to identify the photos and thumb impressions of the culprits. Government uses computers to store the data of population. Music: Computers can be used to play the music and also used for editing the sounds. Multimedia: Computers can be used to design multimedia applications and also to play them. Now a days most of the games and web applications use multimedia. Communication: Computers can also be connected so as to provide a better communication facility. Data can be transferred from one place to another place.

What are input devices and output devices? Input devices: The information that is given to the computer is input. The devices used for sending input are said to be input devices. Some of the input devices are listed below. Key board: Keyboard is standard input device. It has various types of keys like alphanumeric keys, modifier keys,cursor movement keys etc. Mouse: Mouse is used to operate windows. It has left button, right button and scrolling wheel. It is used to click on icons to perform operations. Joystick: Joy stick is used to move the cursor from one place to another place, and to click on various items in programs. A joystick is mostly used for computer games. I Scanners: This device converts the printed image into an electronic form. It uses technology of reflecting light onto the images and sensing the intensity at every point. There are also color scanners, which can scan color images. They separate the components of colors (red, green, and blue) at each point of the image. The scanned images can be manipulated using some software such as photo-shop. Optical Code Recognizers (OCR): It is some software that translates the image into text that you can edit. When scanner reads an image, the image is stored as a bit map image. A bit map is grid of dots, each dot is represented by one or more dots. The job of the OCR is to convert the grid of dots to meaningful text, which can be represented by the computer. OCR also can be treated as a scanner. They come in several sizes. Microphone: Microphones can accept auditory input. Using speech recognition software, you can use your microphone as an input device for dictating text, navigating programs and choosing commands. To use Microphone with the computer, it must be equipped with a sound card to enable the functionality of the microphone. Digital Cameras: They are very much similar to ordinary cameras, but used to store still images in digital format. This can be connected to computer to exchange the data and can be printed using printers such as snapshot printers. Bar code reader: Bar code reader is an input device, which is commonly used in super markets and bookshops. Bar code is a pattern of printed bars. It generally specifies the cost of the products. Bar code readers scan the bar code pattern and convert it to equivalent number or digits. It scans the pattern by emitting a beam of light, frequently a laser beam. It is handy and very useful for vendors. Trackball: Track ball is an input device, which works like an upside-down mouse. The ball upside is rolled using thumb to move the cursor over screen. It is comparatively small than mouse. We use track ball when the space is less. It is used more with laptops, because there the workspace is less. Track-pad: Track-pad is a stationary input device. The size of the Track-pad is compact. It, best suits for notebook computers. Track-pad has a small screen of size around 2 Inches Square. We move the finger over the small screen to move the cursor over the monitor.

Output devices: The information that is received from the computer is output. The devices used for receiving
output are said to be output devices. Some of the output devices are listed below Monitor: Monitor is standard output device. It is used to display the information. Now a days various types of monitors are available like CRT monitors, LCD monitors etc.

Printer: Printers are used for printing. To take hard copy of the information we are using the printers. Various printers are Laser printer, Snop shot printer and Ink jet printer etc.
Plotters: Plotters work the same as printers, but it accommodates very big size sheet. Plotter uses colored pens and a robotic arm to draw on the sheets. It is designed to produce large drawings such as building plans and machine drawing. Printer and plotter are used for printing.

Speaker: Speaker is an output device that gives sound output from the computer. They vary in size and configuration. LCD Projector: A Projector can be connected to a PC for displaying presentations. Many Projectors provide the same resolutions and color levels as high-quality monitors, but they project the image on a large screen. 6. Write about different types of memories? Memory unit is responsible for storing data. It has two sub units: a) Primary memory b) Secondary Memory Primary memory: It is the built-in memory. It is used to run the computer. It includes the following subtypes. RAM: RAM stands for random access memory. The data what we store in RAM can be changed by the user. ROM: ROM stands for Read only memory. The data stored in ROM cannot be changed and it is static. Cache memory: Cache memory is used to avoid the mismatch between the speeds of CPU and RAM. Secondary Memory: This is supporting memory for any computer. Users data and programs are stored in this memory. It includes the following subtypes. Magnetic type: They include hard disks, Floppies and magnetic tapes. Computer writes the data onto these devices by charging iron particles and creating magnetic field in them. Optical type: They include CDs. It uses a laser beam to write data on the disks. Magneto Optical: It includes Magneto optical disks. To write data onto magneto-optical disks, highpowered laser is used and crystals are aligned as per the data. Explain RAM,ROM, and Cache memory (primary memory) RAM: RAM stands for random access memory. The data what we store in RAM can be changed by the user. When we enter the data, the data is first stored in RAM. When the system is switched off the information in the RAM is lost. Speed of the RAM determines the speed of the computer. RAM is said to be main memory or primary memory. ROM: ROM stands for Read only memory. The data stored in ROM cannot be changed and it is static. When we switch of the system it will not affect the data in ROM. Manufacturer provides fixed information i.e. firmware in ROM. Cache memory: Cache memory is used to avoid the mismatch between the speeds of CPU and RAM. The speed of RAM is slower than the speed of CPU. When we enter some data, the data first moves into RAM and then CPU. It becomes time consuming to collect the data every time from RAM. To avoid this, Cache memory is included. Cache memory is similar to RAM but it is extremely fast. When CPU collects information from RAM, it loads the same data into Cache memory. The next time the CPU needs the same data, it finds it in the Cache memory.

7. Explain the classification of computers (or) types of computers.


We can classify the computers based on the three factors. i) Based on the purpose ii) Based on the operation or utility iii) Baed on the size or performance

Purpose based Computers: Based on the purpose we can classify the computers into two types. i. Special purpose Computers: These computers can be designed to perform specific functions. Some of the special purpose computers are electronic voting machine (EVM), aircraft control system. ii. General purpose Computers: These computers are used for variety of tasks. They are flexible and can be used to work on business and scientific problem. Operation based Computers: Based on operation or utility computers can be classified into three types. 1) Analog Computers: These computers follow the principle used in measuring. These computers operate by measuring physical units such as temperature, pressure, speed and voltage etc. Analog computers cant make decisions and are not very accurate. Eg: RADAR, Thermo meter 2) Digital Computers: Counting is the main principle used in digital computers operate on numbers consisting of 0s and 1s. Digital computers are used in business as well as scientific and engineering applications. In these computers accuracy is very high. Eg: Calculator. 3) Hybrid Computers: Hybrid computer is a combination of digital and analog computers. Now a days these computers are used in petrol pumps and banks. Eg:MODEM (Modulator and Demodulator). It convers the analog signals to digital signals and digital signals to analog signals. Size based computers: Based on size, processing speed and performance the computers can be classified into five types. 1) Super Computers: Super computers are fastest and most powerful computers today. Those computers are specially designed for processing complex applications in scientific and engineering disciplines. These computers have very large memory capacity and high speed of processing. These computers are mainly used for applications like weather forecasting, atomic bomb designing, satellite communication, and space ship detection. Indias first super computer is PARAM designed by C-DAC. 2) Mainframe Computers: Mainframe computers have fast processing speed and greater storage capacity than any computer other than super computers. These computers are generally used in organizations that require data exchange among several users. Mainframe computer is a very big server, which has some sharable resource. The data from the mainframe server is distributed to several dummy terminals that are connected to the server. With the use of mainframe computers, the data, hardware and software can be shared among users. 3) Mini Computers: Mini computers are small general purpose systems. They offer advantages of main frame computer at lower cost. They support more peripherals and much faster than micro computers. A mini computer supports one or more hard disk drives and tape drivers and printers. These computers support powerful softwares like database and word processors. 4) Micro Computers: These are the smallest general purpose computers. These systems have all the functional elements that are found in most of the larger systems. They are basically designed for the single user systems facility. Cost wise these systems are the cheapest among all the systems. Some of the micro computers are o Desktop computes: The most common PC model sized to fit on a desk, with a separate unit for the CPU and for the monitor. o Notebook or LapTop computers: This is the smallest computer available today. It is handy and has very less weight. Hence it is portable. They can operate on current or batteries. o Palmtop computers: These are also called as hand held computers. These are the smallest computing devices. They offer limited and specialized features. Some of the hand held computers are cellular phones and PDAs. 5) Workstations: Workstation is the most powerful PC that is used by engineers, scientists and graphic artists. The users who need a great deal of computing power use these workstations. They come with

highly configured and advanced computer peripherals. They are used as network servers and Internet servers. 8. Explain different types of storage devices (secondary memory devices). Secondary memory is used to store data and programs. Secondary storage is the permanent memory. Data and programs ae retained when the power is turned off. Secondary storage is also called auxiliary storage. Secondary memory or auxiliary memory is the slowest and cheapest form of memory. It can not be processed directly by the CPU. The common secondary storage devices include magnetic storage devices and optical storage devices. The magnetic storage devices can be divided into two types Magnetic tape storage Magnetic disk storage

Magnetic tape: Magnetic tape is a one half inch or one quarter inch ribbon of coated with millions of iron particle that store the data. Head writes the data onto the particles by creating magnetic field in particles. Magnetic tapes are erasable, reusable and durable. Magnetic tape is not suitable for data files that are revised or updated often because it stores data sequentially. Magnetic disk: Magnetic disks are the most widely used storage medium for computers. A magnetic disk offers high storage capacity, reliability and the capacity to directly access stored data. Types of magnetic disks include:

Diskettes: Diskettes are commonly known as floppies. It has a rotating disk that spins at around 300 rotations per minute. Surface of the disk is coated with tiny iron particles to store the data. Each particle acts as a magnet. As the head passes over the disk, it creates magnetic filed in the iron particles and writes the data. Generally they are of capacity 1.44 MB Hard disks: hard disks are the common storage device for all computers. Hard disk uses the same technology that is used by diskettes. The data is stored in tracks that are divided into sectors. A hard disk is a stack of metal platters that spin on a spindle. They are of capacity 10 GB to 20 GB Removable hard disks: Removable combines the speed and capacity of a hard disk and portability of a disk. The optical storage is a storage medium from which data is read and to which it is written by lasers. They are CD-ROM: CD-ROM (Compact disk read only memory) uses the same technology as a music CD does. A laser reads lands and pits from the surface of the disk. This is readable only. It stores 650 MB of data. WORM: WORM stands for Write Once and Read Many. The CD-recordable disks can be written to once, but not rewritten or erased. 11) Explain the standard Key board layout? Keyboard for a PC comes in many styles. The various models differ in size and shape. The following are the part of the standard keyboard layout. Alphanumeric keys: 0 to 9 digits, a to z and A to Z alphabets and +, -, *, /, ), (, etc White space keys: White space keys Include non-printable characters such as Tab ( introduces horizontal tab), Caps lock (prints capital letters when on) and Backspace(removes the character in front of the cursor), Enter(to move to new line or choose buttons/commands). Modifier keys: These are used to modify the input of other keys. The keys are: Shift - enforces to print capital letters and symbols. Ctrl used as short cut key with other keys as a combination Alt - used as short cut key with other keys as a combination Numeric keypad keys: It appears at the right side of the keyboard. It includes 0 to 9 digits and +, -, *, / keys. Cursor movement keys: These keys allow to move the cursor. They are : Arrow keys move the cursor Home move cursor to beginning End move cursor end of a line Page up, Page down move the page up/down Special purpose keys: They perform a specialized functions. These are Insert takes to insert mode

Delete deletes a character Escape backs up one level Print screen capture the screen Scroll lock stops scrolling Pause stops a program Function keys: These keys are used as short cut keys to perform a specific task. They are F1 to F12 12) Explain how computer accepts the input from the keyboard. When we press a key, a chip called as keyboard controller, notes that a key has been pressed.

The keyboard controller places a code in a temporary memory, called as keyboard buffer. The code indicates which key was pressed. Keyboard controller sends a signal to the system software. This is called as interrupt request. When system software receives the interrupt, it evaluates the request to determine the appropriate response. The system reads the scan code from keyboard and passes the scan code to the CPU. Keyboard buffer can store a number of keystrokes at a time.
13) Explain Types of Monitors. Monitors can be classified based on two types: a) According to technology: CRT monitors and Flat Panel Monitors. According to color scheme: Monochrome Monitors: Grayscale Monitors: Color Monitors According to technology: CRT monitors: The CRT monitor is used in Monochrome (or) Grayscale monitors. CRT stands for Cathod Ray Tube Technology. An electron gun is placed at the back of the monitor. The gun shoots a beam of electrons through a magnetic coil, which is projected on the front of the monitor. The back of the monitors screen is coated with Phosphors, chemicals that glow when they are struck by the electron beam. The screens Phosphor coating is organized into a grid dots. The smallest number of Phosphor dots that the gun can focus on is called a pixel. Flat Panel Monitors: Flat panel Monitors are of lightweight and compact. These monitors use LCD technology and can be called as LCD monitors. LCD stands for Liquid Crystal Display. They create images with a special type of liquid that is normally transparent but becomes opaque when charged with electricity. These are generally used in notebook computers. CRT Monitors Large in size Requires lot of power CRT- Cathode Ray Technology Used for stand-alone systems Clarity is high Flat Panel Monitors Very compact Requires less power LCD- Liquid Crystal display Technology Used in notebook computers Less clarity

According to Color scheme: According to color we can classify the monitors into three types:

Monochrome Monitors: Monochrome monitors displays only one color (such as green, amber, or white) against a contrasting back ground, which is usually black. Grayscale Monitors: Grayscale Monitors display varying intensities of gray (from a very light gray to black) against a white. Color Monitors: Color Monitors display ranges anywhere from 16 colors to 16 million colors.
14) Explain different types of printers. Printer is an output device, which prints the images or data files. There are mainly two types of printers are there. Impact printers and non impact printers. Impact Printer: They use a ribbon and press it on a paper to produce print Dot matrix printers. Non-Impact Printers: They use ink cartage and spray or spread ink on papers. Inkjet printers Laser printers Snap shot printers

10

Plotters 1) Dot matrix printers: Dot matrix printer uses a ribbon to print some thing. This is the oldest type of printer. It prints a document slow and the printing quality would be very poor. 2) Ink jet printers: Inkjet printers create an image directly on a paper by spraying ink through small nozzles. Image quality would be more with these printers. It offers most cost-effective to print in color. Color inkjet printers generally have four color ink nozzles to produce a color image. 3) Laser printers: Laser printer uses laser technology. It uses toner (an ink like substance used in printer), which is composed of tiny particles. Laser creates electric charge on the drum and toner particles are oppositely charged, there by resulting, a quality-print. 4) Snapshot Printers: Snapshot printers are used to print color photographs. Snapshot printers are popular among users who own digital cameras. Snapshot printers are very slow, and they can be more expensive to operate than inkjet (or) laser printers. 5) Plotters: Plotters work the same as printers, but it accommodates very big size sheet. Plotter uses colored pens and a robotic arm to draw on the sheets. It is designed to produce large drawings such as building plans and machine drawing. 15) What is Software and Hardware?

Hardware: Knowing all the peripherals of the computer and its mechanism is called Hardware. (Or) Hardware is a collection of all physically existing computer peripherals and relative study of those. Software: Software is a collection of programs where program is a set of commands. Command is an instructions that is given to the computer to perform specific task. Software can be divided mainly into two types: System software, application software. System Software: The software that is used for the purpose of a system can be called as system software. This is mainly used to run the computer and manage the functionality of the computer. Some of system softwares are: Operating system: Operating system acts as an interface between the user and the system. An interface is a communication between the user and the system. The interface can be of two types CUI and GUI. CUI stands for Command line user Interface. In the CUI the user can interact with the system by typing the commands only. In this the user need to remember the commands and type the commands. Eg: MS-DOS. GUI stands for Graphical user Interface. In the GUI, the user can interact with the system by selecting the small graphical icons to perform the tasks. In the GUI all the commands are available in the graphical representation called as icons. In this there is no need to remember the commands and type the commands. Eg: MS-Windows The Operating system can be of two types 1) Single User Operating System 2) Multi User Operating System Single user operating system allows only one user to communicate with the operating system. Eg: MS-DOS Multi user operating system allows more than one user to communicate with the operating system. In this the data sharing and the multi tasking concepts are main. By data sharing the task can be performed with in the less time. Multi tasking is performing more than one task simultaneously. Functions of Operating system: The Operating system manages all the programs that are running. It provides system level services to those programs, including file management, memory management and printing. The operating system allows programs to share information. A modern operating system allows multi tasking. The operating system keeps track of all files on each disk. Operating system constantly updates the FAT(File Allocation Table) on disk. The operating system uses interrupt request to communicate with CPU and other hardware. Operating system activates and use the computer devices with the help of device driver software. The operating system provides necessary software to the computer to form a network. Device driver: The device driver software allows computer devices such as keyboard and etc to communicate with the system Compiler: It converts High-level programs to low-level programs (Whole program at once). Interpreter: It converts high-level programs to low-level programs (Line by line). Application software: Application software is a of programs that are specially designed to suit the requirements of the user. By the application software user can perform particularly specific tasks only. User can perform easily but can

11

perform one or two specific tasks. These are applicable generally in the field of business, education and scientific applications. The application software is classified into two types. Languages and Packages. Languages: Language is a full fledged software which allows to do anything. By the languages we can build our own applications. The languages are two types. High level languages and Low level languages High level language: It is a language by which the user can interact with the system. It is just like the English language. It is understandable by the user. s It is a language which is directly understood by the machine where the data and instructions are in binary form i.e. 0 and 1. It is also called as binary language and machine level language. Packages(application): It is a software which is used for performing a single task. In this there is no possibility to do different types of jobs. It is used to perform specific tasks only. 16) Explain the booting process Booting : The process of loading the operating system in the memory is known as booting process. The booting process has three steps 1) The processor starts executing the instructions which are stored in ROM. 2) These instructions test to see if all the computer parts are in good working condition or not. This testing is called as POST(Power On Self Test). POST checks all the areas of RAM memory and the connections of hardware devices. 3) When it loads the system files and the operating system. The system files are IO.SYS, MSDOS.SYS. COMMAND.COM There are basically two types of booting. 1) cold booting 2) warm booting Cold booting: Booting of computer with switching on the main power is called cold booting. Warm bootig: Booting of machine without switching on the main power when the system is hang up is called as warm booting. It is possible by pressing CTRL+ALT+DELETE keys simultaneously. Worm booting does not provide the facility of POST. 17) Explain DOS Internal Commands. MS-DOS is a single user operating system. It supports CUI. There are two types of commands are available in the MS-DOS. They are internal and external commands. Internal commands: The commands which are available in the COMMAND.COM system file, those can be called as internal commands. These are loaded at time of booting process only. These commands get executed faster. COMMAND: CLS PURPOSE: This command is used to clear the screen and redisplay the DOS prompt at the upper lefthand corner of the screen. SYNTAX: CLS < press enter > NOTE: CLS is the short form of clear screen.

COMMAND: DATE PURPOSE: This command is used to display and /or changes the system date. SYNTAX: DATE < press enter > OUTPUT: Current date is wed 5-2-2002 Enter new date: NOTE: the date is should be entered in the MM-DD-YY format. COMMAND: TIME PURPOSE: This command is used to set and display the system time. SYNTAX: TIME < press enter > OUTPUT: Current time is 09:30:45:23 Enter new time: NOTE: The time will be displayed in the HH-MM-SS. COMMAND: VER PURPOSE: Displays The DOS or Windows Version Number.. SYNTAX: VER< press enter > NOTE: This command will display the version of DOS loaded in your Computer. COMMAND: DIR PURPOSE: This is command will list any or all files and sub-directories. This command will display the following details Disk volume name (if any) Name of the directory Name of each files and sub-directory

12

Number of files Date and time of creation/last update of the file Number of Bytes occupied by each file Amount of free space on the disk SYNTAX: DIR<press enter> DIR/A It will display the files with attributes DIR/AH It will display only the hidden files. DIR/AR It will display read only files DIR/AS It will display system files DIR/AD It will display only the directories DIR/P It will display all the files and directories in page wise manner DIR/W It will display the list of files and directories in width wise manner DIR/P/W It will display the list of files and directories in the page wise and width wise manner DIR/B It will display the list of files and directories in the bare format (no heading information) DIR/O It will display the list of files and directories in the sorted order (ascending or descending) DIR/ON It will sort the list of files and directories by name DIR/OS It will sort the list of files and directories by size DIR/OE It will sort the list of files and directories by extension. DIR/OD It will sort the list of files and directories by date. COMMAND: COPY CON PURPOSE: Copy con is a command used to create a file in DOS SYNTAX: COPY CON < file name > < press enter> NOTE: To save the file, type Ctrl+Z (or) F6. COMMAND: TYPE PURPOSE: It is used to view the contents of a file. SYNTAX: TYPE< file name > < press enter>

COMMAND: DEL and ERASE PURPOSE: To delete a file. SYNTAX: DEL <File name> <press enter> ERASE <File name> <press enter>

COMMAND: COPY PURPOSE: This command copies one file to another. SYNTAX: Copy <source file name path> <Target file name path> <press enter> NOTE: The COPY command accepts two file names.

COMMAND: CD or CHDIR PURPOSE: Changes the current directory. SYNTAX: CD <Directory name> <press enter>

COMMAND: RD or RMDIR PURPOSE: Deletes a directory. Before you can delete a directory, the directory must be empty. SYNTAX: RMDIR <name of the directory > <press enter> COMMAND: PROMPT PURPOSE: To change the MS-DOS prompt. SYNTAX: PROMPT <text > <press enter> There are so options in the PROMPT command. They are: $Q - =sign $$ - $sign $T - Time $D - Date $P - Current Drive & Path $V - Version

13

$G - Greater than $L - Less than $B - | Pipe

18) Explain DOS external commands.


EXTERNAL COMMANDS: The commands which are loaded externally are called as external commands. these commands are not available in command.com file. The external commands not loaded at the time of booting process. These are loaded from hard disk. 1. LABEL: This command is used for changing the current volume label of the current disk that is in use. Required File: Label.Exe Syntax: C:\ >LABEL <enter> Ex: C:\> Label C:\> VOL 2. CHKDSK: Check Disk This command gives the complete information about the current disk that is in use. Req. File: Chkdsk.Exe Syntax: C:\> CHKDSK <enter> Ex: C:\> CHKDSK 3. MEM: Memory This command gives complete information about the conventional memory of the current system. Req.file: Mem.Exe Syntax: C:\> MEM <enter> Ex: C:\> Mem 4. TREE: This command is used for listing or displaying the complete directory structure in branching format. Req.File: Tree.Com Syntax: C:\> TREE [/F] <enter> Where /F => Files too Ex: C:\> Tree C:\> Tree/F 5. SORT: This command is used for sorting i.e. arranging the given text either in ascending (alphabetical) order or reverse (descending) order. By default it sorts in ascending order. Req.file: Sort.Exe Syntax: C:\> SORT [/R] [ < Filename ] [ > Newfilename] <enter> Where /R => Reverse Order (Descending Order) < => Input Redirector > => Output Redirector Ex: 1. C:\> Sort Lilly Rose Jasmine Lotus Mogra Dathura Hybiscus Lavender Marie Gold Sunflower

14

(Press F6 / Ctrl+Z) => Dathura Hybiscus Jasmine Lavender Lilly

Lotus Marie Gold Mogra Rose Sunflower

6. MORE: This command is used for listing or displaying the output of the given dos command in page by page format. Req. File: More.Exe Syntax: <Dos Command> | More <enter> Where Dos Command => Any Internal/External command | => Pipe Symbol (Shift+\) Ex: 1. C:\> Type Names | More 2. C:\> Sort < Names | More 3. C:\> Dir | More 4. C:\> Tree | More 7. EDIT: Editor It is used to edit a file, it is possible to modify the file contents using EDIT command. At the same time it also allows to create a new file. Syntax: EDIT [<Filename>] <enter> Ex: C:\> EDIT C:\> Edit Names 8. ATTRIB: Attributes This command is used for giving attributes to the existing file / files, such as hiding or read only. Req. File: Attrib.Exe Syntax: ATTRIB [+R/-R] [+H/-H] <Filename/s> <enter> Where +R => Read only files -R => Write & Read Files +H => Hides the files -H => Unhides the files Ex: 1.C:\> Edit Names C:\> ATTRIB +R Names C:\> Edit Names 2. C:\> Attrib -R Names C:\> Edit Names 3. C:\> Dir ...... Names ... ..... C:\> Attrib +H Names c:\> Dir 4. C:\> Attrib -H Names C:\> Dir 9. FIND: This command is used for finding or searching for the required word within the required file. Req. File: Find.Exe Syntax:

15

FIND [/I] [/C] [/N] [/V] "String" <Filename> <enter> Where /I => Ignores Capital and small alphabets /C => Gives count of the word /N => Gives line numbers also /V => Displays all other lines not containing the given word String => word to search Ex: 1. C:\> Find "Computer" Sample2 2. C:\> Find/I "Computer" Sample2 3. C:\> Find/C "COMPUTER" Sample2 4. C:\> Find/I/C "Computer" Sample2 5. C:\> Find/N/I "Computer" Sample2 6. C:\> Find/V "COMPUTER" Sample2 10. FC: File Comparision This command is used for comparing the two given file contents Req.file: FC.EXE Syntax: FC <Filename1> <Filename2> <enter> Ex: C:\> FC Sample Sample2 11. MOVE: This command is used for moving the required file/s from one drive to another drive or from one path into another path. Req.file: Move.Exe Syntax: MOVE [<Sourcepath>]<Filename/s> <Target path> <enter> Ex: 1.C:\> Move Sample2 D: C:\> D: D:\> Dir D:\> C: 2. C:\> move Computer C:\Students C:\> Cd Students C:\Students> Dir 12. DOSKEY: This command when given installs doskey, which creates a temporary history file and stores all the commands given at the dos prompt with line numbers, which can be recalled by pressing up / down arrow or by pressing F9 followed by line number. Press F7 to list history file commands. Req. File: Doskey.Exe Syntax: DOSKEY <enter> Ex: C:\> Doskey => Doskey Installed 13. DISKCOMP: Disk Comparision (Don't Practise) This command is used for comparing the status of two disks, in terms of memory and files Req.file: DISKCOMP.EXE Syntax: DISKCOMP <Drivename1> <Drivename2> <enter> Ex: C:\> Diskcomp A: B: WILD CARDS: MS-DOS provides two special characters referred as Wild cards, which are used for representing collection of file

16

names with a single pattern known as Wild card pattern. 1. ? (Question Mark) : => Represents any single character or a blank space 2. * (Asterisk) : => Represents Eight or less characters in primary name and three or less characters in an extension

Wild cards pattern is used with the following commands: DIR, COPY, DEL, ERASE, ATTRIB, MOVE, XCOPY Ex: DIR DIR S?????? -> Rep. all the files whose name starts with 's' and consists of 7 or less characters DIR S* -> Rep all the files whose names starts with 's' DIR ?A* -> Rep all those files whose name has 'A' as second letter DIR *.EXE -> Rep all those files having .EXE extension C:\> Copy S* D: => Copies all the files whose names starts with 'S' from C: drive into D: drive C:\> Attrib +h S* => Hides all those files whose names starts with 'S' C:\> Attrib +h *.* => Hides all the files 14. XCOPY: This command is used for copying set of files from the source path into the target path. Req.file: Xcopy.Exe Syntax: XCOPY [<Sourcepath>]<Wild Card Pattern> <Targetpath> <enter> Ex: C:\> Xcopy S*.* D: C:\> Xcopy C:\Students\Raju\*.* C:\Staff\Kamal 15. DELTREE: (Be careful) This command is used for deleting or removing the complete directory structure of the given name. Req.file: Deltree.Exe Syntax: DELTREE <Dir.name> <enter> Ex: C:\>Deltree Students 16. DISKCOPY: (Don't Practise) This command is used for copying the complete contents from the source disk into the target disk i.e. creates a duplicate disk. Req.file: Diskcopy.Exe Syntax: DISKCOPY <Source-Diskdrivename> <Target-diskdrivename> <enter> Ex: C:\> Diskcopy A: B: 19) What is Batch programming? Give examples. BATCH FILES :

17

It is a file that is used for storing collection of DOS Commands, may be internal or external commands including batch file commands in a sequential order. A batch is used to execute a group of commands automatically at a time. The batch files are created with copy con and edit commands with ".BAT" extension. Batch programs speed up our work. When we run a batch program we have to remember one command instead of several commands. Batch programs customize MS-DOS. Using batch programs we can create a personalized commands that perform the exact task we need. We can also design our own prompts and messages. Features: 1. Repeated tasks can be simplified 2. Easy for the users 3. Used for DOS Programming 4. Saves time 5. Also used for setting the system's configuration, etc. To create a batch file, use COPY CON or EDIT command. Syntax: COPY CON <.BAT Filename> <Command 1> <Command 2> ............ <Command n> (Press F6/Ctrl+Z) Ex: C:\> Copy Con File1.Bat CLS DATE TIME VER DIR CHKDSK PROMPT SATYAM$G (Press F6) => To execute the batch file, use only the batch file primary name at the prompt. Syntax: <.Bat Filename> Ex: C:\> File1 => ECHO ON/OFF: It is a batch file command used for activating or suppressing the prompt display while executing the batch file commands. By default it is in ON mode. EX: C:\> Copy Con File2.Bat ECHO OFF LABEL VOL PROMPT VIKAS$G DATE DIR/P (Press F6) C:\> File2 Batch Commands: PAUSE CALL ECHO GOTO IF sample programs COPY CON TEST2.BAT DEL ABC ^Z If it is not available it displays "FILE NOT FOUND" We can also use parametes in batch files. COPY CON TEST2.BAT IF EXIST REM CHOICE

18

4) COPY CON TEST5.BAT @ECHO OFF CLS IF %1==%2 GOTO 100 GOTO 50 :100 ECHO THE GIVEN TWO NUMBERS ARE EQUAL GOTO END :50 ECHO THE GIVEN TWO NUMBERS ARE NOT EQUAL :END ECHO PROGRAM IS OVER ^Z 20) What is operating system? Compare DOS, and Windows. Operating system: Operating system is system software that acts like an interface between user and the system. DOS: DOS is a single user operating system. DOS supports single processor. DOS is a single tasking operating system. In DOS we can load only a single application into memory at a time. To work with second program, we have to close the first. DOS uses Command User Interfacing method. DOS was designed for 8 bit and 16 bit CPUS. It can not take advantage of the 32 bit architecture of advanced chips. Hardware is difficult to install and configure under DOS. It does not support advanced features like networking. Here, the interactions of keyboard is more. Windows: Windows is multi-user operating system. Windows supports multiple processors. Windows is multi-tasking operating system. In windows we can load multiple applications at a time without closing the other. Windows supports 32 bit architecture. Windows use Graphic User Interfacing method. Windows supports plug and play capabilities for new hardware. It supports many advanced features. Here, the interactions of mouse is more.

DEL %1 ^Z execution: test2 aaa.txt -> it is the parameter 2) copy con mycopy.bat copy %1 %2 ^z 3) COPY CON TEST5.BAT @ECHO OFF ECHO THIS IS A GOTO 100 ECHO AT HYDERABAD :100 ECHO DEGREE COLLEGE ^Z

21) Write about Microsoft windows operating systems?


(Or) Write about features of windows 95, windows 98, windows 2000 operating systems? Microsoft Windows is an operating system and it supports graphical user interface. Microsoft first introduced an operating environment named Windows in 1985 as an extension to MSDOS. With the growing interest in graphical user interfaces (GUIs), Microsoft Windows dominated the personal computer market. The most recent client version of Windows is Windows Vista; the most recent server version is Windows Server 2008. In earlier days, Windows 3.0 (1990) and Windows 3.1 (1992) improved the design, mostly because of virtual memory, GUI and multi tasking capabilities.

19

Features of Windows 95 Operating System:

User Interface: The basic elements of the interface introduced in Windows 95 are the taskbar, start button and menu and the Windows Explorer file manager. Plug and Play: Allows hardware devices to be automatically installed into the computer with the proper software. 32 Bit: 32-Bit operating system allowing the computer to run faster and more efficiently. Memory: Windows 95 has an improved memory handling processes compared to Windows 3.11 Right mouse click: Allows you new access and text manipulation by utilizing both buttons instead of one. CD-Player: Enhanced CD-Player. Long file names: Windows 95 included support for 255 character mixed case long filenames. Multi tasking: Windows 95 uses multi tasking and runs each 32 bit application in a separate address space.

Features of Windows 98 Operating System:


Improved Setup: While upgrading from Windows95 to Windows 98, there is no need for full hardware detection. It uses information from pre-installed Applets and utilities, hence, many of the preferences do not have to be made manually. Faster Program Invocation: In the Defrag Applet, the programs, which are most commonly used, are stored close together, towards the beginning of the disk. This reduces the burden on the Hard Drive. With this, a program can be accessed fast. Quick Boot up: Many of the newest include a feature called On-Now. When the PC is turned off, On-Now saves everything. When the computer is started again, it takes few seconds to display desktop. Quicker Shutdown: Many of us lack the patience to wait through those long minutes of Shutdown. Windows98 eliminates that, by shutting down the computer in seconds. Improved Dial up Networking: Combining several phone-lines with separate modems at a time is possible with Windows 98. Protection: Windows 98 includes additional protection for important files on your computer such as backing up your registry automatically. Improved support: Improved support for new devices such as DVD, USB etc. FAT32: Windows 98 has the capability of converting your drive to FAT32 without losing any information. Interface: Users of Windows 95 and NT will enjoy the same easy interface. Internet explorer 4.0: Included Internet Explorer 4.0 Customizable Taskbar: Windows add many nice new features to the taskbar that 95 and NT do not have. Active Desktop: Includes Active Desktop that allows for users to customize their desktop with the look of the Internet. Software: Updated versions of Internet Explorer, Outlook Express, Windows Media Player are supported. Drivers / Support: Additional support for latest technology such as USB, Inter Pentium III and more.

Features of Windows 2000 Operating System:


Windows 2000 has basically four versions Professional An Operating System for business desktop and laptop systems. Server - An Operating System for both a Web server and an Office Server. Advanced Server - An Operating System for line of business applications and e-commerce. Data center Server - An Operating System developed to work in high traffic computer networks. Improved setup and installation: Although plug and play has existed for a few years, the protocol has improved. Windows 2000 also includes new windows installer to make software installation easier.

20

Improved internet features: New features make it easier to blend (combine) work stations, servers, intranets, and internet into one unit. Improved Networking: The networking features of windows 2000 make it easier for administrators to set up and run a network, allowing less experienced users to run office networks. Improved Disk Management: Windows 2000 includes a more flexible method of dividing and accessing hard drive space. It also support drive maintenance programs like Disk Defragmenter that are missing in windows NT.

22)

Explain Windows operating systems?

There are several windows operating systems. Some of the operating systems are discussed below.

Windows 3.0,3.1: Windows 3.0,3.1 are among the first operating systems that provided GUI environment. They also brought multi tasking capabilities. Windows NT: Windows NT offered 32-bit architecture and excellent networking capabilities. It was initially designed to replace DOS. There are two versions in Windows NT: Windows NT workstation and Windows NT Server. Windows NT workstation is used as a stand alone system and Windows NT server is used in networks. Windows 95: Windows 95 simplified interface and supported many advanced features. It also allows multitasking. It is the Microsofts first true GUI based operating system. It can run under DOS and Windows 3.x programs. Windows 98: Windows 98 included advanced internet capabilities, and improved user interface and enhanced file system performance. Windows 2000: Windows 2000 includes the same interface and features of windows 98 and with the file system, networking, power and stability of Windows NT. There are several versions of Windows 2000. Windows-Me: With windows-Me, we can use Microsoft Windows Movie Maker to capture audio and video sequences from sources such as digital cameras. With Windows Plug and Play, we can plug new equipment into our computer and have it work instantly, without restarting!. With the new Hibernate feature, we can shut down the computer safely, even while unsaved files are open.

22) Explain the procedure for using Windows Explorer for maintaining files and folders
Explorer is a navigator of files, folders and drives. It is very easy to maintain files and folders using windows explorer. Explorer window has components like menu bar, toolbar, location, folder-view and file details view. Folder-view displays all drives, and folders in a tree manner. When you click on these folders they either expand or collapse depending upon their current status. When the icon of the branch is + (plus), clicking on that icon expands it i.e. it displays all subfolders of the directory. Immediately the icon changes to - (minus). When the icon of the branch is - (minus), clicking on that icon collapses it. Immediately the icon changes to + (plus). Explorer allows drag and drop methods for cut and paste of folder and files. Clicking on every directory changes the contents of file-details view. File-details window displays four types of views: small icon view, large icon view, list view, and detail view. When you right-click the mouse in the folders-window, a pop-up menu appears on the screen, which has options like cut, copy, paste, open, delete, rename, create short cut, and send to. Clicking on each performs actions accordingly. When you right-click the mouse in the file-window, a pop-up menu appears on the screen, which has options such as refresh, arrange icons, new, and properties. New option allows you to create folders and files. Selecting a file or folder and typing a new name can easily change the name of the file or folder.

21

23)

Explain desktop and task bar

Desktop: It is the initial screen of windows operating system. Desktop is a graphical representation on the screen in which all files, utilities, and programs are at the fingertips of the user All the programs or files appear in the form of icons, a small image representing the file. Desktop allows copying, arranging, deleting and creating new files or programs. It has some specific components like my documents, my computer, recycle bin, and other programs that act like short cuts to open those. Desktop allows drag and drop methods for cut and paste. You can easily create new short cuts, or folders by selecting new option from the pop-up menu that appears when you right-click on the desktop area. Desktop has some properties like appearance, screen saver, background, web, effects and settings. The background of the desktop area can be plain, or it can take an image, or even a web page. Screen saver is some animated program that gets executed when computer does not receive any data for several minutes. Similarly, effects, appearance and settings manipulate the view of the desktop. Desktop also allows you to create short cuts. Taskbar: Taskbar is a Windows screen element, displayed on the desktop, which includes the start button and lists the programs that are currently running on the computer. It displays all the currently running programs in the form of minimized icons. To move to program files, or seek help, or find files, there is a pop-up menu that appears when you click on the start button. Task bar is movable, resizable and can be made hidden. Task bar on its corner displays time, and has icons which generally show the status of programs.

24)

Explain the options of start button.

Start button appears on the task bar, which is displayed first after booting. Clicking on start button displays the following menu options. Programs: Programs display the list of all kinds of programs that can be run by clicking on them. Some options display cascade menus, a collection of sub programs. Favorites: It displays list of favorite web sites and channels. Clicking the options open those web pages on the Internet. Documents: It displays the list of recently used files. Next time the user wants to work with those files, he can directly open them from documents.

22

Settings: It displays a list of settings related to control panel, task bar, desktop, and printers. Clicking on each allows you to change the current settings related to them. Find: Find displays a dialog window to search files or folders based on the key words you supply. It also allows you to find web pages on the Internet. Help: It displays a dialog window that allows you search for some content by navigating or providing key words in the index location Run: It allows you to open the executable files directly by typing the file names. For example, to open paintbrush type pbrush. Logoff: To logoff from the network this option can be used Shutdown: Shut down allows you to shutdown the computer, or reset the computer, or switch over to DOS mode and to be in stand-alone mode

25) Explain the process of creating and deleting files and folders. File: File is a collection of some information and is identified by a name. Folder: Folder is collection of files and sub folders. Folder is also called as a directory. Windows operating system allows us to create and delete files and folders in the easiest manner. File or folder creation can be done in many ways. For creating a file/folder we use the following methods. 1. Using Editors (Files) 2. Using Desktop 3. Using Windows Explorer

Creating Files/Folders:
1) Using Editors: 1. Open any of your favorite editors such as Notepad, WordPad or Word star. 2. Enter contents in the file. 3. Save the file using save option of File menu. 2) Using Editors: 1. Right click the mouse on desktop area 2. It opens a pop-up menu containing several options. 3. Select new option and it opens a cascade menu. 4. Select folder option to create a folder or text document to create a file. 5. Immediately, an icon representing the folder or file appears on the desktop. 6. Give a name for the folder or file. 7. To open the folder simply double click on the folder and repeat the same process to have sub folders. 8. If it is a file, enter contents and save the file. 3) Using Windows Explorer: To create files or folders using windows explorer, we follow the same procedure as in the case of creating files/folders using desktop.

Deleting Files/Folders:
A folder or file can be deleted by selecting it, and pressing the del key. Or, right click on the file/folder to be deleted and select delete option from the popup menu that appears. Click yes button when it asks conformation for deleting.

23

Moving Files/Folders:
To move a file or folder we can use drag and drop options or cut, copy and paste options of the menu that appears by right clicking. 26) Explain the process of creating short cuts. Short cut is a direct means of accessing a file or a program that exists in any directory. Short cut is in the form of an icon and arranged on the desktop. To create a short cut the following steps must be followed. 1. Right click the mouse on the desk top area 2. A pop-up menu appears displaying several options 3. Select new | shortcut from the options. 4. It displays a dialog window asking a program file name. 5. Program name can be directly entered or we can locate it by clicking on browse button. 6. Say next and enter a name for the short cut 7. You can also select an icon for the short cut you are trying to create. 8. Say finish and an icon that acts like short cut appears on the desktop. 27) Explain the process of using recycle bin Recycle bin is a very useful tool to keep track of the deleted files. When you delete a file, the file moves into recycle bin. To delete a file permanently, you need to delete it from the recycle bin. To activate recycle bin, click on recycle-bin icon on the desktop. It displays the list of currently deleted files, folders and programs. Clicking on each display the name of the file, location of the file and the date when it has been deleted. It provides one option restore to restore the deleted files. i.e. the files would move to the original locations. When you delete a file from the recycle bin the file gets deleted permanently. It allows drag and drop methods for cut and paste Files can be cut, or copy and pasted into other locations.

28) Explain Interfacing control elements in windows. Today, most of the operating systems use Graphic user interfacing technique to have interaction from the users. Interfacing control elements include icons, text boxes, dialog-boxes, menus, buttons and window control buttons.

Desktop: Desktop is the graphical representation of initial screen of the operating system in which all files, utilities, and programs are at the fingertips of the user in the form of icons. User can open or activate a file or a program just by clicking on the icon. User can use drag and drop options to copy or move the folders or files on the desktop Icons: Icons are basically small images that represent parts of the computer you work with. It may refer to printers, fonts, folders, programs and disk drives. To select a particular icon you just have to click on the icon. Task bar: when you start windows 95,98 operating system a button appears at the bottom of the screen. The purpose of the task bar is to hold the currently running programs. It provides direct and quick way of running a program. Task bar includes Start button and time display. Start button: Start button is the permanent feature on the task bar. When you click on the start button it displays a pop-up menu that has menu items, which allow you to start a program, find information, seek help and shut down your computer. Window control Buttons: Every window has three control buttons at its top-right corner. It includes minimize button, maximize button, and close button. Menu: Menu is list of commands. They are also called as drop-down menus. Several menus make a menu bar. For example, file menu in windows contains command for opening, saving, and printing files. Dialog boxes: Dialog boxes are special purpose windows that appear to convey messages to the user. Those messages are generally details of steps to be taken next or list of options to be selected or reminders. Most of the dialog boxes do not allow you to work with other windows when they are active.

29) What is Control Panel?

24

Control Panel is a tool that allows you to customize Windows operating system. Using Control Panel, The settings of the computer can be changed very easily as if they are at your fingertips. This allows you to change options such as appearance, add/remove new hard ware, mouse-options, keyboard-options and etc. It also includes password settings and network options. To change your computer's settings, we follow the procedure given below.

1. Click Start, and then click to Settings. 2. Click Control Panel.


Double-click the icon that represents the settings you want to change

30) Compare Windows 98 and Windows 2000. Windows 98 It uses FAT 16 but can be converted to FAT 32 file system. FAT (File Allocation Table) is used to compress the memory while storing files. Searching option works for only files and folders User can bypass the password dialog window when machine is switched on Shut down dialog window with radio buttons Right clicking means quick access to few options or operations Limited Networking Capabilities Windows 2000 It uses FAT or NTFS. NTFS stands for New Technology File System that includes automatic backups for master file table and security controls of file system Searching has much advanced options such as containing text and etc. User cannot bypass the password dialog window Shut down dialog window with drop down list Right clicking allows virtually anything Extended Networking Capabilities

31) Explain the functionality of any browser you are familiar with. Browser is a program that enables the user to view web pages, navigate web pages and move from one site to another. It acts like a container that holds almost any type of object or content in it. They are of types: text browsers and graphic browsers Internet Explorer and Netscape Navigator are few examples of Browsers.

Functionality of Internet explorer: Internet explorer is a product of Microsoft It is a browser used to display web pages. It keeps track of previously visited web sites and favorite web sits. It provides buttons such as forward and backward to move to sites visited. It displays images and few components. It also plays animation and sound files. It provides facilities to view and copy source code of a file. It provides facilities to upload or download files. We can access any web site by typing the address of it in the location bar of Internet explorer. It displays the progress of the loading of the web pages when in online.

25

SHORT ANSWER QUESTIONS


Languages: Language is a full fledged software which allows to do anything. By the languages we can build our own applications. The languages are two types. High level languages and Low level languages High level language: It is a language by which the user can interact with the system. It is just like the English language. It is understandable by the user. Low level language: It is a language which is directly understood by the machine where the data and instructions are in binary form i.e. 0 and 1. It is also called as binary language and machine level language. Packages(application): It is a software which is used for performing a single task. In this there is no possibility to do different types of jobs. It is used to perform specific tasks only. Compiler: It is system software that translates the source code (high level) to object code (low level). It translates the entire program at once. Interpreter: It is system software that translates the source code (high level) to object code (low level). It translates the program line by line. Programs produced by compilers run much faster than the same programs executed by an interpreter. Linker: It is also called link editor and binder. A linker is a program that combines object modules to form an executable program. Debugger: A special program used to find errors(bugs) in other programs. A debugger allows a programmer to stop a program at any point and examine and change the values of variables. Device Driver: It is a system software that allows to communicate the devices to the computer. Many drivers such as the keyboard driver, come with the operating system. For other devices, we need to load a new driver when we connect the device to the computer. File: A collection of data or information that has a name, called the filename. There are many different types of files: data files, text files, program files, directory files and so on. Folder: A folder is an object that can contain multiple documents or files. Folders are used to organize information. In the DOS and UNIX folders are called directories. File name: File name consists two parts. Primary name and Extension. Primary name should be upto 8 characters and Extension should be upto 3 characters. The primary name and Extension should be separated by the dot operator. Processor: The procedure that transforms raw data into useful information is processing. To perform this processing, computer uses processors. Usually computer processor has one or more microprocessors(chips). The processor is like brain of the computer in the way that it organizes and carries out the instructions. Registers: Registers are high speed memory locations that are built in ALU. Regesters are used to hold the data and instructions that are being processed. EBCDIC CODE: EBCDIC stands for Extended Binary Coded Decimal Interchanging Code. It allowed maximum of 256 symbols and consists of 8 bits. ASCII CODE: ASCII stands for American Standard Code for Information Interchange. It represents symbols with bits. In ASCII 0 to 31 are control characters, 32 to 64 are special characters and numbers. 65 to 127 are letters. ASCII is a 7 bit code. UNICODE: UNICODE is the new standard for representing data. It represents 65536 different with bits. It provides 2 bytes (16 bits) to represent symbols. It represents characters of different languages like Chinese, Japanese. Data bus: Data bus is an electronic path composed of parallel wires that connect CPU, memory and other hardware. Data bus carries the data from one unit to another unit. Task bar: A windows screen element, displayed on the desktop, which includes the start button and lists the programs that are currently running on the computer.

26

Multitasking: Ability to perform many tasks at a time is multi tasking. Windows operating system is a multi tasking operating system. It also follows time sharing mechanism. Control panel: Control panel is a tool that allows to customize windows operating system. The settings of the computer can be changed very easily using control panel. Dialog box: Dialog boxes are special purpose windows that appear to convey messages to the user. Some of the dialog boxes are model dialog boxes and some are modeless. Screen saver: Screen saver is some animated program that gets executed when computer does not receive any data for several minutes. This is very useful for avoiding some of the problems of the computer. Back up software: Back up software is a program that enables the user to copy large group of files from hard disks to any other storage medium. The most common back up mediums are floppies, CDs and hard disks.

UNIT II [MS-WORD and MS-POWERPOINT] 1 What are the tools of MS-Office. MS-Office and its Tools MS-office is a office automation tool which performs the office tasks like creating documents. Ms-office is an application software. MS-Office has mainly four tools

1) 2) 3) 4)

MS-Word MS-Excel MS-Access MS-Power point

1) MS-Word: MS Word is word processing software that is used to design documents. It allows creating the
text, editing, deleting n etc. ms-word contains many advanced features like macros and mail merge.

2) MS-Excel: MS-Excel is spreadsheet software. In this ms excel we can perform calculating. It is a software
tool for entering, calculating, manipulating and analyzing sets of numbers. Each spread sheet contains rows and columns. The rows identified with numbers (1 2 3 . .) and columns identified with characters (a, b, c ..). A cell in the spread sheet is an intersection of a row and a column. Every cell has a unique reference in terms of rows and columns such as A1, B2. The cells can hold text, numbers, date and formulas. Every cell can be formatted according to the requirements of users.

3) MS-Access: MS Access allows the user to create DBMS. DBMS stands for data base management system.
Database is a collection of data in an organized form. DBMS is set of user interfacing programs to store, access and manipulate the data of a database. In MS Access, we can store the data and we can access the data.

4) MS-Power point: MS Power point is presentation software. We can design the presentation in the form of
slides. We can also apply the animation. 2 Write the parts of MS-Word application window. Tto open MS-Word click on Start button and select Programs - Ms-office - Microsoft word 2003 When you open the MS-Word it has number of different parts.

27

a) b) c) d) e) f) g)

Title bar Menu bar Tool bar The ruler Status bar Scroll bar Window area

Control menu box: A small box displayed a the top left corner of the window. Title bar:

The Title bar is used to display the name of the program as Microsoft word. It is also display the name of the document, which is currently opened. If you are creating new document , then it will be document1. You can move the window any where on the screen using the mouse . here click the left mouse button once and holding the mouse, you can drag it any where.Title bar contains three control buttons. minimize, maximize and close buttons. Minimize: This button is used to minimize the window. Maximize : This button is used to maximize the window size. Means we can increase and decrease the window size. Close: This button is used to close the window. Menu bar:

The next bar of the window contains menu bar. The menu bar contains number of menus. Such as file, edit, view, insert, format, tools, table, window, help. Every menu one character contains underline. Using the keyboard we can also open the menus by pressing alt+<underline character>. For example to open a file menu we can use alt+E. here each menu contains some options. Tool bar: A set of icons to perform different tasls and displayed as a set is called a tool bar. Standard tool bar and formatting tool bars are displayed at the top of the scree below the menu bar. Drawing tool bar is displayed at the bottom of the screen. Ruler line: It displays the margins, indents, tab positions on a numbers scale. Horizontal ruler line will be on the top and vertical ruler line is to the left of the screen. Status bar: The status bar is displayed at the bottom of MS-Word window. It displays the information about the active document such as page number, section number, number of pages, insertion point position etc.

28

Explain about templates in MS-Word.

Pre-defined format of document is a template. Templates are readymade and read only documents with styles and some designing elements. A template contains the format of the document, which can be filled in blank places to create good documents. It is also possible to create user defined templates. Templates are of three types: Contemporary Elegant Professional Each template has documents such as Fax Memo Letter Report Resume etc. Templates can be used in our documents in two different ways 1. Selecting new option from File menu and selecting memo and letter tabs of the dialog windows. 2. Choosing templates from style gallery of Format menu. User defined templates can be created by selecting create new template option of the New file dialog window. After adding templates to your documents, the styles and headings or other elements can be used to over write the styles of the text in the document. 4 Explain the process of formatting text in MS-Word. The text formatting feature includes font, font size, bold, italic, underline, text color, text background and text border. To format the text, first we have to select the text and click on the appropriate icon in the formatting toolbar. To color a portion of text or highlight a portion of text first select the text and click on the arrow mark pointing downwards, in formatting tool bar and click on the desired colour. Text border is used to put a border to the selected portion of the text. Fonts refer to the style of letters, symbols and punctuation marks in the document. In addition to the fonts that come with O.S., most word processors come with built-in additional fonts. Type size indicates the size of the Font, which is measured in points. One point equals .02 inch in height. Most common size used in business documents is 12 point type. Type style is used to control the appearance of the characters in addition to the those above mentioned. The most commonly used type styles are Bold, Italic, and Underlining. Paragraph Formats include the formatting that can be applied on a complete paragraph. We can have control over the space between lines of a paragraph using line and paragraph spacing feature. It can be single spaced or double spaced or any custom defined setting. Indents determine how close the paragraph is to the margin of the page. Indent can be different from paragraph to paragraph. Alignment includes four options: Left, Right, Center and Justification. Using tab stops feature the cursor moves till it encounters a tab stop. Tab stop can be measured from left margin. A document can have any number of tab stops set. Paragraphs can be formatted with borders and shading. Borders can be any side, or all sides of the paragraph. Shading includes different colors and patterns. Document formats include the formatting that can be applied to the complete document. A document can be set to fit on any standard size paper. The orientation can also be set up. The orientation could be portrait or landscape orientation. Headers and footers are common elements to all pages of the document. They may take page numbers, date, time and custom set messages. Footnotes are placed at the bottom of the page and they annotate a specific place in a document. 5 Explain different views of documents in MS-Word. A document can be edited by displaying it in different ways on the screen called Views. Word has six different views. Normal view Online layout view Page layout view

29

Print preview Outline view and Master Documet. These different views (except print preview) can be selected from View Menu. Normal view: is the default view in Word. It is an all purpose view for typing, editing and formatting the text. Normal view shows text formatting but simplifies the layout of the page so that typing and editing can be done faster. It will not display side by side column positioning, footers, headers nor the printing position of framed objects. Page breaks are shown as dotted lines. Online layout view (web layout), which optimizes the layout to make online reaing easier. Text appears larger and wraps to fit the window. It will not display the text the way in which it is actually printed. By default, online layout view includes a resizable navigation pane called Document Map, which shows the outline view of the documents structure. By clicking on outline topic of the document, the cursor can be included only in the online layout view. Page layout view (Print layout) displays the ttext and graphic objects, as it will appear when printed. This view is useful for editing headers and footers, for adjusting margins and working with columns, drawing objects, inserting pictures etc. both horizontal and vertical margins will be displayed allowing the user to set the tabs and margins easily. Print preview displays one or multiple pages of a document in a reduced size to display the document as it will be on a printed page. This view is useful to check the layout of the document by displaying the header, footer, and margins and allows the user to edit or format before printing the document. Outline view makes it easy to look at the structure of a document and to move, copy and reorganize text. In the outline view, there is a provision to collapse the document to see only the main headings or the document can be expanded to see the entire document. Master Document View makes it easier to organize and maintain a long document, such as a multi part report or a book with chapters.

6 Explain the features of Word processing. Uses of MS-Word: It provides extensive tools for creating all kinds of text based documents. In word, we can add images or clipart to documents. It provides several templates to create professional looking memos, letters etc. We can add animations, and embed sounds and video clips. We can use Word documents to publish on WWW. We can create hyperlinks to move to other parts of documents or other documents. It includes advanced options such as kerning, tracking, rotating objects etc.

There are several formatting options available for formatting the document Features of a good word processor: A word processor has number of advantages

A good word processor should give a good view of the document while the document is being typed so that the mistakes can easily be removed. It should have number of menus and commands There should be the provision to import and export the text data i.e documents. It should have the feature to execute the commands both keyboard as well as by mouse. A good word processor should have the spell and grammar checking facility so the text of the document is correct and grammatically error free. It provides the facility to boldface italic and underline the selected text and also print the selected text. Word processor should have the facility that the text can be left justified, right justified and centered. It contains the facility that super script and sub script. It should provide the facility to define header and footer. There should be a provision to cut, copy and paste. User should able to set the indents. It supports many advanced features: Print preview is used to see how document will look like when it is printed. Mail merge is one of the advanced feature of the word processor. Hyperlinks and HTML options allows to formatting HTML pages and also we can create hyperlinks. We can also create Graphics and sounds in out document.

30

There are so many styles and style sheets are available in word processing software. 7 Explain the process of creating the macro. Macro is a series of stored of commands. It automates the task as and when requited. It can call as a set of recorded key strokes. When commands are to be stored, macro will play back the same commands when you run the macro. Macro can be used to enter data and format data. Macro can be used in the same application or in any other similar application. Creating a Macro: Open a word document. Go to tools menu, click o macro to open a sub menu. Select record new macro option from that. It immediately opens a dialog window asking for a name. Enter a name for the macro. Type something or set any formatting options related to font or margin or page formatting. All these keystrokes and formatting options are stored in the macro. Stop the recording of the macro when you are finished. Opening and running a Macro: Open a new document or any other existing document to repeat the keystrokes or formatting options on the current document. Go to tools menu; click on macro to open a sub menu. Select macros option and then run macro option from the sub menu. It opens a dialog window asking to select a stored macro. Select the macro that you would like to run. It repeats the entire key strokes and places them on the current document. It also sets the formatting options stored in the macro to the current document. 8 Explain the proof checking ( spell checking) of text in MS-Word. The read ability of the document is highly affected by the spelling mistakes. To avoid spelling mistakes word provides a tool i.e. spelling and grammar. Check tool. After typing the document to correct the mistakes choose tools spelling and grammar check or press F7 button on keyboard. Then we find a dialog box with different options. The options of spelling checking are explained below: Option Ignore Ignore all Add Change Change all Auto correct Cancel Undo Effect Ignores the word that is wrongly spelled or not in dictionary. Ignores all the word that is wrongly spelled or not in dictionary. Adds the word to internal dictionary Changes the word with selected suggestion Changes all occurrences of the word with selected suggestion. Replaces the wrongly spelled word with the selected suggestion and add it to auto correct tool. Terminates the spell check process Cancels the previous spelling correction.

In MS-Word , while typing the text, if any spelling mistake is made, a red wavy underline will be included for such words and if there is a suspected grammar mistake in the sentence, a green wavy underline will be included. To correct the spelling of such words, right click on the word which is has the red underline. Possible correct spellings will be displayed in the short cut menu. MS-Word checks document for possible grammar and style errors. It also displays suggestions. The grammar checker first checks the spelling of the words in the sentence and then the grammar. The grammar mistakes are displayed with a green underline. To correct the grammar, right click on such a word, possible suggestion will be displayed in the shortcut menu. Select the appropriate choice. If you think the grammar is right, but the green underline is still displayed, then select ignore sentence from the shortcut menu. 9 Write a short note on page set up and printing a document in MS-Word. Page setup: Page setup allows to set different page options for the current document. This option is available in file menu of MS-Word. It includes options such as Margins, Paper size, Paper source and Layout. Margins: This option sets margins for the document. It includes Header spacing, Footer Spacing, Left, Right, Top, Bottom margins. Set these to appropriate values to suit our document. Paper size: Paper size i.e. size of the current document can be changed using this option. This frame of the page setup dialog window shows readymade paper sizes. We can even mention any custom defined size. It also allows to change the orientation of the document to portrait or landscape. Paper source: This option lets to enter paper source method while printing the document. It includes options such as manual feed, tractor feed and default tray. Layout: Layout of the document can be changed using this. Here we can set start page

31

While printing, it even attaches line numbers to document. Printing options: When we click on print option of file menu it displays a dialog window, which has mainly three options: Printer, Page Range and Copies. Printer: This option allows to mention the name of the printer in usage. The properties of the printer can be changed. Page Range: This option allows to set page range i.e. all or current page or pages x,y. At a time any number of pages can be printed. Copies: This allows to set number of copies to be printed. When we select this the selected pages will be printed in specified number of copies. 10. Explain the process of creating headers and footers in MS-Word. Headers and footers are common elements of all pages of the document. Header appears on the top of the page.. Footer appears at the bottom of the page. Header and footer may contain elements like page number, date, time, and total number of pages, filename and any user defined message Creating header and footer involves the following steps: Select header and footer option from View menu. A dashed rectangle covering header/footer area and a menu bar appears on the window. Type text in the dashed rectangle. We can also insert readymade text like page number, date, filename and time can be selected from the header/footer toolbar. Similarly, we can switch over to the footer and add text. Click outside the rectangle i.e. in the document and header/footer get linked to the document. Page setup can also be made to have header / footers at proper positions. 11. Explain the process of creating mail merge in MS-Word. (Or) Explain the feature of mail merge in MS-Word Mail Merge is used to quickly create form letters, mailing labels, envelops and catalogs by merging the information from two different files. Those two files are generally the Main Document and Data Source file. After creating those two files, they are merged to get the desired result. Generally, Mail Merge is used to print multiple letters addressed to many members when the subject matter of the letter is the same. For example Circulars, Invitations etc, Main Document: the Main Document contains the subject matter of the letter to be printed. It can contain text, graphic objects and fields (data) which are to be inserted into the letter. When merging, data will be merged with the main document. Therefore, the format of the letter and where the data from data source file must be inserted is specified in the main document. Data Source: Data Source file contains the information in the form of records, which is to be inserted to the main document. In one record, one members information is stored. The individual information in the records is called a field. Actually, the data written in these fields will be inserted in the main document during merge. Mere required 3 steps 1. Creating Main Document 2) Creating Data Source 3) Merge Creating Main Document:: Open a new document to create a main document by selecting File New. Then select Tools Mail Merge. In the appeared dialog box click on the create button. From the available formats( form letter, mailing labels, envelope or catalog) click on the form letters. Then a dialog will be displayed prompting where to create the main document? Click on Active Window to create the main document in the active window. the Edit button will be displayed to the right of create. Before selecting Edit the Master Document, specify the address of members to whom the letters must be sent. Creating Data Source: The address must be stored in the data file. To create the data file, click on Get Data in Data Source. From the appeared dialog box click on create data source to specify the fields to be included in the address. After specifying the field name, click on ok. Next, from the appeared dialog box select Edit Data Source to type the addresses. Merge: After typing the letter, save it. Now, the document is ready to merge. To merge the data source with the main document and to print a letter for every address in the data source, select Tools Mail Merge. Merge dialog will be displayed again. Click on Merge displayed at the bottom of the dialog. These merged letters can be saved in a file and printed later. 12. How do insert tables in MS-Word.

32

(or) How do you handle tables in MS-Word. Table can be created in two different ways. 1 By selecting the option draw table from table menu 2 By selecting the option insert table from table menu When we select draw tableoption, the cursor changes to pencil type and dragging it draws lines. When we select the option insert table, it asks for number of rows and columns. According to the given number of rows and columns, it draws a table. Table menu has several options to delete, insert and format cells. Data can be directly entered into the table. Pressing tab moves to the next cell of a row. Table can be formatted by the table auto format option. Merging and splitting of the cells can be done in the table. It is also possible to sort the records of a table according to the column specified. We can use some simple formulas to find sum, max and average of the values. Inserting rows and columns: Place the cursor in a cell where you want the row / column and choose table insert option and select the options from sub menu. Deleting rows and columns: Select row / column that you want to delete and choose table delete option. Merging the cells : Select the cells and choose table merge cells option Spitting a table To split one table into two, click in the row that will be the first row of the new table, then select split table from the table menu. Deleting tables: To delete a table and its contents: Select the table Select table delete table option To delete the contents of a table, leaving the table itself Select the table Press the delete key To delete a table, leaving its contents as tabbed text Select the table Select convert table to text from the table men. Select tabs, (if necessary) then click ok

MS-POWERPOIINT
1. What are the advantages / features / applications of MS-PowerPoint?

Power Point is presentation software that allows us to create a presentation and manipulate slide shows. Using the power point we can teach with animations. The slide can be made to have animations and sound effects. Now a days the business organizations need to show their products. The form of presentations to their customers and employees. It is commonly used in advertising because of its wide range of visual effects. The more powerful features of powerpoint are very useful. These include the slide maser, copy / paste, custom animation schemes, slide transitions, background effects. In power point, we can also apply our own designs to the slides. We can also apply the transitions using the slide transition. We can also apply the charts and pictures Business organizations use power point to interact with their customers. Demonstrators can also add the notes page along with the slides to refer to them while presenting the slideshow. We can show the presentation slide by slide manner. 2. Write about parts of MS-PowerPoint window

Parts of powerpoint screen: Title bar displays the document name and application name Menu bar it holds various menus such as File, Edit, View, Insert, Format, Tools, Slideshow, Window, Help Standard tool bar frequently used menu options such as new, open, save, print, print preview, cut, copy,

33

paste, format painter etc. Formatting tool bar displays formatting commands such as font, size, bold, italic, underline, alignment, bullets etc. Outline view button displays document in outline form Slide view button displays slides one at a time. Slide sorter view button displays all slides in a single screen Slideshow button displays slide show Drawing toolbar displays drawing tools Status bar shows the current page number and position of the insertion point in the document. Office assistant quick help when you need help. 3. Explain different views in MS-PowerPoint Vies in power point: There are several vies in power point. 1) slide view: it display the actual slide in which design can be made. 2) Outline view: outline view display the contents of the slide in a tree manner. It doe not show the images. New contents can be added in this view. 3) Normal View: The normal is the default view. Normal view display only one slide at a time. It displays each slide for easy selection. Once selected, slides can be moved, edited or deleted. 4) Slide sorter: slide sorter display all slides in miniature at a time. Here we can drag and drop to move or change the order of the slides. We can also delete the slides. 5) Notes page: notes page displays a small editor to type the text along with the slide. Notes page can be viewed at the time of presentation. It can also be included while printing or importing. 6) Slide show: slide show option is used to run the presentation. The presentation can be run automatically or on mouse clicking. 4. Write different ways to create a presentation in MS-PowerPoint Creating a presentation: After opening MS-PowerPoint, a screen pops up asking if you would like to create a New Presentation or Open an existing presentation. A New Presentation can be created mainly in three different ways: 1) Using Design Template 2) Using Auto Content Wizard 3) Using blank presentation 1) Using Design Template: In this Design Template the user can creates own designs. Select new option from File menu Select design template from the task pane. It will display the slide designs. From that you can choose any one design It will apply to the selected slide

2) Using the Auto Content wizard: On the file menu click on new. Select the Auto content wizard And follow the instructions in the wizard. Power point opens a simple presentation that you can add your own words and pictures to. Change the presentation to suit your needs. When you finish, click save option on the file menu. Name your presentation and then click save.

3) Using a blank Presentation:

Creates a new, blank presentation using the default settings for text and colors. After selecting blank presentation, a window pops us asking to select the layout of the first slide.

34

Opening an Existing Presentation: On the standard tool bar you can choose open option It will display the open window From that window you can select the presentation you want. Change the presentation. For example change the text, or change the pictures or add or remove slides. To save the presentation you select save as from File Menu. Name your presentation and then click save. 5. How do you insert and format slides in MS-PowerPoint (slide manipulation) Inserting a new slide: Click insert at top of screen Select new slide. Inserting clipart & pictures: Display the slide you want to add a picture to. Click insert at the top of the screen. Select picture clipart. Click the category you want and then select the picture. Click insert clip on the shortcut menu. When you finished using the clip gallery, click the close button on the clip gallery title bar. Formatting slides: We can easily format the slide in many ways. Formatting text: formatting text in presentation is just like formatting text in word document. Text is slides in the form of title, sub title and lists. To format the text select the text which you want to format. And select font option from the format menu. We can also apply the bullets and numberings to the selected text. We ca also increase or decrease the font size. We can apply the bold under line and italic styles to the selected text. Adding colors: we can choose the color for the selected slide. And do not make text difficult to read. We can also add the colors to the selected text. We can also add our own design to the selected slide by selecting fill color option from the drawing tool bar. Adding designs: we can also add designs to the selected slide. First select the slide which you want to add the design. Then you select slide design option from slide show menu. Custom Animation: Custom animation is used to apply the animation effect for the selected text. Steps for adding animations: Select custom animation option from slide show menu It will display the add effect button on the task pane. When you click on add effect button it will display four options such as Entrance, Exit, Motion paths, Emphasis. First select the text which you want to add the animation effect. Choose add effect button. Select any effect from that button It will display the number at the corner of the text. Now you can run the presentation. 6. How do you add transition effect in MS-PowerPoint? We can add customized transitions to our slide show to make it come effective to our audience. Transition effects determine how a slide enters the screen and leaves the screen. Steps to add transition effects: Select Slide Transition option from Slide show menu It will display slide transitions on the task pane From that you can select the transitions like box out, box in and etc. We can also select speed. It contains three option fast, slow, medium. Choose any one. Slide transition contains sound. Using this option we can apply the sounds. Slide transition contains two more options such as on mouse click and automatically after We can run the presentation automatically by selecting Automatically after

35

When you choose automatically it will display the tome. You must mention the time. Using the on mouse click option we can run the presentation by pressing left mouse button. 7. Write about Slide Master in MS-PowerPoint?

Slide Master: Power point comes with special type of slide called slide master. The slide master controls certain text characteristics such as font type, size and color as well as background color. And also change certain effects like bullets. Slide master contains date and time, footer and slide number. When you want to make global change to the look of your slides, you dont have to change each slide individually, just make the change one on the slide master. Then the power point updates the existing slide and applies the changes to any new slides you add. To change the formatting of the text, select in the place holders and make the changes you want. For example if you want to change the title text color, select the title on the slide master and select the color. 8. Explain the slide transactions in MS-PowerPoint Slide transactions include creating a slide, deleting a slide, copying, saving and printing a slide. Creating a slide: Creating a slide can be done in many ways To insert a slide select insert menu Select new slide option And we can also press ctrl+M to insert a slide Deleting a slide: Select the slide which you want to delete And choose delete slide option from edit menu And right click on slide It will display menu From that menu you can choose delete option Copying a slide: Slide can be copied by selecting duplicate option from edit menu We can also use copy and paste methods to copy the slides. Saving a slide: To save a slide we choose save option from file menu It will display the save as window From that window you can select the location and give the file name Press ok button Printing the slide: To print the slide we select print option from file menu It will display the print window From that you can enter slide numbers in slides option And select number of copies and press ok button. 9. Explain about different types of menus available in MS-PowerPoint Power Point is presentation software. It is one of the software packages of MS-Office. Using the power point we can prepare teaching with animations. Power point contains slides. In this slides we can write the text and also insert the pictures. using the power point we create a presentation based on suggested content and design. Menus in Power Point: File: File has some menus such as New, Open, Save and etc. Using the file menu options we can create a new presentations, we Can open the existing presentations, save the presentation and print the slides. Edit: Edit menu has some options such as undo, redo, cut, copy, paste and etc. Using the edit menu options we copy the selected text, and paste the text. And we can easily edit the slide show. View: View menu has some options such as Normal, Slide sorter, slide show, zoom, and etc. using the slide sorter we change the order of the slides. Using the zoom option we can increase the slide size.

36

Insert: Insert menu has some options such as new slide, slide number, date and time, picture and etc. using this insert menu we insert the new slide, insert slide number, insert date and time and we can insert the pictures like clip art, word art etc. Format: Format menu has some options like font, slide layout, slide design and etc. using the slide design option we design the slides. Using the format option we can format the selected text. Slide show: slide show menu has some options such as slide transition, custom animation, view show and etc. using the slide transition we can apply the transitions, timing. Using the custom animation we can apply the effects. Tools: Tools menu has some options such as spelling and grammar, Auto correct, macro and etc. using the spelling and grammar we ca check the spelling and grammar. Using the macro option we store the set of actions. Windows/help: This menu allows us to arrange the windows in cascade, titled manner. Help menu offer help on power point. 10. Explain the options available on standard tool bar in MS-PowerPoint? Function in tool bar: The following are the functions of tool bar New: this option is used to create a new presentation by choosing blank document option Open: this option is used to open an existing presentation. Save: this option is used to save the presentation. Print: this option is used to print the selected slide Spelling and grammar: this option is used to check the spelling and grammar. Insert Table: this option is used to insert the table. Insert Microsoft excel sheet: this option is used to Insert Microsoft excel sheet. Chart: this option is used to insert the chart Slide layout: changes the layout of selected slide. Slide design: this option is used to apply the design to the selected slide. Print preview: this option is used to show the preview of the slide. 11. Explain the procedure to create Handouts in MS-PowerPoint? Handouts: You can print your presentation in the form of handouts with one, two, three, four, six, or nine slides on a page. Handouts show only slides, they dont include any corresponding notes. Procedure: Select master option from view menu Select handout master It will display handout master tool bar To preview the layout you click the buttons on the handout master tool bar. We can also add 1 slide, 2 slides, 3 slides and also add 9 slides per page. We can also select the Orientation such as horizontal or vertical. To close the handout master you choose close handout master from handout master tool bar. We can also change the background color of the handout page. Select handout background from format menu It will display the handout background window From that you select the background fill, and apply . To print the handout master select print option from file menu. It will display the print window. It contains print what option You select handouts options. Then select print button.

SHORT ANSWER QUESTIONS 1) What is word processing?


Word processing software is used to create documents, which consist of text. With word processing software, users can create simple letters, memos, brochures and reports. It supports wide variety of text styles, colors, printing options, drawings, tables and spell checkers What are templates?

2)

37

3)

4)

5)

6)

7) 8)

9)

10)

Pre-defined format of document is a template. Templates are readymade and read only documents with styles and some designing elements. A template contains the format of the document, which can be filled in blank places to create good documents. It is also possible to create user defined templates. What is thesaurus in word processors? An electronic thesaurus is just like a printed dictionary: a source of alternative words. If you want to find a different word with similar meaning, you can select the word, then launch the thesaurus. It will display a definition of the selected word and a list of possible replacements. What is macro? Macro is a series of stored of commands. It automates the task as and when requited. It can call as a set of recorded key strokes. When commands are to be stored, macro will play back the same commands when you run the macro. Macro can be used to enter data and format data. Explain mail merge feature? Mail Merge is used to quickly create form letters, mailing labels, envelops and catalogs by merging the information from two different files. Those two files are generally the Main Document and Data Source file. After creating those two files, they are merged to get the desired result. Generally, Mail Merge is used to print multiple letters addressed to many members when the subject matter of the letter is the same. For example Circulars, Invitations etc, Explain word wrap feature? Word wrap is an advanced feature supported by some of the word processing software such as MS-Word. This feature saves the user from typing enter key every time to move the next line. When word wrap is on the text automatically moved to the next line depending upon the line size or window size is set. Explain undo / redo feature? Undo and Redo are features of word processing software. Undo cancels the most recent action performed by the user. The Redo command repeats the most recent action performed by the user. Explain about paste special option? Paste special is used to get the cut or copied information. By this option we can format the cut or copied information according to our requirement. We can also create a link between the source and target information. What is presentation software? Presentation software is meant for designing a presentation in the form of slides. It is collection of slides with graphics, animations, and sounds. This can be presented on computers or to audience by automatic navigation or manual navigation of slides. What is header & footer? Headers and footers are common elements of all pages of the document. Header appears on the top of the page.. Footer appears at the bottom of the page. Header and footer may contain elements like page number, date, time, and total number of pages, filename and any user defined message

UNIT III (MS-EXCEL & MS-ACCESS)


1. Define workbook, work sheet and cell. Write the uses of spread sheet. Workbook: Microsoft Excel is spread sheet software. A Microsoft Excel work book is a file that contains one or more worksheets. The term spreadsheet often used to refer to a workbook. When you launch Excel, the excel application window opens with a new Excel workbook file consisting of three blank worksheets. The excel application window includes title bar, standard bar, name box and formula bar. Worksheet: A work sheet is a single page or sheet in an excel spreadsheet. Excel worksheet is divided into columns, rows and cells, separated by grid lines. Columns are vertical divisions. The first column is column A. the horizontal rows are numbered. Each worksheet has 256 columns and 65536 rows. Cell: A cell is the intersection of row and column. Each cell has a unique address. The active cell has a box around it called the cell pointer. To move the pointer one cell to the left, right, up or down, use the keyboard arrow keys. To activate the cell with the mouse, simply click the cell. If you want to see other areas of the worksheet, use the scroll bar. To enter the text or numbers simply click the cell and enter the text. You can change an entry in a cell, you activate the cell and type the new entry, the old entry will be replaced. We can also increase and decrease the row and column sizes. In Excel at least one cell is always activated. A group of cells is called a range. To select a range move to the first cell in the range, hold down the mouse button and drag to the last cell you want to select before releasing the mouse button. Features of Electronic Spreadsheet: Spreadsheet allows us to organize the data in the form of rows and column. It allows us to work with functions such as sum, average, min and etc. It allows us to sort the records and perform data validation There are several formatting features such as conditional formatting, auto format and etc.

38

A formula lets you to calculate a value based on the values of the cell. A cell is referenced by its address such as A1 and B1 Numbers can be formatted as dollars, percentages and decimal numbers. We can format the worksheet using fonts, borders, maps. Spreadsheet allows us to create charts. Charts includes several types such as line, bar, pie, column and etc. Excel has some advanced features like goal seeking, sorting. 2. How do you create a worksheet?

Creating a worksheet: The process of creating a worksheet involves organizing data, entering the data, editing, formatting, creating formulas and adding charts. Organizing data: It includes arranging the data in rows and columns and placing the graphs and images. Entering the data: To enter the text or numbers simply click the cell and enter the text. To activate the cell with the mouse, simply click the cell. If you want to see other areas of the worksheet, use the scroll bar. Editing the data: You can change an entry in a cell, you activate the cell and type the new entry, the old entry will be replaced. The Edit menu contains several options like copy, cut, and paste to edit the text or numbers. For deleting the data you select the data which you want to delete and press delete button. Formatting the data: Formatting is used to identify numbers as currency or percentages. You format the selected cell using the formatting tool bar. The formatting tool bar contains several options like font, font size, color etc. we can also apply the different types of borders for the selected cell. Creating formulas: A formula lets you to calculate a value based on the values of the cells. In Excel we find sum of numbers, average, and etc. we can directly enter the formula in formula bar. Adding charts: Charts makes you understand the data easier. Charts includes several types such as line, bar, pie chart, column chart, area chart and etc. before insert the chart we select the data range. Select chart option from insert menu.

6. Write about cell references in MS-Excel? Cell reference indicates how the cell address is referenced when it is used in the formula. In excel we find three different cell references. Those cell references are explained below: Relative reference: When a formula is copied from one part of the worksheet to the other, the address of the cell changes, relative to where it has been copied. This ability to adjust a formula from one location to another is called Relative Addressing. The formula is always adjusted relative to its location. Absolute reference: An absolute address points to only one address. It does not change even though the position of the cell containing the formula changes. That means whenever an absolute address is used, it instructs the spreadsheet program not to update the address if the formula is to be copied or moved. Mixed reference: In absolute reference both row and column are fixed. When either the row remains constant and the column changes or the column remains constant and the row changes, it is called a mixed addressing method. In other words, mixed mode referencing is a combination of relative and absolute address. 7. Explain the basic structure of MS-Excel spreadsheet. Basic structure of Spreadsheet: Spreadsheet is a software tool for entering, editing, calculating, manipulating and analyzing set of numbers. Spreadsheet basic structure includes: Menu bar: Menu bar contains several menus like file, edit, view, format and etc. Tool bar: Tool bar displays some of the menu options in the form of icons. Formula bar: it lets you enter the formulas and functions such as text, math and date functions. Name box: It display the reference of the current cell in terms of rows and columns. Scroll bars: there are two types of scroll bars. Horizontal and vertical scroll bars. Horizontal scroll bar is used to move the sheet from left to right. The vertical scroll bar is used to move the sheet from top to bottom. Sheet tab: display the name of the current work sheet. Row heading: indicates the rows and numbered as 1,2,3 Column heading: indicates the columns and labeled as A, B, C Cell: Intersection of row and column is cell. Status bar: Left part of the status bar indicates the mode of the cell such as ready mode or edit mode. Right part displays the status of keys such as caps lock on/off, num lock on/off etc.

39

8. Explain the formatting features in MS-Excel. Formatting Cells: Formatting the cells and data in Excel is facilitated by several options of formatting menu. Formatting cell has some options such as Number, Alignment, Font, Border, Patterns, Protection. Number: Number tab contains several options such as Number, Percentage, Currency and etc. formatting numbers is used to identify numbers as currency or percentages. When you format a number you can change its appearance not its numeric value. Alignment: Data in the cell can be aligned left, right, center. There are horizontal alignment and vertical alignments. Numbers can be stored right side of the cell and text can be stored in left side of the cell. Using the alignment we can change the alignment of the text and numbers. Font: Data can be formatted by changing its color, size, and font style. The font option contains several options such as Font, Font color, Font size, Underline and etc. before formatting the text we must select the cell. Border: Using the Border option we can change the border of the cell. There are some options border color and border style. Before using this options we must select the cell which you want to apply. Patterns: Using this option we can change the cell background color. First select the cell and select the background color. Protection: Protection determines the accessibility of the data in the cells. Cells can be locked or made hidden. Other Formatting options: Auto Formatting: Auto formatting option provides several ready made styles and selecting them formats the sheet or selected range accordingly. Conditional formatting: Based on the condition, cells can be formatted. For example cells which contain values less than 100 may appear in blue and other in red. 9. Explain different types of charts / graphs and Explain the process of creating the graph in MS-Excel. Graphs: Chart allows you to represent data graphically. In Ms-Excel you can easily create the charts. There are several types of charts. Line chart Bar chart Pie chart Column chart Area chart Surface chart Cylinder chart Bubble chart Pyramid chart

Creation of graphs: Creating graph is major facility provided to us by the Microsoft Excel. Excel provides number of charts Chart is graphical representation of the data Suppose we want to compare the result if three students having different marks. Before applying the graph you must select the data range. Suppose the position of the data is A1 to D4, select the range. Select the chart option from insert menu or select the chart option from standard tool bar. Select the area where you want to create the graph of the above given data Excel shows a chart wizard dialogue box that asks the user to put the range that is used for creating the graph. Now move to next step by clicking on the next button is chart wizard. In this step we select the chart type which can be Area, column, Line, bar and etc. By default column graph is highlighted. We can also select any other graph. Now click on the next button. We can write the chart title and write the text in X-axis and Y-axis Click on Finish button to end the procedure for making the graph. It will display the complete chart.

40

To change the chart type right click on the graph, it will display chart type option, select it. It will display chart wizard. From that select the chart and click on OK button.

10. Explain the components of the graphs in MS-Excel. Various Components of graph: A chart is made up of several independent objects that is a chart may have a title, legend, and various data series. To display the chart tool bar open the view menu and select the tool bar option it will display the cascading pop up menu. Form that you can select the chart option. Components: Chart type: if you want to change the chart type of the displaying chart at any time, then he has to first change the chart type by opening the chart tool bar. User can see the chart tool bar displaying on the worksheet area. Legends: When there is more then one data range in a chart, then MS-Excel set different chart ranges by different patterns and colors. These patterns and colors combination is called legends. by using the legend we can add particular pattern/color. It contains five options top, bottom, left, right, corner. By default MS-Excel shows the legend on the right side of the chart. if you want to set the legend left side select left option. Gridlines: User can set X, Y, Z axis according to the type of chart. Grid lines helps you to guess the actual value of the points plotted on the chart. To set gridlines on the chart, the simplest way is to click the gridlines button on the chart tool bar. MS-Excel display the gridlines on the chart. By clicking gridlines button on the chart tool bar we can remove the gridlines from graph. Axes: In chart we have three axes X, Y, and Z. we can set title for X, Y, Z axis on the chart. Before setting the title chart should be in edit mode. for this purpose double click the chart area. Here three- dimensional charts have Z axis. After selecting axis title and typing their names, click the OK button. Chart table: In chart tool bar there is one more option that is data table. This option is used to display the data in the form of table with chart. If you want to display the table along with the chart you select show data table option in data table tab. Chart text: the chart wizard automatically adds the text for things like chart and data labels. 12. Explain the various functions that are available in MS-Excel. Functions in Excel: FUNCTION DATE functions Date(year, month, day) Today() Now() Year(number) Month(Number) Day(number) TIME Functions Now() Time(Hour, Minute, Second) Hour(number) Minute(number) Second(Number) STATISTICAL Functions Average(n1, n2,) Count(n1, n2) Max(n1, n2,.) Min(n1, n2) Mode(n1, n2..) Stdev(n1, n2..) MATH Functions Fact(number) Mod(x,y) Sum(n1, n2.) Sqrt( number) Abs(number) MEANING It display the given date It display the system current date It display the system current date and time To print the year part of a date To print the month part of a date To print the day of a date It display the system current date and time It display the given time It display the hour part of a time It display the minute part of a time It display the second part of a time To print the average of set of numbers To print the count of set of numbers To print the maximum value of a given numbers To print the minimum value of given numbers To print the mode of set of numbers To print the standard deviation of set of numbers To print the factorial of a given number Prints the reminder when x is divided by y Prints the sum of given numbers Prints the sqrt of given number Prints the absolute value of a given number

41

STRING Functions Left(String, n) Right(String, n) Mid(String, p, n) Upper(string) Lower(string) Len(string)

Returns n left characters of a given string Returns n right characters of a given string Returns n mid characters of a given string from position p Convert the given string from lower to upper Convert the given string from upper to lower Prints the length of given string

STATISTICAL function with syntax: 1) Average: Returns the average of the arguments Syntax: Average (number1, number2) Here number1 and number2 are the numeric arguments

2) Max: Returns the largest value in a set of values


Syntax: MAX (number1, numer2)

3) Min : returns the smallest value in a set of values


Syntax: Min (number1, number2,)

4) Stdev : estimates standard deviation of a set of numbers


Syntax: Stdev (number1, number2.)

5) Count: To print the count of set of numbers


Syntax: Count (number1, number2) 6) Mode: to prints the mode of set of numbers Syntax: Mode (number1, number2.) 13. Explain about filtering and sorting in MS-Excel. Filtering: MS-Excel allows you to filter the data based on a customized condition. This filter option is available in Data menu. A filtered range displays only the rows that meet the criteria you specify for a column. Filtering temporarily hides rows you do not want displayed. When you use the AutoFilter command, AutoFilter arrows appear to the right of the column labels in the filtered range. You can apply filters to only one range on a worksheet at a time. 1. Click a cell in the range you want to filter. 2. On the Data menu, point to Filter, and then click AutoFilter. Click on Filter option from data menu to open a sub menu with the options: auto filter, show all, advanced filter. Choose auto filter to attach a list of options to the column headings. The options are all, top 10, custom and ascending and descending. User can click on any column heading and select any of the options as per the user requirement. It will display the selected record only and hides the remaining records. Sorting: Sorting is meant for placing the records either in ascending or descending order according to the specified column. Ascending means (0 to 9 or a to z) descending means (z to a or 9 to 0). In an ascending sort, Microsoft Excel uses the following order. (In a descending sort, this sort order is reversed except for blank cells, which are always placed last. Numbers are sorted from the smallest negative number to the largest positive number) Click on the sort option from data menu. It opens a dialog window with options such as sort by, type, ascending/descending. Select the column heading with which you would like to sort. Select ascending/descending as per the requirement. Click OK button. It will sort the records. 14. Explain the validation techniques in MS-Excel. Data Validation: To enter appropriate data in the cells of an excel sheet, MS-Excel provides data validation techniques.

42

For an example consider data for marks, assume the data for this column must be between 0 to 100, if you do not mention any data validation one can enter any kind of data that overrules the condition. To avoid this we use data validation. It allows you to ensure correct data entry. To choose the data validation we select data menu and select data validation option. It contains three different tabs. Settings: Setting allows the user to mention any data validation criteria such as range of numbers, text length, date and time options. If you want to enter the text you can choose text length. If you want to enter the numbers you can choose Whole number and type the minimum value and maximum value. Input message: This option lets you to write any user-friendly message that is prompted when cell is activated. When the user reaches the cell to enter the data it will display the Input message. In input message we can type title and message. Error Message: When user enters the invalid data in a cell after setting up data validation condition, error alert is raised. In this we can write title and message. And also we can choose style. It contains three options Stop, Information, Warning. Every option contains separate symbol. 15. Write about What if Analysis in MS-Excel. The what if analysis of a spreadsheet allows the user to know the result of calculation if one or more variable are changed. In MS-Excel we find Goal seek Scenarios Goal seeking: Goal seeking changes the value of a cell to make the result of a formula in another cell equal to a value you specify. Often we know the result of calculations, but we do not know the input data values required to reach the result. Goal seeding allows us to change the contents of one cell to get specified result. Scenarios: Spread sheets allow users to create and save sets of input values that produce different results as scenarios. Scenarios allow users to change more than one cell lot the effect on the resultant formula. The tool also gives the facility to create reports of different situations.

16. Write about creation of Pivot table and pivot chart reports in MS-Excel. Pivot table and pivot chart reports: A PivotTable report is an interactive table that quickly combines and compares large amounts of data. Use a PivotTable report when you want to analyze related totals, especially when you have a long list of figures to sum and you want to compare several facts about each figure. Steps: You can type the data and select the range of the data For example you can take some fields like course, group and 1yr, 2yr and 3yr fesses. Type any three records Select the range of the data Select pivot table and pivot chart report from data menu It will display pivot table and pivot chart report window From that window you select pivot table option Select next button It will display the range of the data Select next button Select new worksheet option Select finish button Drop the course field in drop row field here Drop the group in drop column field here Drop the fesses in drop data items here It will display the grand total of 1yr and 2yr and 3yr individually. And it will display the grand total of three years. To create a PivotTable report, you run the PivotTable and PivotChart Wizard. In the wizard, you select the source data you want from your worksheet list or external database. The wizard then provides you with a worksheet area for the report and a list of the available fields. As you drag the fields from the list window to the outlined areas, Microsoft Excel summarizes and calculates the report for you automatically.

43

Pivot chart: You can type the data and select the range of the data For example you can take some fields like course, group and 1yr, 2yr and 3yr fesses. Type any three records Select the range of the data Select pivot table and pivot chart report from data menu It will display pivot table and pivot chart report window From that window you select pivot chart option Select next button It will display the range of the data Select next button Select new worksheet option and select finish button

MS-ACCESS
1. Explain the process of creating a database. When you choose MS-Access It will display the Microsoft access window. MS-Access contains Title bar, menu bar, Standard bar and etc. First you choose new option from file menu It will display blank database on the Task pane You choose blank database It will display file new database window. From that window you select the location and give the file name and click on create button. The database will be created, now open the database. It allows us to create table, reports, queries and forms etc.

2. Write about the database window. (or) Explain the objects in the database window. The database window contains the objects such as tables, queries, forms, reports and macros. The window also includes 3 buttons with the labels new, open and design. Elements of Access: Table: Table is a collection of data in the form of rows and columns. Rows are referred as records and columns are referred as fields. All the data stored in the tables is interrelated. Queries: queries are requests or questions to access database in order to retrieve information. In access we can create different types of queries such as select queries, parameter queries, cross tab queries, action queries with wizards and in design view. Forms: Forms are onscreen arrangements that make the task very easy while entering the records into the database. Forms are used to view the data. We can add the graphics to them and specifying shading, colors, styles and etc. Reports: Reports are the paper copies of information that is obtained from database. We can create complex reports with the help of wizards, the reports can be stored in the disk. report is mainly for the purpose of printing needed information of a table. Macros: Macros are basically actions such as go to record, go to page, display a message and etc. using the macro we can delete the forms, reports and queries. Modules: modules are pieces of code, which get executed upon calling. These modules can be attached to any event such as buttons. 3. What are the important features of the MS-Access? MS-Access is database management software that allows the user to store, organize, find, sort, display and print the information of a database. Database is a collection of data stored together in standardized format and is sharable by multiple users. Features of Access: Stores the large amount of data Organizes the data as per the requirement of the user.

44

Creates tables, forms, queries, and reports Retrieve information based on the criteria you mention. Multiple tables can be prepared in single database. It can be used in accounting vouchers, forms and other reports. Allows the user to store, print, find the information of a database. We can also create macros

4. What are advantages of database approach? Advantages of database approach: Program data independence: In database approach application programs are separated from the data. So we can change the application programs with out changing the data. And changing the data without changing the application programs is also possible. Minimal data Redundancy: Unnecessary data can be reduced. There will be no duplication of records. In database approach, the data is stored by following normalization rules. With this the repetition of data is avoided. Improved Data sharing: A database can be designed as a shared resource. Authorized users are granted permission to use the database. Enforcement of standards: these standards will include procedures for accessing, updating, and protecting data. Focus on data: DBMS first define the data and then all queries, reports and programs to access the data through the database. Improved data Consistency: by eliminating data redundancy we can improve data consistency. Improved data accessibility: Without any programming experience one can retrieve the data very easily. 5. Explain different data types available in MS-Access. Data Type: After entering the name of the field you have to select a data type for that field. You can select any data type from the drop down list. To see drop down list click over the button present in the data type box.

Microsoft Access can have 10 types of data types. S.NO 1 2 3 4 5 6 7 8 9 10 Data Type Text Memo Number Date/Time Currency Auto Number Yes/No Ole Object Hyperlink Lookup Wizard Types of data stored Alphanumeric character Alphanumeric character Numerals/Numeric value Date and Time Currency data Automatic Number Logical value yes/no Objects, pictures, graphics, sound, video Three parts in hyperlink address Displays data from other table Size Required for storage 0-255 char 0-65535 char 1,2,3,4 or 8 bytes 8 bytes 8 bytes 4 bytes 1 byte Upto 1 giga byte All the three parts can have 32048 characters 4 bytes

6. What is relationship? Explain different types of relationships? Relationship is an association of one entity to another entity. We can create the relationship between one entity to another entity. An entity may be a person, place, event or a concept. They are three types of relationships. 1) One to One relationship 2) Many to Many relationship 3) Many to Many relationship One to One relationship: The relationship is used to assign the relationship between one entity to another entity. One to many relationship: The relationship is used to assigned the relationship between one entity to many entities. Many to Many Relationship: The association between many entities to other entities is called as many to many relationships.

45

7. Explain the process of creating relationships? Define a one-to-one or one-to-many relationship Close any tables you have open. You cant create or modify relationships between open tables. Click relationships button on the toolbar. If you havent yet defined any relationships in your database, the show table dialog box is automatically displayed. Double click the names of the tables you want to relate, and then close the show table dialog box. Drag the field that you want to relate from one table to the related field in the other table. To drag multiple fields, press the CTRL key, click each field, and then drag them. Save the relationships and return to the database window. The process is same for creating relationships among the tables. Deleting a relationship: Close any tables you have open. You cant delete relationships between opened tables. Press F11 to switch to the Database window. Click relationships on the toolbar. If the tables whose relationship you want to delete arent displayed, click show table on the toolbar and double click each table you want to dd. Then click close. Click the relationship line for the relationship you want to delete, and then press the DELETE key. 8. Explain the types of queries? Queries: We use queries to view, change, and analyze data in different ways. Queries are used to work on the table. By using Queries we can Apply Different types of operations on the tables. There are Six types of queries. They are 1. 2. 3. 4. 5. Select Queries Parameter Queries Cross table Queries Action Queries SQL Queries

1. Select Query: A select query is most common type of query. It retrieves data from one or more tables and
displays the results in a datasheet. This query is used to select the record among the given tables. 2. Action Queries: An action query is a query that makes changes to or moves many records in just one operation. There are four types of action queries: A. Update Query: This query is used to update the record with the selected table data. The data can be updated by using update query. B. Delete query: This query is used to delete the record form the table. C. Append query: This query is used to append the record from one table to another table. By using this query we can append the record from source table to target table. D. Make table Query: This query is used to prepare the table with the executed tables. 3. Cross table query: this query is used to perform some tasks on the selected table like sum, min, max, avg etc. 4. Parameter Query: A parameter query is a query that when run displays its own dialog box prompting you for information, such as criteria for retrieving records or a value you want to insert in a field. You can design the query to prompt you for more than one piece of information 5. SQL Query: An SQL query is a query you create by using an SQL statement. You can use Structured Query Language (SQL) to query, update, and manage relational databases such as Access. 10. Explain the process of creating Form? Forms: Forms are user friendly on screen arrangement that makes it easy to alter and view the data The main use of forms is to improve the interface for data entry. We can also add the graphics to the form We can also add shadings, colors and styles The most common type of control used to display and enter data is a text box. Create a From: Forms are a user friendly on screen arrangement that makes it easy to view the data.

46

Forms can be creates in many ways. 1. design view 2. form wizard 3. pivot table wizard 4. pivot chart wizard 5. Auto Form: columnar 6. Auto Form: Tabular 7. Auto Form Datasheet 1) Form wizard: Before creating a form create a form. Select form option and select new . It will display new form window from that select form wizard. Select the table name. Add the fields by pressing >> button. Click on next button. Select form layout. Click on next button and select form design and click on next button. Give the form name and click on finish button. 2) Auto form Columnar: It display the data in columnar format. Before creating a form create a table. Select form option and select new. It will display new form window from that select Auto form Columnar. Select the table and click on ok button. 3) Auto Form Tabular: It display the data in tabular format. Before creating a form create a table. Select form option and select new. It will display new form window from that select Auto form tabular. Select the table and click on ok button 4) Auto form datasheet: It display the data in datasheet view. Before creating a form create a table. Select form option and select new. It will display new form window from that select Auto form datasheet. Select the table and click on ok button. 5) Auto form: pivot table: Click on the pivot table wizard in form dialog window. It opens a pivot table wizard, where you can choose the fields. Fields can be placed as rows or columns. 6) Auto form pivot chart: It used to display the data in chart format. Click on pivot chart and choose table name. Click oh button. Drop the fields into the chart 11. Explain the process of creating report? Report: Report is mainly for the purpose of printing needed information of a table. It is basically a layout that arranges the records in printable form. A report is an effective way to present your data in a printed format. The information in a report can be divided into sections. Each section has a specific purpose. Creating a report: Report is mainly for the purpose of printing needed information of a table. Reports can be created in several ways. 1. Report wizard 2. Auto report: columnar 3. Auto report: tabular 4. Chart wizard 1. Report wizard: Before creating a report create a table. Select report option and select new. It will display new report window from that select report wizard. Select the table name. Add the fields by pressing >> button. Click on next button and add the reports in to the report. Click on next button. Select the report style and click on next. Give the report name and click on finish button. 2. Auto report columnar: It display the data in columnar format. Before creating a report create a table. Select form option and select new. It will display new report window from that select Auto report Columnar. Select the table and click on ok button. 3. Auto report tabular: It display the data in tabular format. Before creating a report create a table. Select form option and select new. It will display new report window from that select Auto report tabular. Select the table and click on ok button. 4. Chart wizard: Before creating a report create a table. Select form option and select new. It will display new report window from that select chart wizard. Select the table name. Add the field names using >> button. Click on next button. Select the chart type and click on next button. Click on next button. Give the chart name and click on finish button. Components of report: Report Header: The report header contains a label with the report title and other controls Page Header: Page header contains information that will repeat on every page like column headings Detail Section: The detail section contains labels and field controls that specify which data will be printed Page Footer: Page footer contains text and expression that should be printed on each page Report Footer: The report footer contains items that appears only at the end of the report. 13. Explain the process of creating tables? Creating a table:

47

Table is a collection of data in the form of rows and columns. Rows are referred as records and columns are referred as fields. The table can be created in different ways. 1. data sheet view 2. design view 3. table wizard 4. link table 5. import table Data sheet view: It allows creating a table in data sheet view. That is similar to excel sheet. In data sheet view we can directly rename the field names, which are initially field1, field2 by default. Data can be directly entered into the fields. Manipulation in table in datasheet view: To insert a new field To delete a field To rename field To move a field Insert a field in a table in datasheet view: A new field can be added in the table in following way Right click that field name which will come after the newly inserted field Select insert | column option. A new field will be inserted. Deleting a field in a table in datasheet view: Deleting a field in a table in datasheet view is very simple Right click at the field which is to be deleted. Select delete column option Click yes button from the warning box to delete the field and all its contents from the table. Renaming a field in datasheet view: Right click the field name which you want to rename. Select rename column option from the shortcut menu Replace the previous name by new name by typing it. Moving a field in the table in datasheet view Click the field name of the field which is to be moved Drag that field name to the new or desired location Release the mouse button at new location. The field will change its place. Design view: In design view you need to enter the field names directly. You can also setup data type directly. After completion of field names you save the table and give a name for the table. Add primary key if require. To open the table we select the table name and choose open button. Data Type: After entering the name of the field you have to select a data type for that field. You can select any data type from the drop down list. To see drop down list click over the button present in the data type box. Microsoft Access can have 10 types of data types. S.NO 1 2 3 4 5 6 7 Data Type Text Memo Number Date/Time Currency Auto Number Yes/No Types of data stored Alphanumeric character Alphanumeric character Numerals/Numeric value Date and Time Currency data Automatic Number Logical value yes/no Size Required for storage 0-255 char 0-65535 char 1,2,3,4 or 8 bytes 8 bytes 8 bytes 4 bytes 1 byte

48

8 9 10

Ole Object Hyperlink Lookup Wizard

Objects, pictures, graphics, sound, video Three parts in hyperlink address Displays data from other table

Upto 1 giga byte All the three parts can have 32048 characters 4 bytes

Table wizard: Open the table wizard. Select either business or professional Click on table of interest to view sample fields in the sample fields list. To add the fields from the sample field list to your new table you can either double click on a field name or click on > . to add all fields to your table click on >> button. To remove fields from table you select the field and click on <. After completion click on next button. Enter the table name. If you want to set a primary key select set a primary key for me option. Click on next button. Click on next button Click on finish Now we can directly enter the values into the table.

Link table: Import table: Import table wizard is to import tables from external databases. Choose the database name and table name you would like to import. Primary Key: Primary key is used to identify the records uniquely. We can create primary key for a particular field. Primary keys can also be created for more than one field. Three ways for setting a primary key for a field. Method 1: Select the filed for which primary key is to be set and click over primary key button present on the table design tool bar Method 2: Select the field for which primary key is to be set. Now Select Edit | Primary key Method 3: Right click the mouse on the field selection cell. A short cut (pop up) menu appears on the screen. Click primary key option from it. After selecting primary key, a key will be visible. This wizard creates a table in the current database that is linked to tables in the external file. When you select this option it asks for an existing database file. Enter the database name in the dialog window. Select the tables you want to link. The linked table appeared on the current database.

SHORT ANSWER QUESTIONS


Data: Data: Data is a collection of facts and figures. It may include alphabets, numbers, alpha numerals and special
characters. Data is a word which is derived from DATUM, which means collection of something.

Information: Processed data is called as Information. Information increases the knowledge of user who uses the data. For eg:
if list of marks of a class are given it will be data and when we process the data we get the information such as total marks, average and grade etc.

Database: Database is a collection of data stored together in standardized format and is sharable by multiple users. DBMS: Database management software that allows the user to store, organize, find, sort, display and print the information of a database. File: A file is a collection of records identified by a name. Record: It is a collection of fields. It is a row in a file. The fields are inter related.

49

Inputmask: The input mask is a property to make data entry easier and to control the values users can enter in a text box control (the wizard will only work for Text or Date field type). Relationship: The relationship is meaningful association between entities. Entity may a person, place, event or a concept. Dynaset: A dynaset is new table that is create temporarily base on the table we chosen to work within our query. This Dynaset may not represent all the information that exist in a table there may thousand of records in a database but based on the question we ask it can only pull a few dozens. This dynaset is one that is updated automatically because it not saved. Every time a query is executed or called on this dynaset is created based on our table. Field Size: We can use the Field Size property to set the maximum size for data stored in a field set to the Text, Number or Auto Number data type.

UNIT IV C Language Fundamentals:


1. Write the advantages of C programming languages? (or) 2. Write about the importance of C languages? Features of C language: 1) Structured programming Language : C is called as structured programming language as it has some rules and regulations and conditions to write the programs. User must follow the structure to build the programs or applications in 'C' language. 2) General purpose programming language: There are mainly two types of programming languages are there based on the purpose. They are special purpose programming language and general purpose programming language. 'C' is called as general purpose programming language. Because by using 'C' language we can build any type of application. 3) Acts as Middle level language: 'C' is called as middle level language as it combines both the advantages of high level and low level language. It is very easy to understand to the user, at the same time it directly coordinates with the hardware. 4) Case sensitive language : 'C' is called as case sensitive language. It recognizes upper case letters and lower case letters separately. It accepts only the lower case letters. 5) Modularity: Instead of writing a 'C' program sequentially we can split it into number of modules. It is one of the most important feature of C' language. Modularity improves understandability. By using modularity we can reduce the length of the program. 6) Portability: we can use the 'C' software with many operating systems. Hence it is portable to other system even if operating system differs 7) Simple yet powerful language: 'C' language is a very simple language. It has only 32 key words to build the applications and the 'C' language is very powerful language. By using 'C' language we can design the system software & it is best used for data structures. By using 'C' language we can also build math oriented applications; scientific applications, business oriented applications & graphics. So it is very powerful language. 2. Write the process of creating, compiling and running a C program? The steps involved in building a 'C' program are: 1. First program is created by using any text editor and the file is stored with extention as .c. We call this file as source file. 2. Next the program is compiled. There are many compilers available like Sun compiler, Borland compiler. In Turbo C environment we press Alt+F9 for compilation. 3. At this stage errors like typing mistake, mistake in key words, syntax usage errors will be detected and will displayed by the compiler. The programmer should correct the errors. But a programmer must note that compiler can not detect logical errors. 4. After this process the compiled code will be stored in an object file. 5. Press Ctrl+F9 to link object code with system library and to execute the program by creating an executable file. 6. Give the required input on console screen and press enter key. To view the results of the program press Alt+F5. 3 . Explain the basic structure of a C program?

50

Structure of the C program: 'C' programs structure is divided into no. of sections. 'C' program can be written in the form of functions. A function is a reusable block of statements which is designed to perform a specific task.

'C' programs sections are:


Documentation Section Linkage Section Definition Section Global Declaration Section main Function Section { Declaration Part Executable Part } Sub Programs Section { Declaration Part Executable Part } The documentation section consists of a set of comment lines. User can write these comments any where in the program. The linkage section provides instructions to the compiler to link the functions from the system library. The definition section defines the definitions of the functions. Global declaration section consists of global variables that are used in more than one function. Every 'C' program must have one main() function section. This section contains two parts declaration part and executable part. Declaration part declares all variables used in the executable part. There are at least one statement in the executable part. These two parts must appear between the opening and closing braces. The program execution begins at the opening brace and ends at the closing brace. The closing brace of the main() function section is the logical end of the program. All statements in the declaration and executable parts end with a semicolon. The sub program section contains all the user defined functions that are called in the main () function. All sections except the main function section may be absent when they are not required. Example: #include <stdio.h> /* preprocessor statement */ int x=30; /* Global declaration */ void F1(); /* Function Declaration */ main() { printf(\n%d,x); F1(); /* Call of Function */ } void F1() { int y=40; /* Local declaration */ printf(\n%d,x); printf(\n%d,y); } 3 . Explain the token of a 'C' program? C Tokens C tokens include identifiers, keywords, variables, constants, special characters and operators.
C Tokens

Identifiers

Keywords

Variables

Constants

51

Characters

Operators

Identifiers: The names of variables, functions, labels and various other user-defined items are called as identifiers. An identifier can include the following characters. Alphabets : a..z, A..Z Numerals: 0..9 Underscore: _ ..To give an identifier name we must follow the following rules i) The length of an identifier can vary from one to several characters. ii) It starts with a letter or an underscore. iii) It cant include the spaces. iv) Upper case and lower case letters are treated separately.(distinct) Ex: int abc; int sum( ); void vikas_college( ); Key words: Key words are defined by C compiler, and each key word has a different meaning. These are reserved words and cannot be used as names of an identifier. . C has 32 key words. Ex: auto, for, switch, int etc Variables: Variable is a named location in the memory and that is used to hold a value or a constant. These are defined by user and used in programming. It is composed of letters of the alphabet, digits and an underscore. Values of the variables can be changed. Ex: float x; where x is a variable. Constants: Constant never changes its value. There are two types of constants.they are: Primary constants and Secondary constants. Primary Constants: In primary constants there are various types of constants o Integer constants: An integer type of variables can hold integer constants. Ex: int a=10 o Float constants: A float variable can hold float constants Ex: float x=2.5 (decimal pointers) o Char constants: A character variable char can hold only one character. Character constant must be enclosed in single quotations. Ex: char ch= a o String constants: A set of characters are called as string. Strings must be enclosed in double quotations. Ex: char x[ ]= vikas o Boolean constants: Boolean constants may be any one state of two states. For example true or false (or) yes or no (or) one or zero. The Boolean constant may be any data type. Ex: char ch =y Secondary Constants Secondary constants include arrays, pointers, structures, unions and enumeration. Operators: In C, operators are of several types such as arithmetic operators +,-,*,/, % etc Special characters : In 'C' program we use different special symbols such C #,$,%,^,& etc. as Data Types 4 . Explain the datatypes available in C? Datatypes: The Data type explains which type of data the variable can accept.in 'C' , each variable is attached with some datatype. The Data type defines the amount of storage allocated to variables and the operations that can be System Defined DataTypes Derived DataTypes performed on them. Every variable, which is used in the program, User Defined must be declared as what data-type it is. For every data type C compiler defines and allocates required number of bytes. Different data types in C
Integer Type Char Type Structures Arrays

Integer

Single Char

52

Unions

Pointers

Float

String

Enumeration

Primitive data types are mainly of four types. 1. int (unsigned int, long int, long unsigned int) 2. char (signed char, unsigned char) 3. float (float, double, long double) 4. void (empty data type). Primitive data types: Data type

Char Int unsigned int long int Long unsigned Float Double long double Sting char[n] Void

Descrption Single character Integer Unsigned integers Long integers Long unsigned integer Floating point values Double values Long double values Character set No data type

Size(Bytes) 1 2 2 4 4 4 8 10 n bytes 0

Range 0 to 255 -32768 to 32767 0 to 65535 -2,147,483,648 to 2,147,483,648 0 to 4,294, 967,295 -3.4 e 38 to +3.4 e 38 (7 digits of precision) -1.7e308 to +1.7e308 -1.7e4932 to +1.7e4932

Consider the following example. It shows which values are accepted int x; x can take only integer values x= 30; is OK x=3.4; is Not OK, cannot accept float values x=35000; fails, x cannot take values greater than 32767 long int x; x=35000; is OK The range is now extended. Here, it accepts the value though it is greater than 32767 Void : It is known as empty datatype. It can be used in two ways. 1) When specified as a function return type. Void means that the function doesnt return any value. 2) The void is also used as argument for function. When found in a function heading, void means that the function doesnt take any arguments. 5. Explain about format specifiers that are available in C? Format specifiers: The special symbols are allotted by C compiler to the different data types called Format specifiers or Conversion Characters. The format specifiers are used to provide the format for the value to be printed. It has a prefix % and followed by a specifier. These are used in some of the input and output statements such as printf and scanf. Data type Int Conversion character %d,%i Meaning Prints Integer

53

Float Char Double Unsigned int long unsigned Long String

%f %c %f %u %lu %ld %s %% %o %x

Prints Float Prints Character Prints Float or double Prints unsigned integer Long unsigned Long decimal Prints String Prints % Prints Octal Value Prints Hexadecimal Value

Example: main() { char a; int b; float c; char s[20]; clrscr(); printf(enter a char, an integer value, a float value and a string); scanf(%c%d%f%s,&a,&b,&c,&s); printf(\nthe character = %c,a); printf(\n the integer = %d,b); printf(\n the float value = %f,c); printf(\n the string is =%s,s); } The above program demonstrates datatypes and format specifiers. 5. Explain about Escape sequences that are available in C? Escape sequences. Escape sequences are used in input and output functions such as printf and scanf. These are used to escape the usual meaning of the character that follow it. Escape character has \ and a following character. The meaning of escape sequences depend upon the characters that follow \. Used in input statement it escapes the specified characters while reading. It is useful for printing some non printing characters. Some of the escape characters are shown below: Sequence \a \b \f \n \r \t \v \ \ \\ \? \0 Example: main() { printf(\nHello\tHow are you\?); printf(\nLet\s go through the \'C'\ world); printf(\n\tluck\r Good); } The above program uses some of the escape sequences shown in the table. The output of the above program is: Hello How are you? Meaning Alert Backspace Form feed New line Carriage Return Horizontal Tab Vertical Tab Single Quote Double Quote Backslash Question Mark Null

54

Lets go through the C world Good luck 6. Explain the input and output statements available in C? Input and Output functions (statements) in C. There mainly two types of input and output functions are available in 'C' language. They are i) Console I/O Functions ii) File I/O Functions Console I/O Functions: The screen and key board together are called as console. These functions are used to receive the input from key board and print the output to the screen. These are classified into two categories. a) Formatted console I/O Functions b) Unformatted console I/O Functions Formatted console I/O Functions: printf( ) and scanf( ) are called as Formatted console I/O Functions. printf ( ) is used to print the output to the screen. The general form of the printf( ) is, printf( format string,list of variables); The format string contains: i) Characters that are simply printed as they are. ii) Conversion specifications that are begin with % sign. iii) Escape sequences that are begin with \ sign. scanf ( ) is used to read the input from the keyboard. The general form of the scanf( ) is, scanf( format string,list of address of variables); The format string contains: i) Conversion specifications that are begin with % sign. ii) Escape sequences that are begin with \ sign. Example: #include<stdio.h> main( ) { int a,b; clrscr(); printf(enter two integers); scanf(%d%d,&a,&b); printf(\,the addition a and b is =%d,a+b); } Unformatted console I/O Functions Input output getch ( ) putch ( ) getche ( ) getchar( ) putchar ( ) getc ( ) putc( ) gets ( ) puts( ) getch( ) reads a character from keyboard and doesnt display the character. getche( ) reads a character from keyboard and displays the typed character. getchar( ) reads a character from keyboard and displays the typed character. putch( ) prints a character on the screen. getc( ) reads a character from keyboard and displays the typed character. putc( ) prints a character on the screen. gets( ) reads a string from keyboard and displays the typed string. puts( ) prints a string on the screen. File I/O Functions These functions are used to perform the input and the output operations on a hard disk. fgetc() This functions is used to read a character from a file. General usage of this function is, fgetc(FILE *fp) where fp is a file pointer variable fputc( ) This functions is used to print a character to a file. General usage of this function is, fputc(int c,FILE *fp) where fp is a file pointer variable and c is a integer type variable fgets( ) This functions is used to read a string from a file. General usage of this function is,

Output: enter two integers 2 3 the addition of a and b is = 5

55

fgets(char *s, FILE *fp) where fp is a file pointer variable and s is a character type pointer. fputs( ) This functions is used to print a string to a file. General usage of this function is, fputs(const char *s, FILE *fp) where fp is a file pointer variable and s is a character type pointer. fscanf( ) This function is used to read the formatted input from the file. The general form of the fscanf( ) is, fscanf( fp,format string,list of address of variables); fprintf( ) This function is used to print the formatted output to the file. The general form of this function is, fprintf(fp, format string,list of variables); fwrite This function is used to write the records to the file. The general usage of this function is fwrite(const void *ptr, size_t size, size_t n, FILE *fp); the first argument is the address of the structure the second argument is the sizeof the structure in bytes the third argument is the number of records we want to write at one time the fourth argument is a file pointer Eg: fwrite(&e, sizeof(e),1,fp); where e is a structure variable fread This function is used to read the records from the file.The general usage of this function is, fread(void *ptr, size_t size, size_t n, FILE *fp); the first argument is the address of the structure the second argument is the sizeof the structure in bytes the third argument is the number of records we want to write at one time the fourth argument is a file pointer Eg: fread(&e, sizeof(e),1,fp); where e is a structure variable 7. What are operators in C language? The operators in C. C supports many kinds of operators. Operators can be applied on variables or constants. Classification of operators can be done in two ways based on the following. Number of operands involved: Unary operators: Unary operators can be applied on only one operator Ex: ++, --, - (unary minus), sizeof, compliment Binary operators: Binary operators can be applied on two operands Ex: +, * Ternary operator: Ternary operator can be applied on three operands Ex: ternary conditional operator ( ? : ) 2. Their nature: Type Arithmetic operators Operators + * / % > >= < <= == != && || ! =, +=, -=, *=, /=, %= a++ ++a a---a & | ^ << Meaning Addition Substation Multiplication Division Modulus Greater than Greater than or equal to Less than Less than or equal to Equal to Not equal to AND OR NOT Assignment Post increment Pre increment Post decrement Pre decrement Bitwise AND Bitwise OR Bitwise XOR Left shift

Relational operators

Logical operators Assignment operators Increment and Decrement Operators Bit wise operators

56

Ternary operator or Conditional operator Other operators

>> ~ ?: , Sizeof

Right shift Ones Complement Ternary conditional Unary minus Comma Size of operator

Arithmetic operators + - Addition - - Subtraction * - Multipliation / - Division % - Modulus #include<stdio.h> #include<conio.h> main() { int a,b; clrscr(); printf("Enter a,b values:\n"); scanf("%d%d",&a,&b); printf("\nAddition is %d,a+b); printf("\nSubtraction is %d,a-b); printf("\nMultiplication is %d,a*b); printf("\nDivision is %d,a/b); printf("\nModulus is %d,a%b); getch(); } Relational operators > >= < <= == != - Greater than - Greater than or equal to - Less than - Less than or equal to - Equal to - Not equal to

Program to find the biggest of two numbers #include<stdio.h> #include<conio.h> main() { int a,b; clrscr(); printf("Enter two values \n"); scanf("%d%d",&a,&b); if(a>b) printf("A is big"); if(b>a) printf("B is big"); } Logical Operators AND - && OR - || NOT - ! Program to find the biggest of three numbers #include<stdio.h> #include<conio.h> main() {

57

int a,b,c; clrscr(); printf("Enter a,b,c:\n"); scanf("%d%d%d",&a,&b,&c); if(a>b && a>c) printf("A is big"); if(b>a && b>c) printf("B is big"); if(c>a && c>a) printf("C is big"); } Truth Table: A T F T F

B T T F F

A&&B T F F F

A||B T T F

not operator: #include<stdio.h> main() { int n; clrscr(); printf(enter a value); scanf(%d,&n); if(n) printf(It is true); if(!n) printf(It is false); }

Assignment operators Operator Expression += a+=5 -= a-=5 *= a*=5 /= a/=5 %= a%=5 #include<stdio.h> main( ) { int a=5; clrscr(); a*=15; printf(%d,a); } The output will be 75 #include<stdio.h> main( ) { int a=10; clrscr(); a+=10; printf(\n a = %d,a); a-=5; printf(\n a = %d,a); Meaning a=a+5 a=a-5 a=a*5 a=a/5 a=a%5

58

a*=2; printf(\n a = %d,a); a/=6; printf(\n a = %d,a); a%=2; printf(\n a = %d,a); } The output will be, a=20 a=15 a=30 a=5 a=1 Increment and decrement operators. The ++ is called as Increment Operator The - - is called as decrement operator. These are unary operators, means we are using these operators on only one operand. Increment Operator (++): Increment operator (++) increases the value by 1. Increment operator is used in two ways : Pre increment operator and Post increment operator. Pre increment: If we are using as pre increment operator, first the value will be incremented then the statement gets executed Consider the example #include<stdio.h> main() { int a=5; printf(\n%d,++a); printf(\n%d,a); }

//prints 6 //prints 6

Post increment: If we are using as post increment operator, first the statement gets executed then the value will be incremented. Consider the example #include<stdio.h> main() { int a=5; printf(\n%d,a++); printf(\n%d,a); }

//prints 5 //prints 6

Decrement Operator (--): decrement operator (--) decreases the value by 1. Decrement operator is used in two ways : Pre decrement operator and Post decrement operator. Pre decrement: If we are using as pre decrement operator, first the value will be decremented then the statement gets executed Consider the example #include<stdio.h> main() { int a=5; printf(\n%d,--a); printf(\n%d,a);

//prints 4 //prints 4

59

} Post decrement: If we are using as post decrement operator, first the statement gets executed then the value will be decremented. Consider the example #include<stdio.h> main() { int a=5; printf(\n%d,a--); //prints 5 printf(\n%d,a); //prints 4 } Bit wise operators Bitwise operator s are used to perform its operation on bits. When Bitwise operator used on operands, they convert the numbers into binary system and then apply bit wise operators. Bit wise operators in C are: Bitwise AND ( & ) Bitwise OR ( | ) Bitwise XOR ( ^ ) [Exclusive or] Left shift operator ( << ) Right shift operator ( >> ) Ones Complement operator (~ [Tilde]) Bitwise AND ( & ): If we are using the bitwise AND operator ,if the two bits are 1, then the result is 1, otherwise the result is 0. Ex: X= 1101 = 13 Y= 1110 = 14 X&Y= 1100 = 12 #include<stdio.h> main() { int a,b,c; clrscr(); printf(enter two values); scanf(%d%d,&a,&b); c=a&b; printf(\n a value is %d,c); } Bitwise OR ( | ): If we are using the bitwise OR operator , if at least one of the bit is 1 then the result is 1, otherwise the result is 0. Ex: X= 1101 = 13 Y= 1110 = 14 X|Y= 1111 = 15 #include<stdio.h> main() { int a,b,c; clrscr(); printf(enter two values); scanf(%d%d,&a,&b); c=a|b; printf(\n a value is %d,c); } Bitwise XOR ( ^ ): If we are using the bitwise XOR operator , if only one of the bit is 1, then the result is 1, otherwise the result is 0. Ex: X= 1101 Y= 1110 X^Y= 0011 #include<stdio.h>

60

main() { int a,b,c; clrscr(); printf(enter two values); scanf(%d%d,&a,&b); c=a^b; printf(\n a value is %d,c); } Left shift ( << ): It is a unary operator. When we are using left shift operator, it shifts n bits left Ex: X= 0000 0000 1011 1101 = 189 X<<3= 0000 0101 1110 1000 = 1512 #include<stdio.h> main() { int a; clrscr(); printf(enter a value); scanf(%d,&a); a=a<<3; printf(\n a value is %d,a); } Right shift ( >> ): It is a unary operator. When we are using right shift operator, it shifts n bits right Ex: X= 0000 0000 1011 1101 = 189 X>>3= 0000 0000 0001 0111 = 23 #include<stdio.h> main() { int a; clrscr(); printf(enter a value); scanf(%d,&a); a=a>>3; printf(\n a value is %d,a); } Complement ( ~): When we are using ones compliment operator, It inverts all the bits. It is a unary operator. Complement of 1 is 0 and complement of 0 is 1. Ex: X = 0000 0000 0000 1011 ~X = 1111 1111 1111 0100 #include<stdio.h> main() { unsigned int a; clrscr(); printf(enter a value); scanf(%d,&a); a=~a; printf(\n a value is %d,a); } if a=48537, the ~a=16998 # include<stdlib.h> main() { unsigned int n=11; char s[25]; clrscr();

61

itoa(n,s,2); printf(integer=%d\t string=%s,n,s); n=~n; itoa(n,s,2); printf(integer=%d\t string=%s,n,s); } Truth Table: A 0 1 0 1 B 0 0 1 1 A&B 0 0 0 1 A|B 0 1 1 1 A^B 0 1 1 0

Conditional (Ternary) operator? In the Conditional operator the three statements are combined into a single statement. These three statements are separated by ? and : In the three statements, the first one is condition, if the condition is true, the ? part statement gets executed. If the condition is false the : part statement gets executed. It is called as ternary operator because it is used on three operands. The general syntax of the ternary operator is shown below

true (Condition)? Statement1: Statement 2 false


Program to find the given number is positive or negative using ternary operator #include<stdio.h> main() { int x; printf( Enter value of x:); scanf(%d,&x); (x>0)?printf(It is positive):printf(It is negative); } Comma operator Comma operator (,) is used to write multiple C statements in a single line. Generally every statement must be terminated by a semicolon but with this, multiple statements can be clubbed by separating them by commas. Consider the following example: main() { int x,y,res; res= (x=30, y=40, x+y); printf(%d,res); } Explanation: In the above example the value of the res will be 70. Initially 30 is assigned to x ,then 40 is assigned to y and then the sum i.e x+y moves into res. Hence the output would be 70. Unary minus operator: The minus operator can also be used as unary operator. With this operator the operand multiplies by -1, When we using this minus as unary, the sign of the value will be changes as minus to plus and plus to minus. Eg: main()

62

{ int x=30; x=-x; printf(the value of x is %d,x); } Here the output is printed as the value of x is -30 sizeof operator C provides a unary operator named size of to find number of bytes needed to store an object. The sizeof operator returns the number of bytes the operand occupies. The operand may be a variable or a constant. Example: main() { printf(%d,sizeof(int)); /* prints 2 */ printf(\n%d,sizeof(char)); /* prints 1 */ printf(\n%d,sizeof(float)); /* prints 4 */ } 8) Explain about operator precedence in C? Operator precedence. Operators have rules of precedence and associatively that are used to determine how expressions are evaluated. These rules are exceptional when expressions are put in parentheses. Expressions in parentheses are evaluated first. Parenthesis are said to be at the highest level of precedence. In the case of nested or embedded parenthesis the operators in the innermost pair of parenthesis are applied first. Exponentiation is applied next. If an expression contains several exponention operations, operators are applied from left to right. Unary operators are applied next. If an expression contains several unary operations, operators are applied from right to left. Multiplication and division are performed next. Modulus operators are applied next. If an expression contains several modulus arithmetic operations, operators are applied from left to right. Addition and subtraction operations are applied last. If an expression contains several addition and subtraction operations, operators are applied from left to right. Addition and subtraction also have the same level of precedence. Last priority is given to assignment operators. Only unary operators and assignment operators are done right to left. For eg: x=y=z means x=(y=z) The operator and precedence of some operators is shown in the table below. Operator precedence Associativity () ++ (postfix) -- (postfix) Left to Right Right to Left Left to Right Left to Right Right to Left

+ (unary) - (unary) ++ (prefix) - (prefix) * / + % -

= += -= *= /= %= Example: RES = A * B ^ C + D / E F

The numbers show the order in which the calculations are being done. 9). Explain about control structures (statements) in C? Control structure in C

63

Normally statements in a C program are executed sequentially i.e. in the order in which they are written. This is called sequential execution. Transferring control to a desired location in a program is possible through Control structure. C allows many kinds of control structures, which include: 1. Conditional control structure: a) if b) if else c) if else if d) nested if 2. Iterative control structure: a) while loop b) do while loop c) for while loop 3. Jumping control structure: a) goto b) break c) continue d) return 4. Multi-way conditional control structure: a) switch- case 1. Conditional control structure: a) if :

Condition False

True

Statements

If Structure

Syntax: if (condition) { statements }

Explanation: If structure is also called as conditional statement. In If, statements get executed only when the condition is true. It omits the condition based statements when the condition is false. Braces are not necessary if only one statement is related to the condition. b) if else:

False Statements

Condition

True Statements

If Else Structure

Syntax: if (condition) { Statements } else

64

{ Statements } Explanation: Statements in if block get executed only when the condition is true and statements in else block get executed only when the condition is false. c) if else if:

Condition1 False Condition2 False

True Statements True Statements

Statements

If Else If Structure

Syntax: if (condition1) { Statements } else if (condition2) { Statements } . . else { statements }

Explanation: Statements get executed in loops only when the corresponding conditions are true. Statements in the final else block get executed when all other conditions are false. The control checks a condition only when all the afore-mentioned conditions are false. d) Nested if

Condition1

False

True Nested If Structure


Condition2

Statements

true

Statements

65

Syntax: if (condition1) { if ( condition2) { Statements } } Explanation: Writing if in another if is nested if. Inner if is processed only when outer ifs condition is true. Hence, statements in inner if get executed only when condition1 and condition2 are true. 2. Iterative control structure: a) while loop:

Condition False

True

Statements

Whileloop

syntax: while ( condition ) { Statements } Explanation: Statements get executed as long as the condition is true. It checks the condition first and executes the statements later. Example: i=0; while( i<10 ) { printf (hello); i=i+1; } /* prints hello 10 times */ do while loop:

Statements

True Condition False

Do While

Syntax: do { Statements } while(condition); Explanation:

66

Statements get executed as long as the condition is true. It is similar to while but, it executes the statements first and checks the condition later. It ensures one time execution. Nested loop b) Loop is a control structure that gets executed as long as the condition is true. Loop structures include while, do-while and for loops. If a loop is combined in another loop, it is said to be a nested loop. In a nested loop, the inner loop gets executed for every iteration of the outer loop. for loop:

Counter Initialization

Condition False

True

Statements

Step

For loop

syntax: for ( Initialization ; condition; increment / decrement) { Statements; } explanation: for is also an iterative control structure. In for loop Statements get executed as long as the condition is true. Generally first expression includes initializing statements and last expression includes statements that use increment, decrement, and assignment operators. 3. Jumping Control structure: a) goto

Jumping forward jumping backward Jumping back


label:

goto label;

label:

Syntax: b) Jumping back: a) Jumping forward: Statement 1 Statement 1 label: goto label; Statement 2 Statement 2 goto label; label: Statement 3 Statement 3 Explanation: Goto is a kind of branching structure. It moves the control (moves forward or back) to a label. Generally, Goto is condition dependent. In the example (jumping forward) shown above, Statement2 gets omitted because after statement 1 gets executed goto moves the control to the labeled statement i.e. statement 3 In the second example (jumping back) shown above, After statement 1 gets executed statement 2 gets executed for infinite times, because goto moves the control to statement 2 repeatedly. Example: a) Jumping forward x=-x; main( ABC: { printf(absolute value=%d,x); int x=-3; } clrscr(); b) Jumping back if (x>0) main() goto ABC; {

goto label;

67

int i=0; clrscr(); ABC: printf(hello); b) Break:

i++; if (i<10) goto ABC }

Loop Break;

Explanation: Break quits the corresponding iterative loop. Break is valid only in iterative loops and switch loop. Break is used to bring the control out of iterative loops intermediately. Example: Program to find whether the numeber 5 is in given no. or not for ( i=1 ; i<=10; i++) { printf (hello); if (i==5) break; } /* prints hello 5 times */ c) Continue:

Explanation: continue moves the control the first statement in the corresponding iterative loop. continue is valid only in iterative loops. It omits the statements written after continue and restarts the iterative loop. Example: i=0; while (1) { printf (hello); if (i<5) continue; break; } /* prints hello 5 times */ d) Return: Explanation: return is used in functions. It moves the control to calling function from the called module. "return is also used to return values to the point where it is called. But it is possible to return only one value at a time. Example:

68

int sum(int x, int y) { return x+y; } main() { int k; k= sum(30,40); printf(%d,k); } Here sum function returns 70 into the variable k. 4. Multi-way conditional control structure: a) Switch:

Syntax: switch(variable) { case constant1: statement1 break; case constant2: statement2 break; . . default: statements break; } Explanation: switch is similar to if else if. Statement 1 gets executed when the variable is equal to constant1 and so on. Control comes to default portion when all the cases (constants), which have been mentioned do not match with the value of the variable. Here break and default are optional. When there is no break for a case it continues till it encounters break or the end of the switch loop. 10). Write the differences between while and do while loops in C? Differences between while and Do-While. While loop: While loop gets executed as long as the condition is true Condition is evaluated first and then statements. While loop is called entry control structure. Minimum number of execution in this case is zero In this loop the while keyword followed by test condition is not terminated with semi colon. syntax: while ( condition ) { Statements }

69

Do while loop: Do-While loop gets executed as long as the condition is true Statements get executed first and then Condition. Do while loop is called as exit control structure. Minimum number of execution in this case is one In this loop the while keyword followed by test condition is terminated with semi colon. Syntax: do { Statements }while(condition); 11). What is nested loop? Explain with examples. Using a loop within another loop is called nested loop. In general use nested for loops. The nested loops are generally used to construct matrix like data. The outer loop counts the rows and inner loop counts columns. Nested for loop: Generally to print a double dimensional array we use nested for loop. int a[3][3]={ {1,2,3}, {4,5,6}, {7,8,9}}; for(i=0;i<3;i++) { printf(\n); for(j=0;j<3;j++) { printf(\t%d,a[i][j]); } } In the above program, j takes values from 0 to 2 for each iteration of the outer loop i.e. for each value of i. 12) What are functions. What are the advantages of functions?

Modularity is one of the important feature of C language. 'C' allows a large program to be broken into number of smaller, self contained components called as modules or functions. A function is a reusable, self contained block of statements that gets executed on calling that carries out some specific, well defined task. It can be treated as a sub program. 'C' supports two types of functions. 1) Library functions 2) User defined functions Library functions: Library functions can be used in any program by including respective header files. The header files must be included using #include preprocessor directive. The user can also define and use their own functions for performing some specific tasks. Such functions are called as user defined functions. The advantages of functions are: Functions supports modular programming. It improves the understandability of a program. It reduces the size of code. It allows reusability. Use of functions avoid code duplication. A function can be called any number of times. Programs with functions need less maintenance. Function allows calls of other functions within. It performs same set of instructions on different sets of data. A set of functions can be used to form libraries.

13) Explain the parts of a function? A function has the following parts:

70

1. 2. 3. 4. 5.

Function prototype Definition of a function Function call Actual and formal arguments (parameters) The return statememt

1. Function prototype: The function prototype specifies the following : return type, Name of the function, and type and number of arguments it takes. 2. Definition of a function: The first line of the function is called function header and is followed by function body. The block of statements followed by function header is called function definition. The and header and prototype should match each other. The function can be defined any where. If the function is defined before its call, then its prototype declaration is optional. 3. Function call: A function call executes the code of the function. Call of function can any where in the program and any no. of times. A function must be called by its name, followed by argument list enclosed in parenthesis and terminated by a semicolon. 4. Actual and formal arguments: Argument is a value that is sent from calling from to called function. The arguments declared in caller function and mentioned in the function call are called as actual arguments. The arguments declared in the function header are known as formal arguments. 5. The return statememt: Return is a value that is returned from the called function to calling function. The return statement can return only one value at a time. When a function doesnt return any thing we write void, when a function return something we write, the return datatype. Structure of a function: return-type Function-name (Argument list) { Declaration part Executable part } Example: void printsum(int,int); /* function declaration(prototype) */ main() { printsum(30,40); /* call of function */ } void printsum(int x, int y) /* function definition */ { int z; z=x+y; printf(sum=%d,z); } 14) Explain Different ways (types) of writing functions: In C, A function can be written in four different ways. 1. No Argument, No Return 2. Argument, No Return 3. No Argument, Return 4. Argument, Return 1. No Argument. No Return: a function, which does not take any arguments and does not return any value. Ex: void printline( ); main() { printline(); printf(hello); printline(); } void printline() { int i; for(i=1;i<=10;i++) printf(-); pritnf(\n); }

71

2. Argument. No Return: a function which takes arguments, but do not return any value. Ex: void sum(int,int); main() { int k; sum(30,40); } void sum(int x, int y) { printf(sum=%d, x+y); } 3. No Argument. Return: a function, which does not take arguments, but returns a value. Example: int sum( ); main() { int k; k=sum( ); printf(sum=%d,k); } int sum( ) { int x=30,y=40; return x+y; } 4. Argument. Return: a function, which takes arguments, and returns a value. Example: long fact int); main() { long k; k=fact(5); printf(factorial = %ld,k); } long fact( int n) { long f=1; int i; for (i=1;i<n;i++) f*=i; return f; } 15) What are Storage classes?

Storage class explains the behavior of variables in terms of their scope, life and storage location. Storage class of a variable determines how, when and where storage will be allocated for the variable. C has four types of storage classes. 1. Auto: For all local variables, auto storage class is the default storage class. These variables get initialized or recreated each time a function is called. The scope of an auto variable is limited to the function, in which it has been declared. They get initialized to some garbage values if no data is give. Example: main( ) { auto int x=30; printf(%d,x); } 2. Extern: For all global variables, this is the storage class. The scope of external variable is through out all the modules of a program. Other programs can also share extern variables. Extern int variables get initialized to zero automatically. Example: extern int x=30; void show( ); main( )

72

{ printf(%d,x); /* prints 30 */ show( ); } void show( ) { printf(\n%d,x); /* prints 30 */ } 3. Static: Static variable has local scope but life as a global variable. A static variable can be initialized for only once. A static variable also gets initialized to zero automatically Example: void show( ); main( ) { int i; for(i=1;i<=10;i++) show( ); } void show( ) { static int j; j++; printf( Call Number: %d,j); } The output will be: Call Number: 1 Call Number: 2 . . Call Number: 10 4. Register: For Register storage class variables, system allocates memory in CPU registers. Generally, this is done for fast accessing because the speed of the registers is high. Register storage class can be applied to local variables only. And register variables do not have any address. Example: main() { register int i=30; printf(%d,i); scanf(%d,&i); /* causes error, because register } variables do not have any address */ Storage class Auto (local) Extern (global) Static Register 16) Scope Life Default value

Within the function


Through out the program Within the function Within the function

Till the function terminates


Till the program terminates Till the program terminates Till the function terminates

Garbage value
Zero Zero Garbage value

List out some mathematical functions

Mathematical functions of C are declared in the header file math.h. Some of the math functions are listed below. Function double sqrt(double) double pow(double x, double y) int abs(int) double cos (double) double sin (double) Meaning returns the square root of a given number. returns x power y prints the absolute value of a given integer returns the cos value of a given number, argument must be in radians returns the sin value of a given number, argument must be in radians

73

double tan (double) double floor (double x) double ceil (double x)

returns the tan value of a given number, argument must be in radians returns the greatest integer < x (floor(3.4) returns 3) return the smallest integer > x (ceil(3.4) returns 4)

17) List out String functions String functions of C are declared in the header file string.h Function char * strcpy(char *s1, char *s2) char* strcat (char *s1, char *s2) char* strlwr(char *s) char* strupr(char*s) char* strrev(char*) int strlen(char*) int strcmp(char*s1, char *s2) Meaning copies the string s2 to s1 concatenates s1 and s2 into s1 converts s into lower case string converts s into uppercase string reverses the given string returns the length of the given string compares s1 and s2 and returns 0 if s1 and s2 are equal returns positive if s1 > s2 returns negative if s1<s2

18) Explain various standard functions in header files. Standard functions are library functions of C. They are defined in C header files. Following are some of the standard (system-defined or built-in) functions. Header file math.h Function Sqrt Abs Pow Sin Cos Strlen Strcpy Strrev strcmp Strupr Strlwr toupper tolower isupper islower isdigit random Exit Abs Printf Scanf Meaning Finds square root of a number Finds absolute value of a number Finds power i.e. x to the power of y Computes sin value of given radians Computes cos value of given radians Finds the length of a string Copies one string to another string Reverses a string Compares two strings Converts a string into uppercase Converts a string into lowercase Converts a character into uppercase Converts a character into lowercase Determines whether the char is in upper case Determines whether the char is in lower case Determines whether the char is digit or not Generates random number Terminates the program Returns the absolute value of a number To print the formatted text on the screen To read formatted text from the keyboard.

string.h

ctype.h

stdlib.h stdio.h

19)

What are recursive functions?

If a function is called within the same function, it is said to be recursion. A recursion function must be base criteria(condition) dependent. For each recursion, it must be closer to the base condition. Example: To find out the factorial of a given number, the recursive logic is as follows: Fact (4) = 4 * Fact (3) = 4 * 3 * Fact (2)

74

= 4 * 3 * 2 * Fact (1) =4*3*2*1 In the given example Fact (n) is written as n* Fact (n-1) and Fact (1) is replaced with the value of it i.e. 1. The same put in the C-syntax is: int fact (int n) { if ( n==1) return 1; else return n* fact(n-1); } main() { int k; k=fact(4); printf(factorial=%d,k); }

20) Explain the differences between iteration and recursion.


1. Iteration: If some logic is produced using iterative loops such as for loop, while loop and do-while loop, we call it as iteration. An iterative loop gets executed as long as the condition is true. For every cycle or Iteration it evaluates the condition and executes the related statements. Iterative logic gets executed fast when compared to recursion. Example: An Iterative logic to find Factorial: int fact(int n) { int i,f=1; for(i=1;i<=n;i++) f=f*i; return f; } 2. Recursion: If a function is called within the same function, it is said to be recursion. In recursion, a function is called with in the same function till it meets with a proper terminating condition. Recursive logic gets executed slowly when compared to iteration because system has to set up a stack for execution of recursive logic. Example: A recursive logic to find Factorial: Fact (n) can be written as n* Fact (n-1) and Fact (1) is replaced with the value of 1. int fact (int n) { if ( n==1) return 1; else return n* fact(n-1); } 21) How do you send Functions as arguments? (OR) Explain pointers to functions. Passing functions to other functions as argument: A pointer to a Functions can be sent to other functions as arguments. This allows one function to be transferred to another, as though the first function were a variable. This would be very useful in cases such as executing one of many functions based on a condition. Pointer to the function can be written as Return-type ( * function-pointer ) ( argument,)

75

Consider the following example int add( int x, int y) { return x+y; } int sub( int x, int y) { return x-y; } void show( int (*fp)( ), int x, int y) { printf(%d, (*fp)(x,y)); /* call of which function depends upon the function argument supplied */ } main( ) { show(add,40,30); show(sub,40,30); /* prints 70 */ /* prints 10 */ } In the above example, the statement show(add,30,40) sends add function as argument and add function is called in show. Similarly, the statement show(sub,30,40) sends sub function as argument and sub function is called in show. 22) Differentiate local and global variables. Local These are of the type auto storage class Life of the local variable is till the function gets terminated Scope of the local variable is within the function Local variable does not take any initial value Global These are of the type extern storage class. Life of the global variable is till the program terminated Scope of the variable is through out the program. Global variable automatically gets initialized to zero

Example: int x=30; /* global variable */ void f1(); main( ) { int y=40; /* local variable */ printf(\n%d,x); printf(\n%d,y); f1(); } void f1() { printf(\n%d,x); } Explanation: In the above example, x is a global variable, which can be accessed through out the program. y is a local variable, which can be accessed only within the main() function. 23) What are Arrays? Explain its advantages and disadvantages. What are types of arrays? Array is a group of related data items that share common name. we can also define an array is a set of values of similar type. The complete set of values is referred to an array, the individual values are called elements. Array elements are stored in sequential memory locations. A value is indicated by writing a number called index number or sub script in brackets after the array name. eg: int a[10].

76

To refer to the elements of the array, we use indexes accordingly. Array indexing starts from zero. Advantages of arrays: It is capable of storing many elements at a time It allows random access of elements i.e. any element of the array can be randomly accessed using indexes. Disadvantages: Predetermining the size of the array is a must. Memory wastage will be there. To insert or delete one element in the array, we need to traverse through out the array. In 'C', Arrays can be used and defined in many types: single dimensional and double dimensional. 1. Single dimensional array : A list of items with one variable name using only one subscript value, such variable is called as single dimensional array. It can represent either one row or one column. Ex: int a[10] In the above expression, a variable can hold 10 values and the array a will be allocated 20 bytes of memory. Declaration of the Array: Syntax: data_type array_name[size]; eg: int a[10]; float height[5]; char name[20]; Initializing the Array [Array Constant]: Syntax: data_type array_name[size] = {list of values}; eg: int a[]={10,20,30,40,50} To access the third element of the array we may use a[2] i.e. the index of third element in the array is 2. To print the array, we may write: for (i=0;i<5;i++) printf(\n%d,a[i]); 2. Double Dimensional Arrays: Double dimensional arrays can represent the data in the form of rows and columns i.e. by taking two or more indexes. Ex: int a[5][5]; In the above expression, the Array a can hold maximum of 25 (5X5) integers at a time and 50 bytes of memory would be allocated. Declaration and Initialization of the Double dimensional Array: Syntax: data_type array_name[row-size][col-size] = {list of values}; Array initialization can be done as follows: int a[3][3]={ {10,20,30}, {40,50,60}, {70,80,90} }; To access the second element of second row in the array we may use a[1][1] To print the Double dimensional array, we may write: for (i=0;i<5;i++) for(j=0;j<5;j++) printf(\n%d,a[i][j]); 24) What are multi dimensional arrays? Explain. Multi Dimensional Arrays: Multi dimensional arrays can represent the data in the form of rows and columns i.e. by taking two or more indexes i.e. two dimensional array, three dimensional array etc. a) Two-dimensional arrays: Two-dimensional array uses two indexes to refer to its elements Ex: int a[5][5] In the above expression, for the array a 50 bytes of memory would be allocated and array a can hold maximum of 25 integers at a time.

77

Array initialization can be done as follows: int a[3][3]={ {10,20,30}, {40,50,60}, {70,80,90} }; To access the second element of second row in the array we may use a[1][1] To print the array, we may write: for (i=0;i<3;i++) { printf(\n); for(j=0;j<3;j++) printf(\t%d,a[i][j]); } b) Three-dimensional arrays: Three-dimensional array uses three indexes to refer to its elements Ex: int a[2][2][2] In the above expression, for the array a 16 bytes of memory would be allocated and array a can hold maximum of 8 integers at a time. Array initialization can be done as follows: int a[2][2][3]={ {10,20,30},{40,50,60}, {70,80,90},{11,22,33} }; a[0][0][0] fetches the first element of the array To print the array, we may write: for (i=0;i<2;i++) { printf(\n); for(j=0;j<2;j++) { printf(\n); for(k=0;k<3;k++) printf(\t%d,a[i][j][k]); } } 25) Explain arrays as arguments. (OR) Explain Passing Array as an argument to a function.

Like the values of simple variable, it is also possible to pass the values of an array to a function. Array can be sent to a function in the form of argument. The advantage here is, all the elements of the array can be at a time sent to a function. To pass an array to a called function, it is sufficient to list the name of the array, without any subscipts. When you do some modifications to array variables in the functions, it affects the original values also. Example: The program below finds out the max of n integers. #include <stdio.h> #include <conio.h> int max(int a[],int n) /* array as argument to a function.*/ { int i,m; m=a[0]; for(i=1;i<n;i++) if(a[i]>m) m=a[i]; return m; } main() { int i,n,a[10]; clrscr(); printf("How many values:");

78

scanf("%d",&n); printf("Enter A values:"); for(i=0;i<n;i++) scanf("%d",&a[i]); k=max(a,n) printf(maximum val=%d,k); getch(); } Explanation: In the above example, array a is sent to the function max as input i.e. argument. max function finds the biggest of the array elements and returns it. 26) Explain differences between procedures and functions. Explain how arrays are passed to both functions and procedures. Procedure It is a reusable block of statements or a sub-routine that usually does not return any value. A procedure can be used to alter the values of actual parameters through call by reference mechanism when there is a need for altering many values. It takes arguments. A call of procedure cannot be used for assignment purposes or in expressions. Function It is a reusable block of statements or a sub-routine that usually returns value. When there is no need for altering actual parameters but expect a return value, functions can be used. Functions also take arguments. A call of function can be used for assignment purposes and in expression because it returns a value.

Though there are some differences between procedures and functions, now a days, in most of the programming languages, reusable block of statements are called as functions. void swap(int *, int * ); int fact(int n); main( ) { int a=30,b=40; swap( &a, &b ); // can be treated as procedure printf(%d\t%d,a,b); printf(\nFact of 4=%d,fact(4)); // can be treated as function } void swap(int *p1, int *p2) { int temp; temp =*p1; *p1 = *p2; *p2 = temp; } int fact(int n) { int i,f=1; for(i=1;i<=n;i++) f=f*i; return f; } In the above example, we have a written a sub-routine swap which takes arguments and used to alter values of actual parameters. It does not return any value. Hence it can be treated as procedure. There is another subroutine fact() which returns a value. Hence it can be treated as function.

79

27) What is searching? Explain any two methods that are used for searching. Searching is a process of finding out the existence of an element in a list. There are several methods such as linear search, binary search, fibonacci search, etc. to perform searching for elements in a list. Linear search: This is also called as sequential search. In this search technique, we compare the search key with the elements of the array sequentially till it is found or till the end of the array. This type of search can be performed on unsorted elements. This is considered to be inefficient. The time complexity involved in this technique is O(1) for best case, O(N) for the worst case, N/2 comparisons in average case i.e. O(N). #include<stdio.h> #include<conio.h> void main() { int a[10],n,i,x,found; clrscr(); printf("enter n :"); scanf("%d",&n); printf("enter a values :"); for(i=0;i<n;i++) scanf("%d", &a[i]); printf("enter element to be searched\n"); scanf("%d", &x); found=0; for(i=0;i<n;i++) if( a[i]==x) { found=1; break; } if(found==0) printf("%d not found",x); else printf("found"); getch(); }

Binary search: This is also called as logarithmic search. In this search technique, it involves a method of splitting the set of elements into two equal halves and splitting lower set (if element falls lower side) or upper set (if element falls upper side) repeatedly till element is found or only one is left. Binary search can be performed on sorted elements only. Each Comparison in the binary search reduces the number of possible candidates by a factor of 2. Thus the max number of comparisons is approximately log2n. The running time of a binary search is proportional to log2n. Thus We may say that the running time of a binary search algorithm is O (log n) #include<stdio.h> #include<conio.h> main() { int a[10],x,found=0,l,h,mid,n,i; clrscr(); printf("Enter No.of Elements:"); scanf("%d",&n); printf("\nEnter 'A' Values in sorted Order:\n"); for(i=0;i<n;i++) scanf("%d",&a[i]); printf("Enter Element to be Searched:"); scanf("%d",&x); l=0; h=n-1; while(l<=h)

80

{ mid=(l+h)/2; if(x<a[mid]) h=mid-1; else if(x>a[mid]) l=mid+1; else if(x==a[mid]) { found=1; break; } } if(found==1) printf("Element Found"); else printf("Element Not Found"); getch(); } 28) What are Strings?

A string is an array of characters. A string variable is any valid 'C' variable name and is always declared as an array. The declaration of a string variable is, Syntax: char <variable_name>[size]; Eg: char name[20]; char city[15]; The size determines the no. of characters in the string name. when we assign a string to a character array, it automatically supplies a null character [\0], whose integer equivalent value is zero at the end of the string. Therefore the size should be equal to the max. no. of characters in the string +1. String can be in initialized in two different ways: char x[ ]= { a,m,a,r,\0}; or char x[ ]= amar; To print the string we may write: printf(%s,x); To access the individual characters of the string, we may write: printf(%c,x[1]); It is also possible to write set of strings as follows char x[10][10]={ amar, kiran, ravi, ramu}; In the above expression first 10 indicates maximum number of strings and second 10 indicates maximum of 10 characters in each string. To print the complete set of strings we use for (i=0;i<4;i++) printf(\n%s,x[i]); The common operations performed on strings are: reading & writing strings, combining strings together, copying one string to another, comparing strings for equality, extracting a portion of a string. To perform these operations on strings we use string functions such as, strcat(),strcmp(),strrev() etc. these string functions are defined in string.h headerfile. UNIT V (PROGRAMMING IN 'C' ) 1) What are user-defined data types? Explain enumeration and unions. Apart from the primary data types int, char, float, void, 'C' allows us to define our own data types. This is done for the purpose of customized programming and to reduce the complexity of programs. In C, User defined data types can be created in three different ways Structures Unions

81

Enumeration 1.Structures: Structure is a collection of data items of different datatypes. It is a way of defining user defined data type that encapsulates (combines) different data types. The general syntax of the structure is: struct struct-tag { data-type1 varibale1; data-type2 variable2; . }; Example: struct student { char name[10]; int rno; int marks; }; main() { struct student s1={ravi,33,540}; printf(%s\t%d\t%d,s1.name,s1.rno,s1.marks); } 2.Unions: Union is also a way of defining user defined data type that encapsulates different data types. But there is a major distinction between unions and structures in terms of storarage. In structures, each member has its own storage location, whereas in unions, all the members of the union use same location. They share single common memory area. Example: main() { union alpha { int a; float b; }; union alpha a1; a1.a = 30; pritntf(%d, a1.a); /* prints 30 */ a1.b = 3.9; printf(%f,a1.b); /* prints 3.9 */ } In the above example the size of the alpha will be 4 bytes. 3.Enumeration: Enumeration is also a way of defining user defined data type. It is meant for declaring string constants with integer equivalent values. Syntax: enum <enum_tag> { member1, member2member n}; Example: main( ) { enum colors { red=10, green=20, blue=30 }; enum colors c1,c2; c1 = red; c2 = blue; printf(%d,c1); /* prints 10 -integer equivalent of red */ printf(%d,c2); /* prints 30 -integer equivalent of blue */ } 2) What is structure? Explain with examples Structure is a way of defining user defined data type that encapsulates different data types. A structure variable can hold a set of dissimilar values. The general syntax of the structure is: struct struct-tag

82

{ data-type1 varibale1; data-type2 variable2; . }; Advantages: Handling many values at a time in the form of a group is possible. In C, it possible to return only one value, but using structures it is possible to return more values grouped together. It reduces burden on the programmer Structures can include other structures to extend its features. Example: struct student { char name[10]; int rno; int marks; }; main() { struct student s1={ravi,33,540}; printf(%s\t%d\t%d,s1.name,s1.rno,s1.marks); } In the above example, struct tag is student and it encapsulates three different properties name, rno, marks. These are also called as members of the structure. s1 is instance of the structure student. The members of the structure are accessible with dot (.) extension. i.e. s1.name, s1.rno and so on. 3) Compare structures, and unions Structures: User defined data type that encapsulates different data types. It can hold set of different values grouped together Members of the structure variable are accessed with dot ( . ) extension. Allocates memory for all the members as a block of memory locations whose size is equivalent to the sum of memory bytes required by individual members. Unions: User defined data type that encapsulates different data types. It can hold a single value at a time, which can be the value of any one of the members Members of the union variable are accessed with dot ( . ) extension. Members of the union share common memory area, whose size is equivalent to the highest of memory bytes required by individual members. Note: also give examples for structure and union. 4) Explain structure initialization and array of structures. A) Structure Initialization: A structure can be initialized as in the case of array. But, the values while initializing structure must be in the same order as that of the members of structures. Example: typedef struct student { char name[10];

83

char sec; int rno,m1,m2,m3; }student; main() { student s1 = {"ravi", B, 22, 78, 87, 79}; /* structure initialization */ clrscr(); printf("%s\t%c\t%d\t%d\t%d\t%d",s1.name,s1.sec,s1.rno,s1.m1, s1.m2,s1.m3); } B) Array of structures: Array is set of similar values, whereas array of structures is a set of structure variables. Arrays of structures can be initialize in the following manner. struct student { char name[10]; int rno,marks; }; struct student s[]={ravi, 33,500, kiran, 44,600}; in the above example s[0] {ravi,33,500} and s[1] {kiran,44,600} the above entire array of structure can be printed as follows: for(j=0;j<2;j++) printf(\n%s\t%d\%d,s[j].name,s[j].rno,s[j].marks); 5) Compare Structure, Union and Arrays.

Structure User defined data type that encapsulates different data types. It can hold set of different values grouped together in structure variables All the Members of the structure are accessed with dot (.) extension. Allocates memory whose size is equivalent to the sum of memory required by individual properties Structure declaration struct student { char name[10]; int rno; }; struct student s1={ravi,33,500};

Union User defined data type that encapsulates different data types. It can hold a single value at a time, which can be the value of any one of the members All the Members of the union are accessed with dot (.) extension. Members of the union share common memory area, whose size is equivalent to the highest of memory required by individual members. Union declaration union alpha { int x,y; }; union alpha a1; a1.x=30

array It is a collection of values of similar data type. It can hold a set of values which share common name. Each element of the array can be accessed using array name and a unique index For declaring an array predetermination of the size is a must.

Array declaration int a[]={10,20,30}

84

6) What is the enumeration data type? List down the conditions for using enumeration data type in a program. Enumeration is a way of defining user defined data type. It is meant for declaring string constants with integer equivalent values. This offers lot of convenience to the programmer. Programmer can write strings in the place of integers. When integer values are not specified, the string constants will have values from zero. Example: main( ) { enum colors { red=10, green=20, blue=30 }; enum colors c1,c2; c1 = red; c2 = blue; printf(%d,c1); /* prints 10 -integer equivalent of red */ printf(%d,c2); /* prints 30 -integer equivalent of blue */ } Conditions for using enumeration data type: The variables and enumerators must have unique identifiers They can be used in ordinary expressions provided compatibility is maintained. They are compatible with integer data types They can be used in case labels in a switch.

8) Explain about bitfields.


Normally, integer occupies 2 bytes of memory i.e. 16 bits to store data. There are occations where data items requires much less than 16 bits space. In such cases, we waste memory space, 'C' allows us to use small bit fields to hold data items and there by to pack several data items in a word of memory. A bit field is a set of adjacent bits whose size can be from 1 to 16 bits in length. A word can therefore be divided into no. of bit fieds. The name and size of bit fields are defining using a strcture. The general form of bit field definition is:

struct struct-tag { data-type1 varibale1: bit length; data-type2 variable2; bit length; .. . data-type n variable n; bit length; }; The datatype is either int or unsigned int or signed int and bit length is the number of bits used for the specified name. Signed bit field should have at least 2 bits(1 for sign). The bit lengthis decided by the range of value to be stored. The largest value that can be stored is 2n-1, where n is the bit-length. Example: typedef struct sample { unsigned a:1; unsigned b:3; unsigned c:2; unsigned d:1; }sample; main() { sample v={1,2,3,4};

85

printf ((\n v.a = %d,v.a); printf ((\n v.b = %d,v.b); printf ((\n v.c = %d,v.c); printf ((\n v.d = %d,v.d); printf(\n no. of bytes occupied by %d,sizeof(v)); }

9) Explain about nesting of structures?


Nesting structure is writing a structure within the structure. This enables us to access the members of inner structure with outer structure variables. We can also have variables of type inner structure anywhere in the program. Consider the following to demonstrate nested structures: typedef struct student { int rno; char name[20]; struct marks { int m1,m2,m3; }m; } student; main() { student s1={33,vikas,56,78,90}; printf (%d\t%s\t%d\t%d\t%d,s1.rno,s1.name,s1.m.m1,s1.m.m2,s1.m.m3); } Here, we can access members of the inner structure marks with outer structure student. 10)Explain how a structure can be send as argument to a function ? A function may take structure variable as argument. We can send the structure variable as argument to a function in two ways: 1. using call by value 2. using call by reference In call by value technique we pass structure variable as an argument and in call by reference we pass the address of the structure variable as argument. A program to demonstrate to structure variable as an argument ot a function.

typedef struct student { int rno; char name[10]; int m1,m2,m3; }student; void showdata(student); void show_data(student*); main() { student s1 = {10,"ravi", 78, 87, 79}; showdata(s1); show_data(&s1); /* structure initialization */ clrscr(); } void showdata(student s1) { printf("%d\t%s\t%d\t%d\t%d", s1.rno ,s1.name,s1.m1,s1.m2, s1.m3); } void show_data(student *p) { printf(\n rno = %d,p->rno); printf(\n name = %d,p->name);

86

printf(\n total

= %d,p->m1+p->m2+p->m3);

}
11)What are pointers? Explain. Pointer variable is a variable that holds address of simple variable of same type. Pointing to an address variable gives value at that address. Advantages of pointers: Pointers save the memory space. Excution time of pointer is faster because data is manipulated with address i.e. direct access to memory location. Memory is accessed efficiently with the pointers, i.e. memory is dynamically allocated and released. Pointers are used with data structures. Pointers are useful for representing two dimensional and multidimensional arrays. It allows call by reference mechanism for arguments Pointers improve the efficiency of the programs. Disadvantages: Pointer variables require extra memory. Programmer finds writing pointers tiresome. Use of pointers increases complexity. Let us consider int a=30, here a is the name of the variable &a is the address of the variable 30 is the value of the variable. Example: int a=30,*p; p=&a; printf(%d,a); /* Accessing the value by name of the variable */ printf(%d,*&a); /* Accessing the value by pointing to the address */ printf(%d,*p); /* Accessing the value by pointing to the pointer variable */ In the above example all the three statements would give 30. 12)Explain arrays of pointers. Array of pointers is a set of pointer variables that hold addresses of simple variables of same type. Consider the example: main( ) { int *p[10]; int a[]={10,20,30,40}; p[0]=&a[0]; p[1]=&a[1]; p[2]=&a[2]; p[3]=&a[3]; for(i=0;i<4;i++) printf(\n%d,*p[i]); /* prints 10 20 30 40 */ } In the above program, p is an array of pointers. Pointing to the elements of the p array gives values at the address, what they hold. 13) Demonstrate call by value, call by reference with examples (OR) Explain different ways of parameter passing techniques. Call by value and Call by reference determine the nature of the arguments and reflection of the changes of the variable in calling function.

87

1. Call by Value: In this method, simple variables are sent to the functions in the form of arguments. In this case, only values of the arguments are copied to the corresponding function parameters. When we make some changes to the variables in the function, it does not affect the variables of the calling function. Example: void swap(int,int); main() { int a=30,b=40; swap(a,b); printf(%d\n%d,a,b); } void swap(int x, int y) { int temp; temp=a; a=b; b=temp; } In the above example the output will be 30 and 40. It does not change the values of a and b. 2. Call by Reference: In this method, addresses of the variables are sent to the functions in the form of arguments. In this case, addresses of the argument variables are copied to the corresponding function pointer-type parameters. When we make some changes to the variables in the function, it affects the variables of the calling function also. Example: void swap(int *, int * ); main( ) { int a=30,b=40; swap( &a, &b ); printf(%d\n%d,a,b); } void swap(int *p1, int *p2) { int temp; temp =*p1; *p1 = *p2; *p2 = temp; } In the above example the output will be 40 and 30. It changes the values of a and b, though you make changes in other module. 14)What is dynamic memory allocation?

Allocating memory at runtime is dynamic memory allocation. It eliminates predetermining of number of variables to be used in the program. This mechanism is extensively used in data structures like linked lists and binary trees. In dynamic memory allocation, after our purpose is served, we can release the memory to avoid blocking of the memory. Dynamic memory allocation is done using malloc or calloc functions. Memory release is done using free function

Example: main( ) { int *p; *p= ( int *) malloc ( sizeof(int) ); *p=30; printf(%d,*p); free(p); }

88

in the above example, for the pointer variable p, two bytes of memory has been allocated dynamically. And memory has been released by the function free

15) Explain the operators that are used on pointers. (OR) Explain pointer arithmetic.
Pointer variable is a variable that holds address of simple variable of same type. Pointing to and address variable gives value at that address. Pointer arithmentic is one of the powerful feature of 'C'. if the variable p as a pointer to a type, p+1 gives the address of next variable of same type. Using operators on a pointer variable is called pointer arithmetic. The different operators that can be used on pointer are: +, -, ++, and --'. This mechanism is commonly used in accessing array elements using pointers. Example: main() { int a[]={10,20,30,40},*p,*p1,*p2; p=&a[0]; printf(%d,*p); // prints 10 p++; // pointer arithmetic printf(\n%d,*p); // prints 20 p1=&a[0]; p2=&a[1]; printf(\n%d,p2-p1) // prints 2 } Explanation: In the above example, pointer variable p holds the address of a[0] i.e. address of first element in the array. Pointing that gives the value of a[0] i.e.10. When increment operator is applied on pointer variable p, it gets incremented by 2 (2 bytes, size of an integer). As arrays elements are stored sequentially, pointing to that gives the value of a[1] i.e. 20. Similarly, the difference between the address of two consecutive elements of the array gives 2.

16) What is storage mapping function?


For any array the mapping between pointer values and array indices is called the storage mapping function. Consider the declaration int a[3][3]; for the above array a, the storage mapping function is specified by noting that a[i][j] is equivalent to *(*(a+i)+j) Similarly in the case of single dimensional array a[i] is equivalent to *(a+i) Example: main( ) { int a[]={10,20,30,40},i; for (i=0;i<4;i++) printf(\n%d,*(a+i)); /* prints 10 20 30 40 */ } In the above example, to print the values we have used storage mapping function. 17)What are the common features of arrays and pointers. Arrays is a set of values of same type. Where as, pointer refers to an address of a variable. The common features of arrays and pointers are: Pointer variable holds the address of another simple variable. If a pointer variable p points to an array, to access nth element of the array, we use *(p+n) When we alter the value of a variable using pointers in a function, it affects the actual value in the calling function. Array variable holds the address of first element of the array. To access nth element of an array named a, we use *(a+n) or a[n] When we alter the value of an array in a function, it affects the actual value in the calling function.

89

When pointer are used as arguments, it is done through call by reference mechanism.

When array is used as argument, it is done through call by reference mechanism.

18)What are ragged arrays? An array of pointers whose elements are used to point to arrays of varying size is called a ragged array. Ragged array:

a
0 1 T J O E M R \0 R Y \0

Example: main( ) { char * A[2] = { TOM, JERRY}; printf(%s, A[0]); /* prints TOM */ printf(\n%s,A[1]); /* prints JERRY */ } In the above example, A is array of pointers, but each element in the array may have elements of different sizes. First element TOM has 3 characters and the second element JERRY has 5 characters. Hence it is said to be a ragged array. 19)Compare malloc, calloc, realloc and free functions malloc, calloc, realloc functions are related to dynamic memory allocation free function releases the memory All these functions are declared in malloc.h malloc(k): malloc allocates k bytes of memory dynamically. It returns the base address on success; otherwise it returns NULL. The space is not initialized. Allocating a block of memory: Syntax: ptr = (datatype*) malloc (byte size); example: *ptr = (int*) malloc (sizeof(int)); *ptr = (char*) malloc (sizeof(char)); *ptr = (struct std*) malloc (sizeof(struct std)); calloc(n,k): calloc allocates k bytes memory dynamically for n elements i.e. array of n elements. It returns the base address on success; otherwise it returns NULL. The space is initialized zero. Allocating multiple blocks of memory: Syntax: ptr = (datatype*) calloc (n,element_size); it allocates n bytes of memory dynamically for n elements(array) and initialized to 0. realloc(void*p,k): Changes the size of the block pointed by p to k bytes. Contents in old spaces will not be changed. It returns the base address of the resized spaces on success; otherwise it returns NULL. New spaces are not initialized free(void *p) It de-allocates the memory pointed by the pointer p To be de-allocated the memory must be allocated by malloc, calloc or realloc functions.

20) What is file management? 90

A file is a place on the disk where a group of related data is stored. File management, is a methodology provided in C to deal with the files or input and output streams. Generally to manage file transactions, we use operating system. But 'C' supports a number of functions that have the ability to perform basic operations, while include: Creating a file. Deleting a file. Copying one file to another. Renaming a file. Appending contents to a file. Reading the contents of a file. 21)How do you define and open a file in 'C' ? If we want to store the data in a file in the secondary memory, we must specify, 1) filename 2) data structure 3) purpose file is a valid name for the operating system. Data structure of a file is defined as FILE. FILE is a defined datatype and all files should be declared as type FILE. When we open a file, we must specify what we want to do with the file. Syntax: FILE * fp; fp= fopen(filename, moode); mode specifies the purpose of opening the file. In C, a file can be opened in different modes. Mode r w a r+ w+ a+ rb wb Meaning Read only Write only Append only Read/Write Read/Write Read/Append Read binary Write binary Description Opens a file for reading contents return NULL if file does not exist. Opens a file for writing. It overwrites if the file exists and returns if it fails to create a file Opens a file for appending, creates if it is not existing Opens a file for both reading and writing. File must exist Opens a file for both reading and writing. Creates a file if it is not existing and overwrites if it is existing. Opens a file for both reading and appending. Creates a file if it is not existing. Opens a file for reading in binary mode. Opens a file for writing in binary mode.

22)Explain Different File input, output functions File functions are declared in stdio.h. The functions are tabulated below. These functions can be used to manage the files i.e. performing file transactions such as creating a file, reading a file, copying a file and etc. Fie functions: Function fopen(fname,mode) fclose(fp) rewind(fp) unlink(fname) rename(source, target) fseek(fp, offset, whence) ftell(fp) Description To Open file in specified mode To Close a file pointed by the file pointer To move a file pointer to the beginning of the file stream To delete a specified file To change the name of a file To set the position to a desired in the file To give the current position in the file (in terms of bytes from the starts

Fie I/Ofunctions: These functions are used to perform the input and the output operations on a hard disk. fgetc() This functions is used to read a character from a file. General usage of this function is, fgetc(FILE *fp) where fp is a file pointer variable fputc( ) This functions is used to print a character to a file. General usage of this function is, fputc(int c,FILE *fp) where fp is a file pointer variable and c is a integer type variable fgets( ) This functions is used to read a string from a file. General usage of this function is, fgets(char *s, FILE *fp) where fp is a file pointer variable and s is a character type pointer. fputs( ) This functions is used to print a string to a file. General usage of this function is, fputs(const char *s, FILE *fp) where fp is a file pointer variable and s is a character type

91

pointer. getw() This functions is used to read an integer from a stream. General usage of this function is, getw(FILE *fp) where fp is a file pointer variable. putw() This functions is used to print an integer to a stream. General usage of this function is, putw(int i, FILE *fp) where fp is a file pointer variable and i is a integer type variable. fscanf( ) This function is used to read the formatted input from the file. The general form of the fscanf( ) is, fscanf( fp,format string,list of address of variables); fprintf( ) This function is used to print the formatted output to the file. The general form of this function is, fprintf(fp, format string,list of variables); fwrite() This function is used to write the records to the file. The general usage of this function is fwrite(const void *ptr, size_t size, size_t n, FILE *fp); the first argument is the address of the structure the second argument is the sizeof the structure in bytes the third argument is the number of records we want to write at one time the fourth argument is a file pointer Eg: fwrite(&e, sizeof(e),1,fp); where e is a structure variable fread () This function is used to read the records from the file.The general usage of this function is, fread(void *ptr, size_t size, size_t n, FILE *fp); the first argument is the address of the structure the second argument is the sizeof the structure in bytes the third argument is the number of records we want to write at one time the fourth argument is a file pointer Eg: fread(&e, sizeof(e),1,fp); where e is a structure variable 23)Explain different ways of accessing files. File management not only deals with storing information in the file and accessing information from the file, but also accessing ways of accessing information. The information of a file can be accesses mainly in two different ways which are listed below. 1. Sequential access: Using sequential access method, it is possible retrieve the information of a file sequentially, i.e. fetching the records one by one sequentially. To achieve this, we may use functions such as fgetc( ), fgets( ), etc. 2. Random access(direct access): Using random(direct) access method, it is possible to retrieve the information of a file randomly, i.e. fetching any random record stored in the file. it involves moving to those particular memory locations. To achieve this we may use functions such as fseek( ) 24)Explain the Following File Functions. a) rewind b) fseek c) ftell a) rewind: rewind function moves the file pointer to the beginning of a stream. The declaration of the function is void rewind(FILE * fp) Example: FILE *fp; char s[80]; fp= fopen(a.dat, r); puts(fgets(s,80,fp)); rewind(fp); puts(fgets(s,80,fp)); fclose(fp); In the above program the first line of a.dat is read twice because we have moved the pointer to the beginning after reading it once using rewind b) fseek: This function moves the file pointer to a specified position. The declaration of the function is int fseek(FILE * fp, long offset, int whence)

92

Example: FILE *fp; fp= fopen(a.dat, r); printf(%c,fgetc(fp)); fseek(fp,2,SEEK_SET); printf(%c,fgetc(fp)); fclose(fp); In the above program first it reads first character and then the third character because we are moving the file pointer to third byte using fseek function. SEEK_SET: Moves file pointer from the beginning SEEK_CUR: Moves file pointer from the Current position SEEK_END: Moves file pointer from the End of the stream c) ftell: This function returns the current file pointer The declaration of the function is long ftell(FILE * fp) Example: FILE *fp; long l; fp= fopen(a.dat, r); fseek(fp,0,SEEK_END); l= ftell(fp); printf(%d,l); fclose(fp); The above program prints the size of the file a.dat. We are first moving the file pointer to the end and the pointer at this position is nothing but total number of bytes in that file. 25)What are command line arguments? Command line arguments are the parameters passed to the executable C file in the form of strings. Command line arguments are collected in main function itself. The first argument in the main is number of arguments The second argument is list of arguments in the form of strings File name is also included in the list of arguments. This concept is very useful to implement commands.

Consider the following example. /* demo.c */ main( int argc, char* argv[ ] ) { int i; printf( Number of arguments=%d,argc); for(i=0;i<argc;i++) printf(\n%s,argv[i]); } If the name of the program is demo.c and after creating executable file you may type the following command: c:/>demo aa bb xx The above command produces the following output: Number of arguments=4 demo.exe aa bb xx

26)

What is preprocessor statement ? Explain any four pre processor commands (OR) What are Compiler Directives (#include, #define, %undef and #if directives)

93

The preprocessor mechanism allows different directives such as #include and #define. Before processing the actual program these are processed first. In the case of #include, it may include the processed version of other programs. In the case of #define, it creates a macro that replaces the code of the program accordingly. In the case of #if, it includes contents based on conditions The preprocessor statements start with # and they are not terminated by a semicolon. Few other directives are: #undef, #if, #else, #endif, #elif

1) Include Directive: include directive includes the processed file that has been mentioned in angle brackets or quotes. Example: #include<stdio.h> #include abc.c in this case the contents of abc.c are included in the current program 2) Define Directive It replaces the defined identifiers with the pieces of text. Example: #define pi 3.14 In this case, wherever pi appears in the program it is replaced with 3.14. 3) If Directive If directive instructs the compiler to compile the statements between #if and #endif, only if the condition is true. Example: #define flag 1 #if flag statements #endif In the above example, statements get executed. But if the value of flag is 0 the statements will not be compiled. 4) Undef Directive It undefines an identifier defined by define directive. Example: #define pi 3.14 #undef pi In this case, the identifier pi will be undefined and it will be no longer replaced with 3.14. 27)What is typecasting (Type Conversion)? Type casting is a mechanism to convert one data type to another. It makes the variable compatible temporarily. Type casting can be of two types: 1) Implicit type Casting: when constants and variables of different types are mixed in an expression they are converted to the same type. This conversion is done implicitly by the C compiler. The C compiler converts all the operands to the to the type of the largest operand. For example if an expression involves int and float, int type gets converted to float type. Example: float f=3; printf(%f,f); /* prints 3.0 */ The value 3 is automatically converted to 3.0 because of implicit casting. 2) Explicit type Casting: if a user forcefully changes the data type into other allowable data type it is said to be explicit type casting.

94

Example: int to float: float x; x=5/2 x=(float)5/2;

/* x value will be 2.0 */ /* x value will be 2.5 */

float to int: int x; x= 3.2 /* causes error */ x=(int)3.2 /* x will be 3 */ 28)Explain macros with examples. Define directive allows us to define identifiers which are replaced with the other meaningful piece of code or value. Macro is a preprocessor identifier in a program is replaced by a predefined string composed of one or more tokens. Macro can be defined using the preprocessor directive #define. Macro can be defined using the directive #define Macro can be undefined using the directive #undef It offers lot of convenience to the programmer. Macro can be a simple expression or an expression which can take arguments. Example: #define big( x, y ) x>y ? x : y main( ) { int i; char ch; i = big(30,40); / * this statement is replaced with 30>40?30:40 */ ch = big(q,z); / * this statement is replaced with q> z? q: z */ printf (%d,i); /* prints the bigger value i.e. 40 */ printf (%c,ch); /* prints the bigger value i.e. z */ } In the above example we have used a macro. Here, o big(x,y) is replaced with x>y ? x : y o big(30,40) is replaced with 30>40?30:40

29) Explain typedef with example. (or) Explain about user defined type declaration in 'C' ?
'C' supports a feature known as type definition that allows users to define an identifier that would represent an existing data type. In other words we can say that that it is used for giving aliases for data types. i.e. user can give an another name for the data types to be used in the program. Syntax: typedef type identifier; Here, type refers to existing datatype. Identifier refers to new name. Example: typedef int unit; typedef float marks; units a1,a2; marks m1,m2; main( ) { typedef int rama; typedef rama sita; rama x=30; sita y=40; printf(%d,x+y); } In the above example, writing rama is as good as writing int and writing sita is as good as writing rama, which in turn is int. Hence x and y are treated as of type int.

30) Explain the type qualifiers: const and volatile (OR) What are Symbolic constants? 95

The key words const and volatile have been added by the ANSI (American National Standards Institute). These are called as type qualifiers because they qualify the way a variable of a given type is used. const: when a variable is declared as a constant it cannot be modified again. This is done to prevent accidental changes on variables that hold constants like pi value. Example: main() { const float pi=3.14; pi=9.8; } In the above example, the compiler reports error because the value of pi cannot be modified volatile: when a variable is declared with this qualifier, it indicates that the variable can be modified by some background process or by some external source. Example: main( ) { const volatile int clock; } In the above example, the variable can be modified by some external source like system hardware, but not by the code.
x=x/10; count++; } printf("NO OF DIGITS=%d",count); getch(); }

********************************ALL THE BEST*********************************

96

You might also like