Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 197

insertselecta(An Autonomous Institution approved by UGC and affiliated to JNTUH))

(Accredited by NAAC with ‘A” Grade, Accredited by NBA of AICTE and


Recipient of World Bank under TEQIP-I and II )
Yamnampet, Ghatkesar Mandal, Hyderabad - 501 301

LAB MANUALS
For
IT WORKSHOP & PYTHON
PROGRAMMING
(From Page No.1 to 71 )

&
DATABASE MANAGEMENT SYSTEMS
(From Page No. 72 to 128 )

&
ANALOG & PULSE CIRCUITS
(From Page No. 129 to End)

FOR
B. Tech. II Year - II Semester
ECM Branch

DEPARTMENT OF ELECTRONICS & COMPUTER ENGINEERING


2024
Syllabus for B. Tech II Year II semester
Electronics and Computer Engineering
IT WORKSHOP AND PYTHON PROGRAMMING LAB
L T P/D C
Code: 9D467 0 0 3 1.5

Course Objectives
Students will try to learn
 Basics of Python programming, Decision Making and Functions in Python, Object Oriented Programming
using Python.
 To introduce to a personal computer and its basic peripherals, the process of assembling a personal
computer, installation of system software like MS Windows, Linux and the required device drivers.

Course Outcomes
Students will be able to
1. Apply knowledge for computer assembling and software installation and ability to solve the trouble shoot-
ing problems.
2. Apply the tools for preparation of PPT, Documentation and budget sheet etc.
3. Install and run the Python interpreter, Create and execute Python programs.
4. Apply the best features of mathematics, engineering and natural sciences to program real life problems.
5. Describe the Numbers, Math functions, Strings, List, Tuples and Dictionaries in Python, Express different
Decision Making statements and Functions, Interpret Object oriented programming in Python.
6. Understand and summarize different File handling operations, explain how to design GUI Applications in
Python.

IT Workshop
Week 1:
Introduction to Computer: Identify the peripherals of a computer, components/peripherals in a
CPU & its functions. Introduction to the types of Operating System, Assembling and
disassembling demonstration.

Week 2:
Install computer with dual boot operating system (Windows, Linux with PowerPoint
presentation). Comparison of types of OS in different platform

Week3:
Introduction to S/W's, difference b/w hardware and software. Introduction to MS-Office and its
importance.

Ms Word
Ms Power Point Presentation

Week4:
Introduction to Excel
Features: Accessing, Overview at toolbars, saving excel files, Gridlines, Format cells,
Summation, Auto fill, formatting text.
Formula in excel – Average, Standard Deviation, Charts, Roaming & Inserting worksheets,
Hyper linking, count function, lookup / Vlookup, sorting, Conditional formatting.

1|Page
IT Workshop Lab
Week 1:
Identify the peripherals of a computer, components in a CPU and its functions. Draw the
block diagram of the CPU along with the configuration of each peripheral and submit to
your instructor
AIM: To identify the peripherals of a computer.
1. The Mother Board

2. CPU (Processor)

3. SMPS (Switched mode Power Supply)

2|Page
4. Cabinet

5. CPU heat Sink and fan

6. RAM (Random Access Memory)

3|Page
7. HDD (Hard Disk Drive)

8. FDD (Floppy Disk Drive)

9. CD-ROM Drive

4|Page
10. CD Writer

11 Different Screws

5|Page
12. AGP (Accelerated Graphics Port) Card

13. LAN (Local Area Network)

6|Page
THE MOTHER BOARD

Steps for Assembling.

Socket 478

DDR RAM

SD RAM
Slots
Slots
Bridge
North

ATX Power
Connector
Floppy Drive
AGP Slot Connector

South Primary
Bridge Secondary
BIO
S

PCI Slots
CMOS Battery
1. Setting the cabinet ready.
2. Preparing to fit the components.
3. Fitting the mother board.
4. Fitting the RAM, processor and cooler.
5. Installing PCI cards.
6. Fitting the hard disk and floppy drive.
7. Installing the CD ROM drives.
8. Connecting the ribbon cables.
9. Powering the drives and mother board.
10. Connecting the cables for the case front panel.
11. Final check.

7|Page
Getting the Cabinet ready:-
1. Check how to open the cabinet and determine where to fix the components.
2. Determine if the case has the appropriate risers installed.

Preparing to fit the Components:


1. Network adapter drive.
2. Floppy disk drive.
3. Ribbon cables.
4. Hard disk.
5. CD-ROM Drive.
6. RAM
7. CPU
8. Heat sink / cooler / fan.
9. Mother board.
10. Screws.

Fitting the Mother board.


1. Line up the patch on the motherboard ( ps/l, USB, etc ) with the appropriate holes in
the block panel I/O shield of the case.
2. Check the points where you and to install
3. Install them and make the mother board sit on them and fix screws if required.

Mother board parts:


1. ACR slot.
2. PCI Slot.
3. AGP Slot.
4. ATX Connectors.
5. CPU Fan.
6. Chipset North Bridge.
7. CPU socket.
8. Floppy.
9. System memory.
10. Chipset south bridge.
11. Panel connector.
12. Power supply.
13. IDE connectors.

ATX Connectors:
1. PS, Mouse.
2. Key board.
3. USB.
4. Parallel ( Prints )

8|Page
5. Serial COM1.
6. Serial COM 2.
7. Joystick.
8. Sound.

Fitting the processor:


1. Raise the small lever at the side of the socket.
2. Notice that there is a pin missing at one corner, determine the direction to fit in the
processor.
3. You should not force the CPU. When inserting it. All pins should slide smoothly into
the socket.
4. Lock the lever back down.
5. Install the heat sink over it (Different type for each processor). Heat sink / CPU fan.

Fitting the RAM:


1. The RAM must be suitable for motherboard.
2. There are currently 3 types of RAM available.
a) SD RAM.
b) DDR SD RAM.
c) RD RAM.
3. The mother board’s chipset determines which type of RAM may be used.

Installing the PCI Cards:


1. Most of the cards are inbuilt these days.
2. NIL, Sound Cards etc. are fitted into PCI slots.

Fitting the hard disk and Floppy disk:


1. Place the floppy and hard disks in their slots.
2. Leave some space above HDD to prevent heat building.
3. Check the jumper configuration.
4. Fix the screws.

Installing the CD-ROM Drives:


1. CD-ROM drive is similar to installing a hard disk.
2. 1ST check that the jumper configuration is correct.
3. Fix the screw.

Connecting the ribbon Cables:-


1. Attach the long end of the cable to the IDEU connector on the motherboard first.
2. The red stripe on the IDE cable should be facing the CD Power.

Powering the driver and motherboard:


Connecting the cables for the case front pane

9|Page
1. SD, SPK or SPEAK: The loud speakers o/p. it has 4 pins.
2. RS, RE, RS or RESET: Connect the two pin Reset cable here.
3. PWR, PW, PWSW, PS or power SW: Power switch, the pc’s on (switch, the plug is
two pin ).
4. PWLED, PWRLED or Power LED: The light emitting diode on the front panel of the
case illuminates when the computer is switched on. It’s a 2-pin cable.
5. HD, HDD, and LED: These two pins connect to the cable for the hard disk activity
LED.
Final Check:-
1. Mother board jumper configurations are the settings for the processor operator.
2. Drive jumper settings, master/ slave correct?
3. Are the processor, RAM modules and plug in cards finally seated in there sockets?
4. Did you plug all the cables in? Do they all fit really?
5. Have you frightened all the screws in plug- in cards or fitted the clips?
6. Are the drive secure?
7. Have u connected the power cables to all driver?

Powering up for the first time:


1. Ensure that no wires are touching the CPU heat sink fan.
2. Plug your monitor, mouse and keyboard.
3. Plug in power card and switch the power supply.
4. If everything is connected as it should be
 All system, fans should start spinning.
 U should hear a single beep and after about 5-10 sec.
 Amber light on monitor should go green.
 You will see computer start to boot with a memory check.
 Now check front LED’S to see if u plugged them in correctly.
 Check all other buttons.
 Power afford change any wrong settings.
Viva Questions:
1. Define a computer?
2. Define hardware and software?
3. What are the functional units of a computer?
4. Define the following: RAM,ROM,BIOS,BUS,BIT,PROGRAM.
5. What is the use of a mother board?
6. Define assembling of a system?
7. Explain the steps involved in the installation of the mother board>
8. What is the use of pin 1 indicated on the processor?
9. What is the use of locking level at the processor slot?
10. Define a port?

10 | P a g e
Week 2:
AIM: To install Windows XP

PROCEDURE:

1. Keep on press the delete button and go to advanced BIOS feature. [BIOS- Basic Input
Output System]
2. And go to boot sequence. Select first boot drivers. CD ROM and press F10 to save
the bios feature. Yes and then enter. Press any key to boot from CD. Press enter to
setup windows XP.
F8 = To agree the license.
3. Press ESC to don’t repair the windows XP setup.
4. Press ‘p’ to delete the previous partitions. Then press enter.
5. Press ‘L’ to delete the partition.
6. Press ‘C’ to create the partition in the un partition space.
7. Press enter to setup windows XP on the selected items.

BASIC FILE SYSTEMS:


FAT: File Allocation Table.
NTFS: New Technology File System.
Format the create using NTFS partition

BASIC STEPS IN INSTALLATION:-


 Collecting information.
 Dynamic update.
 Preparing installation
 Installing windows.
 Tracking installation.
Select the language as English (United States), then ok.
Enter your name and organization.
Enter the product key.
Enter the computer name and give password (if necessary) then ok.
Then select the date and time.
Then select the typical setting.

AIM: To install Linux in system

PROCEDURE:
1. Language Selection
 Using your mouse select the language you would prefer to use for the installation
 Click next to continue.

2. Key Board Configuration:

11 | P a g e
 Using your mouse select the correct layout type for the keyboard you would prefer to use
for the installation and as the system default.
 Once you have made the selection click next to continue.

3. Mouse Configuration:
 If you have a PS/2 ,USB or Bus mouse you do not need to pick a port and device. If you
have a serial mouse, you should choose the correct port and device that your serial mouse
is on.
 The Emulate 3 buttons checkbox allows you to use a two-button mouse as if it had
three buttons. If you select this check box you can emulate a third “middle” button by
pressing both mouse buttons simultaneously.

4. Installation Type:
 Choose the type of installation you would like to perform.
 Your options are Personal desktop, Workstation, Server, Custom and upgrade

5. Disk partition Setup:


 You can chose automatic partitioning or manual partitioning using Disk Druid of fdisk.
 Automatic partitioning allows you to perform an installation without having to partition
your drives yourself.
 Automatic partitioning allows you to have some control concerning what data is removed
from your system.
 Your options are:
 Remove all Linux partitions on this system.
 Remove all partitions on this system
 Keep all partitions and use existing free space.
 To partition manually choose either Disk druid or fdisk partitioning tool.
 Lick next once you have made your selections.

6. Partitioning your system:


 If you chose automatic partitioning and did not select Review skip ahead
 If you choose automatic partitioning and selected review you can either ac-
cept the current partition settings (click next) or modify the setup using Disk Druid, the
manual partition tool.
 If you choose manual partition with fdisk skip ahead.
 At this point you must tell the installation program where to install Linux.
This is done by defining mount points for one or more disk partitions in which Linux will
be installed.

7. Adding Partitions:
 To add a new partition select new button, a dialogue box appears.

12 | P a g e
 Select the options and click ok
8. Boot Loader Configuration:
 Boot loader is the first software program that runs when a computer starts.
 The installation program provides two boot loaders GRUB ( GR and Unified Boot
Loader) which is the default and LILO
 If you do not want GRUB as your boot loader click Change Boot Loader.
 You can then choose to install LILO or choose not to install boot loader at all by clicking
Do not install boot loader on the change boot loader button.
 Network devices are automatically detected and displayed in Network Devices list,
 Select a network device and click Edit
 Here you can configure IP address and net mask of the device.

9. Firewall configuration:
 Offers firewall protection for enhanced protection.
 A properly configured firewall can greatly increase the security of the system.

10. Time zone configuration:


You can set your time zone by selecting your computers physical location or by
specifying your time zones offset from Universal Time.

11. Account Configuration:


 Allows to set Root password or user accounts
 Root count is similar to the administrator password that you set up in Win NT.
 Click add button to add a new non-rot user.
 Enter the details and click OK.

12. Packing group selection:


You can select package groups which groups components together or individual packages
or a combination of the two.

Viva Questions:
1) NTFS stands for_____________?
2) What is the use of product key in the installation process of software?
3) How many characters does a product key contain fro windows XP?
4) Describe different kinds of Microsoft Operating systems?
5) What are the pre-arrangements for installing the windows OS?
6) Give the advantages of Linux over other OS?
7) What do you mean by open source OS?
8) What are the commands used to make disk partitioning manually in Linux OS?
9) What do you mean by dual boot systems?
10) Which type of file systems are required to install hard disk at the time of installation of
Linux OS?
13 | P a g e
Week3:

Difference between Hardware and Software:


Hardware
It refers to any physical component of computer. Hardware is the part of the computer that we
can touch and feel. It is made up of interconnected electronic devices that control the operations
of the computer.
A computer system has the following hardware components:
Motherboard, Input Devices, Output Devices, Storage Devices, Cards, Ports and Cords, Power
Supply, Processor, Memory.

Software
It refers to the programs to run the computer. Software is a group of instructions that tell the
hardware what to do. These instructions are also called ‘programs’.
Ex: Ms Outlook Express, ASP, VB, Java, MS Office etc.

Microsoft Office and its Tools


Office Tools is a set of several tools like Word, Excel, and PowerPoint etc.
MS Word -> used for word processing
MS Excel -> used for calculation and analysis of data
MS PowerPoint -> used for business and technical presentations

Ms Word
INTRODUCTION TO MS-WORD
Let us consider an office scene. Many letters are typed in the office. The officer dictates a letter.
The typist first types a draft copy of the letter. The officer goes through it to check mistakes
regarding spelling errors, missing words, etc. and suggests corrections. The typist changes the
letter as suggested by the officer. This is a simple example of word processing.
There are many software packages to do the job of word processing. Some of them work in DOS
environment. Example are WordStar, Word Perfect and Professional Write. But in these days
working in WINDOWS is becoming more and more popular. So let us consider software for
word processing which works in WINDOWS. Our choice is MS-WORD because it is the most
popular software in these days.
MS-WORD is a part of the bigger package called MS OFFICE, which can do much more than
word processing. In fact when you open up MS OFFICE you will find four main components in
it. They are MS-WORD (for word processing), MS EXCEL (for spreadsheet), MS ACCESS (for
database management) and MS POWERPOINT (for presentation purposes). However, we will
limit ourselves to MS-WORD only in this lesson.

Objectives
After going through this lesson you should be in a position to
 start the MS-WORD package
 be familiar with the MS-WORD screen
 advantages and Features of Word Processing
 some common Word Processing Packages

14 | P a g e
 how to invoke Ms-Word
 learn the capabilities of Ms-Word

What is Word-Processing?
Word Processor is a Software package that enables you to create, edit, print and save documents
for future retrieval and reference. Creating a document involves typing by using a keyboard and
saving it. Editing a document involves correcting the spelling mistakes, if any, deleting or
moving words sentences or paragraphs.

(a) Advantages of Word Processing


One of the main advantages of a word processor over a conventional typewriter is that a word
processor enables you to make changes to a document without retyping the entire document.

(b) Features of Word Processing


Most Word Processor available today allows more than just creating and editing documents.
They have wide range of other tools and functions, which are used in formatting the documents.
The following are the main features of a Word Processor
i. Text is typing into the computer, which allows alterations to be made easily.
ii. Words and sentences can be inserted, amended or deleted.
iii. Paragraphs or text can be copied /moved throughout the document.
iv. Margins and page length can be adjusted as desired.
v. Spelling can be checked and modified through the spell check facility.
vi. Multiple document/files can be merged.
vii. Multiple copies of letters can be generated with different addresses through the mail-
merge facility.
(c) Some Common Word Processing Packages
The followings are examples of some popular word processor available
 Softword
 WordStar
 Word perfect
 Microsoft word

Important Features of MS-WORD


Ms-Word not only supports word processing features but also DTP features. Some of the
important features of Ms-Word are listed below:
i. Using word you can create the document and edit them later, as and when required, by
adding more text, modifying the existing text, deleting/moving some part of it.
ii. Changing the size of the margins can reformat complete document or part of text.
iii. Font size and type of fonts can also be changed. Page numbers and Header and Footer
can be included.
iv. Spelling can be checked and correction can be made automatically in the entire docu-
ment. Word count and other statistics can be generated.

15 | P a g e
v. Text can be formatted in columnar style as we see in the newspaper. Text boxes can be
made.
vi. Tables can be made and included in the text.
vii. Word also allows the user to mix the graphical pictures with the text. Graphical pictures
can either be created in word itself or can be imported from outside like from Clip Art
Gallery.
viii. Word also provides the mail-merge facility.
ix. Word also has the facility of macros. Macros can be either attached to some function/spe-
cial keys or to a tool bar or to a menu.
x. It also provides online help of any option.

Getting Started With MS-WORD


We have already told you that for working in Ms-Word you should be familiar with WINDOWS.
If you have not covered WINDOWS so far then read that first and then go through MS-WORD.
By now you must be aware of the fact that a software package is improved from time to time.
These improvements are sold in the market as new versions of the same software. Thus you will
find many versions of MS-WORD being used in different offices. In this lesson we will cover
the version MS-WORD 97, which is latest in the market and contain many improvements over
the older versions. However, you do not have to worry if you have an older version such as
WORD 6.0 or WORD 95. All the commands available in these older versions are also available
in WORD 97 and they are compatible.
While working in MS-WORD you have to work with a mouse. Also one can work, to some ex-
tent, through the keyboard. The use of mouse is simpler as it is fully menu driven. In MS-WORD
every command is available in the form of ‘icons’.
Let us discuss the important components of the screen.
a. Title Bar
The title bar displays the name of the currently active word document. Like other
WINDOWS applications, it can be used to alter the size and location of the word
window.
b. Tool Bars
Word has a number of tool bars that help you perform task faster and with great ease.
Two of the most commonly tool bars are the formatting tool bar and the standard tool bar.
These two toolbars are displayed just below the title bar. At any point of time any tool bar
can be made ON or OFF through the tool bar option of View Menu.
c. Ruler Bar
The Ruler Bar allows you to format the vertical alignment of text in a document.
d. Status Bar
The Status Bar displays information about the currently active document. This includes
the page number that you are working, the column and line number of the cursor
position and so on.
e. Scroll Bar

16 | P a g e
The Scroll Bar helps you scroll the content or body of document. You can do so by
moving the elevator button along the scroll bar, or by click in on the buttons with the
arrow marked on them to move up and down and left and right of a page.
f. Workspace
The Workspace is the area in the document window were you enter/type the text of your
document.
g. Main Menu
The Word main menu is displayed at the top of the screen as shown in the Fig. 9.1. The
main menu further displays a sub menu. Some of the options are highlighted options and
some of them appear as faded options. At any time, only highlighted options can be
executed, faded options are not applicable. Infect if the option is faded you will not be
able to choose it. You may not that any option faded under present situation may become
highlighted under different situations.

Starting MS Word
Click on Start -> Programs -> Microsoft Word
Major operations of MS Word
1. Create, open, save and print the documents.
2. Typing, editing, cut, copy, paste and justify the text.
3. Spell check & grammatical errors.
4. Format the paragraphs.
5. Create & manipulate tables.
6. Using Spell-checker.
7. Page setup, paper size, margin, header, footer, page numbering.
8. Word count.

Ms Power Point Presentation

Introduction:
Microsoft PowerPoint is a software product used to perform computer-based presentations.
There are various circumstances in which a presentation is made: teaching a class, introducing a
product to sell, explaining an organizational structure, etc.
There are two main kinds of presentations you can deliver: before an audience or not. The prepa-
ration and the actual delivery of each are quite different. Before getting into the details of each,
we will first take a look at the software and analyze what it has to offer.
Starting Microsoft PowerPoint
 To use Microsoft PowerPoint, you must first open it:
One way you can open Microsoft PowerPoint by clicking Start -> (All) Programs ->
Microsoft Office Microsoft Office PowerPoint.
 Sometimes somebody may send you a Microsoft PowerPoint presentation as an E-Mail
attachment, a file on a floppy disk, or a file on the network, etc. The file is usually repre -
sented by a Microsoft PowerPoint icon. You can double-click the icon to launch
Microsoft PowerPoint and immediately open the presentation.

17 | P a g e
 You can open Microsoft PowerPoint using a shortcut. If you happen to use the software
on a regular basis, you can create a shortcut on your desktop or on the Quick Launch
area. Many users also take advantage of the Microsoft Office Shortcut Bar. Sometimes,
the icon you need will not be there; in that case you should insert it manually.
 If you are working on a network of related computers, a presentation may be located in
another computer. Once you locate the computer or the folder on the network and you see
the Microsoft PowerPoint icon, you can double-click it. This would open the application
and the presentation. The network administrator can also create a link or shortcut to the
drive that is hosting the presentation. You can then click or double-click this link or
shortcut to open the presentation and, as a result, launch Microsoft PowerPoint.

Creating a New Presentation


Shows the opening window that you see when you start PowerPoint and begin a new presenta-
tion. If you close the Slide and Outline tabs window on the left side of the screen, you gain more
room to work on the individual presentation slides that appear in the center of the screen.
Select the New Presentation task pane by clicking the task pane's down arrow and selecting New
Presentation. This task pane includes an option under the New section labeled From Design
Template. Instead of starting to work right away on a blank (and generic) presentation, you can
click the option to choose from one of many predefined presentation templates. Click the option
now to see your New Presentation task pane change to the Slide Design task pane as shown in
The task pane displays a list of many presentation style choices, all defined by templates. The
idea is that you find the style you like and click that style, and your presentation's elements such
as headings, background artwork, and fonts all have a uniform appearance and tone.

Creating Presentations Using Design Templates


As you learned in this lesson's first section, you can begin working on your presentation's first
slide the moment you start PowerPoint. Instead of letting the AutoContent Wizard generate a
sample presentation, you can select from one of the templates to get your presentation started
with a design and then add slides as you create your presentation using the same template so that
your presentation maintains a uniform appearance.
Note
If you click the toolbar's New button, PowerPoint does not open the New Presentation task pane
but begins a new presentation with a blank slide and the Slide Layout task pane, as Figure 11.5
shows. The presentation often includes placeholders that you can use to enter your presentation's
content. You can choose from among the layouts to generate each slide's look. You won't have
the uniformity throughout your presentation that a template would give you, but at the same time
you have more flexibility to create exactly the look you require.

18 | P a g e
Figure 11.5 You can forgo the AutoContent Wizard and templates and add slides that fit any lay-
out.
When you finish with a slide and you are ready to add the next one, click the New Slide toolbar
button and PowerPoint adds a blank slide to your presentation and presents the Slide Layout task
pane once more. A presentation contains one or more slides, so you need to click the New Slide
button every time you are ready to add the next slide to your presentation.
You can change the template design at any point while you're developing your presentation. To
do so, just click the toolbar's Design button and the templates appear in the Slide Design task
pane. When you select a template, PowerPoint converts your entire presentation to that tem-
plate's format. Each slide's background image and standard text such as headings and footers
then take on a uniform appearance. If you click another template, PowerPoint converts the entire
presentation once again to that new template. You can experiment with different templates to see
which, if any, match the tone of presentation you want to achieve.
The instructions on the template's generated slide, as shown in Figure 11.6, indicate what to do
next
These preset areas on each slide (placeholders) are designed to accept various kinds of data and
make entering information on slides a snap. For example, you can click in a text placeholder and
then type your text. In most cases, you edit the text, possibly change colors, and perhaps add a
graphic image to the slide. Placeholders help you more easily do this.

Figure 11.6 The template's placeholders provide instructions you follow to create a unique slide.
After you add the presentation's final slide, you can save your presentation. You can save the
presentation in PowerPoint format or in HTML for embedding into Web pages. Even if your pre-
sentation has video and other multimedia content, you can save the presentation as a Web page
for viewing from a browser.
You can save a presentation in much the same way as you save a file in Word or Excel. Choose
File, Save As and then specify a name for your presentation. PowerPoint automatically adds the
filename extension .ppt to your presentation's file.
Note
As you can see, if you start out designing your own slides without the use of a template, you can,
at any time later, apply one of the template styles to the slide. Therefore, if you don't like what
you generate from scratch, you can redesign the slide or entire presentation without re-entering

19 | P a g e
the slide's text. If you save a presentation as a template file, you can use that presentation's for-
mat for subsequent presentations.
Note
Without a template to get you started, presentations require that you manually create every slide
element, including the text, titles, and body. Most slides have a title and text, and many have a
graphic image. Why not let the AutoContent Wizard or the templates start things off right? The
predefined slides work for so many purposes. Resist the temptation to create your slides from
scratch until you acquaint yourself with the predefined slides. In most cases, the AutoContent
Wizard and templates provide exactly what your presentation needs.

Different ways to create a PowerPoint presentation


AutoContent Wizard -> it contains content & design
Design Template -> it contains only design but doesn’t include content
Blank Presentation -> it does not contain either content or design

AutoContent Wizard
In this method, user can create a presentation on suggested content and designs.
information according to their own.

Blank Presentation
It creates a new, blank presentation using the default settings for text and colors.

Starting MS PowerPoint
Click on Start -> Programs -> Microsoft PowerPoint
Major operations of MS PowerPoint
1. Create, open, save the presentation.
2. Add new slide(s) to the existing presentation.
3. View the presentation.
4. Start slide show.
5. Delete a slide.
6. Change the formatting.
7. Apply animation.

Opening an Existing Presentation


Select Open an Existing Presentation from the picture.
Click on your presentation in the white box.
1. If you do not see your presentation in the white box, select More Files
and hit OK. Locate you existing Presentation and hit the Open button.

Week 4:
MS EXCEL (Microsoft Excel)
Microsoft Excel is allows user to create professional spreadsheets and charts. It performs
numerous functions and formulas to assist users in their projects.
A spreadsheet is a simple worksheet comprising of rows and columns, which allows storage of
data in the format of rows and columns.

20 | P a g e
With Microsoft Excel 2000, user can create detailed spreadsheets for viewing and collaboration.
User can create customized formulas for data and analyze it with the easy to construct charts.

Starting MS Excel

Click on Start -> Programs -> Microsoft Excel

Major operations of MS Excel


1. Create, open, save, edit workbook.
2. Page setup, menu commands, and alignment.
3. Calculation in the worksheet, entering & editing a formula.
4. Working with Charts (Line chart, Bar chart, Pie chart etc.).
Example of a Spreadsheet:

Overview of toolbars:

21 | P a g e
22 | P a g e
23 | P a g e
Selecting cell ranges

24 | P a g e
Saving excel files:

Grid lines:
Gridlines are the faint lines that appear around cells in Excel 2007. They are used to distinguish
cells on the worksheet.

25 | P a g e
Format cells:
A style in Excel 2007 is a combination of formatting options that is named and saved as part of
your current spreadsheet file. The new style can then quickly be applied to data and cells in the
spreadsheet.

Steps to Create a Custom Formatting Style in Excel 2007


1. Select a single spreadsheet cell.
2. Apply all desired formatting options to this cell.
3. Click the Home tab on the ribbon.
4. Click on the Cell Styles option on the ribbon to open the Cell Styles gallery.
5. Click on the New cell styles option at the bottom of the gallery to open the Style dialog
box.
6. Type a name for the new style in the Style name box.
7. The formatting options already applied to the selected cell will be listed in the dialog box.

To make additional formatting options or modify the current choices:


1. Click on the Format button in the Style dialog box to open the Format Cells dialog box.
2. Click on the appropriate tab in the dialog box.
3. Make the desired changes.
4. Click OK to close the Format Cells dialog box.
5. Click OK to close the Style dialog box.
6. The new style is added to the top of the Cell Styles gallery
To apply the new style to cells in your spreadsheet
1. Select the desired cells.
2. Click the Home tab on the ribbon.
3. Click on the Cell Styles option on the ribbon to open the Cell Styles gallery.

26 | P a g e
4. Click on the new style name at the top of the gallery.
5. The style's formatting is immediately applied to the selected cells.

This will automatically color the items based on the range they are in…

Summation:
Probably the most popular function in any spreadsheet is the SUM function. The Sum function
takes all of the values in each of the specified cells and totals their values. The syntax is:

27 | P a g e
 =SUM(first value, second value, etc)
In the first and second spots you can enter any of the following (constant, cell, range of cells).
 Blank cells will return a value of zero to be added to the total.
 Text cells cannot be added to a number and will produce an error.

A
Let's use the table here for the discussion that follows: 1 25
We will look at several different specific examples that show how 2 50
the typical function can be used! Notice that in A4 there is a
TEXT entry. This has NO numeric value and can not be included 3 75
in a total. 4 test
5

Example Cells to ADD Answer


=sum(A1:A3) A1, A2, A3 150
=sum(A1:A3, 100) A1, A2, A3 and 100 250
=sum(A1+A4) A1, A4 #VALUE!
=sum(A1:A2, A5) A1, A2, A5 75

Auto fill:
When you fill in data based on adjacent cells by dragging the fill handle in Microsoft Excel, the
Auto Fill Options button is displayed just below and to the right of your filled selection. When
you click the Auto Fill Options button, a list of options appears that allows you to choose to fill
the cells with text or data, and whether or not to include the format of the initial selection or to
copy only the format.

The Auto Fill Options button is also displayed after you select the AutoFill option in the Series
dialog box. To show the Series dialog box, use one of the following procedures, as appropriate
for the version of Excel that you are running:
 In Microsoft Office Excel 2007 and Excel 2010, click the Home tab, and then click Fill
in the Editing group.

28 | P a g e
 In Microsoft Office Excel and in earlier versions of Excel, point to Fill on the Edit menu,
and then click Series.
The options that are available depend on the type of content in the cells (text or numbers) and on
the format of the data. You can use the Series command to find the AutoFill option and other
options.
Fill down:
Often we have several cells that need the same formula (in relationship) to the location it is to be
typed into. There is a short cut that is called Fill Down. There are a number of ways to perform
this operation. One of the ways is to
1. select the cell that has the original formula
2. hold the shift key down and click on the last cell (in the series that needs the formula)
3. under the edit menu go down to fill and over to down
A B C
Cells information is copied from its relative position. In other words in the
1 5 3 =A1+B1 original cell (C1) the equation was (A1+B1). When we paste the function
2 8 2 fill down it will look to the two cells to the left. So the equation pasted into (C2)
3 4 6 fill down would be (A2+B2). And the equation pasted into (C3) would be (A3+B3).
And the equation pasted into (C4) would be(A4+B4).
4 3 8 fill down
Fill right:
We can also fill right. We must select the original cell (and the cells to the right) and select from
the Edit menu -- Fill and Right.
A B C
1 =A2+$B$3 =B2+$B$3 =C2+$B$3 If we were to fill right from A1 to C1 we would get the
formulas displayed to the left. Notice that the second
2 6 2 5
part of the equation is FIXED or (ABSOLUTE
3 7 10 4 REFERENCE so always references B3 which is 10).
4 9 8 7

Answers would be A1=16, B1=12, C1=15.

Formatting text:
We can use most of the tricks in our word processor to do the formatting of text. We can use :
bold face, italics, underline, change the color, align (left, right, center), font size, font, etc.
We need to select the cell (or group of cells) that we wish to change the formatting and then go
from the FORMAT menu -- down to CELLS -- click on FONT. Here is a picture of what you
will see there. Notice that you can choose to change the alignment as well as several other
options.

29 | P a g e
Formula in excel:
Excel Formulas
A formula is nothing more than an equation that you write up. In Excel a typical formula might
contain cells, constants, and even functions. Here is an example Excel formula that we have la-
beled for your understanding.
Advertise on Tizag.com
=B3 * 5 / SUM(B4:B7)
 cell(s): B3 and the range of cells from B4:B7
 constant(s): 5
 function(s): SUM()
There are many functions built into many spreadsheets. One of the first ones that we are going to
discuss is the Average function. The average function finds the average of the specified data.
(Simplifies adding all of the indicated cells together and dividing by the total number of cells.)
The syntax is as follows.
 =Average (first value, second value, etc.)
Text fields and blank entries are not included in the calculations of the Average Function.

A
1 25
Let's use the table here for the discussion that follows: 2 50
We will look at several different specific examples that show how
the average function can be used! 3 75
4 100
5

Example Cells to average Answer


=average (A1:A4) A1, A2, A3, A4 62.5

30 | P a g e
=average (A1:A4,
A1, A2, A3, A4 and 300 110
300)
=average (A1:A5) A1, A2, A3, A4, A5 62.5
=average (A1:A2,
A1, A2, A4 58.33
A4)

Excel Formulas: Creating Your First Formula


This first formula will be as simple as they come and will teach you the basic form of an Excel
formula. Create a new spreadsheet and then follow these steps:
1. Select cell A1
2. Type the following basic arithmetic formula into cell A1: =1+1

3. Press Enter and notice how cell A1 changes from your formula to the result!

This may seem simple, but there are a some very important things you should get out of this ex -
ample. When you start off a cell entry with the equal sign "=" you are telling Excel that you want
it to evaluate the following formula.
In our case we had a simple "1+1" we wanted Excel to solve for us. You can do this for addition,
subtraction, multiplication, division and any other operation you can think of.
Remember, if you do not start your entry with the equal sign, then Excel will not evaluate the
cell!
Using Cells to Create Dynamic Formulas
The most powerful aspect of Excel is not the simple calculator abilities we describes in our first
formula example, but rather the ability to take values from cells to be used in your formulas.
Let's set up a basic sales spreadsheet to help explain this topic.
1. In cells A1-D4 enter the following information:

31 | P a g e
Notice: that cell D2 and D3 are blank, but should contain the amount of money from sell-
ing 150 candy items and 3 vegetables. By referencing the Quantity and Price cells we will
be able to do this! Let's begin with Candy.
2. Note:It is very important to follow these steps exactly without interruptions! Select cell
D2, candy's "revenue", and type the equal sign "=" to begin your formula.
3. Left-click on cell B2, Candy's Quantity and notice your formula is now "=B2"

4. We want to multiply Quanity(B2) by Price(B3) so enter an asterisk (*)

5. Now left-click on Candy's Price (C2)to complete your formula!

32 | P a g e
6. If your formula looks like ours then press Enter, otherwise you can manually enter the
formula "=B2*C2". However, we really think it is easier and preferred to click on cells to
reference them, instead of entering that information manually.
7. After you pressed Enter your Candy Revenue cell should be functioning properly and
contain the value 75.

8. Using your newly gained knowledge please complete Vegetable's Revenue by repeating
steps 2-7 for Vegetable
9. Your spreadsheet should now look like this:

10. Cheatsheet: If you are having trouble creating the formula for Vegetable's Revenue it is
"=B3*C3"
Advanced Excel Formulas: Using Formulas in Formulas
Now that we have created separate revenues for both Candy and Vegetable it would be nice to
somehow combine these two values to get the Total Revenue. Although both Vegetable Revenue
and Candy Revenue contain formulas, we can still use these cells as we have been doing and add
them together to get our total.
1. Select cell D5 (directly below "Total")
2. Type the equal sign "="
3. Left-click cell D2
4. Type the plus sign "+"

33 | P a g e
5. Left-click cell D3. Cell D5 should now contain this formula "=D2+D3":

6. Press Enter to complete your Total Revenue!

Creating Charts
In Microsoft Excel, you can represent numbers in a chart. On the Insert tab, you can choose from
a variety of chart types, including column, line, pie, bar, area, and scatter. The basic procedure
for creating a chart is the same no matter what type of chart you choose. As you change your
data, your chart will automatically update.
You select a chart type by choosing an option from the Insert tab's Chart group. After you choose
a chart type, such as column, line, or bar, you choose a chart sub-type. For example, after you
choose Column Chart, you can choose to have your chart represented as a two-dimensional chart,
a three-dimensional chart, a cylinder chart, a cone chart, or a pyramid chart. There are further
sub-types within each of these categories. As you roll your mouse pointer over each option, Ex-
cel supplies a brief description of each chart sub

Create a Chart

34 | P a g e
To create the column chart shown above, start by creating the worksheet below exactly as
shown.

After you have created the worksheet, you are ready to create your chart.

35 | P a g e
Create a Column Chart

1. Select cells A3 to D6. You must select all the cells containing the data you want in your
chart. You should also include the data labels.
2. Choose the Insert tab.
3. Click the Column button in the Charts group. A list of column chart sub-types types ap-
pears.
4. Click the Clustered Column chart sub-type. Excel creates a Clustered Column chart and
the Chart Tools context tabs appear.

Apply a Chart Layout


Context tabs are tabs that only appear when you need them. Called Chart Tools, there are three
chart context tabs: Design, Layout, and Format. The tabs become available when you create a
new chart or when you click on a chart. You can use these tabs to customize your chart.
You can determine what your chart displays by choosing a layout. For example, the layout you
choose determines whether your chart displays a title, where the title displays, whether your
chart has a legend, where the legend displays, whether the chart has axis labels and so on. Excel
provides several layouts from which you can choose.

36 | P a g e
Apply a Chart Layout

1. Click your chart. The Chart Tools become available.


2. Choose the Design tab.
3. Click the Quick Layout button in the Chart Layout group. A list of chart layouts appears.
4. Click Layout 5. Excel applies the layout to your chart.

Add Labels
When you apply a layout, Excel may create areas where you can insert labels. You use labels to
give your chart a title or to label your axes. When you applied layout 5, Excel created label areas
for a title and for the vertical axis.

Add labels

Before After

1. Select Chart Title. Click on Chart Title and then place your cursor before the C in Chart
and hold down the Shift key while you use the right arrow key to highlight the words
Chart Title.
2. Type Toy Sales. Excel adds your title.
3. Select Axis Title. Click on Axis Title. Place your cursor before the A in Axis. Hold down
the Shift key while you use the right arrow key to highlight the words Axis Title.

37 | P a g e
4. Type Sales. Excel labels the axis.
5. Click anywhere on the chart to end your entry.
Switch Data
If you want to change what displays in your chart, you can switch from row data to column data
and vice versa.
Switch Data

Before After

1. Click your chart. The Chart Tools become available.


2. Choose the Design tab.
3. Click the Switch Row/Column button in the Data group. Excel changes the data in your
chart.

Change the Style of a Chart


A style is a set of formatting options. You can use a style to change the color and format of your
chart. Excel 2007 has several predefined styles that you can use. They are numbered from left to
right, starting with 1, which is located in the upper-left corner.
Change the Style of a Chart

38 | P a g e
1. Click your chart. The Chart Tools become available.
2. Choose the Design tab.
3. Click the More buttons in the Chart Styles group. The chart styles appear.

4. Click Style 42. Excel applies the style to your chart.

Change the Size and Position of a Chart


When you click a chart, handles appear on the right and left sides, the top and bottom, and the
corners of the chart. You can drag the handles on the top and bottom of the chart to increase or
decrease the height of the chart. You can drag the handles on the left and right sides to increase
or decrease the width of the chart. You can drag the handles on the corners to increase or de -
crease the size of the chart proportionally. You can change the position of a chart by clicking on
an unused area of the chart and dragging. Change the Size and Position of a Chart

39 | P a g e
1. Use the handles to adjust the size of your chart.
2. Click an unused portion of the chart and drag to position the chart beside the data.

Move a Chart to a Chart Sheet


By default, when you create a chart, Excel embeds the chart in the active worksheet. However,
you can move a chart to another worksheet or to a chart sheet. A chart sheet is a sheet dedicated
to a particular chart. By default Excel names each chart sheet sequentially, starting with Chart1.
You can change the name.

Move a Chart to a Chart Sheet

1. Click your chart. The Chart Tools become available.


2. Choose the Design tab.
3. Click the Move Chart button in the Location group. The Move Chart dialog box appears.

40 | P a g e
4. Click the New Sheet radio button.
5. Type Toy Sales to name the chart sheet. Excel creates a chart sheet named Toy Sales and
places your chart on it.

Change the Chart Type


Any change you can make to a chart that is embedded in a worksheet, you can also make to a
chart sheet. For example, you can change the chart type from a column chart to a bar chart.

Change the Chart Type

1. Click your chart. The Chart Tools become available.


2. Choose the Design tab.
3. Click Change Chart Type in the Type group. The Chart Type dialog box appears.
4. Click Bar.
5. Click Clustered Horizontal Cylinder.
6. Click OK. Excel changes your chart type.

41 | P a g e
Hyper linking:
In Excel, the Hyperlink function creates a shortcut to a file or Internet address.
The syntax for the Hyperlink function is:
Hyperlink ( link, display_name )
link is a path to the file or the URL to the Internet address.
display_name is optional. It is the value that appears in the cell. If this parameter is omitted, then
the link will appear in the cell.
For example:

In our first example, we're using the Hyperlink function to reference a file called "Doc1.doc" that
can be found in the c:\test\ directory. The following formula has been entered in cell A1:
=Hyperlink("c:\test\Doc1.doc","Test document")

42 | P a g e
When a user clicks on cell A1, the Word document called "Doc1.doc" will automatically open.

In our second example, we're using the Hyperlink function to reference an Internet address. The
following formula has been entered in cell A1:
=Hyperlink("http://www.techonthenet.com","Tech on the Net")
When a user clicks on cell A1, the default web browser will open to the site called
www.techonthenet.com.

Count function:
Excel's COUNT function is one of a group of Count Functions that can be used when you need
to total the number of cells in a selected range.
The COUNT function's job is to only add up the cells in a selected range that contain numbers. It
ignores empty cells or those contain text. If a number is later added to an empty cell the function
will be automatically updated to include this new data.
Be aware that dates, times, functions, and formulas are stored as numbers in Excel. The COUNT
function will, therefore, include any cells containing these types of data in the total.
The syntax for the COUNT function is:
=COUNT( Range )
Range - the group of cells the function is to count.
Example Using Excel 2007's COUNT Function:
Note: For help with this example, see the image above.
1. Enter the following data into cells D1 to D4: 11, twelve, 13, 14.
2. Enter the following data into cell D6: 16.
3. Note that we have intentionally left cell D5 blank.
4. Click on cell E1 - the location where the results will be displayed.
5. Click on the Formulas tab.
6. Choose More Functions > Statistical from the ribbon to open the function drop down
list.
7. Click on COUNT in the list to bring up that function's dialog box.
8. Drag select cells D1 to D6 on the spreadsheet to enter the range into the dialog box.

43 | P a g e
9. Click OK.
10. The answer 4 should appear in cell E1 since only four of the six cells in the range contain
numbers.
11. Cell D2, which contains text, and cell D5, which is blank, are ignored by the COUNT
function.
12. When you click on cell E1 the complete function =COUNT( D1 : D6 ) appears in the
formula bar above the worksheet.

Lookup/Vlookup :
Lookup:
The Lookup Value

The lookup value is located in the first column of the table of data. After specifying a subject in
the first column, VLOOKUP will then allow you to search for specific information located in the
same row as the subject.
The lookup value can be a text string, a logical value (TRUE or FALSE only), a number, or a
cell reference to a value.
It is a good idea to use an absolute cell reference for the lookup value.
If you don’t use an absolute reference and you copy the VLOOKUP function to other cells, there
is a good chance you will get error messages in the cells the function is copied to.

Vlookup:
Excel VLOOKUP Function

44 | P a g e
Excel's VLOOKUP function, which stands for vertical lookup, can help you find specific
information in large data tables such as an inventory list of parts or a large membership contact
list.

Sorting:
Excel's sort feature is a quick and easy way to sort data in a spreadsheet. The options for sorting
your data include:
 Sort in ascending order - A to Z alphabetically or smallest to largest for number data.
 Sort in descending order - Z to A alphabetically or largest to smallest for number data.
 Custom sort - includes sorting by the cell background color or the font color of the data.

Example: Sort Data in Excel


For help with this example, see the image above.
1. Enter the following data into cells A1 to A6: 40, 20, 30, 60, 5, 25.
2. Drag select cells A1 to A6 to highlight them.

3. Click on the Home tab of the ribbon.


4. Click on the Sort & Filter icon on the ribbon to open the drop down list.
5. Click on Sort smallest to largest.

45 | P a g e
6. The data in cells A1 to A6 should now be in this order:
5, 20, 25, 30, 40, 60.

Note: Excel knows the difference between text and number data and adjust the options in the
drop down list accordingly. For example, if cells A1 to A6 contained text - such as words or
letters of the alphabet - instead of numbers the options in the Sort & Filter drop down list would
change to Sort A to Z instead of Sort smallest to largest .

Also Note: If you have multiple columns of related data and you wish to perform a simple sort
on one of those columns - such as sorting an address list by the person's last name - remember to
select all columns of related data before carrying out the sort in order to keep your data together.

Conditional formatting:
You can also create your own rule to color only cells that fit within a certain range, or greater
than a certain number.

This rule will only color cells greater than a certain amount, with the color you specify.

46 | P a g e
This can be very useful, and you should note that you can apply a second rule to the same range.
For instance, I added a second rule that colored items larger than 2000 with green instead of red.

47 | P a g e
Python Programming Lab
Week -1:
1. Use a web browser to go to the Python website http://python.org. This page contains
information about Python and links to Python-related pages, and it gives you the ability
to search the Python documentation.
2. Start the Python interpreter and type help() to start the online help utility.
3. Start Python interpreter and use it as Calculator.

Week -2:
4. If you run a 10 kilometer race in 43 minutes 30 seconds, what is your average time per
mile? What is your average speed in miles per hour? (Hint: there are 1.61 kilometers in
a mile).
5. The volume of a sphere with radius r is 5? (Use Sphere volume formula)

6. Suppose the cover price of a book is $24.95, but bookstores get a 40% discount.
Shipping costs $3 for the first copy and 75 cents for each additional copy. What is
the total wholesale cost for 60 copies?

Week -3:
7. A function object is a value you can assign to a variable or pass as an argument. For
example, do_twice is a function that takes a function object as an argument and calls it
twice:
def do_twice(f):
f()
f()
Here’s an example that uses do_twice to call a function named print_spam twice.
def print_spam():
print 'spam'
do_twice(print_spam)
a. Type this example into a script and test it.
b. Modify do_twice so that it takes two arguments, a function object and a value, and
calls the function twice, passing the value as an argument.
c. Write a more general version of print_spam, called print_twice, that takes a string
as a parameter and prints it twice.
d. Use the modified version of do_twice to call print_twice twice, passing 'spam' as
an argument.

48 | P a g e
8. Write a function that draws a grid like the following:
+----+----+
| | |
| | |
| | |
+----+----+
| | |
| | |
| | |
| | |
+----+----+
Hint: to print more than one value on a line, you can print a comma-separated
sequence.
9. Write a function called gcd that takes parameters a and b and returns their
greatest common divisor.
10. Write a function called is_palindrome that takes a string argument and returns
True if it is a palindrome and False otherwise. Remember that you can use the
built-in function len to check the length of a string.

Week-4:
11. Write a function called is_sorted that takes a list as a parameter and returns True if the
list is sorted in ascending order and False otherwise.
12. Write a function called has_duplicates that takes a list and returns True if there is any
element that appears more than once. It should not modify the original list.
i) Write a function called remove_duplicates that takes a list and returns a new list
with
only the unique elements from the original. Hint: they don’t have to be in the same
order.
ii) The wordlist I provided, words.txt, doesn’t contain single letter words. So you might
want to add “I”, “a”, and the empty string.
iii) Write a python code to read a dictionary values from the user. Construct a function to
invert its content. i.e., keys should be values and values should be keys.

Week-5:
iv) If there are 23 students in your class, what are the chances that two of you have the
same birthday? You can estimate this probability by generating random samples of 23
birthdays and checking for matches.
Hint: you can generate random birthdays with the randint function in the random
module.
v) How does a module source code file become a module object?
vi) Why might you have to set your PYTHONPATH environment variable?
vii) What is a namespace, and what does a module’s namespace contain?
viii) How do you make a module? Give an example of construction of a module using
different geometrical shapes and operations on them as its functions.
ix) What is the purpose of a _ _init_ _.py file in a module package directory? Explain

49 | P a g e
with a suitable example.
x) Use the structure of exception handling all general purpose exceptions.

Week-6:
xi) a. Write a function called draw_rectangle that takes a Canvas and a Rectangle as
arguments and draws a representation of the Rectangle on the Canvas.

b. Add an attribute named color to your Rectangle objects and modify draw_rectangle
so that it uses the color attribute as the fill color.

c. Write a function called draw_point that takes a Canvas and a Point as arguments and
draws a representation of the Point on the Canvas.

d. Define a new class called Circle with appropriate attributes and instantiate a few
Circle objects. Write a function called draw_circle that draws circles on the canvas.

xii) Write a Python program to demonstrate the usage of MRO in multiple levels of
Inheritances.
xiii) Write a python code to read a phone number and email-id from the user and
validate it for correctness.

Week-7:
xiv) Write a Python code to merge two given file contents into third file.
xv) Write a Python code to open a given file and construct a function to check for given
words present in it and display on found.

Week-8:
xvi) Import numpy, Plotpy and Scipy and explore their functionalities.
xvii) Write a GUI program to create a window wizard having two text labels, two text
fields and two buttons as Submit and Reset.

50 | P a g e
Python Programming Lab
Week -1:
1. Use a web browser to go to the Python website
This page contains information about Python and links to Python-related pages, and it
gives you the ability to search the Python documentation.

2. Start the Python interpreter and type help() to start the online help utility.

51 | P a g e
3. Start Python interpreter and use it as Calculator.

Week -2:
4. The volume of a sphere with radius r is 5? (Use Sphere volume formula)

pi = 3.1415926535897931
2r= 6.0
V= 4.0/3.0*pi* r**3
print('The volume of the sphere is: ',V)
line that has just executed
5. Suppose the cover price of a book is $24.95, but bookstores get a 40% discount.
Shipping costs $3 for the first copy and 75 cents for each additional copy. What is the
total wholesale cost for 60 copies?
6. If you run a 10 kilometer race in 43 minutes 30 seconds, what is your average time per
mile? What is your average speed in miles per hour? (Hint: there are 1.61 kilometers in a
mile).

Week -3:
7. A function object is a value you can assign to a variable or pass as an argument. For
example, do_twice is a function that takes a function object as an argument and calls it
twice:
def do_twice(f):
f()
f()
Here’s an example that uses do_twice to call a function named print_spam twice.
def print_spam():
print 'spam'
do_twice(print_spam)
a. Type this example into a script and test it.

52 | P a g e
b. Modify do_twice so that it takes two arguments, a function object and a value, and
calls the function twice, passing the value as an argument.

c. Write a more general version of print_spam, called print_twice, that takes a string
as a parameter and prints it twice.

d. Use the modified version of do_twice to call print_twice twice, passing 'spam' as
an argument.

e. Write a function that draws a grid like the following:

+----+----+
|| |
| | |
|| |
+----+----+
| | |
| | |
| | |
|| |
+----+----+

Hint: to print more than one value on a line, you can print a comma-separated
sequence.

8. Write a function called gcd that takes parameters a and b and returns their greatest com-
mon divisor.
9. Write a function called is_palindrome that takes a string argument and returns
True if it is a palindrome and False otherwise. Remember that you can use the
built-in function len to check the length of a string.

Week-4:
10. . Write a function called is_sorted that takes a list as a parameter and returns True if the
list is sorted in ascending order and False otherwise.
def is_sorted(vlist):
n=len(vlist)
i=1
flag=0
while i<n:
if (vlist[i]>vlist[i-1]):
flag+=1
else:
break
i+=1
if flag==n-1:

53 | P a g e
return 'true'
else:
return 'false'
input_string=input("Enter the list elements:")
vlist= input_string.split()
print(is_sorted(vlist))

11. Write a function called has_duplicates that takes a list and returns True if there is any
element that appears more than once. It should not modify the original list.
def has_duplicates(vlist):
n=len(vlist)
rep=[]
for i in range(n):
k=i+1
for j in range(k,n):
if vlist[i]==vlist[j]:
return 'true'
return 'false'
input_string=input("Enter the list elements:")
vlist= input_string.split()
print(has_duplicates(vlist))

12. Write a function called remove_duplicates that takes a list and returns a new list with
only the unique elements from the original. Hint: they don’t have to be in the same

order.
def remove_duplicates(vlist):
final_list = []
for num in vlist:
if num not in final_list:
final_list.append(num)
return final_list
input_string=input("Enter the list elements:")
vlist= input_string.split()
print(remove_duplicates(vlist))

13. Write a python code to read a dictionary values from the user. Construct a function to
invert its content. i.e., keys should be values and values should be keys.

def invert_dict(d):
return dict([(v, k) for k, v in d.items()])
user_input = input("Enter key and value separated by commas (,): ")
key, value = user_input.split(",")
d=dict()
d[key]=value

54 | P a g e
print(invert_dict(d))

14. The wordlist I provided, words.txt, doesn’t contain single letter words. So you might
want to add “I”, “a”, and the empty string.

Week-5:
15. If there are 23 students in your class, what are the chances that two of you have the same
birthday? You can estimate this probability by generating random samples of 23
birthdays and checking for matches.
Hint: you can generate random birthdays with the randint function in the random
module.
import random
classSize = 23
numTrials = 1000
dupeCount = 0

for trial in range(numTrials):


birthdayList = []
for i in range(classSize):
newBDay = random.randint(1,365)
birthdayList.append(newBDay)

foundDupe = False
for num in birthdayList:
if birthdayList.count(num) > 1:
foundDupe = True

if foundDupe == True:
dupeCount = dupeCount + 1

prob = dupeCount / numTrials


print("The probability of a shared birthday in a class of ", classSize, " is ", prob)

16. How do you make a module? Give an example of construction of a module using
different geometrical shapes and operations on them as its functions.
from turtle import *
canvas = Screen()
canvas.setup(400,400)
def square():
sarah = Turtle()
sarah.forward(50)
sarah.left(90)
sarah.forward(50)
sarah.left(90)
sarah.forward(50)
sarah.left(90)

55 | P a g e
sarah.forward(50)
sarah.left(90)
canvas.exitonclick()
def rectangle():
sarah = Turtle()
sarah.forward(50)
sarah.left(90)
sarah.forward(20)
sarah.left(90)
sarah.forward(50)
sarah.left(90)
sarah.forward(20)
sarah.left(90)
canvas.exitonclick()
def hexagon():
sarah = Turtle()
sarah.forward(50)
sarah.left(60)
sarah.forward(50)
sarah.left(60)
sarah.forward(50)
sarah.left(60)
sarah.forward(50)
sarah.left(60)
sarah.forward(50)
sarah.left(60)
sarah.forward(50)

17. What is the purpose of a _ _init_ _.py file in a module package directory? Explain with
a suitable example.
class Rectangle:
def __init__(self, length, breadth, unit_cost=0):
self.length = length
self.breadth = breadth
self.unit_cost = unit_cost
def get_area(self):
return self.length * self.breadth
def calculate_cost(self):
area = self.get_area()
return area * self.unit_cost
r = Rectangle(160, 120, 2000)
print("Area of Rectangle: %s sq units" % (r.get_area()))

18. Use the structure of exception handling all general purpose exceptions.
try:
fh = open("testfile", "w")

56 | P a g e
try:
fh.write("This is my test file for exception handling!!")
finally:
print("Going to close the file")
fh.close()
except IOError:
print("Error: can\'t find file or read data")

19. How does a module source code file become a module object?

20. Why might you have to set your PYTHONPATH environment variable?

21. What is a namespace, and what does a module’s namespace contain?

Week-6:
22.a. Write a function called draw_rectangle that takes a Canvas and a Rectangle as
arguments and draws a representation of the Rectangle on the Canvas.

from swampy.TurtleWorld import *


class Point(object):
"represents a point in 2-D space"

p = Point()
p.x = 60
p.y = 15

class Rectangle(object):
"""Represents a rectangle."""
box = Rectangle()
box.color = 'blue'
box.bbox = [[-100, -60],[100, 60]]

class Canvas(object):
"""Represents a canvas.
attributes: width, height, background color"""
a_canvas = Canvas()
a_canvas.width = 500
a_canvas.height = 500

def draw_rectangle(canvas, rectangle):


drawn_canvas = world.ca(canvas.width, canvas.height)
drawn_canvas.rectangle(rectangle.bbox, fill=rectangle.color)

world = World()
draw_czech_republic_flag(a_canvas)
world.mainloop()

b. Write a function called draw_point that takes a Canvas and a Point as arguments
and draws a representation of the Point on the Canvas.

from swampy.TurtleWorld import *


class Point(object):

57 | P a g e
"represents a point in 2-D space"

p = Point()
p.x = 60
p.y = 15

class Canvas(object):
"""Represents a canvas.
attributes: width, height, background color"""
a_canvas = Canvas()
a_canvas.width = 500
a_canvas.height = 500

def draw_point(canvas, point):


bbox = [[point.x, point.y], [point.x, point.y]]
drawn_canvas = world.ca(canvas.width, canvas.height)
drawn_canvas.rectangle(bbox, fill="black")

world = World()
draw_czech_republic_flag(a_canvas)
world.mainloop()

c. Define a new class called Circle with appropriate attributes and instantiate a few
Circle objects. Write a function called draw_circle that draws circles on the canvas.

d. Add an attribute named color to your Rectangle objects and modify draw_rectan-
gle so that it uses the color attribute as the fill color.

23. Write a Python program to demonstrate the usage of MRO in multiple levels of
inheritances.

class Person:
#defining constructor
def __init__(self, personName, personAge):
self.name = personName
self.age = personAge

#defining class methods


def showName(self):
print(self.name)

def showAge(self):
print(self.age)

#end of class definition

# defining another class


class Student: # Person is the

58 | P a g e
def __init__(self, studentId):
self.studentId = studentId

def getId(self):
return self.studentId

class Resident(Person, Student): # extends both Person and Student class


def __init__(self, name, age, id):
Person.__init__(self, name, age)
Student.__init__(self, id)

# Create an object of the subclass


resident1 = Resident('John', 30, '102')
resident1.showName()
print(resident1.getId())

24.Write a python code to read a phone number and email-id from the user and validate it
for correctness.

Week-7:
25. Write a Python code to merge two given file contents into third file.

# Python Program - Merge Two Files

import shutil;
print("Enter 'x' for exit.");
filename1 = input("Enter first file name to merge: ");
if filename1 == 'x':
exit();
else:
filename2 = input("Enter second file name to merge: ");
filename3 = input("Create a new file to merge content of two file inside this
file: ");
print();
print("Merging the content of two file in",filename3);
with open(filename3, "wb") as wfd:
for f in [filename1, filename2]:
with open(f, "rb") as fd:
shutil.copyfileobj(fd, wfd, 1024*1024*10);
print("\nContent merged successfully.!");
print("Want to see ? (y/n): ");
check = input();
if check == 'n':
exit();
else:
print();

59 | P a g e
c = open(filename3, "r");
print(c.read());
c.close();

24. Write a Python code to open a given file and


construct a function to check for given words
present in it and display on found.

def txt_search_m(self):
files = [f for f in os.listdir(self.path1) if os.path.isfile(self.path1+"/"+f)]
file_number = 0
for file in files:
file_t = open(self.path1+"/"+file)
line_number=1
flag_file = 0
for line1 in file_t:
if self.i:
line1 = line1.lower()
if re.search(self.string2, line1):
flag_file= 1
print "The text "+self.string1+" found in ", file, " at line number ",line_number
line_number=line_number+1
if flag_file == 1:
file_number=file_number+1
flag_file=0
file_t.close()
print "total files are ",file_number

Week-8:
25. Import numpy, Plotpy and Scipy and explore their
functionalities.
NumPy - Introduction
NumPy is a Python package. It stands for 'Numerical Python'. It is a library con-
sisting of multidimensional array objects and a collection of routines for process-
ing of array.
Numeric, the ancestor of NumPy, was developed by Jim Hugunin. Another package Numarray
was also developed, having some additional functionalities. In 2005, Travis Oliphant created
NumPy package by incorporating the features of Numarray into Numeric package. There are
many contributors to this open source project.

Operations using NumPy


Using NumPy, a developer can perform the following operations −
1. Mathematical and logical operations on arrays.
2. Fourier transforms and routines for shape manipulation.

60 | P a g e
3. Operations related to linear algebra. NumPy has in-built functions for linear algebra
and random number generation.
4. o install NumPy, run the following command.
5. Python setup.py install
6. To test whether NumPy module is properly installed, try to import it from Python
prompt.
7. import numpy
8. If it is not installed, the following error message will be displayed.
9. Traceback (most recent call last):
10. File "<pyshell#0>", line 1, in <module>
11. import numpy
12. ImportError: No module named 'numpy'
Alternatively, NumPy package is imported using the following syntax –

Example 1
import numpy as np
import numpy as np
a = np.array([1,2,3])
print a
The output is as follows −
[1, 2, 3]

Example 2
# more than one dimensions
import numpy as np
a = np.array([[1, 2], [3, 4]])
print a
The output is as follows −
[[1, 2]
[3, 4]]

Example 3
# minimum dimensions
import numpy as np
a = np.array([1, 2, 3,4,5], ndmin = 2)
print a
The output is as follows −
[[1, 2, 3, 4, 5]]

Example 4
# dtype parameter

61 | P a g e
import numpy as np
a = np.array([1, 2, 3], dtype = complex)
print a
The output is as follows −
[ 1.+0.j, 2.+0.j, 3.+0.j]

62 | P a g e
SciPy - Introduction

SciPy, a scientific library for Python is an open source, BSD-licensed library for mathematics,
science and engineering. The SciPy library depends on NumPy, which provides convenient and
fast N-dimensional array manipulation. The main reason for building the SciPy library is that, it
should work with NumPy arrays. It provides many user-friendly and efficient numerical prac-
tices such as routines for numerical integration and optimization. This is an introductory tutorial,
which covers the fundamentals of SciPy and describes how to deal with its various modules.

Example 1
ip install plotly "notebook>=5.3" "ipywidgets>=7.2"
Inside Jupyter notebook:
import plotly.graph_objs as go
fig = go.FigureWidget()
# Display an empty figure
fig
# Add a scatter chart
fig.add_scatter(y=[2, 1, 4, 3])
# Add a bar chart
fig.add_bar(y=[1, 4, 3, 2])
# Add a title
fig.layout.title = 'Hello FigureWidget'
See the Python documentation for more examples.

63 | P a g e
Plotly - Introduction
plotly.py is an interactive, open-source, and browser-based graphing library for
Python :sparkles:
Built on top of plotly.js, plotly.py is a high-level, declarative charting library. plotly.js
ships with over 30 chart types, including scientific charts, 3D graphs, statistical charts,
SVG maps, financial charts, and more.
plotly.py is MIT Licensed. Plotly graphs can be viewed in Jupyter notebooks, stand-
alone HTML files, or hosted online on plot.ly.

Example 1(Scatter plot)

N = 100
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
sz = np.random.rand(N)*30

fig = go.Figure()
fig.add_scatter(x=x,
y=y,
mode='markers',
marker={'size': sz,
'color': colors,
'opacity': 0.6,
'colorscale': 'Viridis'
});
iplot(fig)

Example 2(Line Plot)

import plotly.plotly as py
import plotly.graph_objs as go

# Create random data with numpy


import numpy as np

N = 500
random_x = np.linspace(0, 1, N)
random_y = np.random.randn(N)

# Create a trace

64 | P a g e
trace = go.Scatter(
x = random_x,
y = random_y
)

data = [trace]

py.iplot(data, filename='basic-line')

Example 3(Bar plot)

import plotly.plotly as py
import plotly.graph_objs as go

data = [go.Bar(
x=['giraffes', 'orangutans', 'monkeys'],
y=[20, 14, 23]
)]

py.iplot(data, filename='basic-bar')

Example 4(Pie chart)


import plotly.plotly as py
import plotly.graph_objs as go

labels = ['Oxygen','Hydrogen','Carbon_Dioxide','Nitrogen']
values = [4500,2500,1053,500]

trace = go.Pie(labels=labels, values=values)

py.iplot([trace], filename='basic_pie_chart')

26. Write a GUI program to create a window wizard


having two text labels, two text fields and two
buttons as Submit and Reset.

Our first GUI will be a window with a label and two buttons:
from tkinter import Tk, Label, Button

class MyFirstGUI:
def __init__(self,master):
self.master = master
master.title("A simple GUI")

65 | P a g e
self.label = Label(master, text="This is our first GUI!")
self.label.pack()

self.greet_button = Button(master, text="Greet", command=self.greet)


self.greet_button.pack()

self.close_button = Button(master, text="Close", command=master.quit)


self.close_button.pack()

def greet(self):
print("Greetings!")

root = Tk()
my_gui = MyFirstGUI(root)
root.mainloop()

Example for the Button Class


The following script defines two buttons: one to quit the application and another one for the
action, i.e. printing the text "Tkinter is easy to use!" on the terminal.
import tkinter as tk

def write_slogan():
print("Tkinter is easy to use!")

root = tk.Tk()
frame = tk.Frame(root)
frame.pack()

button = tk.Button(frame,
text="QUIT",
fg="red",
command=quit)
button.pack(side=tk.LEFT)
slogan = tk.Button(frame,
text="Hello",
command=write_slogan)
slogan.pack(side=tk.LEFT)
root.mainloop()

66 | P a g e
The result of the previous example looks like this:

67 | P a g e
SREENIDHI INSTITUTE OF SCIENCE & TECHNOLOGY
(AN AUTONOMOUS INSTITUTION UNDER JNTUH)
(Approved by AICTE & Aided by World Bank under TEQIP )
Yamnampet, Ghatkesar Mandal, Hyderabad - 501 301.

DATABASE MANAGEMENT SYSTEMS


LAB MANUAL

For
B. Tech. II year – II SEM
ELECTRONICS AND COMPUTER ENGINEERING

DEPARTMENT
OF
ELECTRONICS AND COMPUTER ENGINEERING

68 | P a g e
DATABASE MANAGEMENT SYSTEMS LABORATORY SYLLABUS
L T P/D C
- - 3 2

1. Creation, altering and droping of tables and inserting rows into a table (use
constraints while creating tables) examples using SELECT command.
2. Queries (along with sub Queries) using ANY, ALL, IN, EXISTS,
NOTEXISTS, UNION, INTERSET, Constraints.
Example: - Select the roll number and name of the student who secured fourth
rank in the class.
3. Queries using Aggregate functions (COUNT, SUM, AVG, MAX and MIN),
GROUP BY, HAVING and Creation and dropping of Views.
4. Queries using Conversion functions (to_char, to_number and to_date), string
functions
(Concatenation, lpad, rpad, ltrim, rtrim, lower, upper, initcap, length, substr
and instr), date functions (Sysdate, next_day, add_months, last_day,
months_between, least, greatest, trunc, round, to_char, to_date)
5. i) Creation of simple PL/SQL program which includes declaration
section, executable section and exception –Handling section (Ex.
Student marks can be selected from the table and printed for those
who secured first class and an exception can be raised if no records
were found)
ii) Insert data into student table and use COMMIT, ROLLBACK and
SAVEPOINT in PL/SQL block.
6. Develop a program that includes the features NESTED IF, CASE and CASE
expression. The program can be extended using the NULLIF and
COALESCE functions.
7. Program development using WHILE LOOPS, numeric FOR LOOPS, nested
loops using ERROR Handling, BUILT –IN Exceptions, USE defined
Exceptions, RAISE- APPLICATION ERROR.
8. Programs development using creation of procedures, passing parameters IN
and OUT of PROCEDURES.

69 | P a g e
9. Program development using creation of stored functions, invoke functions in
SQL Statement and write complex functions.
1. Program development using creation of package specification, package
bodies, private objects, package variables and cursors and calling stored
packages.
2. Develop programs using features parameters in a CURSOR, FOR
UPDATE CURSOR, WHERE CURRENT of clause and CURSOR
variables.
3. Develop Programs using BEFORE and AFTER Triggers, Row and
Statement Triggers and INSTEAD OF Triggers

TEXT BOOKS

1. ORACLE PL/SQL by example. Benjamin Rosenzweig, Elena Silvestrova,


Pearson Education 3 Edition
2. ORACLE DATA BASE LOG PL/SQL Programming SCOTT URMAN, Tata
Mc- Graw Hill.
3. SQL & PL/SQL for Oracle 10g, Black Book, Dr.P.S. Deshpande.

70 | P a g e
List1
1. Create Sailors table with the following fields and describe the table (sid:
integer, sname: string, rating: integer)

2. Add field (age: integer) to the Sailors table and describe the table

3. Modify field age to real in the Sailors table and describe the table

4. Delete age field from the Sailors table and describe the table

5. Add field (age: real) to the Sailors table and describe the table

6. Delete Sailors table

7. Create Sailors table with the following fields and describe the table (sid:
integer, sname: string, rating: integer, age: real)

8. Insert the following records in to the Sailors table

71 | P a g e
9. Retrieve all Records from the Sailors table

10. Retrieve all Records (unique) from the Sailors table

11. Retrieve the names and ages of all sailors from the Sailors table

12. Find all sailors with a rating above 7

13. Create Sailors1 table with the following fields and describe the table (sid:
integer, sname: string, rating: integer, age: real)

14. Insert tuples of Sailors table in to the Sailors1 table

15. Retrieve all Records from the Sailors1 table

16. Delete sailor from the Sailors1 table whose sid is 58

17. Retrieve all Records from the Sailors1 table

18. Delete all tuples from the Sailors1 table

19. Create Boats table with the following fields and describe the table (bid: integer,
bname: string, color: string)

20. Insert the following records in to the Boats table

21. Retrieve all Records from the Boats table

22. Create Reserves table with the following fields and describe the table (sid: integer,
bid: integer, day: date)
72 | P a g e
23. Insert the following records in to the Reserves table

24. Retrieve all Records from the Reserves table

73 | P a g e
List -1 Solutions

1. Create Sailors table with the following fields and describe the
table (sid: integer, sname: string, rating: integer)
Query: Create table Sailors(sid number(2),sname varchar2(20),rating number(2))
Output: Table Created
Query: desc Sailors
Output:
Bottom of Form
Name Null? Type
SID NUMBER(2)
SNAME VARCHAR2(20)
RATING NUMBER(2)

2. Add field (age: integer) to the Sailors table and describe the table

Query: ALTER TABLE Sailors


ADD (age NUMBER(2))
Output: Table Altered
Query: desc Sailors
Output:
Bottom of Form
Name Null? Type
SID NUMBER(2)
SNAME VARCHAR2(10)
RATING NUMBER(2)
AGE NUMBER(2)

3. Modify field age to real in the Sailors table and describe the table

Query: ALTER TABLE Sailors


MODIFY (age NUMBER(3,1))
Output: Table Altered
Query: desc Sailors
Output:
Bottom of Form

74 | P a g e
Name Null? Type
SID NUMBER(2)
SNAME VARCHAR2(10)
RATING NUMBER(2)
AGE NUMBER(3,1)

4. Delete age field from the Sailors table and describe the table

Query: ALTER TABLE Sailors


DROP COLUMN age
Output: Table Altered
Query: desc Sailors
Output:
Bottom of Form
Name Null? Type
SID NUMBER(2)
SNAME VARCHAR2(10)
RATING NUMBER(2)

5. Add field (age: real) to the Sailors table and describe the table

Query: ALTER TABLE Sailors


ADD (age NUMBER(3,1))
Output: Table Altered
Query: desc Sailors
Output:
Bottom of Form
Name Null? Type
SID NUMBER(2)
SNAME VARCHAR2(10)
RATING NUMBER(2)
AGE NUMBER(3,1)

6. Delete Sailors table

Query: DROP TABLE Sailors


Output: Table dropped.
75 | P a g e
7. Create Sailors table with the following fields and describe the
table (sid: integer, sname: string, rating: integer, age: real)

Query: CREATE TABLE Sailors (sid NUMBER(2), sname VARCHAR2(20),


rating NUMBER(2),age NUMBER(3,1))
Output: Table Created
Query: desc Sailors
Output:
Bottom of Form
Name Null? Type
SID NUMBER(2)
SNAME VARCHAR2(20)
RATING NUMBER(2)
AGE NUMBER(3,1)

8. Insert the following records in to the Sailors table

Query:
insert into Sailors values(22,'Dustin',7,45.0);
insert into Sailors values(29,'Brutus',1,33.0);
insert into Sailors values(31,'Lubber',8,55.5);
insert into Sailors values(32,'Andy',8,25.5);
insert into Sailors values(58,'Rusty',10,35.0);
insert into Sailors values(64,'Horatio',7,35.0);
insert into Sailors values(71,'Zorba',10,16.0);

76 | P a g e
insert into Sailors values(74,'Horatio',9,35.0);
insert into Sailors values(85,'Art',3,25.5);
insert into Sailors values(95,'Bob',3,63.5);
Output:
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.

9. Retrieve all Records from the Sailors table

Query: select * from Sailors


Output:
Bottom of Form
SID SNAME RATING AGE
22 Dustin 7 45
29 Brutus 1 33
31 Lubber 8 55.5
32 Andy 8 25.5
58 Rusty 10 35
64 Horatio 7 35
71 Zorba 10 16
74 Horatio 9 35
85 Art 3 25.5
95 Bob 3 63.5
10 records selected.

10. Retrieve all Records (unique) from the Sailors table


Query: select distinct sname,age from Sailors
Output:

77 | P a g e
Bottom of Form
SNAME AGE
Andy 25.5
Art 25.5
Bob 63.5
Brutus 33
Dustin 45
Horatio 35
Lubber 55.5
Rusty 35
Zorba 16
9 records selected.
11. Retrieve the names and ages of all sailors from the Sailors table
Query: select sname,age from sailors
Output:
Bottom of Form
SNAME AGE
Dustin 45
Brutus 33
Lubber 55.5
Andy 25.5
Rusty 35
Horatio 35
Zorba 16
Horatio 35
Art 25.5
Bob 63.5
10 records selected.
12. Find all sailors with a rating above 7
Query: select * from sailors where rating>7
Output:
Bottom of Form
SID SNAME RATING AGE
31 Lubber 8 55.5
32 Andy 8 25.5

78 | P a g e
58 Rusty 10 35
71 Zorba 10 16
74 Horatio 9 35
5 records selected
13. Create Sailors1 table with the following fields and describe the table
(sid: integer, sname: string, rating: integer, age: real)

Query: CREATE TABLE Sailors1 (sid NUMBER(2), sname VARCHAR2(20),


rating NUMBER(2),age NUMBER(3,1))
Output: Table created.
Query: desc Sailors1
Output:
Bottom of Form
Name Null? Type
SID NUMBER(2)
SNAME VARCHAR2(20)
RATING NUMBER(2)
AGE NUMBER(3,1)

14. Insert tuples of Sailors table in to the Sailors1 table

Query: INSERT INTO Sailors1 SELECT * FROM Sailors


Output: 10 rows created.

15. Retrieve all Records from the Sailors1 table

Query: select * from Sailors1


Output:
Bottom of Form
SID SNAME RATING AGE
22 Dustin 7 45
29 Brutus 1 33
31 Lubber 8 55.5
32 Andy 8 25.5
58 Rusty 10 35
64 Horatio 7 35

79 | P a g e
71 Zorba 10 16
74 Horatio 9 35
85 Art 3 25.5
95 Bob 3 63.5
10 records selected
16. Delete sailor from the Sailors1 table whose sid is 58
Query: DELETE FROM Sailors1
WHERE sid=58
Output: 1 row deleted.

17. Retrieve all Records from the Sailors1 table


Query: SELECT * FROM Sailors1
Output:
Bottom of Form
SID SNAME RATING AGE
22 Dustin 7 45
29 Brutus 1 33
31 Lubber 8 55.5
32 Andy 8 25.5
64 Horatio 7 35
71 Zorba 10 16
74 Horatio 9 35
85 Art 3 25.5
95 Bob 3 63.5
9 records selected
18. Delete all tuples from the Sailors1 table
Query: DELETE FROM Sailors1
Output: 9 rows deleted.

19. Create Boats table with the following fields and describe the table
(bid: integer, bname: string, color: string)

Query: create table boats(bid number(3),bname varchar2(9),color varchar2(5))


Output: Table Created
Query: desc boats
Output:

80 | P a g e
Top of Form

Bottom of Form
Name Null? Type
BID NUMBER(3)
BNAME VARCHAR2(9)
COLOR VARCHAR2(5)

20. Insert the following records in to the Boats table

Query:
insert into boats values(101,'Interlake','blue');
insert into boats values(102,'Interlake','red');
insert into boats values(103,'Clipper','green');
insert into boats values(104,'Marine','red');

Output:
1 row created.
1 row created.
1 row created.
1 row created.
21. Retrieve all Records from the Boats table

Query: select * from boats


Output:
Bottom of Form
BID BNAME COLOR
101 Interlake blue
102 Interlake red

81 | P a g e
103 Clipper green
104 Marine red
4 records selected
22. Create Reserves table with the following fields and describe the table
(sid: integer, bid: integer, day: date)

Query: create table reserves(sid number(2), bid number(3), day date)


Output: Table Created.
Query: desc reserves
Output:
Top of Form

Bottom of Form
Name Null? Type
SID NUMBER(2)
BID NUMBER(3)
DAY DATE

23. Insert the following records in to the Reserves table

Query:
insert into reserves values(22,101,'10-oct-98');
insert into reserves values(22,102,'10-oct-98');
insert into reserves values(22,103,'10-aug-98');
insert into reserves values(22,104,'10-jul-98');
insert into reserves values(31,102,'11-oct-98');
insert into reserves values(31,103,'11-jun-98');
insert into reserves values(31,104,'11-dec-98');
82 | P a g e
insert into reserves values(64,101,'9-may-98');
insert into reserves values(64,102,'9-aug-98');
insert into reserves values(74,103,'9-aug-98');

Output:
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.

24. Retrieve all Records from the Reserves table

Query: select * from reserves


Output:
Bottom of Form
SID BID DAY
22 101 10-OCT-98
22 102 10-OCT-98
22 103 10-AUG-98
22 104 10-JUL-98
31 102 11-OCT-98
31 103 11-JUN-98
31 104 11-DEC-98
64 101 09-MAY-98
64 102 09-AUG-98
74 103 09-AUG-98
10 records selected

83 | P a g e
List2
1. Find the names of sailors who have reserved boat number 103 (using AND op-
erator)
2. Find all sailors whose age is in between 45.0 and 63.5 (using BETWEEN oper-
ator)
3. Find all sailors whose age is in the list of values(15.0,33.2,45.7,63.5) (using IN
operator)
4. Find all sailors whose second letter in the names contain ‘u’
5. Find all sailors whose first letter and third letter in the names are ‘A’ and ‘d’
6. Find all sailors from sailors and sailors1 table by using UNION operator
7. Find all sailors from sailors and sailors1 table by using INTERSECT operator
8. Find all sailors from sailors and sailors1 table by using MINUS operator
9. Find the names of sailors who have reserved boat 103 (using nested query)
10.Find the names of sailors who have reserved a blue boat (using nested query)
11.Find the names of sailors who have not reserved a red boat (using nested query)
12.Find the names of sailors who have reserved boat 103 (using Correlated Nested
Query)
13.Find sailors whose rating is better than some sailor called Horatio (using ANY
operator)
14.Find sailors whose rating is better than some sailor called Horatio (using ALL
operator)
15.Find the sailors with the highest rating
16.Find the average age of all sailors
17.Find the minimum age of the sailor
18.Find the maximum age of the sailor
19.Count the number of sailors
20.Count the number of different sailor names

84 | P a g e
List -2 Solutions
1. Find the names of sailors who have reserved boat number 103
(using AND operator)
Query: select sname from Sailors S,reserves R
where S.sid=R.sid and R.bid=103;
Output:
Bottom of Form
SNAME
Dustin
Lubber
Horatio

2. Find all sailors whose age is in between 45.0 and 63.5 (using
BETWEEN operator)
Query: select * from Sailors
where age between 45.0 and 63.5
Output:
Bottom of Form
SID SNAME RATING AGE
31 Lubber 8 55.5
95 Bob 3 63.5
22 Dustin 7 45

3. Find all sailors whose age is in the list of values (15.0,33.2,45.7,63.5)


(using IN operator)
Query: select * from Sailors
where age in(15.0,33.2,45.7,63.5)
Output:
Bottom of Form
SID SNAME RATING AGE
95 Bob 3 63.5

4. Find all sailors whose second letter in the names contain ‘u’
Query: select * from Sailors
where sname like '_u%'
Output:
Bottom of Form
85 | P a g e
SID SNAME RATING AGE
31 Lubber 8 55.5
58 Rusty 10 35
22 Dustin 7 45

5. Find all sailors whose first letter and third letter in the names are
‘A’ and ‘d’
Query: select * from Sailors
where sname like 'A_d%'
Output:
Bottom of Form
SID SNAME RATING AGE
32 Andy 8 25.5

6. Find all sailors from sailors and sailors1 table by using (UNION
operator)
Query: select * from Sailors
union select * from Sailors1
Output:
Bottom of Form
SID SNAME RATING AGE
22 Dustin 7 45
29 Brutus 1 33
31 Lubber 8 55.5
32 Andy 8 25.5
58 Rusty 10 35
64 Horatio 7 35
71 Zorba 10 16
74 Horatio 9 35
85 Art 3 25.5
95 Bob 3 63.5

10 rows selected.

7. Find all sailors from sailors and sailors1 table by using


INTERSECT operator

86 | P a g e
Query: select * from Sailors
intersect select * from Sailors1
Output:
Bottom of Form
SID SNAME RATING AGE
22 Dustin 7 45
29 Brutus 1 33
31 Lubber 8 55.5
32 Andy 8 25.5
58 Rusty 10 35
64 Horatio 7 35
71 Zorba 10 16
74 Horatio 9 35
85 Art 3 25.5
95 Bob 3 63.5

8. Find all sailors from sailors and sailors1 table by using MINUS
operator
Query: select * from Sailors
minus select * from Sailors1
Output:
Bottom of Form
SID SNAME RATING AGE
58 Rusty 10 35

9. Find the names of sailors who have reserved boat 103 (using
nested query)
Query: select sname from Sailors
where sid in(select sid from reserves where bid =103);
Output:
Bottom of Form
SNAME
Dustin
Lubber
Horatio

87 | P a g e
10. Find the names of sailors who have reserved a blue boat (using
nested query)
Query: select sname from Sailors
where sid in(select sid from reserves where bid in(select bid from boats
where color='blue'));
Output:
Bottom of Form
SNAME
Dustin
Horatio

11. Find the names of sailors who have not reserved a red boat
(using nested query)
Query: select sname from Sailors
where sid in(select sid from reserves where bid in(select bid from boats
where color!='red'));
Output:
Bottom of Form
SNAME
Dustin
Lubber
Horatio
Horatio

12. Find the names of sailors who have reserved boat 103 (using
Correlated Nested Query)
Query: select s.sname from Sailors s
where exists(select * from reserves r where
r.bid=103 and r.sid=s.sid);
Output:
Bottom of Form
SNAME
Lubber
Horatio
Dustin

88 | P a g e
13. Find sailors whose rating is better than some sailor called
Horatio (using ANY operator)
Query: select * from Sailors
where rating> any(select rating from Sailors where sname='Horatio');
Output:
Bottom of Form
SID SNAME RATING AGE
31 Lubber 8 55.5
32 Andy 8 25.5
58 Rusty 10 35
71 Zorba 10 16
74 Horatio 9 35

14. Find sailors whose rating is better than some sailor called
Horatio (using ALL operator)
Query: select * from Sailors
where rating> all(select rating from Sailors where sname='Horatio');
Output:
Bottom of Form
SID SNAME RATING AGE
58 Rusty 10 35
71 Zorba 10 16

15. Find the sailors with the highest rating


Query: select * from Sailors
where rating=(select max(rating) from Sailors)
Output:
Bottom of Form
SID SNAME RATING AGE
58 Rusty 10 35
71 Zorba 10 16
16. Find the average age of all sailors
Query: select avg(age) from Sailors
Output:
Bottom of Form
AVG(AGE)

89 | P a g e
36.9
17. Find the minimum age of the sailor
Query: select min(age) from Sailors
Output:
Bottom of Form
MIN(AGE)
16
18. Find the maximum age of the sailor
Query: select max(age) from Sailors
Output:
Bottom of Form
MAX(AGE)
63.5
19. Count the number of sailors
Query: select count(*) from Sailors
Output:
Bottom of Form
COUNT(*)
10
20. Count the number of different sailor names
Query: select count(distinct sname) from Sailors
Output:
Bottom of Form
COUNT(DISTINCT SNAME)
9

List – 3

Find the sum of ratings of all sailors


Find the second maximum age of the sailor
Find the name of the sailor whose age is second maximum
Find the name and age of the oldest sailor
Find the number of sailors belongs to each rating level

90 | P a g e
Find the age of the youngest sailor for each rating level
Find the age of the youngest sailor for each rating level, which is greater
than 7
Find the age of the youngest sailor who is eligible to vote (i.e., is at least
18 years old) for each rating level with at least two such sailors
Find the average age of sailors for each rating level that has at least two
sailors
Drop sailors table
Create Sailors table with the following fields and describe the table
(sid: integer, sname: string, rating: integer, age: real)
Note: Underlined attribute represents the primary key
Insert records in to the Sailors table
Drop Reserves table
Create Reserves table with the following fields and describe the table
(sid: integer, bid: integer, day: date)
Insert records in to the Reserves table
Drop Boats table
1. Create Boats table with the following fields and describe the table (bid: integer,
bname: string, color: string).
2. Insert records in to the Boats table
3. For each red boat, find the number of reservations for this boat.
4. Find those ratings for which the average age of sailors is the minimum over all
ratings
5. Count the number of sailors who have reserved boats between '9/5/98' and
'10/10/98'
6. Find the names of sailors who have reserved boats between '9/4/98' and '1/8/98'
7. Find the number of reservations made for each boat
8. Find the number of reservations (with at least three) made for each boat
9. Find the number of reservations made for each boat during '9/5/98' and
'10/10/98'
10.Find the days on which blue color boat is reserved
11.Find the days on which 'Horatio' reserved the boats
12.Find the number of boat reservations made by each sailor
13.Find the number of boats in each color
14.Find the colors of boats reserved by ‘Lubber’

LIST – 3 Solutions

91 | P a g e
1. Find the sum of ratings of all sailors
Query: select sum(rating) from Sailors
Output:
Bottom of Form
SUM(RATING)
66

2. Find the second maximum age of the sailor


Query: select max(age) from Sailors
where age!=(select max(age) from Sailors)
Output:
Bottom of Form
MAX(AGE)
55.5

3. Find the name of the sailor whose age is second maximum


Query: select sname from Sailors
where age=(select max(age) from Sailors
where age!=(select max(age) from Sailors));
Output:
Bottom of Form
SNAME
Lubber

4. Find the name and age of the oldest sailor


Query: select sname,age from Sailors
where age=(select max(age) from Sailors)
Output:
Bottom of Form
SNAME AGE
Bob 63.5
5. Find the number of sailors belongs to each rating level
Query: select rating,count(rating) from Sailors
group by rating
Output:
Bottom of Form
RATIN COUNT(RATI

92 | P a g e
G NG)
1 1
3 2
7 2
8 2
9 1
10 2

6. Find the age of the youngest sailor for each rating level
Query: select rating,min(age) from Sailors
group by rating
Output:
Bottom of Form
RATING MIN(AGE)
1 33
3 25.5
7 35
8 25.5
9 35
10 16
7. Find the age of the youngest sailor for each rating level, which is
greater than 7
Query: select rating,min(age) from Sailors
group by rating
having rating>7
Bottom of Form
RATING MIN(AGE)
8 25.5
9 35
10 16

8. Find the age of the youngest sailor who is eligible to vote (i.e., is at
least 18 years old) for each rating level with at least two such sailors
Query: select rating,min(age) from Sailors
where age>=18
group by rating

93 | P a g e
having count (rating)>=2
Output:
Bottom of Form
RATING MIN(AGE)
3 25.5
7 35
8 25.5

9. Find the average age of sailors for each rating level that has at
least two sailors
Query: select rating,avg(age) from Sailors
group by rating
having count (rating)>=2
Output:
Bottom of Form
RATING AVG(AGE)
3 44.5
7 40
8 40.5
10 25.5

10. Drop sailors table


Query: DROP TABLE Sailors
Output: Table dropped.

11. Create Sailors table with the following fields and describe the
table (sid: integer, sname: string, rating: integer, age: real)
Note: Underlined attribute represents the primary key
Query: CREATE TABLE Sailors (sid NUMBER(2) primary key, sname
VARCHAR2(20),rating NUMBER(2),age NUMBER(3,1))
Output:
Table created.
Query: desc Sailors
Output:
Bottom of Form
Name Null? Type
SID NOT NULL NUMBER(2)

94 | P a g e
SNAME VARCHAR2(20)
RATING NUMBER(2)
AGE NUMBER(3,1)

12. Insert records in to the Sailors table


Query:
insert into Sailors values(22,'Dustin',7,45.0);
insert into Sailors values(29,'Brutus',1,33.0);
insert into Sailors values(31,'Lubber',8,55.5);
insert into Sailors values(32,'Andy',8,25.5);
insert into Sailors values(58,'Rusty',10,35.0);
insert into Sailors values(64,'Horatio',7,35.0);
insert into Sailors values(71,'Zorba',10,16.0);
insert into Sailors values(74,'Horatio',9,35.0);
insert into Sailors values(85,'Art',3,25.5);
insert into Sailors values(95,'Bob',3,63.5);
Output:
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.

13. Drop Reserves table


Query: DROP TABLE reserves
Output: Table dropped.

14. Create Reserves table with the following fields and


describe the table (sid: integer, bid: integer, day: date)
Query: create table reserves(sid number(2), bid number(3), day date,primary
key(sid,bid))
Output: Table Created.
Query: desc reserves
Output:
95 | P a g e
Bottom of Form
Name Null? Type
SID NOT NULL NUMBER(2)
BID NOT NULL NUMBER(3)
DAY DATE

15. Insert records in to the Reserves table


Query:
insert into reserves values(22,101,'10-oct-98');
insert into reserves values(22,102,'10-oct-98');
insert into reserves values(22,103,'10-aug-98');
insert into reserves values(22,104,'10-jul-98');
insert into reserves values(31,102,'11-oct-98');
insert into reserves values(31,103,'11-jun-98');
insert into reserves values(31,104,'11-dec-98');
insert into reserves values(64,101,'9-may-98');
insert into reserves values(64,102,'9-aug-98');
insert into reserves values(74,103,'9-aug-98');
Output:
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
16. Drop Boats table
Query: drop table boats
Output: table dropped.

17. Create Boats table with the following fields and describe the
table (bid: integer, bname: string, color: string).
Query: create table boats(bid number(3) primary key,bname varchar2(9),color
varchar2(5))
Output: Table Created

96 | P a g e
Query: desc boats
Output:
Bottom of Form
Name Null? Type
BID NOT NULL NUMBER(3)
BNAME VARCHAR2(9)
COLOR VARCHAR2(5)
18. Insert records in to the Boats table
Query:
insert into boats values(101,'Interlake','blue');
insert into boats values(102,'Interlake','red');
insert into boats values(103,'Clipper','green');
insert into boats values(104,'Marine','red');

Output:
1 row created.
1 row created.
1 row created.
1 row created.

19. For each red boat, find the number of reservations for this boat.
Query: select bid,count(bid) from reserves
where bid in(select bid from boats where color='red')
group by bid
Output:
Bottom of Form
BID COUNT(BID)
102 3
104 2

20. Find those ratings for which the average age of sailors is
the minimum over all ratings
Query: select temp1.rating,temp1.ave age from (select rating,avg(age) ave from
sailors group by rating) temp1
where temp1.ave=(select min(temp2.ave) from (select rating,avg(age) ave
from sailors group by rating) temp2)

97 | P a g e
Output:
Bottom of Form
RATING AGE
10 25.5
21. Count the number of sailors who have reserved boats between
'9/5/98' and '10/10/98'
Query: select count(sid) from reserves
where day between '9-may-98' and '10-oct-98'
Output:
Bottom of Form
COUNT(SID)
8

22. Find the names of sailors who have reserved boats between
'9/4/98' and '1/8/98'
Query: select sname from sailors
where sid in(select sid from reserves where day between '9-apr-98' and '1-aug-
98')
Output:
Bottom of Form
SNAME
Dustin
Lubber
Horatio

23. Find the number of reservations made for each boat


Query: select bid, count(bid) from reserves
group by bid
Output:
Bottom of Form
BID COUNT(BID)
101 2
102 3
103 3
104 2

98 | P a g e
24. Find the number of reservations (with at least three) made for
each boat
Query: select bid,count(bid) from reserves
group by bid
having count(bid)>=3
Output:
Bottom of Form
BID COUNT(BID)
102 3
103 3
25. Find the number of reservations made for each boat during
'9/5/98' and '10/10/98'
Query: select bid,count(bid) from reserves
where day between '9-may-98' and '10-oct-98'
group by bid
Output:
Bottom of Form
BID COUNT(BID)
101 2
102 2
103 3
104 1
26. Find the days on which blue color boat is reserved
Query: select day from reserves where bid in( select bid from boats where
color='blue')
Output:
Bottom of Form
DAY
10-OCT-98
09-MAY-98
27. Find the days on which 'Horatio' reserved the boats
Query: select day from reserves where sid in(select sid from sailors where
sname='Horatio')
Output:
Bottom of Form
DAY
09-MAY-98

99 | P a g e
09-AUG-98
09-AUG-98
28. Find the number of boat reservations made by each sailor
Query: select s.sname,count(*)from sailors s, reserves r
where s.sid=r.sid
group by s.sname;

Output:
Bottom of Form
SNAME COUNT(*)
Dustin 4
Horatio 3
Lubber 3
29. Find the number of boats in each color
Query: select count(bid),color from boats
group by color
Output:
Bottom of Form
COUNT(BID) COLOR
1 blue
1 green
2 red
30. Find the colors of boats reserved by ‘Lubber’
Query: select distinct color from boats where bid in
(select bid from reserves where sid in
(select sid from sailors where sname='Lubber'))
Output:
Bottom of Form
COLOR
green
red

100 | P a g e
List4
1.Create Persons table with the following fields (declare FirstName as DE-
FAULT 'Ola') and describe the table

Pid FirstName LastName Address City


1 Ola Hansen Timoteivn 10 Sandnes
2 Tove Svendson Borgvn 23 Sandnes
3 Kari Pettersen Storgt 20 Stavanger

2. Specify UNIQUE constraint on field LastName in the Persons table


3. Specify PRIMARY KEY constraint on field Pid in the Persons table
4. Create Orders table with the following fields (declare Oid as Primary Key and
Pid as Foreign Key) and describe the table
Oid OrderNo Pid
15.Insert the Per- 1 77895 3 sons records in to
the Persons ta- 2 44678 3 ble
16.Insert the Or- 3 22456 2 ders records in to
the Orders table 4 24562 1
17.Insert
(4,'Andy','Hansen','Storgt 20','Stavanger') record in to the Persons table and ob-
serve the result
18.Insert (3,'Andy','Tahsen','Storgt 20','Stavanger') record in to the Persons table
and observe the result
19.Insert (5,51212,4) record in to the Orders table and observe the result
20.Delete record from the Persons table whose Pid is 3 and observe the result
21.Give example which includes all Arithmetic functions
22.Give example which includes all String functions
23.Give example which includes all Date and Time functions
24.Retrieve tuples from the reserves table (display ‘day’ as dd-mon-yyyy)
25.Retrieve tuples from the boats table, in which trim ‘In’ from left side on
‘bname’
26.Retrieve tuples from the sailors table, in which trim ‘io’ from right side on
‘sname’
27.Convert ‘2010 10 feb’ in to date
28.Give example which includes all General functions

101 | P a g e
List-4 Solutions

1. Create Persons table with the following fields (declare FirstName as


DEFAULT 'Ola') and describe the table
Pid FirstName LastName Address City
1 Ola Hansen Timoteivn 10 Sandnes
2 Tove Svendson Borgvn 23 Sandnes
3 Kari Pettersen Storgt 20 Stavanger
Query:
create table Persons(Pid number(5),FirstName varchar2(10) default
'Ola',LastName varchar2(10), Address varchar2(15),City varchar2(10));
Output:
Table created.
2. Specify UNIQUE constraint on field LastName in the Persons table
Query:
alter table Persons add unique(LastName);
Output:
Table altered.
3. Specify PRIMARY KEY constraint on field Pid in the Persons table
Query:
alter table Persons add primary key(Pid);
Output:
Table altered.
4. Create Orders table with the following fields (declare Oid as Primary
Key and Pid as Foreign Key) and describe the table

Oid OrderNo Pid


1 77895 3
2 44678 3
3 22456 2
4 24562 1
Query:

102 | P a g e
create table Orders (Oid number(2) PRIMARY KEY,OrderNo number(5),Pid
number(2),FOREIGN KEY(Pid ) REFERENCES Persons(Pid));
Output:
Table created.
5. Insert Persons records in to Persons table
Query:
insert into persons(pid,lastname,address,city) values(1,'Hansen','Timotevin
10','Sandnes');
Output:
1 row created.
Query:
Select * from persons;
Output:

PID FIRSTNAME LASTNAME ADDRESS CITY


1 Ola Hansen Timotevin 10 Sandnes
Query:
insert into persons values(2,'Tove','Svendson','Borgvn 23','Sandnes');
insert into persons values(3,'Kari','Pettersen','Storgt 20','Stavanger');
Query:
Select * from persons;
Output:

PID FIRSTNAME LASTNAME ADDRESS CITY


1 Ola Hansen Timotevin 10 Sandnes
2 Tove Svendson Borgvn 23 Sandnes
3 Kari Pettersen Storgt 20 Stavanger
6. Insert Orders records in to Orders table
Query:
insert into orders values(1,77895,3);
insert into orders values(2,44678,3);
insert into orders values(3,22456,2);
insert into orders values(4,24562,1);
Output:
Top of Form

103 | P a g e
Bottom of Form
OID ORDERNO PID
1 77895 3
2 44678 3
3 22456 2
4 24562 1
7. Insert (4,'Andy','Hansen','Storgt 20','Stavanger') record in to Persons ta-
ble and observe the result
Query:
insert into persons values(4,'Andy','Hansen','Storgt 20','Stavanger');
Output:
ERROR: ORA-00001: unique constraint (SCOTT.SYS_C005118) violated
8. Insert (3,'Andy','Tahsen','Storgt 20','Stavanger') record in to Persons table
and observe the result
Query:
insert into persons values(3,'Andy','Tahsen','Storgt 20','Stavanger');
Output:
ERROR: ORA-00001: unique constraint (SCOTT.SYS_C005119) violated
9. Insert (5,51212,4) record in to Orders table and observe the result
Query:
insert into orders values(5,51212,4);
Output:
ERROR: ORA-02291: integrity constraint (SCOTT.SYS_C005121) violated -
parent key not found
10.Delete record from the Persons table whose Pid is 3 and observe the result
Query:
delete from Persons where Pid=3;
Output:
ERROR: ORA-02292: integrity constraint (SCOTT.SYS_C005121) violated -
child record found
11.Give example which includes all Arithmetic functions
Query:
select abs(4.55),ceil(4.55),floor(4.55), mod(5,4),power(2,3),sign(-10), sign(10),
sqrt(9),round(4.333,2),trunc(4.333,2) from dual
Output:
Top of Form

Bottom of Form

104 | P a g e
SIG
ABS(4. CEIL(4. FLOOR( MOD( POWER( SIGN( SQRT ROUND(4.3 TRUNC(4.3
N(-
55) 55) 4.55) 5,4) 2,3) 10) (9) 33,2) 33,2)
10)
4.55 5 4 1 8 -1 1 3 4.33 4.33
12.Give example which includes all String functions
Query:
select ascii('A'),chr(65),concat('abc','def'),instr('abaabcab','ab',1,2),substr('abcd',2)
from dual
Output:
Top of Form

Bottom of Form
ASCII('A') C CONCAT INSTR('ABAABCAB','AB',1,2) SUB
65 A abcdef 4 bcd
select length('abcd'),lengthb('abcde'),lower('ABCD'),lpad('abcd',7,'e'),
ltrim('abcd','a') from dual
Output:
Bottom of Form
LENGTH('ABCD') LENGTHB('ABCDE') LOWE LPAD('A LTR
4 5 abcd eeeabcd bcd
select replace('abcd','a','ef'),rtrim('abcd','d'),rpad('abcd',7,'e'),to_char(123) from dual
Output:
Top of Form

Bottom of Form
REPLA RTR RPAD('A TO_
efbcd abc abcdeee 123
select substr('abcdef',2,3),translate('abcdef','bc','ef'),upper('abcd'),initcap('abcd')
from dual
Output:
Top of Form

Bottom of Form
SUB TRANSL UPPE INIT
bcd aefdef ABCD Abcd
13.Give example which includes all Date and Time functions
Query:

105 | P a g e
select add_months(current_date,5),current_date,current_timestamp(2),to_date('10-
10-2011','dd-mm-yy'),months_between('10-oct-2011','10-oct-2010'),
EXTRACT(year from current_date),to_char(current_date,'mon dd yyyy')
from dual
Output:
Bottom of Form
MONTHS_
ADD_ CURR CURRENT_ TO_ BETWEEN( EXTRACT(YEARF TO_CH
MONT ENT_ TIMESTAM DAT '10-OCT- ROMCURRENT_D AR(CU
H D P(2) E(' 2011','10- ATE) R
OCT-2010')
10- 10- 10-NOV-12 10-
nov 10
APR- NOV- 02.25.41.00 OCT- 12 2012
2012
13 12 PM +05:30 11
01
14.Retrieve tuples from the reserves table (display ‘day’ as dd-mon-yyyy)
Query:
select sid,bid,to_char(day,'dd-mon-yyyy') day from reserves
Output:
Top of Form

Bottom of Form
SID BID DAY
22 101 10-OCT-1998
22 102 10-OCT-1998
22 103 10-AUG-1998
22 104 10-JUL-1998
31 102 11-OCT-1998
31 103 11-JUN-1998
31 104 11-DEC-1998
64 101 09-MAY-1998
64 102 09-AUG-1998
74 103 09-AUG-1998
15. Retrieve tuples from the boats table, in which trim 'In' from left side on
‘bname’
Query:
select ltrim(bname,'In') from boats
Output:

106 | P a g e
Top of Form

Bottom of Form
LTRIM(BNAME,'IN)
terlake
terlake
Clipper
Marine
16.Retrieve tuples from the sailors table, in which trim 'io' from right side on
‘sname’
Query:
select rtrim(sname,'io') from sailors
Output:
Bottom of Form
RTRIM(SNAM
Dustin
Brutus
Lubber
Andy
Rusty
Horat
Zorba
Horat
Art
Bob
17.Convert ‘2010 10 feb’ in to date
Query:
select to_date('2010 10 feb','yyyy dd mon') todate from dual
Output:
TODATE
10-FEB-10

18. Give example which includes all General functions


Query:
select sid,sname,cast(sid as varchar2(10)) from sailors
Output:

107 | P a g e
Top of Form

Bottom of Form
SID SNAME CAST(SIDAS
22 Dustin 22
29 Brutus 29
31 Lubber 31
32 Andy 32
58 Rusty 58
64 Horatio 64
71 Zorba 71
74 Horatio 74
85 Art 85
95 Bob 95
Query:
create table cal(id number);
Output:
Table created.
Query:
insert into cal values(10);
insert into cal(id) values(null);
insert into cal values(20);
Query:
select * from cal
Output:
ID
10

20

Query:
select id,nullif(id,10),nvl(id,88),nvl2(id,66,88) from cal
Output:
Top of Form

Bottom of Form
ID NULLIF(ID,10) NVL(ID,88) NVL2(ID,66,88)

108 | P a g e
10 10 66
88 88
20 20 20 66
Query:
select sid,decode(sid,22,'A',31,'B','ZZ') results from sailors
Output:
Top of Form

Bottom of Form
SID RE
22 A
29 ZZ
31 B
32 ZZ
58 ZZ
64 ZZ
71 ZZ
74 ZZ
85 ZZ
95 ZZ

109 | P a g e
List5
1. Write a PL/SQL program to perform the following:

Insert <99,'John',9,25.6> into the Sailors table, Update sname 'John' to 'Joe' in the
Sailors table, Delete tuple from the Sailors table whose sname is 'Joe'

2. Retrieve tuple from the Sailors table whose sname is 'Lubber' using PL/SQL pro-
gram
3. Write a PL/SQL program to find largest and smallest of three numbers
4. Write a PL/SQL program to check whether a number is prime or not?
5. Write a PL/SQL program to check whether a number is palindrome or not?
6. Write a PL/SQL program to show handling of Pre-defined exception
7. Write a PL/SQL program to show handling of User-defined exception
8. Write a PL/SQL program to print the following values

0 if a=0

1 if a>0

-1 if a<0

9. Write a PL/SQL program to find even numbers and odd numbers in a given range
m to n
10.Write a PL/SQL program to find armstrong numbers in a given range m to n
11.Write a PL/SQL program to retrieve records from the sailors table using cursor
12.Write a PL/SQL procedure to find factorial of a given number
13.Write a PL/SQL procedure to print first n fibonacci numbers
14.Write a PL/SQL function to find sum of digits of a number
15.Write a PL/SQL recursive function to find factorial of a number
16. Explain Packages with PL/SQL program

110 | P a g e
List-5 Solutions
1. Write a PL/SQL program to perform the following: Insert
<99,'John',9,25.6> into the Sailors table, Update sname 'John' to 'Joe' in the
Sailors table, Delete tuple from the Sailorstable whose sname is 'Joe'
Program:
DECLARE
s_id number(2):=99;
s_name varchar2(20):='john';
s_rating number(2):=9;
s_age number(3,1):=25.6;
BEGIN
INSERT INTO Sailors VALUES(s_id,s_name,s_rating,s_age);
end;
Output:
SID SNAME RATING AGE
22 Dustin 7 45
29 Brutus 1 33
31 Lubber 8 55.5
32 Andy 8 25.5
58 Rusty 10 35
64 Horatio 7 35
71 Zorba 10 16
74 Horatio 9 35
85 Art 3 25.5
95 Bob 3 63.5
99 john 9 25.6
11 rows selected.
Program:
begin
update sailors set sname='joe' where sname='john';
end;
Output:
SID SNAME RATING AGE
22 Dustin 7 45
29 Brutus 1 33
31 Lubber 8 55.5
32 Andy 8 25.5
58 Rusty 10 35
64 Horatio 7 35
71 Zorba 10 16
111 | P a g e
74 Horatio 9 35
85 Art 3 25.5
95 Bob 3 63.5
99 joe 9 25.6
11 rows selected.
Program:
begin
delete from sailors where sname='joe';
end;
Output:
SID SNAME RATING AGE
22 Dustin 7 45
29 Brutus 1 33
31 Lubber 8 55.5
32 Andy 8 25.5
58 Rusty 10 35
64 Horatio 7 35
71 Zorba 10 16
74 Horatio 9 35
85 Art 3 25.5
95 Bob 3 63.5
10 rows selected.
2. Retrieve tuple from the Sailors table whose sname is 'Lubber' using
PL/SQL program
Program:
declare
s_id sailors.sid%type;
s_sname sailors.sname%type;
s_rating sailors.rating%type;
s_age sailors.age%type;
begin
select sid,sname,rating,age into s_id,s_sname,s_rating,s_age from sailors
where sname='lubber';
dbms_output.put_line('sid is '||s_id||' sname is'||s_sname||' rating'||s_rating||' age i
s'||s_age);
end;
Output:
sid is 31 sname is lubber rating is 8 age is 55.5
3. Write a PL/SQL program to find largest and smallest of three numbers
Program:
112 | P a g e
declare
a number(2):=10;
b number(2):=5;
c number(2):=15;
large number(2):=0;
small number(2):=0;
begin
if b>a and b>c then
large:=b;
elsif c>b and c>a then
large:=c;
else
large:=a;
end if;
dbms_output.put_line('largest number is'||large);
if b<a and b<c then
small:=b;
elsif c<b and c<a then
small:=c;
else
small:=a;
end if;
dbms_output.put_line('smallest number is'||small);
end;
Output:
largest number is15
smallest number is5
4. Write a PL/SQL program to check whether a number is prime or not?
Program:
declare
a number:=&a;
c number:=0;
i number;
begin
for i in 1..a loop
if mod(a,i)=0 then
c:=c+1;
end if;
end loop;
if c=2 then
113 | P a g e
dbms_output.put_line('number is prime');
else
dbms_output.put_line('number is not prime');
end if;
end;
Output:
Enter value for a: 7
old 2: a number:=&a;
new 2: a number:=7;
number is prime
5. Write a PL/SQL program to check whether a number is palindrome or
not?
Program:
declare
a number:=&a;
c number:=a;
r number:=0;
s number:=0;
begin
while a>0 loop
r:=mod(a,10);
s:=s*10+r;
a:=floor(a/10);
end loop;
if s=c then
dbms_output.put_line('number is palindrome');
else
dbms_output.put_line('number is not palindrome');
end if;
end;
Output:
Enter value for a: 123
old 2: a number:=&a;
new 2: a number:=123;
number is not palindrome
6. Write a PL/SQL program to show handling of Pre-defined exception
Program:
declare
a number:=4;
c number;
114 | P a g e
begin
c:=a/0;
exception
when ZERO_DIVIDE then
dbms_output.put_line('divide by zero exception');
end;
Output:
divide by zero exception
7. Write a PL/SQL program to show handling of User-defined exception
Program:
declare
a number(2);
b number(2);
c number(2);
ex exception;
begin
a:=&a;
b:=&b;
if(b=0) then
raise ex;
else
c:=a/b;
dbms_output.put_line(c);
end if;
exception
when ex then
dbms_output.put_line('divide by zero');
end;
Output:
old 8: b:=&b;
new 8: b:=0;
divide by zero
8. Write a PL/SQL program to print the following values
0 if a=0
1 if a>0
-1 if a<0
Program:
declare
a number:=&a;
begin
115 | P a g e
if a=0 then
dbms_output.put_line('0');
elsif a>0 then
dbms_output.put_line('1');
else
dbms_output.put_line('-1');
end if;
end;
Output:
Enter value for a: 5
old 2: a number:=&a;
new 2: a number:=5;
1
9. Write a PL/SQL program to find even numbers and odd numbers in a
given range m to n
Program:
declare
m number:=&m;
n number:=&n;
i number;
begin
for i in m..n loop
if mod(i,2)=1 then
dbms_output.put_line(i||' is odd number');
else
dbms_output.put_line(i||' is even number');
end if;
end loop;
end;
Output: Enter value for a: 25
old 2: m number:=&m;
new 2: m number:=25;
Enter value for a: 30
old 3: n number:=&n;
new 3: n number:=30;
25 is odd number
26 is even number
27 is odd number
28 is even number
29 is odd number
116 | P a g e
30 is even number
10. Write a PL/SQL program to find armstrong numbers in a given range m
to n
Program:
declare
m number:=&m;
n number:=&n;
i number;
c number;
r number;
s number:=0;
begin
for i in m..n loop
c:=i;
while c>0 loop
r:=mod(c,10);
s:=s+(r*r*r);
c:=floor(c/10);
end loop;
if s=i then
dbms_output.put_line(i||' is armstrong');
end if;
s:=0;
end loop;
end;
Output:
Enter value for m: 150
old 2: m number:=&m;
new 2: m number:=150;
Enter value for n: 1000
old 3: n number:=&n;
new 3: n number:=1000;
153 is armstrong
370 is armstrong
371is armstrong
407 is armstrong
11. Write a PL/SQL program to retrieve records from the sailors table using
cursor
Program:
declare
117 | P a g e
s_id number(2);
s_name varchar2(20);
s_rating number(2);
s_age number(3,1);
cursor c_sailors is select sid,sname,rating,age from sailors;
begin
open c_sailors;
loop
fetch c_sailors into s_id,s_name,s_rating,s_age;
dbms_output.put_line(s_id||' '||s_name||' '||s_rating||' '||s_age);
exit when c_sailors%notfound;
end loop;
close c_sailors;
end;
Output:
22 dustin 7 45
29 brutus 1 33
31 lubber 8 55.5
32 andy 8 25.5
58 rusty 10 35
64 horatio 7 35
71 zorba 10 16
74 horatio 9 35
85 art 3 25.5
95 bob 3 63.5
12. Write a PL/SQL procedure to find factorial of a given number
Procedure:
create or replace procedure fact(n in number, r out number) is
i number:=n; --Never modify in parameter value
f number:=1;
begin
while(i>1) loop
f:=f*i;
i:=i-1;
end loop;
r:=f; --Assign final value to out parameter
end fact;
Output:
Procedure created.
Program:
118 | P a g e
declare
n number;
r number;
begin
n:=&n;
fact(n,r);
dbms_output.put_line('Factorial of '||n||' is '||r);
end;
Output:
Enter value for n: 6
old 5: n:=&n;
new 5: n:=6;
Factorial of 6 is 720
13. Write a PL/SQL procedure to print first n Fibonacci numbers
Procedure:
create or replace procedure fibonacci(n in number) is
f1 number:=0;
f2 number:=1;
f3 number;
i number:=1;
begin
dbms_output.put_line('Fibonacci Series is ');
dbms_output.put_line(f1);
dbms_output.put_line(f2);
while(i<n-1) loop
f3:=f1+f2;
f1:=f2;
f2:=f3;
i:=i+1;
dbms_output.put_line(f3);
end loop;
end fibonacci;
Output:
Procedure created.
Program:
declare
n number;
begin
n:=&n;
fibonacci(n);
119 | P a g e
end;
Output:
Enter value for n: 5
old 4: n:=&n;
new 4: n:=5;
Fibonacci Series is
0
1
1
2
3
14. Write a PL/SQL function to find sum of digits of a number
Function:
create or replace function sumofn(n in number) return number is
s number:=0;
i number:=n;
begin
while(i!=0) loop
s:=s+mod(i,10);
i:=floor(i/10); --Extract decimal part
end loop;
return s;
end sumofn;
Output:
Function created.
Program:
declare
n number;
r number;
begin
n:=&n;
r:=sumofn(n);
dbms_output.put_line('Sum of '||n||' digits is '||r);
end;
Output:
Enter value for n: 456
old 5: n:=&n;
new 5: n:=456;
Sum of 456 digits is 15
15. Write a PL/SQL recursive function to find factorial of a number
120 | P a g e
Procedure:
create or replace function rfact(n in number) return number is
f number:=1;
begin
if n=1 then
return 1;
else
f:=n*rfact(n-1);
return f;
end if;
end;
Output:
Function created
Query;
declare
n number;
r number;
begin
n:=&n;
r:=rfact(n);
dbms_output.put_line('Factorial of '||n||' is '||r);
end;
Output:
Enter value for n: 7
old 5: n:=&n;
new 5: n:=7;
Factorial of 7 is 5040
16. Explain Packages with PL/SQL program
Package Specification:
CREATE OR REPLACE PACKAGE DEMO AS
-- Function Specs goes here
FUNCTION fact(n in number) return number;
-- Procedure one specs goes here
PROCEDURE circle(radius in number, area out number, cir out number);
END DEMO;
Output:
Package created.
Package Body:
CREATE OR REPLACE PACKAGE BODY DEMO AS
FUNCTION fact (n in number) return number is
121 | P a g e
pno number(3):= 0;
c number:= 1;
BEGIN
pno:= n;
WHILE pno >= 1
Loop
c:= c * pno;
pno:= pno - 1;
END LOOP;
return c;
END fact;
PROCEDURE circle (radius in number, area out number, cir out number) AS
BEGIN
area:= (22/7) * radius * radius;
cir:= 2* (22/7) * radius;
END CIRCLE;
END DEMO;
Output:
Package body created.
Program:
DECLARE
x1 number:= 2; -- radius
f1 number:= 5; -- fact
x number:= 0;
sa number:= 0;
sb number:= 0;
BEGIN
x:= demo.FACT(f1);
dbms_output.put_line('Factorial of '||f1||' is '||x);
demo.CIRCLE(x1,sa,sb);
dbms_output.put_line('Area is '||sa||' '||'Circumference is '||sb);
END;
Output:
Factorial of 5 is 120
Area is 12.57142857142857142857142857142857142856
Circumference is 12.57142857142857142857142857142857142856

122 | P a g e
(Approved by AICTE & GOVT OF A.P and Affiliated to JNTU)
Yamnampet, Ghatkesar, Hyderabad – 501 301

LABORATORY MANUAL

FOR

ANALOG AND PULSE CIRCUITS


(9D461)
(II/II B.TECH –ECM)

DEPARTMENT OF
ELECTRONICS AND COMPUTER ENGINEERING (ECM)
February 2024

123 | P a g e
VISION OF THE DEPARTMENT
To emerge as a premier centre in Electronics and Computer engineering with focus on human
values and professional ethics

MISSION OF THE DEPARTMENT


1. To prepare Electronics and Computer Engineering graduates to be a life- long learner
with competence in basic sciences, engineering & professional core, interdisciplinary
subjects, so that they can have professional career or to pursue higher studies.
2. Developing liaison with Academia, R & D institutions, software and electronics Indus-
tries for exposure of students to the practical aspects in engineering and solution of the
industry oriented and societal problems, entrepreneurial pursuit and project management
3. Inculcating interpersonal skills, team work, professional ethics, IPR and regulatory is-
sues in students to improve their employability and promoting leadership in changing
global environment
4. To continuously engage in research and development activities and to promote scientific
temper in the graduates.

124 | P a g e
Program Outcomes (POs)

1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering


fundamentals, and an engineering specialization to the solution of complex engineering
problems.
2. Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering problems
and design system components or processes that meet the specified needs with
appropriate consideration for the public health and safety, and the cultural, societal, and
environmental considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and
research methods including design of experiments, analysis and interpretation of data,
and synthesis of the information to provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to
assess societal, health, safety, legal and cultural issues and the consequent responsibilities
relevant to the professional engineering practice.
7. Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and
need for sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities
and norms of the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or
leader in diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and
write effective reports and design documentation, make effective presentations, and give
and receive clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member
and leader in a team, to manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to
engage in Independent and life-long learning in the broadest context of technological
change.

125 | P a g e
Program Specific Outcomes (PSO)

1. System Development and Research Activity:


Ability to identify, formulate and solve engineering problems using computation and ap-
propriate algorithms in one or more fields of electronics and computer engineering, such
as Internet Of Things, embedded systems, computer vision, machine learning, artificial
intelligence, and signal processing
2. Problem Analysis and Design
Ability to use contemporary engineering tools and techniques and adapt to the industry
needs for solving multi-disciplinary problems
3. Successful Career:
Ability to design a system or process to meet desired needs within realistic constraints
such as economic, environmental, social, political, ethical, safety, and sustainability.

Program Educational Objectives (PEOs)


PEO - I. Graduates will have strong foundation in fundamentals of basic sciences, mathematics,
Engineering sciences and technology with abilities to understand societal problems
PEO - II. Graduates will have successful professional career by demonstrating good scientific
and engineering breadth to comprehend the problems using modern tools , conduct
experiments, analyze the results and design novel products and solutions to the real life
problems.
PEO - III. Graduates will be motivated to achieve academic excellence and promote
entrepreneurship and skills in project and finance management, pursue research to
develop life – long learning in a world of constantly evolving technology
PEO- IV. Graduates will be trained in human values, Professional ethics and Intellectual
Property related issues in broader environmental and social context and sustainable
development, communication skills, team work skills, leadership and multidisciplinary
approach.

126 | P a g e
LAB MANUAL ANALOG AND PULSE CIRCUITS (9D461)
L T P/D C
- - 3 1.5

Course Outcomes:
At the end of the laboratory course, the students will be able to
1. To understand the design and working of various linear and non-linear wave shaping circuits.
2. To demonstrate the working principle of various multivibrators.
3. To verify the functionalities of various logic gates.
4. To perform and verify the BJT/ FET and feedback amplifiers.
5. To perform and verify the working of oscillators and voltage regulators.
6. To perform laboratory experiment to verify the conversion efficiency of various power
amplifiers.
Mapping of Course Outcomes with Program Outcomes
7.
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO PO PS PS PS
11 12 O1 O2 O3
CO1 3 3 3 2 2 2 3 2
CO2 3 3 3 2 2 2 3 2
CO3 2 3 3 2 2 2 3 2
CO4 3 3 3 2 2 2 3 2
CO5 2 3 3 2 2 2 3 2
CO6 3 3 3 2 2 2 3 2
Ove
3 3 3 2 2 2 3 2
rall

127 | P a g e
Syllabus Content:
Part-A: Hardware based experiments
1. Linear wave shaping.
2. Non Linear wave shaping – Clippers. clampers.
3. UJT Relaxation Oscillator
4. Astable and monostable Multivibrator.
5. Bistable Multivibrator.
6. Study of Logic Gates with discrete components.

Part-B: Software Simulation based experiments (Multisim OR Pspice OR Tina Pro Or


Equivalent Simulation Software)
1. Common Emitter and Common Source amplifier
2. Voltage shunt and Feedback Amplifier
3. Cascade Amplifier (CE+CE, CE+CC)
4. RC Phase Shift Oscillator using Transistors
5. Class- A and Class-B Complementary Symmetry Power Amplifier
6. Series and Shunt Voltage Regulator.

128 | P a g e
Contents
S.No: Name of the Experiment Page No
CYCLE - I
1 Linear Wave Shaping 136
2 Non Linear Wave Shaping Clipper Circuits 144
3 Non Linear Wave Shaping Clamper 153
4 Study Of Logic Gates 158
5 Astable Multivibrator 163
6 Monostable Multivibrator 166
7 Bi Stable Multivibrator 169
8 UJT Relaxation Oscillator 171

CYCLE – II

1 Common Emitter Amplifier 174


2 Common Source Amplifier 178
3 Two Stage RC coupled Amplifier 180
4 Darlington Pair (CC +CC) 183
5 Voltage Shunt feedback Amplifier 184
6 RC Phase Shift Oscillator 187
7 Class A Power Amplifier 189
8 Class B complementary symmetry Power Amplifier 192
9 Sereis and Shunt voltage Regulator 196

129 | P a g e
1. LINEAR WAVE SHAPING

AIM: To understand linear wave shaping using RC high pass and Low pass circuits.

APPARATUS:
1. Bread Board
2. Resistor- 1KΩ-1No.
3. Regulated power supply
4. capacitors- 0.01μf – 1 No.
5. Connecting wires.
6. Function Generator.
7. CRO Probes
8. CRO

CIRCUIT DIAGRAM:
i) High pass circuit:

ii) Low pass circuit:

130 | P a g e
THEORY:
The linear wave shaping circuits alter the shape of a waveform by passing them though a
process of differentiation or integration. High pass circuits allow high frequency signals and
attenuate low frequency signals. High pass circuits acts as a good differentiator for RC<<T. Low
pass circuits allows low frequency signals and attenuates high frequency signals. Low pass
circuits acts as a good Integrator for RC>>T.

PROCEDURE:

i) High pass RC circuit:


1. Before connection calculate the time constant τ.
2. Connect high pass RC circuit as per the circuit shown in figure.
3. Connect a square wave generator to the input of the circuit.
4. Connect the CRO channel-I to the input and channel-II to the output of circuit.
5. Adjust the square wave amplitude to 5V peak to peak & note down the input waveform.
6. Adjust the frequency of square wave generator such that i) T<< τ ii) T= τ iii) T>> τ
7. Observe and note down the output waveforms in each case.
8. Now calculate % tilt from the output waveform for case T<< τ and check whether it is equal to
theoretical value or not.

i) Low pass RC circuit:

1. Before connection calculate the time constant τ.


2. Connect low pass RC circuit as per the circuit shown in figure.
3. Connect a square wave generator to the input of the circuit.
4. Connect the CRO channel-I to the input and channel-II to the output of circuit.
5. Adjust the square wave amplitude to 5V peak to peak & note down the input waveform.
6. Adjust the frequency of square wave generator such that i) T<< τ ii) T= τ iii) T>> τ
7. Observe and note down the output waveforms in each case.
8. Now calculate rise time tr from output waveforms for case T<< τ and verify whether it is equal
to theoretical value or not.

131 | P a g e
EXPECTED WAVEFORM:

132 | P a g e
Out put wave forms: High Pass RC Circuit

133 | P a g e
THEORITICAL CALCULATIONS:
High pass circuit:

% tilt = (T/2 RC) X100

Low pass circuit:

Rise time = tr = 2.2 RC

RESULT:
Linear wave shaping using RC high pass and Low pass circuits is studied.

VIVA-QUESTIONS:

1. What is a linear network? What is linear wave shaping?

Ans: A linear network is a network made up of linear elements only.The principle of superposi-
tion and the principle of homogeneity hold good for linear networks.

Linear wave shaping: it is the process whereby the form of non sinusoidal signal is altered by
transmission through a linear network.

2. Define Time constant. What is its formula?

Ans: The time constant of a circuit is defined as the time taken but the output to rise to 63.2% of
the amplitude of the input step T = RC.

3. Define %Tilt and Rise Time. Write the expressions for the same.

Ans: %Tilt: %Tilt is defined as decay in the amplitude of the outut voltage wave due to the inut
voltage maintaining constant level.

%Tilt = V1 –V11/(V/2) ×100

Rise Time: The rise time t is defined as the time taken by the output voltage waveform of a
low pass circuit excited by a step input to the rise from 10% to 90% of its final value.

The rise time of the output of a low pass circuit excited by a step input is given by

t = 2.2RC = 0.35/ f2 = 0.35 / BW

4. When High pass RC circuit is used as Differentiator? What is the formula for the output, when
operated as differentiator?

134 | P a g e
Ans: The high pass RC circuit acts as a differentiator provided the RC time constant of the cir-
cuit is very small in comparison with the time required for the input signals to make an apprecia-
ble change.

Vo (t) = RC dvi(t) / dt

5. When Low pass RC circuit is used as Integrator? What is the formula for the output, when the
circuit is operated as Integrator?

Ans: If the time constant of an RC low pass circuit is very large in comparison with the time re-
quired for the input signal to make an appreciable change, the circuit acts as an integrator.

Vo (t) = t2 / 2RC

6. What is the Difference between Low pass and High pass RC circuits.

Ans: Low Pass: A Low pass circuit is a circuit which transmits only low frequency signals and
attenuates or stops high frequency signals.

High Pass: A High pass circuit is a circuit which transmits only high frequency signals and at-
tenuates or stops low frequency signals.

7. A Capacitor blocks __ signal and passes __ signal. The voltage across the ___ will not change
suddenly.

Ans: A Capacitor blocks DC signal and passes AC signal. The voltage across the capacitor will
not change suddenly.

8. Explain 3 dB values for a LP and HP circuit.

Ans:

High Pass

Low Pass

9. A differentiator converts a square wave into what form? An integrator converts a square wave
into what form?

Ans: A differentiator converts a square wave into spikes waveform An integrator converts a
square wave into triangle waveform.

135 | P a g e
10. What are the formulae for charging a capacitor from an initial voltage of Vi to a final voltage
of Vo.

Ans: Vo = Vf + (Vi - Vf) e-T/RC

11. Instead of using RC components for a low pass or high pass, how the circuit changes , if we
want to use RL components? What are the values for the Time constant for RL circuits?

Ans: T = L/R

12. When a capacitor in a low pass circuit charges to 99.3 % ( treated as fully charged) for a step
input to a Low pass filter?

Ans: V0 = Vi

13. What is a peaking circuit?

Ans: The process of converting pulse into pips by means of a circuit of very short time constant
is called peaking.

14. What is a ringing circuit?

Ans: A ringing circuit is a circuit which can proved as nearly and un-damped oscillations as pos-
sible.

15. Why resistive attenuators are to be compensated?

Ans: A resistive alternator needs to be compensated in order to reduce or eliminate the rise time
of the output waveform.

Design Problems:

1. Design RC Differentiator circuit for frequency of 2kHz.


2. Design RC high circuit for a square wave input signal of frequency 2.5KHz for
i. RC = 10T
ii. RC = T
iii. RC = T/10
3. Design low pass circuit for a square wave signal of 3KHz for

i. RC = 5T
ii. RC = T
iii. RC = T/5
1. Verify the output of circuits given in Fig1.1 and Fig 1.2 for input square wave of fre-
quencies 10KHz and 500Hz.
2. Verify the RC high pass circuit output for sinusoidal input.

136 | P a g e
2. NON LINEAR WAVE SHAPING CLIPPER CIRCUITS

AIM: To study the diode clipper circuit using Diodes.

APPARATUS:
1. Bread Board
2. CRO Probes
3. CRO
4. Capacitor- 0.1μf
5. Regulated power supply
6. IN 4007 diode-1No.
7. Connecting wires.
8. Function Generator.

Circuit diagrams:
Input Signal

Negative clipper with zero reference (Series clipper):

Transfer characteristics:

137 | P a g e
Positive clipper with zero reference (Series clipper):

Transfer characteristics:

138 | P a g e
Negative clipper with zero reference (Shunt clipper):

Transfer characteristics:

Positive clipper with zero reference (Shunt clipper):

139 | P a g e
Transfer characteristics:

Positive clipper with positive reference (Series clipper):

140 | P a g e
Transfer characteristics:

Positive clipper with positive reference (Shunt clipper):

141 | P a g e
Transfer characteristics:

Negative clipper with positive reference (Series clipper):

142 | P a g e
Transfer characteristics:

Clipping at two independent levels :

Transfer characteristics:

THEORY:
Clipping circuits are commonly realized with diodes and resistor and do not contain any energy
storing components. The function performed by the clipping circuits essentially either limiting or
slicing. These circuits also employ devices such as diodes, Zener diodes, and transistors along

143 | P a g e
with resistors. Amplitude selectors and Amplitude limiters are the other names of the clipping
circuits

PROCEDURE:
1. Connect the circuits as per the circuit diagram
2. Connect the CRO Ch-I to input and Ch-2II to output of the circuit.
3. Adjust the input sine wave amplitude to 5V P-P.
4. Connect the D.C.battery wherever necessary.
5. Observe the wave form in the CRO channel II and not the waveform.

RESULT: Diode clipper circuit using ordinary and Zener Diode are studied and observed the
waveforms.

VIVA-QUESTIONS:

1. Define non linear wave shaping? What are the non-linear components?

Ans: The circuits for which the outputs are non-sinusoidal for sinusoidal inputs are called non-
linear wave shaping.

Example: clipping circuits and clamping circuits.

2. Define clipping circuit? What are the other names for clippers?

Ans: A clipping circuit is a circuit which removes the undesired part of the waveform and trans-
mits only the desired part of the signal which is above or below some particular reference level.
The other names for clippers are voltage (or current), limiters, amplitude, selectors or slicers.

3. Write the piecewise linear characteristics of a diode?

Ans: The piecewise linear approximation of a semi conductor diode the break down is at V
which is called offset or threshold voltage the diode behaves like an open circuit if v < V . The
characteristics show a constant incremental resistance r = dv / di if v > V .

4. What are the different types of clippers?

Ans: The different types of clippers are


1. Diode Clippers
2. Shunt Clippers
3. Series Clippers
4. Series And Shunt Noise Clippers
5. Transistor Clippers

144 | P a g e
6. Emitter Coupled Clippers

5. Which kind of a clipper is called a slicer circuit?

Ans: Two level clipper [It clips both positive and negative peaks]

6. What are the applications of Clipper Circuits?

Ans: Clipping circuits may be used to convert sine waves into square waves. They may also be
used to remove unwanted noise signals

7. What is the figure of merit for diodes used in clipping circuits?

Ans: The ratio of Rr / Rf is a figure of merit for diodes using in clipping circuit .

8. What is the influence of the practical diode compared to the ideal diode, in the above circuits?

Ans: In ideal diode current flows freely through the device , when forward bias having no
ressistance . a practical diode offers some in resistance to current flow when it is forward bias an

9. Instead of sinusoidal wave form as input, if we give other wave forms like triangular or
square, then how the clipping action is performed?

Ans: Clipping action is same for any give input.

10. What is Vγ for Ge diode and Vγ for Si diode?

Ans: V for Ge diode is 0.3V and V for Si diode is 0.7V.

145 | P a g e
3. NON LINEAR WAVE SHAPING CLAMPER

AIM: To study the Clamper circuits.

APPARATUS:
1. Bread Board
2. Patch cards
3. CRO Probes
4. CRO
5. Resistor- 1KΩ-1No.
6. Regulated power supply
7. IN 4007 diode-1No.
8. BZX6V2 diode- 2 No.
9. Connecting wires.
10. Function Generator.

CIRCUIT DIAGRAM:

Input Signal

Fig.3.1 Negative clamping with zero reference voltage

Fig.3.2 positive clamping with zero reference voltage

146 | P a g e
Fig.3.3 Negative clamping with Negative reference voltage

Fig.3.4 positive clamping positive reference voltage

Fig.3.5 Negative clamping with Positive reference voltage

Fig.3.6 Positive clamping with Negative reference voltage

THEORY:
147 | P a g e
Clamping circuits do not make any effort to change the wave shape of any signal. Their
main concern is to introduce a dc shift into a waveform by altering its dc component. In RC
coupling and capacitive coupling, the blocking capacitor does not allow the dc component of the
applied signal to pass through it. Since all the sinusoidal components pass through the blocking
capacitor, the wave shape of the signal remains the same after transmission while its dc level is
brought down to zero. Clamping circuits are essentially used to restore this lost dc component.

The process where sinusoidal signals are going to be altered by transmitting through a non-lin-
ear network is called non-linear wave shaping. Non-linear elements (like diodes) in combination
with resistors and capacitors can function as clamping circuit.

Clamping circuits add a DC level to an AC signal. A clamper is also referred to as DC restorer or


DC re-inserter. The Clampers clamp the given waveform either above or below the reference
level, which are known as positive or negative clampers respectively.

Clamping circuits are classified as two types.

i. Negative Clampers
ii. Positive Clampers

148 | P a g e
PROCEDURE:
1. Connect the circuits as per the circuit diagram
2. Connect the CRO Ch-I to input and Ch-2II to output of the circuit.
3. Adjust the input sine wave amplitude to 5V P-P.
4. For Zener diode clipper, increase the amplitude of the input Wave form to 15V P-P
5. Observe the wave form in the CRO, with and without connecting the D.C.battery (i.e. biasing)
and note the wave form from Ch-II of CRO.

RESULT: The clamping circuits are studied.

VIVA-QUESTIONS:
1. What are the applications of clamping circuits?

Ans: Clapping circuits are used to fix the positive or negative extremity of a periodic waveform
at some constant reference level.

3. Explain the Principle of operation of Clampers.

Ans: When a signal is transmitted to a capacitive coupling network (RC high pass circuit), it
losses its dc component, and a clamping circuit may be used to introduce a dc component by fix-
ing the positive or negative extremity of that waveform to some reference level.

4. What is clamping circuit theorem.

Ans: The clamping circuit theorem state that for any input waveform under steady state condi-
tions, the ratio of area Af under the output voltage curve in the forward direction to that in the re-
verse direction Ar is equal to the ratio Rf / R, i.e., Af / Ar = Rf / R

5. What is the function of capacitor in clamper circuit?

Ans: The function of capacitor in clamper circuit is that it will add dc signal to the ac signal.

6. What are the effects of diode characteristics on the output of the Clamper?

Ans: When temperature varies reverse saturation current increases and cut in voltage decreases
which effects clamping circuit.

7. If we interchange the diode and the capacitor in fig 1 above, how the circuit behaves?

Ans: If capacitor connected in series to allow AC ,for DC allowing circuits capacitors connected
in parallel.

8. Calculate the power dissipation in the Resistor for any one of the above circuits?

Ans: P = I2R P = 1 Watt

149 | P a g e
9. What is the difference between a clipper and a clamper?

Ans: Clipper clips OFF the unwanted portion of the input waveform, and the clamper simply
clams the maximum positive or negative peak to a desired level.

10. What are the other names for clampers?

Ans: The other names for clampers are: Dc restorer and Dc reinserter

150 | P a g e
4. LOGIC GATES

AIM: To study and verify the truth table of AND, NOR, OR, NOT, NAND Gate (Discrete
version)

APPARATUS:
1. Bread Board
2. IC trainer Kit Patch cards
3. Diodes IN4007
4. Resistors (1kΩ, 100Ω, 4.7kΩ, 330Ω, 10KΩ)
5. Capacitors (0.1μf)
4. Connecting wires.

CIRCUIT DIAGRAM:

151 | P a g e
152 | P a g e
153 | P a g e
154 | P a g e
155 | P a g e
THEORY:
In digital electronics, the binary digits 0 and 1 are represented by voltages LOW and HIGH.
This branch of electronics is mathematically supported by Boolean algebra. The basic logic
operations in this algebra are NOT, AND & OR. These logic operators are binary as they work
on two operands to specify the output.

PROCEDURE:
1. Connect the circuit as per the circuit diagram.
2. Give different combinations of inputs and observe the output.
3. Construct the truth tables for each circuit considering the input and output levels of the circuit.

RESULT: The truth tables of AND, OR, NOT, NOR, NAND gates are verified.

VIVA-QUESTIONS:
1) What is logic gate and by using which devices we can realize the logic gates?
2) What is combination circuit? What is truth table?
3) Realize the NAND gate using AND,OR and NOT gates?
4) Realize logic gates using transistors?
5) What is IC and give some IC’s name for logic gates?

156 | P a g e
5. ASTABLE MULTIVIBRATOR

AIM: To study an Astable Multivibrator to generate a square wave using Astable multivibrator.

APPARATUS:
1. D.C. Regulated power supply
2. Dual Trace CRO
3. Resistors
4. Capacitors/Decade capacitance box.
5. Bread Board.

CIRCUIT DIAGRAM:

THEORY:

Transistor multivibrators make use of all the three regions of operations: cut-off, saturation, as
well as the active region. The working principle of transistor multivibrators involves the cutoff
and saturation regions. Astable multivibrator can also be treated as a relaxation oscillator. The
astable multivibrator has two quasi-stable states. This circuit is commonly used for the
generation of a rectangular waveform.

157 | P a g e
PROCEDURE:
1. Connect the circuit diagram according to the given diagram.
2. Apply D.C.power supply to the circuit.
3. Observe the base and collector voltages of Q1 and Q2 on CRO.
4. Measure the time period of the output waveforms and compare with theoretical
Values.
5. Repast the above steps with different capacitance values from decade capacitance.

Expected Wave forms:

158 | P a g e
THEORITICAL CALCULATIONS:

T=0.69 (RB1C1+RB2C2)

If RB1C1=RB2 = R & C1 = C2=C


T =1.38RC

RESULT:
The working of Astable multivibrator is studied and Observed the practical values and
waveforms.

VIVA-QUESTIONS:

1) What is multivibrator? Give some names of the multivibrators?


2) What are the applications of astable multivibrator?
3) Which multivibrator is used as a voltage to frequency converter?
4) In which multivibrator we have to apply triggering pulses to change the states
of transistor?
5) How many stable states are there in astable multivibrator?

159 | P a g e
6. MONOSTABLE MULTIVIBRATOR

AIM: To study Monostable Multivibrator to generate a square wave

APPARATUS:
1. D.C. Regulated power supply
2. Dual Trace CRO
3. Resistors
4. Capacitors/Decade capacitance box.
5. Bread Board.

CIRCUIT DIAGRAM:

160 | P a g e
THEORY:

PROCEDURE:
1. Connect the circuit diagram according to the given diagram.
2. Apply D.C.power supply to the circuit.
3. Observe the base and collector voltages of Q1 and Q2 on CRO.
4. Measure the time period of the output waveforms and compare with theoretical
Values.
5. Repeat the above steps with different capacitance values from decade capacitance.

Expected Wave Forms:

161 | P a g e
THEORITICAL CALCULATIONS:

RESULT: The working of Mono stable multivibrator is studied and Observed the practical
values and waveforms.

162 | P a g e
7. BI STABLE MULTIVIBRATOR

AIM: To study Bistable Multivibrator to generate a square wave

APPARATUS:
1. D.C. Regulated power supply
2. Dual Trace CRO
3. Resistors
4. Capacitors/Decade capacitance box.
5. Bread Board.

CIRCUIT DIAGRAM:

THEORY:

The Bistable Multivibrator is another type of two state device similar to the monostable
multivibrator. Bistable Multivibrators have TWO stable states (hence the name: "Bi" meaning
two) and maintain a given output state indefinitely unless an external trigger is applied. The
bistable multivibrator can be switched over from one stable state to the other by the application
of an external trigger pulse thus, it requires two external trigger pulses before it returns back to
its original state. As bistable multivibrators have two stable states they are more commonly
known as Latches and Flip-flops for use in sequential type circuits.

163 | P a g e
PROCEDURE:

1. Connect the circuit diagram according to the given diagram.


2. Apply D.C.power supply to the circuit.
3.Verify the stable states by measuring the voltages at two collectors by using multimeter .
4. Observe the base and collector voltages of Q1 and Q2 on CRO.
5. Measure the time period of the output waveforms and compare with theoretical
Values.
6. Repeat the above steps with different capacitance values from decade capacitance

RESULT: The working of Bistable multivibrator is studied and Observed the practical values
and waveforms.

VIVA-QUESTIONS:

1) What is multivibrator? Give some names of the multivibrators?


2) What are the applications of bistable multivibrator?
3) Which multivibrator is used as a voltage to frequency converter?
4) Is triggering required for a bistable multivibrator?
5) How many stable states are there in bistable multivibrator?

164 | P a g e
8. UJT RELAXATION OSCILLATOR

AIM: To study the relaxation oscillator using uni junction transistor.

APPARATUS:

1. Bread Board
2. Patch cords
3. CRO
4. CRO Probes
5. Components, UJT

THEORY:

Uni junction transistor has only one junction. It is used to generate saw tooth wave forms i.e.
time base signals. UJT is used as a relaxation oscillator. A relaxation oscillator is one which
gives saw tooth waveforms without giving any input signal.

CIRCUIT DIAGRAM:

165 | P a g e
EXPECTED WAVEFORM:

PROCEDURE:
1. Connect the circuit as per the diagram
2. Switch on the supply and the capacitor is taken across the capacitor Ce.
3. Observe the output waveform and calculate the time period.

RESULT:
The UJT relaxation oscillator is studied.

VIVA-QUESTIONS:
1) What is an oscillator?
2) What is relaxation oscillator?
3) What are the different methods are used to generate time base waveforms?
4) What are the applications of relaxation oscillator?
5) What are differences between diode and UJT?

166 | P a g e
CYCLE -II

167 | P a g e
Experiment No. 1

COMMON EMITTER AMPLIFIER

AIM: To measure the gain, bandwidth, input resistance, output resistance of CE amplifier by
using TINA software

APPARATUS:

TINA software.

CIRCUIT DIAGRAM:

COMMOM EMITTER A MPLIFIER

V1 12V
R1 3 .3 k
R3 3 3k

C1 10uF VF1

R2 1k C1 10uF
T2 BC107A
R1 4 .7 k

C1 1 00 uF
+

R1 4 70

VG1

168 | P a g e
EXPECTED GRAPH :

169 | P a g e
170 | P a g e
PROCEDURE ( FREQUENCY RESPONSE ):

1. Connect the circuit as shown in fig.


2. Go to AC analysis and get the AC transfer characteristics as shown in Expected
graph.
3. By using scales we can calculate the bandwidth and gain.
4. By using the frequency response note down the readings.
5. Calculate the lower cut off frequency and upper cut off frequency theoretically.
.
CALCULATIONS:

1. Voltage gain at mid frequencies (Amid) = Maximum value of Av.


2. Voltage gain at lower & upper cut off frequencies = Avmid.-3
3. Lower cut off frequency = f1
4. Upper cut off frequency = f2
5. 3-dB band width of the amplifier = f2- f1

QUESTIONS:
1. Does phase reversal exist in CE amplifier?
2. Does phase reversal effect amplification?
3. What is signification of operating point?
4. Mention the influence of coupling capacitor CC on low frequency response.
5. Define & .
6. Calculate with the help of observed in this experiment?
7. In which transistor configuration current gain is less than unity.

Experiment No. 2

171 | P a g e
COMMON SOURCE AMPLIFIER

AIM: To measure the gain, bandwidth, input resistance, output resistance of CS amplifier by us-
ing TINA software.

APPARATUS:

TINA software.

CIRCUIT DIAGRAM:

COMMOM SOURCE AMPLIFIER

V1 12V

R1 4 .7 k
C1 10uF VF1

R2 1k C1 10uF

C1 1 00 uF
T1 BF245A
R1 2 .2 M
+

R1 4 70

VG1

EXPECTED GRAPH :

172 | P a g e
PROCEDURE( FREQUENCY RESPONSE ):

1. Connect the circuit as shown in fig.


2. Go to AC analysis and get the AC transfer characteristics as shown in Expected
graph.
3. By using scales we can calculate the bandwidth and gain.
4. By using the frequency response note down the readings.
.

CALCULATIONS:

1. Voltage gain at mid frequencies (Amid) = Maximum value of Av.


2. Voltage gain at lower & upper cut off frequencies = Avmid.-3
3. Lower cut off frequency = f1
4. Upper cut off frequency = f2
5. 3-dB band width of the amplifier = f2- f1

QUESTIONS:

1. Does phase reversal exist in CS amplifier?


2. Why the gain is increasing in low frequency, constant in mid frequencies and decreasing
in high frequencies?
3. Why cut off frequencies are also called as half power points?
4. Mention the influence of Bypass capacitor Ce on low frequency response.

173 | P a g e
Experiment No.3
TWO STAGE RC COUPLED AMPLIFIER

AIM: To meaure and plot gain and bandwidth (frequency response) for two stage RC coupled ampli-
fier by using SPICE software.

APPARATUS :

TINA PRO Software

CIRCUIT DIAGRAM:

Two Stage RC coupled Amplifier


V1 12
R1 3 3k

R1 3 .3 k

R1 3 3k

R1 3 .3 k
C110u VF1
VF2
R21k C110u
C110u
T1 BC107
T2 BC107
R1 4 .7 k

R1 4 .7 k
+

C1 1 00 u

VG1
R1 4 70

C1 1 00 u

R3 1 0k
R1 4 70

THEORY:
The output from single stage amplifier is usually insufficient to drive to drive an output
device. To achieve the extra gain the output of each amplifier stage is coupled in some way to
the input of next stage. A transistor circuit contains more than one stages known as multistage
amplifier.The coupling of one stage to another is done with help of some coupling device. If is
coupled with R and C then the amplifier(cascade) is called
R-C coupled amplifier. It can be Direct coupled or transformer coupled.

GAIN:- The gain G is the ratio of output to input. The gain of the multistage amplifier is equal to
the product of gains of individual stages.
i.e G=G1 x G2 x G3.

174 | P a g e
(EXPECTED GRAPH):-

PROCEDURE( FREQUENCY RESPONSE ):

1. Connect the circuit as shown in fig.


2. Go to AC analysis and get the AC transfer characteristics for both stages as shown in Ex-
pected graph .
3. By using scales we can calculate the bandwidth and gain at both stages.
4. By using the frequency response note down the readings.
5. Calculate Gain and Bandwidth at both the stages from frequency response.
6. calculate the LCF due to all external capacitors.
.

CALCULATIONS:

Single stage:

1. Voltage gain at mid frequencies (Amid)=Max. Value of Av.(dB)


2. Voltage gain at lower & upper cutoff frequencies = Avmid -3
3. Lower cutoff frequency = fL1...
4. Upper cutoff frequency = fH1.
5. 3-dB band width of the amplifier = fH1 - fL1..

175 | P a g e
Two Stage:

1. Voltage gain at mid frequencies (Amid)=Max. Value of Av.


2. Voltage gain at lower & upper cutoff frequencies = Avmid.-3
3. Lower cutoff frequency = fL2...
4. Upper cutoff frequency = fH2.
5. 3-dB band width of the amplifier = fH2 – fL2..

fL2>fL!; fH2<fH1; Bandwidth 2<Band width 1

QUESTIONS:

1. Is fH* for two stages greater or smaller than fH for a single stage? Explain
2. Given an approximate expression relating fH* and 3-dB frequencies of n
non-identical stages?
3. Three identical cascaded stages have an overall upper – 3dB frequency of 20 KHZ and a
lower 3-dB frequency of 20HZ. What are fL and fH of each stage? Assuming non-inter-
acting stages?
4. R-C coupled amplifier has a very ______ frequency response curve.
5. Direct coupling is used for amplifying _______________________.

176 | P a g e
Experiment No:4

DARLINGTON PAIR (CC+CC)

AIM: To calculate the input resistance of Darlington pair and comparing with the theoretical
values.

APPARATUS:

SPICE Software

CIRCUIT DIAGRAM:

Darlington Pair V1 12V


R2 1 00 M

R6 1 00 M

T1 BC107
R11k C110uF
VF2
R3 3 3M

C210uF
T2 BC107
R7 3 3M

C310uF VF1
+

R4 5 00

VG1
R5 1 0k

PROCEDURE:
1. Connect the circuit diagram as shown in Fig.
2. Calculate the input resistance by the following for both stages
And compare with the theoretical values

Observation:

Sl.No Vs Vi Ii= Vs- Vi / Rs Ri=Vi / Ii Ris = Vs/Ii

Result:

177 | P a g e
Experiment No.5

VOLTAGE SHUNT FEED BACK AMPLIFIER

AIM: To measure the gain and bandwidth (frequency response) of voltage shunt feedback amplifier
with and without feedback by using TINA software.

APPARATUS:

TINA Software

CIRCUIT BIAGRAM;

EXPECTED GRAPH :

178 | P a g e
PROCEDURE:

1. Arrange the circuit as shown in the circuit diagram.


2. Apply ac signal to the input of the amplifier from the signal generator.
3. Keep the input signal voltage 1mV and frequency at 10kHz.
4. Go to AC analysis and get the AC transfer characteristics for both circuit diagram
as shown in Expected graph .
5. By using scales we can calculate the bandwidth and gain at both with and without
feedback.
6. By using the frequency response note down the readings.
7. Calculate Gain and Bandwidth at both the stages from frequency response.
8. Repeat the above steps by removing the feed back resistance and note down the
with out feedback readings.

CALCULATIONS:

With out feed back:

1. Voltage gain at mid frequencies (Amid)=Max. Value of Av.(dB)


2. Voltage gain at lower & upper cutoff frequencies = Avmid -3
3. Lower cutoff frequency = fL1...

179 | P a g e
4. Upper cutoff frequency = fH1.
5. 3-dB band width of the amplifier = fH1 - fL1..

With feed back:

1. Voltage gain at mid frequencies (Amid)=Max. Value of Av.


2. Voltage gain at lower & upper cutoff frequencies = Avmid.-3
3. Lower cutoff frequency = fL2...
4. Upper cutoff frequency = fH2.
5. 3-dB band width of the amplifier = fH2 – fL2..

fL2<fL!; fH2>fH1; Bandwidth 2>Band width 1

180 | P a g e
Experiment No.: 6

RC PHASE SHIFT OSCILLATOR

AIM: To study the performance of RC phase shift oscillator by using SPICE

APPARATUS:

TINA PRO software.

CIRCUIT DIAGRAM

EXPECTED GRAPH

181 | P a g e
PROCEDURE:

1.Connect the RC circuit as shown in the figure


2.Simulate the circuit and observe the waveform in the CRO.
3.Measure the frequency of the wave form generated and compare with the theoretical value.
. .
CALCULATIONS:

f0 = for : C = 0.01 F
R = 2.7 K

182 | P a g e
Experiment No: 7

CLASS –A POWER AMPLIFIER

AIM: To determine the efficiency of Class A power amplifier using TINA software.

APPARATUS:

TINA PRO software

INTRODUCTION:

An amplifier is a circuit meant to amplify a signal with a minimum of distortion, so as to make it


more useful. In an amplifier system, there are more than one stages. The initial and middle stages
work as voltage amplifiers and handle small signals. However the final stage (also called the
output stage) is required to drive a load (such as loud speaker) which handles sufficient power:
For obtaining sufficient power, it requires a large swing of voltage or current.

In almost all electronic systems, the last stage has to be a power amplifier. For example, in a
public-address system, it is the power amplifier that drives the loud speakers. A power amplifier
is meant to boost the power level of the input signal. This amplifier can feed a large amount of
power to the load. To obtain large power at the output of the power amplifier, its input- signal
voltage must be large. That is why, in an electronic system, a voltage amplifier invariably
proceeds the power amplifier. Therefore, the power amplifiers are called large-signal amplifiers.

Actually the power amplifier does not amplify the power. The power amplifier takes power from
the dc power supply connected to the output circuit and converts it into useful ac signal power.
This power is fed to the load (e.g. loud speaker).

The type of ac power developed at the output of the power amplifier is controlled by the input
signal. Thus, a power amplifier is also called as a dc- to-ac power converter, whose action is
controlled by the input signal.

Power amplifiers are divided into many types depending their conduction time over a cycle.
They are

1. Class-A Power Amplifier.


2. Class-B Power Amplifier.
3. Class-AB Power Amplifier.
4. Class-C Power Amplifier.

CIRCUIT DIAGRAM:

183 | P a g e
EXPECTED GRAPH:-

184 | P a g e
THEORY:

In Class-A operation, the transistor stays in the active region through- out the ac cycle. In this
operation, the transistor conducts for full 360° of the input cycle. For making conduction
possible through 360°, that is, through both positive and negative half-cycles, it is necessary that
the transistor should be biased for swing in the negative half-cycle also. Such biasing causes
continuous drain of current from the power-supply or battery, even if the input signal is absent. '

The output signal varies for a full (3600) cycle of the input. In this case, the Q-point is biased al -
most at the half of the DC load line. A Class-A amplifier, with DC bias at one half of the supply
voltage, uses a good amount of power to maintain bias, even with no signal applied. This results
in very poor efficiency. When very little AC power is delivered to the load a large amount of
power is dissipated in the collector resistance (Rc). This results in a maxi- mum efficiency of
only 25%. By replacing the collector resistance (Rc) by a large inductor (also called a choke), the
maximum efficiency can be increased to 50%.

PROCEDURE:

1. Switch ON Class- A Power amplifier.


2. Set V s (say 150 to 200mV), at 10KHz using signal generator.
3. Connect milli Ammeter to the ammeter terminals
4. Increase the input voltage till there is no distortion in the output voltage. The maximum
input voltage where there is no distortion in the output voltage at that point note down the
milli ammeter reading Idc and measure the output voltage Vo.
5. Calculate Pdc, Pac and efficiency using following formulae.
i. Pdc = Vcc X Idc. Pac = Vo2 /8 RL
6. Simulate the above class-A Power Amplifier using SPICE software and compare the
values.

185 | P a g e
Experiment No: 8

CLASS-B COMPLEMENTARY SYMMETRY AMPLIFIER

AIM:

To study Class-B (complementary Symmetry) power amplifier and to determine its efficiency
and simulate the same using spice / TINAPRO Software.

APPARATUS:

TINA PRO Software

INTRODUCTION:

An amplifier is a circuit meant to amplify a signal with a minimum of distortion, so as to make it


more useful. In an' amplifier system, there are more than one stages. The initial and middle
stages work as voltage amplifiers and handle small signals. However the final stage (also called
the output stage) is required to drive a load (such as loud speaker) which handles sufficient
power. For obtaining sufficient power, it requires a large swing of voltage or current.

In almost all electronic systems, the last stage has to be a power amplifier. For example, in a
public-address system, it is the power amplifier that drives the loud speakers. A power amplifier
is meant to boost the power level of the input signal. This amplifier can feed a large amount of
power to the load. To obtain large power at the output of the power amplifier, its input- signal
voltage must be large. That is why, in an electronic system, a voltage amplifier invariably
precedes the power amplifier. Therefore, the power amplifiers are called large-signal amplifiers.

Actually the power amplifier does not amplify the power. The power amplifier takes power from
the dc power supply connected to the output circuit and converts it into useful ac signal power.
This power is fed to the load (e.g. loud speaker).

The type of ac power developed at the output of the power amplifier is controlled by the input
signal. Thus, a power amplifier is also called as a dc- to-ac power converter, whose action is
controlled by the input signal.

Power amplifiers are divided into many types depending their conduction time over a cycle.
They are

1. Class-A Power Amplifier.


2. Class-B Power Amplifier.
3. Class-AB Power Amplifier.
4. Class-C Power Amplifier.

186 | P a g e
CIRCUIT DIAGRAM:

EXPECTED GRAPH :

187 | P a g e
THEORY:

The circuit of class-B push-pull amplifier uses two transformers, one at the input and cone at the
output. However, transformers are costly and add to the weight of the amplifier. We can elimi-
nate this drawback by using class- B complementary -symmetry power amplifier. This amplifier
does not have any transformer.

This circuit uses a pair of transistors having complementary symmetry,; that is, one transistor is
PNP and the other is NPN. The complementary- symmetry circuit requires two power supplies,
since each transistor must be biased suitably. The resistors act as voltage dividers across power
supplies to forward bias the emitter-base junction of both transistors. The transistors are operated
in Class-B. That is the bias is adjusted such that the operating point corresponds to the cut-off
points. Hence, with no signal input, both transistors are cut-off and no collector current flows.

The signal applied at the input goes to the base of both the transistors. Since the transistors are of
opposite type, they conduct in opposite half-cycles of the input. For example, during the positive
half-cycle of the input signal, the PNP transistor is reverse biased and does not conduct. The
NPN transistor, on the other hand is forward-biased and conducts. This results in a half-cycle of
output voltage across the load resistor. The other half-cycle of output across the load is provided
by the conduction of other transistor dur -ing the negative half-cycle of the input. Since the
collector current from each transistor flows through the load during alternative half-cycles of the
input signal, no centre tapped output transformer is required.
The two transistors-though of opposite type, must be matched. If there is an imbalance in the
characteristics of the two transistors, even harmonics will no longer be cancelled. This would
result in considerable distortion. In- creasing availability of complementary transistors is making
the use of class- B transformer-coupled stages obsolete. All modern power amplifier circuits are
transformer less aid use complementary transistors.

CIRCUIT DESCRIPTION:

The principle of complementary-symmetry is assembling of push-pull class-B amplifier without


requiring centre-tapped transformer at the input and output stages of transistor. The function of
input transformer present in push-pull amplifier is, providing two input signals 1800 out of
phase, which makes only one transistor to conduct at a time. However in this circuit, the same
signal voltage is applied simultaneously to the two transistors; one of them a PNP and another
NPN transistor. On the positive half cycle of V s' NPN transistor is forward biased and therefore
conducts, but another transistor, being PN~ is reverse biased and therefore does not conduct. The
opposite of this action is takes place when the signal V s is in the negative half cycle. The total
current flowing through RL is in both half -cycles.

ADVANTAGES:

1. This circuit does not require transformer. This saves on weight and cost.
2. The efficiency of Class-B(78.5%) is higher than class -A (50%).
3. Since the efficiency is higher, it is possible to obtain greater power out- put.

188 | P a g e
4. Since the power loss is negligible at no signal condition, it is well suited for battery or solar-
cell operation.

DISADVANTAGES:

1. It is difficult to get both transistors (NPN & PNP) consists of similar characteristics.
2. Both positive and negative supply voltages are required.
3. Cross-over distortion is present.
4. Harmonic distortion is high compared to Class-A.

PROCEDURE:

1. Connect the circuit as shown in fig.


2. Give the input from function generator to the input (Vs) terminals of the circuit (say 2V)
3. Observe the output in the CRO
4. Increase the input voltage amplitude till there is no distortion in the output. At the point
measure the output voltage Vo.
5. Calculate the efficiency by using following formula
 =  Vo/4 Vcc

6. Simulate the above circuit using TINA and compare the both Hardware and simulation
results.

189 | P a g e
Experiment No.9

SERIES AND SHUNT VOLAGE REGULATOR

AIM: To study the Load and Line regulation characteristics of series and shunt voltage
Regulatro

APPARATUS:

TINA software.

THEORY:

A voltage regulator is designed to automatically ‘regulate’ voltage level. It basically steps down
the input voltage to the desired level and keeps that in that same level during the supply. This
makes sure that even when a load is applied the voltage doesn’t drop.

Thus, a voltage regulator is used for two reasons:-

1. To regulate or vary the output voltage of the circuit.


2. To keep the output voltage constant at the desired value in-spite of variations in the sup-
ply voltage or in the load current
.
Voltage regulators find their applications in computers, alternators, power generator plants where
the circuit is used to control the output of the plant.
Types of Regulators
Regulators can be classified into different categories, depending upon their working and type of
connection.
Depending upon the type of regulation, the regulators are mainly divided into two types
namely, line and load regulators.
 Line Regulator − The regulator which regulates the output voltage to be constant, in
spite of input line variations, it is called as Line regulator.
 Load Regulator − The regulator which regulates the output voltage to be constant, in
spite of the variations in load at the output, it is called as Load regulator.
Depending upon the type of connection, there are two type of voltage regulators. They are

 Series voltage regulator


 Shunt voltage regulator

190 | P a g e
Shunt Voltage Regulator

Block diagram

Circuit diagram

191 | P a g e
The voltage drop across series resistance depends upon the current supplied to the load RL. The
output voltage is equal to the sum of zener voltage (VZ) and transistor base-emitter voltage
(VBE)
Vout = VZ + VBE
If the load resistance decreases, the current through base of transistor decreases. As a result, less
collector current is shunted. Therefore, the load current becomes larger, thereby maintaining the
regulated voltage across the load. Reverse happens should the load resistance increase.

Drawbacks:
 A large portion of the total current through RS flows through transistor rather than to the
load.
 There is considerable power loss in RS.
 There are problems of overvoltage protection in this circuit.
 For these reasons, a series voltage regulator is preferred over the shunt voltage regulator.

Expected Graphs:

192 | P a g e
Procedure:

Load Regulation:

 Connect the circuit as shown in fig.


 Keep the input voltage constant. Vin =20V
 Draw the DC characteristic by Vary the load Resistance from (1-100K )
 Calculate the percentage of Regulation.

 Where:
VNL = the no-load output voltage
VFL = the full-load output voltage

Line Reulation;

1. Connect the circuit as shown in fig.


2. Keep the Load Resistance =10Kohm
3. Draw the DC characteristic by Vary the inpu voltage 0-20V

Series Voltage Regulator

Block diagram

193 | P a g e
Circuit diagram

You can see in the figure that the load current is passing through the series transistor Q1 & that’s
the reason why we call the circuit a series voltage regulator. You can see that we feed the unreg -
ulated d.c. supply through the input terminals so that we can get the regulated across the load.
Here, the zener diode is providing the reference voltage.
Operation of Transistor Series Voltage Regulator

The base voltage of transistor Q1 is held to a relatively constant voltage across the Zener diode.
For example, if 8V zener (i.e., VZ = 8V) is used, the base voltage of Q1 will remain approxi-
mately 8V. Hence , Vout = VZ – VBE

194 | P a g e
Case 1 : Output Voltage Decreases

Under this circumstance , the increased base-emitter voltage will cause transistor Q1 to conduct
more, thus increasing the output voltage. Hence, the output voltage will be maintained at a con-
stant level.

Case 2 : Output Voltage Increases

Under this circumstance , the decreased base-emitter voltage will cause Q1 to conduct less, thus

reducing the output voltage. Hence, the output voltage will be maintained at a constant level .

EXPECTED GRAPHS:

Procedure:

195 | P a g e
Load Regulation:

 Connect the circuit as shown in fig.


 Keep the input voltage constant. Vin =20V
 Draw the DC characteristic by Vary the load Resistance from (1-100K )
 Calculate the percentage of Regulation.

 Where:VNL = the no-load output voltage; VFL = the full-load output voltage

Line Reulation;
 Connect the circuit as shown in fig.
 Keep the Load Resistance =10Kohm
 Draw the DC characteristic by Vary the inpu voltage 0-20V

196 | P a g e

You might also like