0% found this document useful (0 votes)
55 views87 pages

CS - PUC-II - All Chapter'S - Question Bank Final

Uploaded by

rohitnatikar246
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views87 pages

CS - PUC-II - All Chapter'S - Question Bank Final

Uploaded by

rohitnatikar246
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 87

VECAS Association’s (R)

EXCELLENT PU SCIENCE COLLEGE, VIJAYAPUR


Class: PUC II Year Subject: CS
QUESTION BANK WITH ANSWERS: 2022 – 23
CHAPTER-1 12. What is the function of control bus?
TYPICAL CONFIGURATION OF A A: Function of Control Bus is to control the access to
COMPUTER SYSTEM the use of data and address lines.
[1m X 1 & 3m X 1 = 4 marks] 13. What is a data bus?[March-2015]
1-Mark Questions A: A collection of parallel wires which provides a
1. What is a motherboard? [June 2015,Sept-202] path to transfer data between CPU and memory.
A: A main circuit board inside a computer which 14. What is a slot?
provides a platform for all the components and A: A slot is an opening in a computer where we
peripherals to communicate with each other is can insert a printed circuit board.
called motherboard. 15. Mention any two slots.
2. What is a microprocessor?[March-2018] A: ● Expansion slots
A: It is main component of mother board & fabricated ●ISA slots
as an Integrated Circuit (IC) chip. ●PCI slots
3. Mention any two characteristics of motherboard 16. What is the purpose of expansion slots?
A: Form factor A: The purpose of Expansion slots allow you to
Chipset expand the capabilities of a computer.
Processor socket 17. What is the purpose of AGP?
4. Mention any two components of motherboard. A: The purpose of AGP slot is to provide faster access
*Processor(CPU) to a graphics accelerator card, thus enhancing the
*BIOS visual experience for the user.
*CMOS 18. What is a port?[March-2020]
5. What is the purpose of registers in the CPU? A: A socket used to connect external devices to the
A: Purpose of registers is to store temporary data, computer is called port.
Instructions & addresses which is required for 19. What is an interface?
processing. A: Hardware used to connect external devices to
6. Name any two types of motherboard. the computer is called an interface.
A: i) XT(eXtended Technology) motherboard 20. How many bits of data are sent in a serial port?
ii) AT (Advanced Technology)motherboard A: One bit of data at a time.
7. How does the computer communicate with 21. How many bits of data are sent in a parallel
other devices? port?
A: Computers communicate with other devices with A: Eight bit of data at a time.
the help of buses. 22. Give one feature of USB port.
8. Define a north bridge. A: USB is a plug and play interface between a
A: The North Bridge is a chip in the core logic chipset computer & add-on devices.
on a PC motherboard, used to manage data 23. What is meant by plug and play device?
communications between the CPU and A: A device that can be added to the computer
motherboard. without adding an adapter card or even turning the
9. Define a south bridge. computer off.
A: South Bridge or South Chipset is similar as north 24. Name any one USB device.
chipset, but the south bridge manages the slower A: Printer, scanner, digital camera keyboard, mouse,
components as Sound Card, Net Card, Hard Disk, speaker, etc.
CD ROM drive, USB Port, IO and BIOS IC etc. 25. Is device controller a hardware or a software?
10. What is bus? [March 2017] A: Device controller is hardware.
A: A collection of parallel wires that form a path way 26. Define clock speed.
to carry address, data & control signals. A: The Clock Speed is defined as the measure of the
11. What is system bus? processor‟s operating speed, measured in
A: The bus which connects major computer MHz(Megahertz) and GHz(Gigahertz)
components such as processor, memory and 27. What is cache memory?[June-2016]
I/O is called System Bus / Internal Bus. A: A high speed memory available inside CPU

1|Page Dept. of Computer Science| Excellent PU Science College, Vijayapur


In order to speed up access to data and b) Chipset: It controls the majority of resources of
Instructions stored in RAM memory is called the computer. The function of chipset is to coordinate
cache memory. data transfer between the various components of the
28. Where is L1 cache located? computer.
A: L1 cache is located inside the CPU. c) Processor Socket: It may be a rectangular
29. Where is L2 cache located? connector into which the processor is mounted with
many small connectors into which the processor is
A: L2 cache is located inside the motherboard.
directly inserted.
30. What is the use of SMPS?[June-2017]
2. What is a Motherboard? Explain the different
A: A SMPS converts AC power from an electrical
types of Motherboards. [June-2016]
outlet to the DC power
A: Motherboard: A main circuit board inside a
31. What is the approximate power consumed by a
computer which provides a platform for all the
PC?
components and peripherals to communicate with
A: Around 300 watts to 400 watts.
each other is called motherboard.
32. What is the use of UPS?
Types of Motherboard:
A: UPS keeps a computer running for minutes to few
i) XT Motherboard: XT stands for eXtended
hours after a power failure, enabling us to save data
Technology. XT motherboards are all old model
and then shut down the computer gracefully.
motherboard. This motherboard contains slot old
33. List the types of UPS.
model processor socket, LIF sockets, RAM slots,
DIMM Memory modules, ISA slots, 12 pin power
connector & no ports.
34. Expand the following terms Ex: Pentium-I, Pentium-II, Pentium-MMX.
PCI - Peripheral Component Interconnect ii) AT motherboard: AT stands for Advanced
USB - Universal Serial Bus. Technology. AT motherboards have PGA socket,
SDRAM - Synchronous Dynamic Random Access DRAM slots, PCI slots& ISA slots.
Memory Ex: Pentium-III.
DDRRAM[March-2019] - iii) Baby AT motherboard: These motherboards
Double Data Rate Random Access have the combination of XT & AT. They have slot
Memory. type processor sockets & PGA processor sockets,
SMPS[June-2018] - DRAM slots & DDRRAM slots
Switch Mode Power Supply Ex: Pentium-III, Pentium-IV.
UPS - Uninterruptible Power Supply iv) ATX Motherboard: ATX stands for Advanced
BIOS - Basic Input Output System. Technology extended. Latest motherboards all are
ISA[March-2016] - called as ATX motherboards. They have MPGA
Industry Standard Architecture processor sockets, DDRRAM slots, PCI slots, AGP
AGP - Accelerated Graphic Port slots, SATA connectors & ports.
HDC - Hard Disk Controller 3. Explain the different components of
FDC - Floppy Disk Controller motherboard.(Any Three)
SCSI - Small Computer System Interface A: Components of Motherboard
VGA - Visual Graphic Adapter 1) Processor: Processor or the CPU is the main
PGA - Pin Grid Array component of the motherboard and consists of
DVI - Digital Video Interface Arithmetic Logic Unit (ALU), and Control unit (CU).
MIDI - Musical Instrument Digital Interface 2) BIOS (Basic Input Output System): It is a small
CMOS - Complementary Metal Oxide chip on the motherboard that holds a set of
Semiconductor instructions to load the settings requires activating
SIMM - Single Inline Memory Module devices like keyboards, monitors or drives.
DIMM - Dual Inline Memory Module 3) CMOS (Complementary Metal Oxide
3-Marks Questions Semiconductor): It is a type of memory chip to store
1. Explain the characteristics of motherboard. the date, time and system setup parameters. These
[March-2017,June-2018] parameters are loaded every time the computer is
A: Characteristics of Motherboard: started.
a) Form Factor: It refers to the motherboard‟s 4) Slots: A slots is an opening in a computer where
we can insert a printed circuit board. Slots are often
geometry, dimensions, arrangement and electrical
called expansion slots.
requirements. Advanced Technology Extended
5) Disk Controllers: It is the circuit that enables the
(ATX) is the most common design of motherboards.
CPU to communicate with a hard disk, floppy disk or
2|Page Dept. of Computer Science| Excellent PU Science College, Vijayapur
other kind of disk drive. Some of the disk controllers insert a printed circuit board.
are: Hard disk controller (HDC), Floppy Disk  Expansion slot is allowed to expand the
Controller (FDC). capabilities of a computer.
6) I/O Ports and Interfaces: Ports are used to  These slots give the new features or increased
connect external devices like printers, keyboards or performance.
scanners to the computer which gets connected to the 10. What is a slot? What is the purpose of AGP slot?
computers motherboard. Some of the I/O ports are:  A slot is an opening in a computer where we can
Serial Port, Parallel Port, USB, Game port. insert a printed circuit board.
7) BUS: A bus is a collection of parallel wires that  AGP (Accelerated Graphics Port) slot used to
form a pathway to carry address, data and control provide faster access to a graphics accelerator
signals. A bus can be classified into internal bus & cards.
external bus.  AGP slots enhancing the visual experience for
4. Mention the components of Motherboard. the user.
A: Refer answer to Q. No 3 (Only Points) 11. What is a slot? Explain different types of slots.
5.Explain the general structure of a processor. A: A slot is an opening in a computer where we can
A: General structure of a processor. insert a printed circuit board.
Processor: The primary function of the processor is Types of Slots
to execute the instructions given to it & to produce i) Expansion slot: Expansion slot is allowed to
the results. expand the capabilities of a computer. These slots
North Bridge: The north bridge or host bridge is one give the new features or increased performance.
of the two chips in the core logic chipset on a PC ii) AGP (Accelerated Graphics Port) slot: AGP
motherboard, used to manage data communications (Accelerated Graphics Port) slot used to provide
between the CPU and motherboard. faster access to a graphics accelerator cards. AGP
North Bridge is responsible for control of high speed slots enhancing the visual experience for the user.
components like CPU, RAM and Video card. iii) RAM slot: RAM slot is used to install memory.
South Bridge: South bridge or south chipset is There are two types: SIMM & DIMM.
similar as north chipset but the south bridge 12. Write a note on MIDI.
components are slower.  Musical Instrument Digital Interface port is a
6. What is a north bridge? Name the devices system designed to transmit information between
controlled by North Bridge. electronic musical instruments.
A: The North Bridge: It is one of the two chips in the  A MIDI musical keyboard can be attached to a
core logic chipset on a PC motherboard, used to computer & allow a performer to play music that
manage data communications between the CPU and is captured by the computer.
motherboard. 13. Name the different types of I/O ports.
Devices controlled by North Bridge: Serial Port
CPU, RAM, and Video Card. Parallel Port
7. What is south bridge? Name the devices controlled USB (Universal Serial Bus)
by south bridge. Game Port
A: South Bridge: It is similar as north chipset, but the AGP (Accelerated Graphics Port)
south bridge manages slower components 14. What is a port? Explain serial port. [March-2015]
Devices controlled by South Bridge: A: A socket used to connect external devices to the
Sound Card, Net Card, hard disk, CD ROM drive, Computer is called Port.
USB port, SIO and BIOS IC etc. Serial Port:
8. Write a note on registers.  It is used to connecting communication devices
 Registers are high speed storage units within the like mouse & modem.
CPU, but have least storage capacity.  This port transfers data serially one bit at a time
 Registers are not referenced by their address, but through single wire.
are directly accessed and manipulated by the  Serial port is also known as communication
CPU during instruction execution. (COM) ports or RS232C ports.
 Registers are referred to as the CPU‟s working 15. What is a port? Explain Parallel port.
memory as they are used to store data, A: A socket used to connect external devices to the
instructions, addresses and intermediate results of computer is called Port.
processing. Parallel ports
9. What is a slot? What is the purpose of expansion  They are used to connect external input or
slot? output devices like printers or scanners.
 A slot is an opening in a computer where we can  This port transfers 8 bits of data at a time.
3|Page Dept. of Computer Science| Excellent PU Science College, Vijayapur
 Parallel port facilitates the parallel transfer of Control bus: Control bus is used to control the
data. access to & the use of the data & address lines.
 Parallel ports come in the form of 25-pin 22. What is the purpose of ports and buses?
connector. [June 2017]
16. Explain USB port. A: Purpose of Ports:
 USB Port gives a single standardized, easy to use  Ports are used to connect external devices like
way to connect a variety of new peripherals to a printers, keyboards or scanners to the computer
computer. which gets connected to the computers
 These devices include printers, scanners, digital motherboard.
cameras, speakers, etc.  Some of the I/O ports are: Serial Port, Parallel
 USB is a plug-and-play interface between a Port, USB, Game port etc.
computer and add-on devices. Purpose Of Buses:
 New device can be added to the computer  A Bus is a collection of parallel wires that form a
without adding an adapter card by using USB. pathway to carry address, data and control signals.
 USB supports a data speed of 12 megabits per  A bus can be classified into internal bus &
second & supporting up to 127 devices. external bus.
17. Give the features of USB port. 23. What is bus? Explain system bus.
 USB is a plug-and-play interface between a  A bus is a collection of parallel wires that form a
computer and add-on devices. pathway to carry address, data and control signals.
 These devices include printers, scanners, web  System bus connects major computer components
cameras, speakers, etc. like processor, memory and I/O. A system bus
 New device can be added to the computer also called as internal bus.
without adding an adapter card by using USB.  A system bus comprises of data bus, address bus,
18. What is meant by plug and play card? and control bus.
 New device can be added to the computer 24. What is the purpose of ports, buses and
without adding an adapter card by using USB. controllers in the I/O system?
 USB is a plug-and-play interface between a Ports: Ports are used to connect external devices like
computer and add-on devices. printers, keyboards or scanners to the computer
 The cards such as fax card, modem card, sound which gets connected to the computers motherboard.
card and AGP card can be easily fit into Buses: A bus is a collection of parallel wires that
expansion slots of motherboard which are plug form a pathway to carry address, data and control
and play in nature. signals.
19. Explain different types of I/O ports. Controllers: Controllers enable the CPU to
A: Refer answer to Q. No 14, 15, 16 communicate with a hard disk, floppy disk other kind
20. What is disk controller? Explain different types of disk drive.
of disk controllers. 25. What is an internal memory? Give the features of
A: Disk Controller is the circuits that enable the CPU to internal memory?
communicate with a hard disk, floppy disk or other A: Internal memory includes registers, cache
kind of disk drive. memory and primary memory which can be directly
There are two types: Hard disk controller (HDC) & accessed by the processor.
Floppy Disk controller (FDC) It is used for temporary storage of data and
i) Hard disk controller (HDC): It is the interface instructions on which the processor is currently
that enables the computer to read & write working.
information to the hard drive. The first standard disk The features of internal memory are:
controller developed is the IDE standard drive also Temporary storage
known as Advanced Technology Attachment (ATA). Limited storage capacity
ii) Floppy disk controller (FDC): It is the interface Fast access
that directs & controls reading from & writing to a 26. What is primary memory? Name the two types of
floppy disk drive. FDC usually performs data primary memory.
transmission in direct memory access (DMA) mode. A: Primary memory is also known as main memory.
21. What is data bus, address bus & control bus? This memory is of two types: Random Access
A: Data bus: Data bus provides a path to transfer data Memory (RAM) and Read Only Memory (ROM)
between CPU and memory. The width of data bus Types of primary memory.
affects the speed of the computer. i) RAM: RAM temporarily stores the computer‟s
Address bus: Address bus provides a path to transfer operating system, application programs and current
address between CPU and RAM. data so that the processor can reach them quickly.
4|Page Dept. of Computer Science| Excellent PU Science College, Vijayapur
RAM is a faster memory and volatile in nature. i.e. 31. Write a note on SDRAM.
when the power is switched off, the data in this  SDRAM or Synchronous Dynamic Random
memory is lost. Access Memory is a special type of DRAM that
ii) ROM: ROM is a small memory, which stores the is synchronized to the system clock.
boot firmware (BIOS). BIOS hold enough  Since it is synchronized to the CPU, it knows
information to enable the computer to check its when the next cycle is coming, and has the data
hardware and load its operating system into its RAM ready when the CPU requests it.
at the time of system booting. ROM is non-volatile in  This increases efficiency by reducing CPU
nature. i.e. even when the computer is switched off, waiting time.
the contents of ROM remains available. 32. Explain the types of power supply.
27. Write a note on DRAM. A: SMPS:
A: i) DRAM or Dynamic RAM is the most common type  An SMPS converts AC power from an electrical
of memory chip. outlet to the DC power needed by the system
ii) DRAM is mostly used as main memory, since it is components.
small and cheap.  An SMPS is a metal box in the rear of the system
iii) It uses transistors and capacitors. The transistors that is attached to the computer chassis & to the
are arranged in a matrix of rows and columns. system board.
iv) The capacitor holds the bits of information 0 and  It contains the power card plug & a fan for
1.The transistor acts as a switch that lets the control cooling.
circuitry on the memory chip read the capacitor or  In a PC, the SMPS converts 230 watts of AC to 5
change its state. to 12 DC volts and the wattage is around 180 to
v) The transistor and capacitor are paired to make a 300 watts, 450 watts and 500 watts.
memory cell. UPS:
vi) DRAM must be refreshed continually to store  An UPS is a power supply that includes a battery
information; otherwise it will lose what it is holding. to maintain power in the event of power failure.
vii) The refresh operation occurs automatically  An UPS keeps a computer running for minutes to
thousands of times per second. DRAM is slow hours after a power failure, enabling us to save
because the refreshing takes time. data and then shut down the computer gracefully.
28. Write a note on SRAM.  There are 2 types of UPS: Online UPS and
A: i) SRAM or Static Random Access memory chip is Standby UPS.
usually used in cache memory due to its high speed. 33. What is UPS? Explain the different types of UPS.
ii) SRAM uses multiple transistors for each memory [June-2015,March-2019]
cell. A: An UPS is a power supply that includes a battery to
iii) It does not have a capacitor in each cell. A maintain power in the event of power failure.
SRAM memory cell has more parts, so it takes more There are 2 types of UPS: Online UPS and Standby
space on a chip than DRAM cell. UPS.
iv) It does not need constant refreshing and therefore Online UPS:
is faster than DRAM. SRAM is more expensive than  An online UPS avoids those momentary power
DRAM, and it takes up more space. lapses by continuously providing power from its
v) It stores information as long as it is supplied with own inverter.
power. SRAM is very fast and easier to use.  Online UPS is more costly than standby UPS.
29. Write a note on DRAM & SRAM. Standby UPS:
A: Refer answer to Q. No 27 & 28  A Standby UPS or off-line UPS monitors the
30. Compare DRAM & SRAM. power line & switches to battery power as soon
as it detects a problem.
34. Explain cache memory. [March-2018]
 Cache memory is a high speed memory available
inside CPU in order to speed up access of data
and instructions stored in RAM.
 Cache memory stores data that is used more often
& temporarily. During processing, the CPU first
checks cache for the required data. If data is not
found in cache, then it looks in the RAM for data.

5|Page Dept. of Computer Science| Excellent PU Science College, Vijayapur


 There are two types of Cache. L1 cache and L2
cache and some CPU‟s also have a L3 cache on
the motherboard.
36. Name the different components of south bridge.
A: South Bridge connects to a PCI bus, USB ports, IDE,
SATA hard disk, sound card, net card, BIOS, CD-
ROM etc.
37. Name the different components of North Bridge.
A: North Bridge connects CPU, RAM, video card, AGP,
PCI express bus, memory bus.
38. Expand UPS? Explain the different types of UPS.
[March-2016]
A: UPS- Uninterrupted Power Supply
There are 2 types of UPS:
Refer answer to Q. No 33

6|Page Dept. of Computer Science| Excellent PU Science College, Vijayapur


Chapter 2. 7. Write the principles of duality theorems.
BOOLEAN ALGEBRA The principles of duality states
[2mX2 & 5mX1 = 9 marks] a. Changing each OR sign (+) to an AND sign (.)
2 Marks Questions: b. Changing each AND sign (.) to an OR sign (+)
1. What is tautology and fallacy? c. Changing each 0 by 1 and each 1 by 0.
A: Tautology: If result of any logical statement or 8. What is prof by perfect induction? Write the
expression is always TRUE or 1, it is called properties of 0 and 1. 6
Tautology A method of proving Boolean theorems by
Fallacy: If result of any logical statement or substituting all possible values of variables is
expression is always FALSE or 0 it is called called proof by perfect induction. Properties of
Fallacy. 0 and 1
2. Name the three logical operators. a) 0+X=X
A:There are three logical operator, NOT,OR and AND b) 1+X=1
3. Write the truth table of AND operator. c) 0.X=0
X Y X.Y d) 1.X=X
9. Prove that 0+X=X using proof by perfect
0 0 0
induction method.
0 1 0
If X=0, then LHS=0+X
1 0 0
=0+0
1 1 1
=0
4. Write the truth table of OR operator.
=X
X Y X+Y
= RHS
0 0 0
If X=1, then LHS=0+X
0 1 1 =0+1
1 0 1 =1
1 1 1 =X
5. Write any three basic postulates of Boolean = RHS
algebra. 10. Prove that 1+X=1 using prof by perfect
The Boolean postulates are: induction method.
I. If X then X=1, and If X 1 then X=0 If X=0, LHS= 1+X
II. OR relation (Logical Addition) =1+0
a. 0+0=0 =1
b. 0+1=1 If X=1, LHS= 1+X
c. 1+0=1 =1+1
d. 1+1=1 =1
III. AND relation(Logical Multiplication) Thus, for every value of X, 1+X=1 always.
a. 0.0=0 11. Prove that 0 ‧X=0 using prof by perfect
b. 0.1=1 induction method.
c. 1.0=1 A: If X=0, LHS= 0. X
d. 1.1=1 =0.0
IV. Complement Rules =0
a. 0=1 =RHS
b. 1=0 If X=1, LHS = 0. X
6. Write the postulates of complement rules. =0.1
=0
=RHS
Thus, for every value of X, 0‧X=0 always.
7|Page Dept. of Computer Science| Excellent PU Science College, Vijayapur
12. Prove that 1‧X=X using prof by perfect If X=1, then ̅ and ̅
induction method. Thus, is a variable is complemented twice,
If X=0, LHS=1. X we get the same variable.
=1.0 17. State complementarity law.
=0 (a) X+ ̅ =1
=RHS (b) X. ̅ =0
If X=1, LHS = 1. X 18. Prove complementarity law using truth table.
=1.1 X ̅ X+ ̅
=1 0 1 1
=X 1 0 1
=RHS 19. State commutative law.
Thus, for every value of X, 1.X=X always. The laws state that (a) X+Y=Y+X
(b) X.Y=Y.X
13. Prove that X+X=1. 20. State Associative Law.
If X=0, LHS=X+X These laws state that (a) X+(Y+Z)=(X+Y)+Z
= 0+0 (b) X(YZ)=(XY)Z
=0 21. State distributive law.
=X These law states that (a) X(Y+Z)=XY+XZ
= RHS (b) X+YZ=(X+Y)(X+Z)
If X=1, LHS = X+ X 22. State Absorption Law.
= 1+1 These law states that (a) X+XY=X
=1 (b) X(X+Y)=X
=X 23. State De Morgan’s theorems.
= RHS
De Morgan‟s First Theorem: =
Thus, for every value of X, 1.X=X always.
De Morgan‟s Second Theorem: =
14. Prove that X‧X=X
24. Write any two Applications of De Morgan’s
If X=0, LHS=X.X
Theorem.
= 0.0
1. De Morgan‟s theorem useful in the
=0
implementation of the basic gate operations
=X
with alternative gates.
= RHS
2. De Morgan‟s theorem is used in the
If X=1, LHS = X.X
simplification of Boolean expressions.
= 1.1
3. De Morgan‟s laws commonly apply to text
=1
searching using Boolean operators AND, OR
=X
and NOT
= RHS
4. De Morgan‟s laws are an example of a more
15. State Indempotence law.
general concept of mathematical duality.
This law states that when a variable is combines
25. What is minter and maxterm?
with itself using OR or AND operator, the output
A product of all the literals within the logic
is the same variable.
system is called minterm.
(a) X+X=X
A sum of all the literals within the logic system is
(b) X.X=X
called maxterm.
16. State and prove Involution law.
26. What is canonical expression?
This law states that the complement of variable is
Mention the different forms to represent canonical
complemented again, we get the same variable.
̅ expression. (Name the two forms of expressing
Boolean functions) Boolean Expression
If X=0, then ̅ and ̅
8|Page Dept. of Computer Science| Excellent PU Science College, Vijayapur
Composed entirely either of minterms or 32. Prove algebraically X+XY=X
maxterms is known as canonical expression. X+XY=X(1+Y)
Canonical expression can be represented in = X.1 (1+Y=1)
following two forms: =X (X.1=X)
(i) Sum-of-Products(SOP) = RHS
(ii) Product-of-sums (POS) 33. Draw logic diagram for X(Y+Z)=XY+XZ
27. What is Sum-of-Products(SOP and Product-of
sums (POS)?
When a Booleans expression is represented purely
as sum of minterms, it said to be in canonical SOP
form. When a Boolean expression is represented
34. Prove algebraically X+ Y=X+Y
purely as product of Maxterms, it is said to be in
canonical Product-of-Sum form. X+ Y=( X+ ) (X+Y) (X+ =1)
28. What is K-map? Draw a general K-map of 2 = 1. (X+Y)
variables A and B. =X+Y
K-Map or Karnaugh Map is a graphical display of = RHS
the fundamental product in a truth table. 35. Prove that X+ Y=X+Y using truth table.

36. Prove algebraically X(X+Y)=X


X(X+Y)= XX+XY (XX=X)
=X+XY
=X(1+Y) (1+X=1)
29. Write the truth table for X‧Y=Y‧X
=X
37. The following input expression ABCD=0010,
ABCD=1100 and ABCD=1110. Write SOP
expression.
SOP expression= +AB + AB
38. Simplify the Boolean expression
X+ + +(X+
30. Write the truth table of X+Y=Y+X
A: X+ + + (X+ ) Y
=(X+ )(X+Y)+ +X ((X+
= 1(X+Y)
((X
= X+Y+
((X+
31. Prove that X+XY=X using truth table = X+1 (X+1=1)
=1
39. Simplify: AB+A +
AB+A + + )+ (C+ )
=A(1) + ((X+
=A+ ((X+ =1

9|Page Dept. of Computer Science| Excellent PU Science College, Vijayapur


40. Simplify: XY+XYZ+XY Y 5 Marks Questions:
XY+XYZ+XY + Y 1. State and prove Indempotence law.
A: This law states that when a variable is combines
=XY(1+Z)+X (Y+Y) (1+X=1)&(X+X=X)
with itself using OR or AND operator, the output is
=XY+ Y
the same variable.
= XY (1+ ) (a) X+X=X
=XY (X+1=1) If X=0, consider
41. Simplify: XYZ+XYZW+XZ LHS=X+X
XYZ+XYZW+XZ=XYZ(1+W)+XZ =0+0
=XYZ.1+XZ =0{By OR relation}
=XZ(Y+1) =X
=XZ =RHS
42. Prove algebraically: Z(Y+Z)(X+Y+Z) If x=1, consider
Z(Y+Z)(X+Y+Z)=(ZY+ZZ)(X+Y+Z) LHS=X+X
=(ZY+Z)(X+Y+Z) =1+1
=Z(X+Y+Z) =1(By OR relation}
=ZX+ZY+ZZ =X
=ZX+ZY+Z =RHS
=Z(X+Y+1) Thus, for every value of X, X+X=X always.
=Z(1) X X X+X
=Z 0 0 0
43. Convert the expression A ( + ) into 1 1 1
canonical sum-of product form. (b) X, X=X
A ( + )= A +A (X+X=X) If X=0, consider
=A +A LHS=X.X
= A (C+ (X+X=X) =0.0
=A A =0{By AND relation}
=X
=A
=RHS
44. Obtain the minterm expression for the Boolean
If X=1,
function F=A+BC.
LHS=X.X
A+BC=A(B+ )(C+ ( )
=1.1
= ABC+AB +A C+A =1(By AND relation}
=ABC+AB +A C+A =X
45. Draw the K-map for the function in three =RHS
variables given below. 2. State and prove absorption laws of Boolean
(a)m0+m2+m4+m6+m7 algebra. This law states that a) X+XY=X
b)X(X+Y)=X
a) X+XY=X

LHS=X+XY
= X(1+Y)
=X.1 (1+Y=1)
=X (X.1=X)
=RHS

10 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


Therefore, for X=0, X+Y=Y+X
X X XY X+XY If X=1 then LHS=X+Y
0 0 0 0 =1+Y
0 1 0 0 =1
1 0 0 1 RHS=Y+X = Y+1
1 1 1 1 =1
b) X(X+Y)=X Therefore, for X=0, X.Y=Y.X
X(X+Y)=X.X+XY If X=1 then LHS=X.Y
=X.X+XY =1.Y
=X+XY (X.X=X) =Y
=X(1+Y) Therefore, for x=1, X.Y=Y.X. Hence the proof.
=X.1 (1+X=1) 5. State and associative law of addition and
=X multiplication.
=RHS These laws state that (a) X+(Y+Z)=(X+Y)+Z
X Y X+Y X(X+Y) (b) X(YZ)=(XY).Z
0 0 0 0 a) X+(Y+Z)=(X+Y)+Z
0 1 1 0 If X=0 the LHS=X+(Y+Z)
1 0 1 1 = 0+(Y+Z)
1 1 1 1 =Y+Z)
RHS=(X+Y)+Z
3. State and prove complementarity law.
= (0+Y)+Z
This law states that a)X+ =1 b) X. =0
=Y+Z
a) X+ Therefore for X=0, X+(Y+Z)=(X+Y)+Z
If X=0, LHS=X+ If X=1, then LHS=X+(Y+Z)
= 0+1 = 1+(Y+Z)
=1 =1
=RHS RHS=(X+Y)+Z
Thus, for every value of X, X+ =1 always. =(1+Y)+Z)
b) X. =0 =1+Z
If X=0, LHS= X. =1
=0.1 Therefore X=1, X+(Y+Z)=(X+Y)+Z=1
=0

If X=1, LHS= X.
=1.0
=0
Thus, for every value of X, X.
4. State and prove commutative law. (b) X(YZ)=(XY). Z
These laws state that a) X+Y=Y+X and If Y=0 LHS=X.(Y.Z)=X(0.Z)
b) X.Y=Y.X = X.0=0
a) If X=0 then LHS= X+Y RHS=(X.Y).Z(X.0).Z
=0+Y = 0.Z=0
=Y Therefore LHS-RHS
RHS=Y+X
=Y+0 If Y=1 LHS=X.(Y.Z)X.(1.Z)
=Y = X.Z=XZ
RHS=(X.Y).Z=(X.1).Z
11 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
=X.Z=XZ complementarity laws.
Therefore LHS=RHS Let us assume that P=X+Y where, P, X, Y are
logical variables.
Then, according to complementation law P+ =1
and P. =0.
Therefore P+ =(X+Y)+
(X+Y)+ Must be equal to 1. (As X+ =1)
6. State and prove Distributive Law. (X+Y). Must be equal to 0(As X =0)
These laws state that (a) X(Y+Z)XY+XZ Let us first prove the first part,(X+Y)+ =1
(b) X+YZ=(X+Y)(X+Z)
(X+Y)+ =((X+Y)+ ).((X+Y)+
(a) X(Y+Z)=XY+XZ
=(X+ +Y). (X+Y+ ) (X+ =1)
If X=0 LHS=X.(Y+Z)
= (1+Y).(X+1) (X+1=1)
=0.(Y+Z)
= 1.1
=0
= 1= RHS
RHS=XY+XZ
Now, let us prove the second part, i.e.,
=0.Y+0.Z
=0 (X+Y). =0
Therefore LHS=RHS (X+Y). = +Y
If X=1 LHS=X.(Y+Z) =0. .0 (X. =0)
= 1.(Y+Z) =0=RHS
= Y+Z Therefore =
RHS=XY+XZ
= 1.Y+1.Z
=Y+Z
Therefore LHS=RHS

De Morgan‟s Second Theorem:


To prove De Morgan‟s second t theorem, we will
use complementarity laws.
Let us assume that P=XY where, P, X, Y are
logical variables.
(b) X+YZ=(X+Y)(X+Z)
Then, according to complementation law P+ =1
RHS=(X+Y)(X+Z)
=XX+XZ+XY+YZ and P. =0
=X+XZ+XY+YZ (XX=X) Therefore P+ =XY( ) =1
=X(1+Z+Y)+YZ Therefore P. =XY( ) =0
To prove the first part XY+( ) =1
XY+( ) =(X+ )(Y+ )
=(1+ ) ( +1) (X+ +1)
=1.1 (X+1=1)
=1=RHS
To prove the second part XY( ) =0
7. State and prove De Morgan’s theorems by the
XY( ) =XY +XY (X. )
method of perfect induction.
= 0. Y+X.0
De Morgan‟s First Theorem: =
=0=RHS
To prove De Morgan‟s first theorem, we will use
12 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
Therefore Quad-1= m1  m3  m5  m7  AD
Quad-2= m7  m6.  m15  m14  BC
Reduced expression = ABC+ D=A +
10. Given Boolean function F(A, B, C, D)
∑ Reduce the
function F using K-map.

8. Given Boolean function F(A,B,C,D)=


∑ reduce the function F
Using K-map.

Quad-1= m0  m4  m8  m12  CD
Quad-2= m8  m9  m10  m11  AB
Quad-3= m9  m11  m13  m15  AD
Reduced expression= + A +AD
11. Given the Boolean function F(W, X, Y, Z)=
Pair-1=m7+m15=BCD

Quad-1=m12+m13+m14+m15=AB
Reduce it by using K-map.
Quad-2=m13+m15+m9+m11=AD
Quad-3=m15+m11+m14+m10=AC
Reduced expression=BCD+AB+AD+AC.
9. Given the Boolean function F(A, B, C, D) =
∑ Reduce it by using
Karnaugh map.

Quad-1= m0  m1  m2  m3  W X
Map rolling octet=
m0  m2  m4  m6  m8  m10  m12  m14  Z
Reduced expression=
12. Given Boolean function
Pair-1= m0  m1  ABC
F(A, B, C, D)= m0+m1+m2+m3+m4+m5+m8
Pair-2= m14  m10  ACD +m9+m10+m11+m13 Reduce the function F
using K-map.
13 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
Quad-1= m0  m1  m4  m5  AC Chapter 3.
Quad-2= m1  m5  m9  m13  CD
LOGIC GATES
[1m X 1 & 3m X 1= 4marks]
Map rolling octet=
1 Mark questions:
m0  m1  m2  m3  m8  m9  m10  m11  B 1. What is a logic gate?
Reduced expression= + D+ A: An electronic circuit which operates on one or more
13. Using maps, simplify the following expression signals and always produces an output signal is
called logic gate.
in four variables A, B, C and
2. Mention different types of logic gates.
D: m0+m4+m7+m8+m9+m10+m11+m12+m13
*Basic gates.
*Derived gates.
3. Mention the three basic logic gates?
*NOT gate
* OR gate
*AND gate
4. Which basic gate is named as Inverter?
NOT gate.
5. What is inverter?
A: A gate with only one input signal and one output
signal but the output state is always opposite of the
input state is called inverter or NOT gate.
6. Which are the three logic operations?
Quad-1= m0  m4  m8  m12  CD *NOT operation
Quad-2= m8  m9  m10  m11  AB * OR operation
* AND operation
Quad-3= m8  m9  m12  m13  AC 7. Write the standard symbol for AND gate. (Write
Single term= = BCD the logic circuit for AND gate.)
Reduced expression= + A +A + BCD
14. Given the Boolean function F(A, B, C, D)=
(0, 4, 6, 8, 9, 10, 12, 14). Reduce it by using 8. Write the standard symbol for OR gate. (Write the
K-map. logic circuit for OR gate.)

9. Write the standard symbol for NOT gate. (Write


the
logic circuit for NOT gate)

10. Write the standard symbol for NAND gate.


Quad-1= M 0 .M 4 .M 8 .M 12  C  D
Quad-2= M8 .M9 .M10 .M11  A  B
11. Write the standard symbol for NOR gate.
Map rollingQuad-3= M 4 .M 6 .M12 .M14  B  D
Reduced expression= (C+D)( +B)( +D)

14 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


12. Write the standard symbol for XOR gate. 21. What is a truth table?
(Exclusive OR gate) A: A table which represents all the possible values of
the logical variables/statements along with all the
possible results for the given combination of values
is called a Truth table.
13. Write the standard symbol for XNOR gate. 22. What is meant by universal gates?
(Exclusive NOR gate) A: A gate using which all the basic gates can be designed
is called universal gates.
NAND and NOR gates are called universal gates.
23. Mention different universal gates.
14. Write the truth table for AND gate. NAND gate and NOR gate.
24. What is the output of the two input NAND gate
for the inputs: A=0, B=1?
A.B=0.1=0

15. Write the truth table for OR gate. 25. What are the values of the inputs to a three input
NAND gate, if its output is

16. Write the truth table for NOT gate.

26. What are the values of the inputs to a three input


17. Write the truth table for NAND gate. NAND gate, if its output is 0?

27. What are the values of the inputs to a three input


OR
gate, if its output is 0?
18. Write the truth table for NOR gate.

28. What are the values of the inputs to a three input


OR gate, if its output is 1?

19. Write the truth table for XOR gate.


3 Marks Questions:
1. What is meant by prof by perfect induction? Give
an example. A method of proving Boolean
theorems by substituting all possible values of the
variable is called perfect induction.
Ex: For two variables X & Y
20. Write the truth table for XNOR gate.
A B Y=
0 0 1
0 1 0
1 0 0
1 1 1

15 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


For three variables X, Y and Z

Truth table for OR gate:

5. Define universal gate. Write the truth table and


standard symbol of NAND gate. A gate using
2. Write the truth table and standard symbol of AND which all the basic gates can be designed is called
gate.(write the AND gate rule) universal gates
A: i) The AND gate can have two or more input signals The logic symbol for NAND gate:
and produce one output signal.
ii) When all the inputs are 1 then the output is 1.
Otherwise, the output is 0. Truth table for NAND gate:
The logic symbol:

Truth table for AND gate: 6. Define universal gate. Write the truth table and
standard symbol of NOR gate.
A gate using which all the basic gates can be designed
is called universal gates.
The logic symbol for NOR gate:

3. Write the truth table and standard symbol of OR


gate. The OR gate has two or more input signals Truth table for NOR gate:
but only one output signal. If any of the input
signals is 1, the output signal is 1.
The logic symbol:

7. Write the truth table and standard symbol of XOR


gate.
Truth table for OR gate:
Exclusive-OR gate accepts two or more inputs and
produces single output. The output is 0 if there are
even numbers of 1‟s in the inputs and the output is 1 if
there are odd number of 1‟s in the inputs.
The logic symbol for XOR gate:
4. Write the truth table and standard symbol of
NOT gate. (Write the NOT gate rule)
NOT gate or an Inverter is a gate with only one input Truth table for NOR gate:
signal and one output signal; the output state is always
the opposite of the input state.
The logic symbol:

16 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


8. Write the truth table and standard symbol of 11. Draw the logic gate diagram to implement AND,
XNOR gate. OR and NOT gates using NOR gates only.
Exclusive NOR Gate(XNOR) produce 1 as output (Realize AND, OR and NOT gates using NOR
when the input combination has even number of 1‟s gate.)
or when all the inputs are 0‟s. NOR to AND gate:
The logic symbol for XNOR gate:

NAND to OR gate:
Truth table for XNOR gate:
A B Y=
0 0 1
0 1 0 NOR to NOT gate:
1 0 0
1 1 1
9. Define universal gate. Design basic gates using
NAND gate. A gate using which all the basic gates 12. Draw the logic gate diagram to implement NOT
can be designed is called universal gates. using
AND gate: (a) only NOR gates (b) only NAND gates.
(a) NOT gate using only NOR

OR gate:

(b) NOT gate using only NAND

NOT gate:
13. Design a circuit to realize the following:
F(A, B, C)= AB+A C
10. Draw the logic gate diagram to implement AND,
OR and NOT gates using NAND gates only
(Realize AND OR and NOT gates using NAND
gate.)
NAND to AND gate:

NAND to OR gate:
14. Draw the diagram of a digital circuit for:
F(A, B,C,D)= AB+BC+CD using NAND-to-NAND
logic.

NAND to NOT gate:

17 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


Chapter 4. 16. Define searching.
A: The process of finding the location of a data item in
DATA STRUCTURE the given collection of data items.
[1m X 1,3m X 1 & 5mX2=14Marks] 17. What is meant by sorting? A: The process of
1- Mark Questions arranging the data items in ascending or descending
1. What are data structures? order.
A: A specialized format for organizing & storing the 18. What is merging?
data is called data structure. A: The process of combining the data items of two
2. How are data structure classified? structures to form a single structure is called
A: Data structure is classified as: merging.
a. Primitive data structure 19. Mention the types of searching in the array.
b. Non-primitive data structure A: a. Linear search
3. What are primitive data structures? b. Binary search
[March-2015]
20. What is a stack?
A: Data structures that are directly operated upon by
A: An ordered collection of items where the addition of
machine-level instructions are known as primitive
new items and the removal of an existing item
data structure.
always takes place at the same end called TOP.
4. What are non-primitive data structures?
21. Name the data structure which is called LIFO list.
A: Data structure that cannot be directly operated upon
A: Stack.
by machine-level instructions are known as primitive
22. What is LIFO list?
data structure.
A: Last In First Out
5.Give any two examples for primitive data structure.
23. What are the operations that can be performed
A: Integer, float, character, pointers.
on stack?
6. Give any two examples for non-primitive data
A: Operations performed on stack:
structure.
Stack( ), Push( ), Pop( ), Peek( ), isEmpty( ), Size( ).
A: Arrays, stack, queues, linked lists, trees, graph.
24. Define PUSH operation.
7. What is meant by linear data structure?
A: The operation which creates new stack that is empty
A: A data structure that has homogeneous data elements.
is called PUSH operation.
8. What are non-linear data structures?
25. Define pop operation.
A: A data structure in which a data item is connected to
A: The operation which removes an existing item from
several other data items (has heterogeneous data
the top of the stack is called pop operation.
elements).
26. Mention any one application of stack.
9. Mention any two examples for linear data
A: a. Stack is used to reverse a word.
structure.
b. Stack is used to solve tower of Hanoi problem.
A: Arrays, stack, queues, linked lists.
27. What is a queue?
10. Mention any two examples for non-linear data
A: An ordered collection of items where an item is
structure.
inserted at one end called “REAR” & an existing
A: Trees, graph.
item is removed from other end called “FRONT”.
11. Mention the various operations performed on
28. Name the data structure which is called FIFO
primitive data structure.
list?
A: Create, destroy, select, update.
A: Queue
12. Mention the various operations performed on
29. What is the other name of queue?
linear data structure.
A: FIFO list.
A: Traversal, insertion, deletion, searching, sorting, and
30. What is FIFO list?
merging.
A: First In First Out
13. Define an array.
31. Mention the different types of queue.
A: A collection of homogeneous elements with same
name & same data type. A: Types of Queue:
14. Mention the types of an array. a. Simple queue
b. Circular queue
A: Types of Array:
c. Priority queue
a. One-dimensional array
d. Dequeue (Double ended queue)
b. Two-dimensional array
c. Multi-dimensional array 32. What is a linked list?
A: A linear collection of data elements called nodes &
15. Define traversing.
the linear order is given by means of pointers.
A: The process of accessing each data item exactly once
to perform some operation.
18 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
33. What are lists? A: Need For Array / Advantages of Array
A: A linear collection of data elements called nodes & i) An array is a collection of homogeneous elements
the linear order is given by means of pointers. with unique name and the elements are arranged one
34. Name data structure whose relationship between after another in adjacent memory location.
data elements is by means of links. ii) The data items in an array are called as elements.
A: Linked list. These elements are accessed by numbers called
35. What is a binary tree? subscripts or indices.
A: A tree in which each node has at most two iii) Since the elements are accessed using subscripts,
descendants (Children‟s) is called binary tree. arrays are also called as subscripted variables.
36. What do you mean by depth of a tree? 5. Mention various operations performed on
A: The length of the path to its root is called depth of arrays.(Any three)
tree. A: operations performed on arrays.
37. How do you find the degree of a tree? i) Traversing: The process of accessing each data
A: The number of nodes in a tree is called degree of item exactly once to perform some operation is called
tree. traversing.
ii) Insertion: The process of adding a new data item
3-Marks Questions : into the given collection of data item is called
1. How are data structure classified? insertion.
iii) Deletion: The process of removing an existing
data item from the given collection of data items is
called deletion.
iv) Searching: The process of finding the location of
a data item in the given collection of data items is
called searching.
v) Sorting: The process of arranging the data items
in ascending or descending order is called sorting.
vi) Merging: The process of combining the data
items of two structures to form a single structure is
called merging.
6. How do you find the length of an array?
A: Length of an array:
i) An array is an ordered collection of elements of
same type and same name.
ii) Arrays can store an elements in consecutive
locations with same data type.
The length of an array can be calculated as:
2. Mention the various operations performed on data L=UB-LB+1
structure. Here UBUpper bound (Largest index).
A: Operations performed on data structure. LBLower bound (Smallest index).
Traversing: The process of accessing each data item Ex: If an array A contains an elements
exactly once to perform some operation is called 10,20,30,40,50 can be represented as
traversing. A[0] A[1] A[2] A[3] A[4]
Insertion: The process of adding a new data item
into the given collection of data item is called
insertion.
Deletion: The process of removing an existing data
The length of an array L = 4 – 0 + 1 = 5
item from the given collection of data items is called
7. Explain the memory representation of one
deletion.
dimensional array.
3. How are arrays classified?
A: Memory representation of one dimensional array.
A: Arrays can be classified as three types:
i) Elements of array are stored in consecutive
One-dimensional arrays
memory locations.
Two dimensional arrays ii) Let P be the location of element. Let Base(A) is an
Multidimensional arrays address of the element in an array is called base
4. Justify the need for Arrays. address of A.
OR iii) Then address of any element can be calculated as:
Advantages of Array Loc(A[P]) = Base(A) + W(P - LB)

19 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


Here WThe number of words per memory cell.
LBLower bound.
Ex: int a[5]={10,20,30,40,50};
Memory representation of this array is:
-The address of a[3] can be calculated as:
Loc(a[3])= Base(A) + W(P - LB ) =1000 + 1(3 -
0)=1003.

8. Write the memory representation arrays in row-


major order.
10. Consider the array A of order 20 x 5 with base
A: i) Let A be the array of order m x n. In row-major
value 1000 and one word per memory location.
order, all the first-row elements are stored in
Find the address of A[10][4] in row-major order
sequential memory locations and then all the second-
and column-major order.
row elements are stored and so on.
A: Given Base(A) = 1000, m = 20, n = 5 LB = 0,W = 1,
ii) Base(A) is the address of the first element.
I = 10, J = 4
iii) The memory address of any element A[I][J] can
Row-major order:
be obtained by the formula
LOC(A[I][J]) = Base(A) + W[n(I-LB) + (J-LB)]
LOC(A[I][J]) = Base(A) + W[n(I-LB) + (J-LB)]
LOC(A[10][5]) = 1000 + 1[5(10-0)+(4-0)]
Where W is the number of words per memory
= 1000 + 5(10) + 4
location.
= 1000 + 50 + 4
Ex: Consider the array of order 3 x 3.
= 1054
Column-major order:
LOC(A[I][J]) = Base(A) + W[ (I-LB) + m(J-LB)]
LOC(A[10][5]) = 1000 + 1[(10-0)+20(4-0)]
= 1000 + 1(10 + 80)
= 1000 +90
= 1090
Row-major order: 11. What are the applications of arrays?
A: Applications of arrays
 Arrays are used to implement other data structures
such as heaps, hash tables, queues, stacks and
strings etc.
 Arrays are used to implement mathematical
vectors and matrices.
 Many databases include one-dimensional arrays
whose elements are records.
9. Write the memory representation arrays in 12. What are the advantages of arrays?
column-major order. A: Advantages of arrays
A: i) Let A be the array of order m x n. In column-major  It is used to represent multiple data items of same
order, all the first column elements are stored in type by using only single name.
sequential memory locations and then all the second-  It can be used to implement other data structures
column elements are stored and so on. like linked lists, stacks, queues, trees, graphs etc.
ii) Base(A) is the address of the first element.  Two-dimensional arrays are used to represent
The memory address of any element A[I][J] can be matrices.
obtained by the formula 13. What are the disadvantages of arrays?
LOC(A[I][J]) = Base(A) + W[(I-LB) + m(J-LB)] A: Disadvantages of arrays
Where W is the number of words per memory  We must know in advance that how many
location. elements are to be stored in array.
Ex: Consider the array of order 3 x 3.  Array is static structure. It means that array is of
Ex: Consider the array of order 3 x 3. fixed size. The memory which is allocated to
array cannot be increased or reduced.

Column -major order:


20 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
 The elements of array are stored in consecutive an existing item is removed from other end called
memory locations. So insertions and deletions are “FRONT”.
very difficult and time consuming.  The condition REAR=N indicates that the queue
14. What is stack? Mention the types of operations is full. The condition FRONT=NULL indicates
performed on the stack. that the queue is empty.
A: A stack is an ordered collection of items where the
addition of new items and the removal of an existing
item always take place at the same end called TOP.
Operations performed on the stack: 19. Write any three applications of queues.
Stack( ), Push( ), Pop( ), Peek( ), isEmpty( ), Size( ) A: a) Simulation
15. Explain the memory representation of a stack
b) Various features of operating system.
using one dimensional array.
A: Memory representation of a stack using one c) Multi-programming platform systems
dimensional array. d) Different type of scheduling algorithm
 A stack is an ordered collection of items where e) Round robin technique
the addition of new items and the removal of
20. Explain the memory representation of single
existing items always take place at the same end
linked list.
called TOP.
A: Representation of single linked list.
 Stack can be represented using one dimensional
 A single linked list contains two fields in each
array. The items of stack are stored in a
node such as data field & link field.
sequential order from the first location of the
 The data field contains the data of that node & the
memory block.
link field contains address of the next node.
 A pointer TOP contains the location of the top
 There is any one link field in each node of single
element of the stack.
linked list.
 The condition TOP= MAXSTK indicates the
 In any linked list the nodes need not necessarily
stack is full & it represents the situation is called
represent a set of consecutive memory locations.
overflow.

21. Define the following with respect to binary tree


 The condition TOP=NULL indicates the stack is
i) Root ii) Subtree iii) Depth
empty & it represents the situation is called
A: i) Root: Top most node in the tree is called root.
underflow.
ii) Subtree: A tree T is a tree contains a node in T &
16. Write any three applications of stacks.
all of its descendents in T.
A: Applications of stacks.
iii) Depth: The length of the path to its root is called
 The simplest application of a stack is to reverse a
depth of tree.
word.
22. Write an algorithm for traversal in a linear array.
 Another application is an “undo” mechanism in
A: Let A is a linear array with LB & UB as lower bound
text editors.
& upper bound.
 Conversion of decimal number into binary.
Step 1: for LOC=LB to UB do
17. What is queue? Mention the various operations
Process A[LOC]
performed on the queue.
End For
A: A queue is an ordered collection of items where an
Step 2: Exit
item is inserted at one end called “REAR” & an
existing item is removed from other end called
5-Marks Questions
“FRONT”.
1. What is primitive data structure? Explain the
Operations performed on the queue:
different operations performed on primitive data
queue( ), enqueue( ), Dequeue( ), isEmpty( ), Size( )
structure.
18. Explain the memory representation of queue
A: Primitive Data structures: Data structures that are
using one dimensional array.
directly operated upon by machine-level instructions
A: Memory representation of queue using one
are known as primitive data structures.
dimensional array.
Operations performed on primitive data
 A queue is an ordered collection of items where
structures:
an item is inserted at one end called “REAR” &

21 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


i) Create: Create operation is used to create a new v) isEmpty() tests whether the stack is empty. It
data structure. This operation reserves memory space needs no parameters and returns a Boolean value.
for the program elements. vi) size() returns the number of items on the stack. It
ii) Destroy: Destroy operation is used to destroy or needs no parameters and returns an integer.
remove the data structures from the memory space. 5. What are the applications of stacks.
iii) Select: Select operation is used by programmers A: Applications of stacks.
to access the data within data structure. 1) The simplest application of a stack is to reverse a
iv) Update: Update operation is used to change data word.
of data structures. 2) Another application is an “undo” mechanism in
2. Explain the different operations performed on text editors.
linear data structure. 3) Conversion of decimal number into binary
A: Operations performed on Linear Data Structure. 4) To solve tower of Hanoi
i) Traversal: The process of accessing each data 5) Expression evaluation and syntax parsing
item exactly once to perform some operation is called 6) Conversion of infix expression into prefix and
traversing. postfix.
ii) Insertion: The process of adding a new data item 7) Rearranging railroad cars
into the given collection of data items is called 6. What is a queue? Explain different types of queue.
insertion. A: Refer answer to Q. No 7 in Part A[1 Mark‟s part]
iii) Deletion: The process of removing an existing Types of queue
data item from the given collection of data items is i) Simple Queue: In Simple queue insertion occurs
called deletion. at the rear end of the list, and deletion occurs at the
iii) Searching: The process of finding the location of front end of the list.
a data item in the given collection of data items is ii) Circular Queue: A circular queue is a queue in
called searching. which all nodes are treated as circular such that the
iv) Sorting: The process of arrangement of data last node follows the first node.
items in ascending or descending order is called iii) Priority Queue: A priority queue is a queue that
sorting. contains items that have some preset priority. An
v) Merging: The process of combining the data element can be inserted or removed from any
items of two structures to form a single structure is position depending on some priority.
called merging. iv) Dequeue (Double Ended queue): It is a queue in
3. Explain the different operations performed on which insertion and deletion takes place at both the
one-dimensional array. ends
A: Operations performed on One-dimensional Array. 7. Explain the different operations performed on
i) Traversing: Accessing each element of the array queue.
exactly once to do some operation. A: Operations performed on Queue.
ii) Searching: Finding the location of an element in i) Queue() creates a new queue that is empty. It
the array. needs no parameters and returns an empty queue.
iii) Sorting: Arranging the elements of the array in ii) enqueue(item) adds a new item to the rear of the
some order. queue. It needs the item and returns nothing. This
iv) Insertion: Inserting an element into the array. operation is generally called as push.
v) Deletion: Removing an element from the array. iii) dequeue() removes the front item from the queue.
vi) Merging: Combining one or more arrays to form It needs no parameters
a single array. and returns the item. The queue is modified. This
4. Explain the different operations performed on operation is generally called as pop.
stacks. iv) isEmpty() tests to see whether the queue is
A: Operations performed on stacks. empty. It needs no parameters and returns a Boolean
i) stack() creates a new stack that is empty. It needs value.
no parameters and returns an empty stack. v) size() returns the number of items in the queue. It
ii) push(item) adds a new item to the top of the needs no parameters and returns an integer.
stack. It needs the item and returns nothing. 8. What are the applications of queue?
iii) pop() removes the top item from the stack. It A: Applications of queue:
needs no parameters and returns the item. The stack Simulation
is modified. Various features of operating system.
iv) peek() returns the top item from the stack but Multi-programming platform systems
does not remove it. It needs no parameters. The stack Different type of scheduling algorithm
is not modified. Round robin technique or Algorithm

22 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


Printer server routines PRINT LOC
Various applications software is also based on else
queue data structure PRINT “Search is unsuccessful”
9. What are the operations performed on the linked Step 4: Exit
list?
Operations performed on the linked list : 14. Write an algorithm to search an element in an
1. Creating a linked list array using binary search.
2. Traversing a linked list A: Step 1: set B = 0, E = n-1,LOC=-1
3. Inserting an item into a linked list Step 2: while (B <= E)
4. Deleting an item from the linked list M= int(B+E)/2
5. Searching an item in the linked list if(ELE = A[M]
6. Merging two or more linked lists loc = M
10. Define the following : GOTO 4
a. Root Node b. Leaf Node c. Height d. Depth else
e. Internal node. if(ELE <A[M])
A: a. Root Node : The topmost node in a tree is called E = M-1
the root node. else
b. Leaf Node : Node that do not have any children B = M+1
are called leaf node. End of while
c. Height: The length of the longest downward path Step 3: if(LOC >= 0)
to a leaf from that node is called height. PRINT LOC
d. Depth: The length of the path to its root is called else
depth. PRINT “Search is unsuccessful”
e. Internal node: Any node of a tree that has child Step 4: Exit
nodes and is thus not a leaf node is called internal 15. Write an algorithm to sort an array using
node. insertion sort.
11. Write an algorithm to insert an element in an A: Step 1: for I = 1 to N-1
array. Step 2: J=I
A: A is array with N elements & item is element to be while ( J >= 1 )
inserted in the position P. if( A[J] < A[J-1])
Step 1: for i=N-1 down to P temp = A[J]
A[i+1]=A[i] A[J] = A[J-1]
End For A[J-1] = temp
Step 2: A[P]=item if end
Step 3: N=N+1 J = J-1
Step 4: Exit while end
12. Write an algorithm to delete an element from an for end
array. Step 3: Exit
A: A is array with N elements & item is element to be 16. Write an algorithm for push and pop operation
deleted from the position P. in stack using array.
Step 1: item= A[P] A: An algorithm for PUSH Operation:
Step 2: for i=P to N-1 Step 1: If TOP = N -1 then [overflow]
A[i]= A[i+1] PRINT “Stack is full”
End For Exit
Step 3: N=N-1 End of If
Step 4: Exit Step 2: TOP = TOP + 1 [Increment the TOP]
13. Write an algorithm for searching an element Step 3: STACK[TOP] = ITEM [Insert the
using linear search method. ITEM]
A: Step 1: LOC = -1 Step 4: Return
Step 2: for P = 0 to N-1 An algorithm for pop operation:
if( A[P] = ELE) Step 1: If TOP = NULL then [underflow]
LOC = P PRINT “Stack is empty”
GOTO 3 Exit
End of if End of If
End of for Step 2: ITEM = STACK[TOP] [Copy the top
Step 3: if(LOC >= 0) element]

23 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


Step 3: TOP = TOP – 1 [Decrement the top] Chapter 6.
Step 4: Return
17. Write an algorithm to insert a data element at the BASIC CONCEPTS OF OOP
rear end of the queue. [ 2m X 1 & 5m X 1 = 7Marks]
A: Step 1: if REAR=N-1 then 2 Marks Questions
PRINT “Overflow” 1. What is the significance of classes in OOP?
Exit  A class is a way grouping objects having similar
Step 2: if(FRONT=NULL) then characteristics.
FRONT=0  Once class is defined then any numbers of objects
REAR=0 of that class are created.
Else  Classes are user defined data types. A class can
REAR=REAR+1 hold both data & functions.
Step 3: Queue[REAR]=item Ex:
Step 4: Return
18. Write an algorithm to delete a data element from
the front end of the queue.
A: Step 1: if FRONT=NULL then
PRINT “Underflow”
Exit
Step 2: item=Queue[FRONT]
Step 3: if(FRONT=REAR) then
2. What is the difference between program module &
FRONT=0
an object?
REAR=0
A:
Else
Module: A module is a program unit which performs
FRONT = FRONT +1
a particular task. Module cannot execute itself & it is
Step 4: Return
called either in the main program or by the other
19. Write an algorithm to insert a data element at the
module.
beginning of the linked list.
Object: An object is a collection of data members &
A: Step 1: Pnew Node
associated member functions as a single unit. Each
Step 2: data(P)num
object is real world entity. Objects are basic building
Step 3: Link(P)START
blocks designing programs. Each object is identified
Step 4: STARTP
by a unique name. Each object must be member of a
Step 5: Return
class.
20. Write an algorithm to delete a data element at the
Ex:
end of a linked list.
A: Step 1: START
Step 2: P2START
Step 3: while(link(P2)!=NULL)
P1P2
P2link(P2)
End while
Step 4: PRINT data(P2)
3.Briefly discuss classes & objects.
Step 5: link(P1)NULL
A: Classes:
Step 6 : exit
 A class is a way grouping objects having similar
characteristics.
 Once class is defined then any numbers of objects
of that class are created.
 Classes are user defined data types. A class can
hold both data & functions.
Ex:

Object:
24 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
 An object is a collection of data members & There are 2 types of overloading
associated member functions as a single unit.
 Each object is real world entity.
 Objects are basic building blocks designing Operator overloading: When an existing operator
programs. operates on new data type is called operator
 Each object is identified by a unique name. overloading.
 Each object must be member of a class. Function overloading: When two or functions
Ex: having same name but differ in the number of
arguments or data type.
9. Mention different types of overloading.
A: Refer answer to Q. No 8
10. Mention any two advantages of object oriented
programming (OOP) over earlier programming
methods.
A: Advantages of OOPs:
4. Explain data encapsulation. 1) The programs are modularized based on the
 A way of combining data & associated functions principle of class & objects.
into a single unit is called data encapsulation. 2) Linking code & objects allows related objects to
 Data encapsulation will provides the direct access share common code. This reduce the code
to data. duplication & code reusability.
 The data can be accessed only through function 3) Easier to develop complex software.
which is present inside the class. 11. Write the disadvantages of object oriented
 The data cannot be modified by an external non- programming (OOP).
member function of a class. A: Disadvantages of OOPs:
 Data encapsulation enables data hiding or 1. OOP software is not having set standards.
information hiding. 2. The classes are overly generalized.
5. Explain inheritance. 3. To convert a real world problem into an object
 The process of forming a new class from an oriented model is difficult.
existing class is called inheritance. 12. Mention any four high level languages that
 The existing class is known as base class. The follows object oriented programming (OOP).
new class is known as derived class. A: 1) C++ 2) Java 3) C# 4) Python
 The derived class shares some of the properties 5) small talk.
of the base class.
 The objects of one class acquire the properties of 5 Marks Questions
another class through inheritance. 1. Write a difference between procedural oriented
 In OOP, the concept of inheritance provides the Programming (POP) & object oriented
idea of reusability. programming (OOP).
Types of inheritance:
Single inheritance
Multiple inheritance
Multilevel inheritance
Hierarchical inheritance
Hybrid inheritance
6. Mention different types of inheritance.
A: Refer answer to Q. No 5
7. Write a note on polymorphism.
A: Ability of a function to take multiple forms is called
polymorphism. Polymorphism is a feature of OOP
where a function can take multiple forms based on
the type of arguments, number of arguments & data
type of return value.
8. Write a note on overloading.
Overloading: Overloading allows objects to have
different meaning depending upon context.
25 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
2.Explain the different characteristics of OOP. associated with a procedure call is known at the time
A: Characteristics of OOPs: of program execution routine.
a) Objects: An object is a collection of data i) Message passing: The processing of data in OOP
members & associated member functions as a single is carried out by sending messages to an object is
unit. Each object is real world entity. Objects are called message passing. A message for an object is
basic building blocks designing programs. Each request for execution of procedure.
object is identified by a unique name. Each object 3. Explain the advantages of object oriented
must be member of a class. programming (OOP).
b) Classes: A class is a way grouping objects A: Advantages of OOPs:
having similar characteristics. Once class is defined  The programs are modularized based on the
then any numbers of objects of that class are created. principle of class & objects.
Classes are user defined data types. A class can hold  Linking code & objects allows related objects to
both data & functions. share common code. This reduce the code
c) Data abstraction: The representation of essential duplication & code reusability.
features of an object without including background  Easier to develop complex software.
details is called as data abstraction. Data abstraction  Creation & implementation of OOP code is easy
permits the user to an object without knowing its & reduces software development time.
internal working. Classes use the concept of  The concept of data abstraction separates object
abstraction. specification & object implementation.
d) Data encapsulation: A way of combining data &  External non-member function cannot access or
associated functions into a single unit is called data modify the data due to data encapsulation.
encapsulation. Data encapsulation will provides the 4. Write the real life applications of object oriented
direct access to data. The data can be accessed only programming (OOP).
through function which is present inside the class.
A: Applications of OOPs:
The data cannot be modified by an external non-
member function of a class. Data encapsulation  Computer graphic applications.
enables data hiding or information hiding.  CAD/CAM software.
e) Inheritance: The process of forming a new class  Object oriented database.
from an existing class is called inheritance. The new  User interface design such as windows.
class is known as base class. The new class is known  Real time systems.
as derived class. The derived class shares some of the  Simulation & modelling.
properties of the base class. The objects of one class  Artificial intelligence & experts systems.
acquire the properties of another class through
inheritance. In OOP ,the concept of inheritance
provides the idea of reusability.
f) Polymorphism: Ability of a function to take
multiple forms is called polymorphism.
Polymorphism is a feature of OOP where a function
can take multiple forms based on the type of
arguments, number of arguments & data type of
return value. Function such as abs( ), fabs( )are
compute & return the absolute value of an integer &
floating value.
g) Overloading: Overloading allows objects to have
different meaning depending upon context.
There are 2 types of overloading
Operator overloading
Function overloading
Operator overloading: When an existing operator
operates on new data type is called operator
overloading.
Function overloading: When two or functions
having same name but differ in the number of
arguments or data type.
h) Dynamic binding: The process of connecting one
program to another. Dynamic binding means code
26 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
Chapter 7. };
CLASSES AND OBJECTS 14. Write the syntax of class declaration.(Write the
syntax to declare an object of a class.)
[1m X 1 & 5m X 1 = 6Marks] A: class user_defined_name
1 Mark Questions {
1. What is a Class? private: Member data, Member functions
A: A way of grouping objects having similar protected: Member data, Member functions
characteristics is called class. public: Member data, Member functions
2. What is an object? };
A: An object is an instance of a class or it represents class_name obeject_name1,object_name2,….;
data & associated functions as a single unit. 15. Is it possible to access data outside a class?
3. What is class instances called as? A: Yes. It is possible to access public data members.
A: An object is an instance of a class. 16. Which type data members are accessible outside a
4. What are the two types of members referenced in class?
a class? A: Public data members are accessible outside a class.
A: Data members 17. Which access specifier is implicitly used in a
Member Functions class?
5. What are data members? A: Private
A: Members which describe the characteristics of a class 18. Which is a default access specifier for members of
or variables declared inside a class are called data a class in C++?
members. A: Private.
6. What is a member function? 19. Define the term public access.
A: Functions which describe the operations that can be A: The data members can be accessed by any function
performed with the data members of the class or outside the class also is called public access.
functions declared inside a class called member 20. What are the different ways of declaring member
functions. functions?
7. Write the differences between class definition and A: Inside a class
class declaration. Outside a class
A: A class definition is a process of naming a class and 21. Mention the operator used to access members of a
data variables, and interface operations of the class. class.
A class declaration specifies the representation of A: Direct member access operator or dot(.) operator is
objects of the class and set of operations that can be used to access members of a class.
applied to such objects. 22. How are member functions of a class defined
8. What does the class definition specify? outside the class declaration?
A: A class definition specifies the naming a class and A: Member functions of a class defined outside the class
data variables, and interface operations of the class. declaration by using scope resolution operator(::).
9. What does the class declaration specify? 23. What is the significance of scope resolution
A: A class declaration specifies the representation of operator (::)?
objects of the class and set of operations that can be A: Scope resolution operator is used when member
applied to such objects. functions are declared outside a class definition.
10. Is memory space allocated for class? 24. Write the syntax for accessing class member.
A: No. A: The syntax for accessing class member is:
11. What is the significance of using access object. Data _member;
specifies?(Why are access specifies used?) object. member_ function(arguments);
A: Access specifiers help in controlling the access of 25. How are objects of a class declared? Give an
data members. They define the scope of data. example.
12. Mention the access specifiers used with a class. A: An object can be declared as:
A: Private, Public and Protected. classname objectname1,objectname2,….;
13. Write the syntax of class definition. Ex: rectangle r;
A: class user_defined_name 26. What is meant by array of objects?
{ A: An array having class type element is called as an
private: Member data Member functions array of objects.
protected: Member data 27. Can an array of objects be created?
Member functions A: Yes.
private: Member data 28. Can object be passed to function as arguments?
Member functions A: Yes.
27 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
29. What are the ways of passing an object as an void getdata( )
argument to functions? {
A: Copy of entire object is passed to function(pass cout<<”Enter the values of a&b”<<endl;
cin>>a>>b; void main( )
by value).
}
Only address of the object is transferred to the void compute( )
function(pass by reference). {
30. Can functions return objects? c=a+b;
A: Yes. }
31. What is accessor? void display( )
A: A member function of a class that only accesses but {
does not modify the values of data member. cout<<”Sum=”<<c;
32. What is mutator? }
A: A member functions of classes that modify the values };
of data member. void main( )
33. Write an example to show how objects can be {
used as function arguments. Sum s;
A: rectangle r1,r2,r3; s.getdata();
r1.getdata (r2,r3); s.compute();
34. Compare structure and class. s.display();
A: The keyword strict is used to define the structure. getch();
By default its member is public. }
The keyword class is used to define the class. By 2. Explain the different types of access specifiers in a
default its member is private. class.
5 Marks Questions A: Access specifier define the scope of data member &
1. Explain the class definition and declaration with member functions.
syntax and example. There are 3 types in access specifiers:
A: Defining a class: A class definition is a process of A) Private:
naming a class, data variables& interface operation i) private access specifier is used to access data
of the class. members only by the member function.
Syntax of class definition: ii) Members declared under private are accessible
class user_defined_name only within the class.
{ iii) Private access specifier is default access specifier.
private: Member data; Ex: private: int a,b,c;
Member functions; B) Public:
protected: Member data; i) public access specifier is used to access data
Member functions; members by the any function inside or outside the
public: Member data; class.
Member functions; Ex: private: int a,b,c;
}; public: void getdata( );
i) Keyword class is used to define a class. void compute( );
ii) Class body is enclosed in a pair of flower brackets. void display( );
iii) Class body contains the declaration of data C) Protected:
members & member functions. i) The members which are declared as protected can
Declaring a class: be accessed only by the member functions, friend
A class declaration specifies the representation of functions of the class & member functions derived
objects of the class & set of operations. from this class.
Syntax: ii) The members cannot be accessed outside of the
class_name obeject_name1,object_name2,….; class.
Ex: Ex: protected: int a,b,c;
#include<iostream.h> 3. What are the characteristics of member functions
#include<conio.h> outside a class?
class sum A: Characteristics of the member functions:
{ 1) Data type & arguments in member function must
private: int a,b,c; be same as data type & arguments declared in class
public: definition.

28 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


2) Several classes can use same function name. i) A member functions declared within a class but
Membership label will resolve their scope. defined separately outside the class.
3) Member function can access private data of a class ii) The defining a function is similar to normal
but non-member function cannot access. function. But a member function has an identity label
4) A member function can call another function in the header.
directly without using dot operator. iii) Scope resolution operator(::) is used define the
5) A member function defined outside a class can be member functions.
accessed by using scope resolution operator. Syntax:
4. Explain member functions (a) inside a class return_type classname:: member_function(arg list)
definition (b)outside a class definition. {
A: A function which is declared within in class is called Function body
as member function. }
The member function can be defined in two places: Ex:
Inside a class definition. #include<iostream.h>
Outside a class definition. #include<conio.h>
Inside a class definition: class sum
i) Member function can be defined inside a class by {
declaring the member function within the class. private: int a, b, c;
ii) A function defined within a class is treated as public: void get data( );
inline function. void compute( );
iii) Only small functions are defined inside a class. void display( );
Syntax: };
return_type_specifier function_name(arguments) void sum::getdata( )
{ {
Function body cout<<”enter the values of a&b”<<endl;
} cin>>a>>b;
Ex: }
#include<iostream.h> void sum::compute( )
#include<conio.h> {
class sum c=a+b;
{ }
private: int a,b,c; void sum::display( )
public: void getdata( ) {
{ cout<<”sum=”<<c;
cout<<”enter the values of a&b”<<endl; }
cin>>a>>b; void main( )
} {
void compute( ) sum s;
{ s.getdata( );
c=a+b; s.compute( );
} s.display( );
void display( ) getch( );
{ }
cout<<”sum=”<<c; 5. Explain how objects of a class can be defined with
} suitable example.
}; A: i) When a class is defined then it specifies the type of
void main( ) objects stored.
{ ii) Once the class is defined then object is created
sum s; from that class.
s.getdata( ); iii) The objects of a class are declared in the same
s.compute( ); manner like other variable declaration.
s.display( ); Syntax:
getch( ); class user_defined_name
} {
Outside the class definition: private: data members
public: member functions

29 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


}; getch( );
user_defined_class_name object1,object2,….; }
Ex:
#include<iostream.h> 7. Explain how an array of objects can be defined
#include<conio.h> with suitable example.
class sum A: i) An array having class type elements is known as
{ array of objects.
private:int a,b,c; ii) An array of objects is declared after class
public: definition & is defined in the same way as any other
void getdata( ) array.
{ Syntax:
cout<<”enter the values of a&b”<<endl; class user_defined_name
cin>>a>>b; {
} private://data members
void compute( ) public://member functions
{ };
c=a+b; user_defined_name object[size];
} Ex:
void display( ) class student
{ {
cout<<”sum=”<<c; private: int rno,m1,m2;
} public:
}; void getdata( )
void main( ) {
{ cout<<”enter a roll no”<<endl;
sum s; cin>>rno;
s.getdata( ); cout<<”enter a first subject marks”<<endl;
s.compute( ); cin>>m1;
s.display( ); cout<<”enter a second subject marks”;
getch( ); cin>>m2;
} }
6. Explain how an array can be used as members of void display( )
a class with suitable example. {
A: Like arrays within structures, it is possible to use cout<<”roll number=”<<rno;
arrays as member data of class. cout<<”first subject mark=”<<m1;
class student cout<<”second subject mark=”<<m2;
{ }
private:int rno[5],i; };
public:void getdata( )
{ void main( )
cout<<”enter a roll no.s of students”<<endl; {
for(i=0;i<n;i++) student s[3]; //s[3]is an array of object
cin>>rno[i]; for(int i=0;i<3;i++)
} s[i].getdata( );
void display( ) for(int i=0;i<3;i++)
{ s[i].display( );
cout<<”roll number=” getch( );
for(i=0;i<n;i++) }
cout<<rno; Here the array of object s contains
} rollnumber,mark1,mark2 of three students.
}; 8. Explain how objects can be used as function
void main( ) arguments.
{ A: i) A function can be receiving an object as a function
student s; argument.
s.getdata( ); ii) This is similar to any other data type is passed as
s.display( ); function arguments.

30 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


An object can be passed to a function in two ways: A: Two or more functions have same name, but differ in
1. Copy of entire object is passed to function(pass the number of arguments or data type of arguments is
by value). called as function overloading.
 In pass by value, a copy of the object is passed The need of/for function overloading/advantages:
to the function .the function creates its own The function overloading is the process of defining
copy of the object & uses it. same function name to carry out similar types of
 Therefore changes made to the object inside the activities with various data items.
function is do not affect the original object By using Function overloading:
2. Only address of the object is transferred to the
function(pass by reference);
 In pass by reference, its address of an object is and debug.
passed to the function.
 The function directly works on the original etween programs and real world
object. Therefore changes made to the object objects.
inside the function will reflect in the original 2. Discuss overloaded functions with syntax and
object. example.
Ex: OR
#include<iostream.h> Explain with a programming example to overload
#include<conio.h>
a function with different number of arguments.
class sum OR
{
Explain with a programming example to overload
private: int a,b,c; a function with different data type of arguments.
public: A: i) Function overloading means two or more functions
void getdata( ) have same name, but differ in the number of
{ arguments or data type of arguments.
cout<<”enter the values of a&b”<<endl; ii) To overload a function, each overloaded function
cin>>a>>b; must be declared and defined separately.
}
Overloaded function definition:
void compute(sum s ) return_type_specifier(argument list)
{ {
c=sum.a+sum.b; function body
} }
void display( ) Overloaded function declaration:
{ return_type_specifier(argument list);
cout<<”sum=”<<c; Ex: int product(int a, int b, int c)
} {
}; cout<<”Product=”<<a*b*c<<endl;
void main( )
}
{
float product(float x, float y)
sum s1;
{
s1.getdata( );
cout<<”Product=”<<x*y<<endl;
s1.compute( );
}
s1.display( );
void main( )
getch( );
{
}
int product(int a,int b,int c);
Chapter 8. float product(float x,float y);
FUNCTION OVERLOADING int a,b,c;
float x,y;
[5m X 1 = 5Marks]
cout<<”Enter three numbers”;
5-Marks Questions
1. What is meant by function overloading? Explain cin>>a>>b>>c;
the need for/of function overloading. cout<<”Enter two numbers”;
OR cin>>x>>y;
What is function overloading? Mention its cout<<”product of three numbers=”<product(a,b,c);
advantages. cout<<”product of two numbers=”<product(x,y);
}

31 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


3. Explain inline functions with syntax and example. }
A: A member function defined within a class with the Characteristics of friend declaration:
keyword inline for a non-member function of a class  A friend functions although not a member
is called inline function. function has full access right to the private and
Inline function definition starts with keyword protected members of the class.
inline.  A friend function can be invoked like any other
The inline functions should be defined before all normal function.
functions that call it.  A friend function is declared by the class that is
The complier replaces the function call statement granting access.
with the function code itself.  They are normal external functions that are given
special access privileges.
They run a little faster than normal functions.
Inline function syntax:  The function is declared with keyword friend.
return_type_specifier(argument list) But while defining friend function it does not use
{ either keyword friend or :: operator.
function body 6. Explain friend functions with example.
} A: A non-member function of a class that has access to
Ex: both private & protected access members is called
#include<iostream.h> friend function.
#include<conio.h> Syntax for friend declaration:
inline int cube(int a) class class_name
{ {
return(a*a*a); public:friend void function1(void);
} }
void main( ) Ex: #include<iostream.h>
{ #include<conio.h>
int x,y; class sum
cout<<”enter a number”; {
cin>>x; private: int a,b;
y=cube(x); public: void set(int i,int j);
friend int add(sum s);
cout<<”Cube of x =”<<y;
};
getch(); }
void sum::set(int i,int j)
4. Define an inline function. Write the advantages &
{
disadvantages of inline functions.
a=i;
A: A member function defined within a class with the
b=j;
keyword inline for a non-member function of a class
}
is called inline function.
int add(sum s)
Advantages of inline functions:
{
 The inline member functions are compact
return(s.a+s.b);
function calls.
}
 Therefore the size of the object code is
void main( )
considerably reduced.
{
 The speed of execution of a program increases.
sum s1;
 Very efficient code can be generated.
s1.set(10,20);
 The readability of the program increases.
cout<<”Sum of 10,20=”<<add(s1);
Disadvantages of inline functions:
 The size of the executable file increases. getch( );
 More memory is needed. }
5. Explain friend functions and their characteristics. 7. Write a C++ program to find the area of rectangle,
A: A non-member function of a class that has access to square & triangle using function overloading.
both private & protected access members is called A:
friend function. #include<iostream.h>
#include<conio.h>
Syntax for friend declaration:
class class_name class funoverload
{ {
public: friend void function1(void); private: float s;
public:
32 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
double area(double a) cout<<”Cube of x =”<<y;
{ getch();
return a*a; }
}
double area(double l,double b) CHAPTER 9.
{ CONSTRUCTORS AND DESTRUCTORS
return l*b; [2m X 1 & 5m X 1= 7Marks ]
}
double area(double a,double b,double c)
2 Marks Questions
{ 1. What is a constructor? Give an example.
s=(a+b+c)/2; A: i) A special member function that is used in classes to
return(sqrt(s*(s-a)*(s-b)*(s-c))); initialize the objects of a class automatically is called
} constructor.
}; ii) A constructor is a member function of a class with
void main( ) the same name as that of the class.
{ Syntax:
int choice; class classname
double x,y,z; {
funoverload f; private:
cout<<”enter the choice(1 or 2 or 3)”<<endl; …………….
cin>>choice; public:
if(choice==1) classname( )
{ {
cout<<”enter the side”; …………….
cin>>x; }
cout<<”area of square=”<<f.area(x); };
} Example:
else if(choice==2) class sum
{ {
cout<<”enter the sides”; private: int a;
cin>>x>>y; public:
cout<<”area of rectangle=”<<f.area(x,y); sum( )
} {
else a=0;
{ }
};
cout<<”enter the sides”;
2. Why are constructors needed in a program?
cin>>x>>y>>z;
Justify.
cout<<”area of triangle=”<<f.area(x,y,z);
OR
}
What is the need of a constructor?
getch( );
A: Need of a constructor / Advantages
}
 A constructor is a special member function that is
8. Write a C++ program to find the cube of a used in classes to initialize the objects of a class
number using inline function. automatically.
A:
 Constructors are named as constructors because
#include<iostream.h>
they are getting called when an object is
#include<conio.h>
constructed.
inline int cube(int a)
 The use of a constructor can be cleverly done
{
especially in those problems where it is necessary
return(a*a*a);
to initialize certain data members compulsorily.
}
 Instead of having separate member functions for
void main( )
initializing we can perform those operations
{
inside the constructor itself.
int x,y;
3. Write any two features of constructor.
cout<<”enter a number”;
A: Features of constructor:
cin>>x;  A Constructor always has name that is same as
y=cube(x);
33 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
the class name of which they are the members.  It is not possible to initialize different objects with
 There is no return type for constructors. different initial values using default constructor.
 A constructor should be declared in public section. 9. What is parameterized constructor? Write its
4. Mention different types constructor. syntax.
A: There are three types of constructors: A: A constructor that takes one or more arguments is
 Default constructor called parameterized constructor.
 Parameterized constructor Syntax:
 Copy constructor. class classname
5. What is default constructor? How many default {
constructors can exists for a class? private:
 A constructor which does not accept any …………….
arguments is called a default constructor. It is public:
also known as zero argument constructor. classname(datatype argument1,datatype
 One default constructor can exist for a class. argument2,…….. )
6. What is default constructor? Write its syntax. {
OR …………….
Write the syntax and example for default }
constructor. };
A: i) A constructor which does not accept any arguments
is called a default constructor. 10. Write any two features of parameterized
ii) It is also known as zero argument constructor. constructors.
Syntax: A: Features of parameterized constructors:
class classname  The parameterized constructors can be
{ overloaded.
private: …………….  For an object created with one argument,
constructor with only one argument is invoked and
public: classname( )
executed.
{
 The parameterized constructor can have default
…………….
arguments and default values.
}
11. How are parameterized constructors invoked?
};
OR
Which are the different methods through which
Example: constructors are invoked?
class sum A: The constructors can be invoked through the
{ following methods:
private: int a; 1. Explicit call
public: 2. Implicit call
sum( ) 3. Initialization at the time of declaration with =
{ operator
a=0; 12. Write an example to show the use of
} parameterized constructor through explicit call.
}; A: #include< iostream. h >
7. What are the features of default constructors? class num
A: The features of default constructors: {
 For every object created, this constructor is private: int a,b;
automatically called. public:
 All objects of a class are initialized to same set of num(int x, int y)
values by the default constructor. {
 If different objects are to be initialized with a = x;
different values, it cannot be done using default b = y;
constructor. }
8. What are the disadvantages of default void display()
constructor? {
A: Disadvantages of default constructor: cout<<"a = "<<a<<" b = "<<b;
 When many objects of the same class are created, }
all objects are initialized to same set of values by };
default constructor.
34 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
void main() public: classname(); //constructor
{ ~classname(); //destructor
num n1=num(10,20); };
num n2=num(30,40); 18. What is a destructor? Which operator is used
n1.display(); with destructor?
n2.display(); A: i) A special member function that will be executed
getch( ); automatically when an object is destroyed is called
} destructor.
13. What is a copy constructor? Write the syntax for ii) Tilde (~) operator is used with destructor.
declaration of copy constructor. 19. Write any two features of destructor.
OR Features of destructor:
Write syntax and example for declaration of  The destructor name is same as that of class but
copy constructor. preceded by a tilde (~).
A: A parameterized constructor using which one object  Destructors do not have a return value
can be copied to another object is called copy  Destructors cannot be overloaded.
constructor. 5 Marks Questions
Syntax: classname :: classname(classname &ptr) 1. What is a Constructor? Write the rules for writing
Example: x :: x(x &ptr) a constructor function.
14. When is copy constructor used in a program? A: Constructor is a special member function that is used
A: Copy constructors are used in the following in classes to initialize the objects of a class
situations: automatically is called constructor.
 To initialize an object with the values of already Rules for writing a constructor function:
existing objects. 1) A Constructor always has name that is same as
 When objects must be returned as function values the class name of which they are the members.
 To state objects as by value parameters of a 2) There is no return type for constructors (not even
function. void).
15. Mention the feature of copy constructor. 3) A constructor should be declared in public
A: Feature of copy constructor: section.
 Copy constructor is not invoked explicitly. 4) A constructor is invoked automatically when
 Copy constructor is invoked automatically when objects are created.
a new object is created and equated to an already 5) Constructors can have default arguments.
existing object in the declaration statement itself. 6) It is not possible to refer to the address of the
 Copy constructor is invoked when an object constructors.
returns a value. 7) The constructors make implicit calls to the
16. Write short note on constructor overloading. operators new and delete when memory
 A class has two or more constructor functions allocation is required.
with the same name but different arguments are 2. Mention the types of constructors. Explain any
called constructor overloading. one in detail.
 Overloading a constructor means specifying A: There are three types of constructors:
additional meaning to it by passing the required Default constructor
arguments. Parameterized constructor
 Depending on the requirement one can define any Copy constructor.
number of overloaded constructors in a single Default constructor:
class. i) A constructor which does not accept any
17. What is a destructor? Give its syntax. arguments is called a default constructor.
A: i) A special member function that will be executed ii) It is also known as zero argument constructor.
automatically when an object is destroyed is called Syntax:
destructor. class classname
ii) Like constructor, the destructor name is same as {
that of class but preceded by a tilde (~). private: …………….
Syntax: public: classname( )
class classname
{
{
…………….
private:
}
//data variables
};
//method
35 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
Example: default arguments and default values.
#include<iostream.h> 5. Explain parameterized constructor with syntax
class x and programming example.
{ OR
private: int a, b; Write a note on parameterized constructor.
public: x( ) A: A constructor that takes one or more arguments is
{ called parameterized constructor.
a=10; Features of parameterized constructors:
b=20;  The parameterized constructors can be
} overloaded
void display()  For an object created with one argument,
{ constructor with only one argument is invoked
cout<<a<<setw(5)<<b<<endl; and executed.
}  The parameterized constructor can have default
}; arguments and default values.
void main() Syntax:
{ class classname
x obj1,obj2; {
obj1.display(); private: ………….
obj2.display(); public:
} classname(datatype argument1, datatype
The features of default constructors: argument2, …….. )
 For every object created, this constructor is
{
automatically called.
…………….
 All objects of a class are initialized to same set of
}
values by the default constructor.
};
 If different objects are to be initialized with
The constructors can be invoked through the
different values, it cannot be done using default
following methods:
constructor.
1. Explicit call
Disadvantages of default constructor:
2. Implicit call
 When many objects of the same class are created,
3. Initialization at the time of declaration with =
all objects are initialized to same set of values by
operator.
default constructor.
Example:
 It is not possible to initialize different objects
#include<iostream.h>
with different initial values using default
class num
constructor.
{
3. Explain default constructor with syntax and
private: int a,b;
example.
public:
A: Refer the answer to Q. No 2
num(int x, int y)
4. Write the features of default constructors and
{
parameterized constructors.
a = x;
The features of default constructors:
b = y;
 For every object created, this constructor is
}
automatically called.
void display()
 All objects of a class are initialized to same set of
{
values by the default constructor.
cout<<"a = "<<a<<" b = "<<b;
 If different objects are to be initialized with
}
different values, it cannot be done using default
};
constructor.
void main()
Features of parameterized constructors:
{
 The parameterized constructors can be
num n1=num(10,20);
overloaded
num n2=num(30,40);
 For an object created with one argument, n1.display();
constructor with only one argument is invoked n2.display();
and executed. getch( );
 The parameterized constructor can have }
36 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
Output: public:
a = 10 b = 20 num(int x, int y)
a = 30 b = 40 {
6. Explain with an example to show how a a = x;
constructor is invoked explicitly. b = y;
OR }
Explain how parameterized constructors are void display()
invoked. {
A: A constructor that takes one or more arguments is cout<<"a = "<<a<<" b = "<<b;
called parameterized constructor. }
The constructors can be invoked through the };
following methods: void main()
1. Explicit call {
2. Implicit call num n1(10,20);
3. Initialization at the time of declaration with = num n2(30,40);
operator. n1.display();
Explicit call : n2.display();
In explicit call, declaration of an object is followed getch( );
by assignment operator, constructor name and }
argument list enclosed in parenthesis. 8. With an example show how constructors are used
Example: with an = operator.
#include<iostream.h> A: In this method declaration is followed by assignment
class num operator and value to be initialized.
{ Example:
private: int a,b; #include<iostream.h>
public: class num
num(int x, int y) {
{ private: int a;
a = x; public:
b = y; num(int x)
} {
void display() a = x;
{ }
cout<<"a = "<<a<<" b = "<<b; void display()
} {
}; cout<<"a = "<<a;
void main() }
{ };
num n1=num(10,20); void main()
num n2=num(30,40); {
n1.display(); num n1=10;
n2.display(); num n2=20;
getch( ); n1.display();
} n2.display();
Output: getch( );
a = 10 b = 20 }
a = 30 b = 40 Output:
7. Illustrate how the parameterized constructor is a = 10
used with implicitly. a = 20
A: An Implicit call means the declaration of the object is 9. What is copy constructor? Explain with
followed by argument list enclosed in parentheses. programming example.
Example: A: A parameterized constructor using which one object
#include<iostream.h> can be copied to another object is called copy
class num constructor.
{ Syntax: classname :: classname (classname &ptr)
private: int a,b; Example: x :: x(x &ptr)

37 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


Copy constructors are used in the following The above example shows the use of copy
situations: constructor to create a new object a2 using
 To initialize an object with the values of already existing object a1.
existing objects. 3) When a new object is declared and existing
 When objects must be returned as function values object is passed as a parameter to it in the
 To state objects as by value parameters of a declaration, then also copy constructor is
function. invoked.
Feature of copy constructor: Example: x a1(100,200);//parameterized
 Copy constructor is not invoked explicitly. constructor
 Copy constructor is invoked automatically when x a2(a1); //copy constructor is invoked for
a new object is created and equated to an already 4) When an object is passed to a function using
existing object in the declaration statement itself. pass-by-value, copy constructor is automatically
 Copy constructor is invoked when an object called.
returns a value. Example:
Example: void test( x )
#include<iostream.h> {
class num ……….
{ }
private:int a,b; void main()
public: {
num(int x, int y) x a;
{ test(a); //copy constructor is
a = x; invoked
b = y; }
} 5) Copy constructor is invoked when an object
void display() returns a value.
{ Example:
cout<<"a = "<<a<<" b = "<<b; class copy
} {
}; int a,b;
void main() copy sum(copy&);
{ };
num n1=num(10,20); copy copy::sum(copy &c)
num n2=n1; {
cout<<”Before copy:”<<n1.display(); return copy(c.a+c.b);
cout<<”After copy:”<<n2.display(); }
getch( ); } 9. Explain Constructor Overloading.
A: i) A class has two or more constructor functions
with the same name but different arguments are
called constructor overloading.
ii) Overloading a constructor means specifying
additional meaning to it by passing the required
10. Explain the features of copy constructor. arguments.
A: Copy Constructor is a parameterized constructor iii) Depending on the requirement one can define any
using which one object can be copied to another number of overloaded constructors in a single
object is called copy constructor. class.
Features of Copy Constructor: Example:
1) Copy Constructor is not invoked explicitly. #include<iostream.h>
2) Copy constructor is invoked automatically when #include<conio.h>
a new object is created and equated to an already class simpleinterest
existing object in the declaration statement itself. {
Example: x a1; //default constructor private: float p, r, t, si;
x a2 = a1; //copy constructor public:
a1.display(); simpleinterest( ) //Default constructor
{
}

38 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


simpleinterest(float x, float y, float z) }
//Parameterized Constructor num::~num()
{ {
p = x; cout<<“in destructor”;
r = y; }
t = z; void num::display()
} {
void compute ( ) cout<<“Value of x = ”<<x;
{ }
si = (p * t * r)/100; void main()
cout<<”Simple Interest is = “<< si; {
} num a;
}; a.display();
void main( ) getch();
{ }
simpleinterest S1, S2(10000.0, 12.0, 2.0); Output:
S2.compute( ); In constructor:
} Value of x = 100
10. What is the purpose of destructor? Write the In destructor
syntax and example.
OR
Explain destructors with syntax and example. CHAPTER 10.
A: i) A special member function that will be executed
automatically when an object is destroyed is INHERITANCE
called destructor. [5m X 1 = 5Marks]
ii) Like constructor, the destructor name is same as 5 Marks Questions
that of class but preceded by a tilde (~). 1. Explain inheritance.
Syntax: A: The capability of one class to inherit properties from
class classname another class is called inheritance. It is the
{ mechanism by which one class called derived class
private: acquires the properties of another class called base
//data variables class. The class whose properties are inherited by
//method another class is called base class. It is also called
public: super class. The class that inherits properties from
classname(); //constructor base class is called derived class. It is also called sub
~classname(); //destructor class.
}; Advantages of Inheritance:
Features of destructor: 1. Reusing existing code
The destructor name is same as that of class 2. Faster development time
but preceded by a tilde (~). 3. Easy to maintain
Destructors do not have a return value 4. Easy to extend
Destructors cannot be overloaded 5. Memory utilization
Example: Defining derived classes:
#include<iostream.h> Syntax:
#include<conio.h> Class derivedClass_name :: visibilitymode
class num baseclass_name
{ {
private: int x; // …….
public: num(); //members of the derived class
void display(); };
~num(); Example:
}; class marks:public student
num::num() {
{ private: int m1,m2,total;
cout<<“ In constructor: ”; public: void getdata( );
x=100; void compute( );
39 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
void display( );  The private members of a base class cannot be
}; inherited to the derived class.
Types of Inheritance:  The public members of a base class become public
1. Single inheritance members of the derived class.
2. Multilevel inheritance  The protected members of a base class stay
3. Multiple inheritance protected in a derived class.
4. Hierarchical inheritance Syntaxclass subclass: public superclass
5. Hybrid inheritance Ex:
2. What are the advantages of inheritance? class student
A: Advantages of Inheritance: {
1. Reusing existing code private: int rno;
2. Faster development time char name[50];
3. Easy to maintain public: void getdata();
4. Easy to extend void display();
5. Memory utilization };
3. What is visibility mode? What is its role with class marks: public student
respect to inheritance? {
 A: The visibility mode (private, public and private: int m1,m2,total;
protected) in the definition of the derived class public: void getdata1();
specifies whether features of the base class are void display1();
privately derived or publicly derived or };
protectedly derived. Protected Inheritance:
 The visibility mode basically controls the access The private members of a base class cannot be
specifier to be for inheritable member of base inherited to the derived class.
class in the derived class.  The public members of a base class become
The role of visibility modes: protected in a derived class.
 The protected members of a base class stay
protected in a derived class.
Syntaxclass subclass : protected superclass
Ex:
class student
{
private: int rno;
Private Inheritance: char name[50];
 The private members of a base class cannot be public: void getdata();
inherited to the derived class. void display();
 The public members of a base class become the };
private members of the derived class. class marks: protected student
 The protected members of a base class stay {
protected in a derived class. private: int m1,m2,total;
Syntaxclass subclass: private superclass public: void getdata1();
Example: void display1();
class student };
{ 4. What is the difference between public and private
private: int rno; and protected access specifier?
char name[50]; A: Private access specifier:
public: void getdata();  The private members of a base class cannot be
void display(); inherited to the derived class.
};  The public members of a base class become the
class marks: private student private members of the derived class.
{  The protected members of a base class stay
private:int m1,m2,total; protected in a derived class.
public: void getdata1(); Syntaxclass subclass: private superclass
void display1(); Ex:
}; class student
Public Inheritance: {

40 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


private: int rno; 5. What are the types of inheritance? Explain any
char name[50]; two.
public: void getdata(); OR
void display(); What is inheritance? Explain the types of
}; inheritance.
class marks: private student A: The capability of one class to inherit properties from
{ another class is called inheritance.
private: int m1,m2,total; Types of inheritance
public: void getdata1(); 1. Single inheritance
void display1(); 2. Multilevel inheritance
}; 3. Multiple inheritance
Public access specifier: 4. Hierarchical inheritance.
 The private members of a base class cannot be 5. Hybrid inheritance
inherited to the derived class. 1) Single Inheritance:
 The public members of a base class become If a class is derived from a single base class, it is
public members of the derived class. called single inheritance.
 The protected members of a base class stay
protected in a derived class.
Syntaxclass subclass: public superclass
Ex:
class student
{ A derived class with single inheritance is declared
private: int rno; as follows:
char name[50]; class Baseclass
public: void getdata(); {
void display(); ………..
}; };
class marks: public student class Derivedclass : public Baseclass
{ {
private: int m1,m2,total; ………..
public: void getdata1(); };
void display1(); Example:
}; class student
Protected Inheritance: {
 The private members of a base class cannot be private: int rno;
inherited to the derived class. char name[20];
 The public members of a base class become public:
protected in a derived class. void getdata()
 The protected members of a base class stay {
protected in a derived class. cout<<“Enter Roll No and name “<<endl;
Syntaxclass subclass : protected superclass cin>> rno >>name;
Ex: }
class student void display()
{ {
private: int rno; cout<<“roll no: “<< rno <<endl;
char name[50]; cout<<“name : “<<name <<endl;
public: void getdata(); }
void display(); };
}; class marks: public student
class marks: protected student {
{ private: int m1,m2,total;
private: int m1,m2,total; public:
public: void getdata1(); void getdata1()
void display1(); {
}; cout<<“enter the marks”;
cin>>m1>>m2;
41 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
total = m1+m2; public:
} void displayB( )
void display1() {
{ cout << “ Intermediate Base class B”<<endl;
cout<<"Total marks = "<<total; cout << “ Derived from A” << endl;
} }
}; };
void main() class C : public B
{ {
marks m; public:
clrscr(); void displayC( )
m.getadata(); {
m.getadata1(); cout << “ Derived Class C”<<endl;
m.display(); cout << “ Derived from B” << endl;
m.display1(); }
getch(); void output( )
} {
2. Multilevel Inheritance: displayA( );
i) The classes can also be derived from the classes displayB( );
that are already derived. displayC( );
ii) This type of inheritance is called multilevel }
inheritance. };
void main( )
{
C c1;
clrscr( );
c1.output( );
getch( );
}
A derived class with multilevel inheritance is 3. Multiple Inheritance:
declared as follows: If a class is derived from more than one base class, it
class A is known as multiple inheritance.
{ 4. Hierarchical Inheritance:
……….. If a number of classes are derived from a single base
}; class, it is called as hierarchical inheritance.
class B : public A 5. Hybrid Inheritance:
{ Hybrid Inheritance is combination of Hierarchical
……….. and Multilevel Inheritance.
}; 6. Explain single inheritance with a suitable C++
class C : public B program.
{ OR
……….. What is single level inheritance? Explain with
}; programming example.
Example: A: If a class is derived from a single base class, it is
#include<iostream.h> called as single inheritance.
#include<conio.h>
class A
{
public:
void display A( )
{ A derived class with single inheritance is declared
cout << “ Base class A”<<endl; as follows:
} class Baseclass
}; {
class B : public A ………..
{ };
42 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
class Derivedclass : public Baseclass A derived class with multilevel inheritance is
{ declared as follows:
……….. class A
}; {
Example: ………..
class student };
{ class B : public A
private: int rno; {
char name[20]; ………..
public: };
void getdata() class C : public B
{ {
cout<<“Enter Roll No and name “<<endl; ………..
cin>> rno >>name; };
} Example:
void display() #include<iostream.h>
{ #include<conio.h>
cout<<“roll no: “<< rno <<endl; class A
cout<<“name : “<<name <<endl; {
} public:
}; void displayA( )
class marks: public student {
{ cout << “ Base class A”<<endl;
private: int m1,m2,total; }
public: };
void getdata1() class B : public A
{ {
cout<<” enter the marks”; public:
cin>>m1>>m2; void displayB( )
total = m1+m2; {
} cout << “ Intermediate Base class B”<<endl;
void display1() cout << “ Derived from A” << endl;
{ }
cout<<"Total marks = "<<total; };
} class C : public B
}; {
void main() public:
{ void displayC( )
marks m; {
clrscr(); cout << “ Derived Class C”<<endl;
m.getadata(); cout << “ Derived from B” << endl;
m.getadata1(); }
m.display(); void output( )
m.display1(); {
getch(); displayA( );
} displayB( );
7. Explain multilevel inheritance with suitable displayC( );
diagram. }
A: i) The classes can also be derived from the classes };
that are already derived. void main( )
ii) This type of inheritance is called multilevel {
inheritance. C c1;
clrscr( );
c1.output( );
getch( );
}
43 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
8. What is virtual base class? Give example. ambiguity problem of which of the two copies is to
OR access will be encountered.
Write a note on Virtual base class. iv) The compiler will generate an error message for
A: i) When two or more objects are derived from a this ambiguity.
common base class, we can prevent multiple copies v) To overcome this problem, the derived class B and
of the base class being present in an object derived C should be declared as virtual.
from those objects by declaring the base class as 9. Explain the requirements of a virtual base class.
virtual when it is being inherited. Such a base class is A: i) Consider a situation where the program design
known as virtual base class. would require one base class (class A) and two
ii) This can be done by preceding the base class name derived classes namely B and C, which are inherited
with the word virtual. from the base class A. Further, derived class D is
Example: created from B and C.
class A
{
————
————
};
class B: virtual public A
{
————
———— ii) In the public inheritance, B and C inherit one copy
}; of the base class data, whereas derived class D
class C: virtual public A inherited from B and C get two copies of the base
{ class data.
———— iii) Now suppose a member function of D now wants
———— to access the data members of the base class an
}; ambiguity problem of which of the two copies is to
class D: public B, public C access will be encountered.
{ iii) The compiler will generate an error message for
———— this ambiguity.
iv) To overcome this problem, the derived class B
————
and C should be declared as virtual.
};
v) When two or more objects are derived from a
common base class, we can prevent multiple copies
i) Consider a situation where the program design
of the base class being present in an object derived
would require one base class (class A) and two
from those objects by declaring the base class as
derived classes namely B and C, which are inherited
virtual when it is being inherited. Such a base class is
from the base class A. Further, derived class D is
known as virtual base class.
created from B and C.
vi) This can be done by preceding the base class
name with the word virtual.
Example:
class A
{
————
————
};
class B: virtual public A
{
————
ii) In the public inheritance, B and C inherit one copy ————
of the base class data, whereas derived class D };
inherited from B and C get two copies of the base class C: virtual public A
class data. {
iii) Now suppose a member function of D now wants ————
to access the data members of the base class an ————
};
44 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
class D: public B, public C In a multilevel inheritance, the constructors will be
{ executed in the order of inheritance.
————  The derived class takes the responsibility of
———— supplying initial values to its base classes.
};  The base constructors are called and executed
before executing the statements in the body of the
10. Define the following: derived constructor.
a. Virtual base class Example:
b. Base class class base
c. Derived class {
d. Abstract class public: base() // base class constructor
e. Visibility mode {
A: a. Virtual base class }
When two or more objects are derived from a };
common base class, we can prevent multiple copies class derived: public base
of the base class being present in an object derived {
from those objects by declaring the base class as public :derived () // derived class constructor
virtual when it is being inherited. Such a base class is {
known as virtual base class. }
b. Base class };
The class whose properties are inherited by another Destructors in derived classes:
class is called base class. It is also called super class. If the constructors are called down the line from the
c. Derived class base to the derived class, the destructors are called
The class that inherits properties from base class is just in the reverse order. That is from the derived
called derived class. It is also called sub class. class up to the base class.
d. Abstract class 12. Write a class program using single Inheritance to
An abstract class is one that is not used to create display student Result.
objects. An abstract class is designed only to act as a OR
base class (to be inherited by other classes). Write a C++ program to create a base class to
e. Visibility mode read and display the roll no and name of a
The visibility mode (private, public and protected) in student. Calculate the total marks by accepting
the definition of the derived class specifies whether marks of 2 subjects in the derived class using the
features of the base class are privately derived or concept of single level inheritance.
publicly derived or protectedly derived. A: If a class is derived from a single base class, it is
11. How does inheritance influence the working of called as single inheritance.
constructors and destructors? #include<iostream.h>
A: Constructors in derived classes: class student
As long as no base class constructor takes any {
arguments, the derived class need not have a private: int rno;
constructor function. char name[20];
If any base class contains a constructor with one public:
or more arguments, then it is mandatory for the void getdata()
derived class to have a constructor and pass the {
arguments to the base class constructors. cout<<“Enter Roll No and name “<<endl;
While applying inheritance we usually create cin>> rno >>name;
objects using the derived class. Thus, it makes sense }
for the derived class to pass arguments to the base void display()
class constructor. {
When both the derived and base classes contain cout<<“roll no: “<< rno <<endl;
constructors, the base constructor is executed first cout<<“name : “<<name <<endl;
and then the constructor in the derived class is
}
executed.
};
In case of multiple inheritances, the base classes
class marks: public student
are constructed in the order in which they appear in
{
the declaration of the derived class.
private: int m1,m2,total;
public:
45 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
void getdata1( ) 11. What is the difference between * and &?
{ A: * returns the value of the variable located at the
cout<<“enter the marks”; address specified by its operand. & returns the
cin>>m1>>m2; memory address of its operand.
total = m1+m2; 12. How to declare pointer?
} A: data-type *variable_name;
void display1() 13. How to initialize pointer?
{ A: int num = 25;
cout<<"Total marks = "<<total; int *p;
} p = &num;
}; The variable num is assigned to pointer variable iptr.
void main() 14. How do we assign an address to a pointer
{ variable?
marks m; A: By using address operator( & ).
clrscr( ); int num = 25;
m.getadata( ); int *iptr;
m.getadata1( ); iptr = &num;
m.display( ); 15. What is static memory?
m.display1( ); A: The amount of memory to be allocated is predicted
getch( ); and pre-known. Memory is allocated during the
} compilation.
16. What is dynamic memory?
Chapter 11. A: The amount of memory to be allocated unknown.
This memory is allocated during run-time as and
POINTERS
when required.
[1m X 1 & 3m X 1 =4Marks ] 17. What is free store / heap memory?
1- Mark Questions A: A pool of unallocated memory given to a program
1. What do you mean by pointer? that is used by the program for dynamic allocation
A: A variable that holds a memory address of another during execution.
variable in memory is called pointer. 18. Write a definition for a variable of type pointer to
2. Mention any one advantage of pointer. float.
A: Memory is utilized properly. A: float *ptr;
3. Why are pointer used? 19. What is new operator in C++?
A: To hold the memory address of another variable in A: We can allocate memory for the variable while the
memory. program is running by using new operator.
4. What is the size of a pointer variable? 20. What is delete operator in C++?
A: On 32-bit computer size of pointer is 32 bits (4 bytes) A: delete operator is used to free dynamic memory .
and on 64 bit computer it's 8 bytes. 21. Under what circumstances we can subtract one
5. float a; p=&a; What is the size of p? pointer from another?
A: 4 bytes A: We can subtract one pointer from another pointer if
6. What does a pointer variable store? both point to the same array.
A: Pointer variable stores a memory address of another 22. What is this pointer?
variable in memory. A: Every object has access to its own address through
7. What is address operator? an important pointer is called this pointer.
A: A unary operator that returns the memory address of 3- Marks Questions:
its operand is called address-of operator (&). 1. What is a pointer? Give the declaration and
8. What is pointer operator / Indirection Operator? initialization of a pointer.
A: A unary operator that returns the value of the A: A variable that holds a memory address of another
variable located at the address specified by its variable in memory is calleds pointer.
operand is called Pointer operator or Indirection Declaration of pointer:
Operator (*) data-type *variable_name;
9. How is address of a variable accessed?
A: Address of a variable can be accessed by using Initialization:
address-of operator (&). int num = 25;
10. What is the other name for pointer operator? int *p;
A: Indirection Operator(*) p = &num;
46 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
2. What are the advantages of pointer? leak?)
A: Advantages of pointer: A: Memory Leak:
 It is possible to write efficient programs  If the objects, that are allocated memory
 Memory is utilized properly dynamically, are not deleted using delete, the
 Dynamically allocate and de-allocate memory memory block remains occupied even at the end
 Easy to deal with hardware components of the program.
 Establishes communication between program  Such memory blocks are known as orphaned
and data memory blocks.
3. What are the operations performed on pointer?(  These orphaned memory blocks when increase in
Give any three arithmetic operators that can be number, bring adverse effect on the system.
used on pointers.)  This situation is called memory leak.
A: Operations performed on pointer: 7. How dynamic memory allocation is different
 We can add an integer value to a pointer. from static memory allocation?
 We can subtract an integer value from a pointer,
 We can compare two pointers, if they point the
elements of the same array
 We can subtract one pointer from another pointer
if both point to the same array.
 We can assign one pointer to another pointer
provided both are of same type.
4. What are the operations that cannot be performed
on pointers?
A: Operations that cannot be performed on pointers
 Addition of two pointers. 8. Show the general form new and delete operator in
 Subtraction of one pointer from another pointer C++.
when they do not point to the same array. A: new operator: new operator is used to allocate the
 Multiplication of two pointers. memory for objects..
 Division of two pointers. General form:
5. What is static memory allocation? Explain. pointer_name = new datatype;
A: Static Memory Allocation: Ex: int *p;
 A memory is allocated during the compilation p= new int;
time is called static memory allocation. delete operator: delete operator is used to de-
 In static memory allocation the amount of allocate the memory for objects.
memory to be allocated is predicted & pre General form: delete pointer_name;
known. Ex : delete p;
 All the variables declared normally, are allocated 9. Explain the use of new operator in C++ with its
memory statically. syntax & example.
Ex: int a; A: Use of new operator:
 This statement allocates 2 bytes of memory space new operator is used to allocate the memory for
during the compilation time. objects during run time. Allocation of memory will
6. What is dynamic memory allocation? Explain. be done from a pool called free store.
A: Dynamic Memory Allocation: General form:
 A memory is allocated during the execution time i) pointer_name = new datatype;
is called Dynamic memory allocation. Here only one element is allocated with required
 In dynamic memory allocation the amount of datatype.
memory to be allocated is unknown. ii) pointer_name = new datatype [number of
 Dynamic allocation and de-allocation of objects elements] ;
is performed using new and delete operators. Here many elements are allocated with required
 The new operator is used to allocate the memory datatype.
for objects. Ex: int *p;
 The delete operator is used to de-allocate the p= new int;
memory for objects. 10. What is array of pointers? Give an example.
A: Pointer array means collection of addresses of same
data type.
Syntax: datatype *arrayname[size];
6. Write a note on memory leak.(What is memory Ex: int *p[5];

47 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


int a=10, b=20, c=30, d=40, e=50; cout<<*(a+i)<<setw(4);
p[0] = &a; *p[0] = 10; getch( );
p[1] = &b; *p[1] = 20; }
p[2] = &c; *p[2] = 30; 14. What is the relationship between string and
p[3] = &d; *p[3] = 40; pointers?
p[4] = &e; *p[4] = 50; A: Relationship between string and pointers
12. Write a C++ program to print the elements of an  String is sequence of characters ends with null
array using pointer. („\0‟) character.
A: #include<iostream.h>  Suppose we have declared an array of 5 elements
#include<conio.h> of the data type character.
void main( ) char s[5];
{ char *cptr;
int i,n,a[10]; cptr = s;
cout<<”enter the size of array”;  Here, s is array of characters (strings). cptr is
cin>>n; character pointer to string. S also represents
cout<”enter the elements”; character pointer to string.
for(i=0;i<n;i++)  The elements of the array can be referred to in the
cin>>*(a+i); program as s[0], s[1],…. , s[5].
cout<<”the elements are:”<<endl;  When the program is compiled, the compiler does
for(i=0;i<n;i++) not save the addresses of all the elements, but only
cout<<*(a+i)<<setw(4); the name of the array.
getch( );  Here, s gives the base address of the array. i.e., the
} address of the first character in the string variable
13. What is the relationship between array and and hence can be regarded as pointer to character.
pointers? Give example.  String always end with null character, it is enough
A: Relationship between array and pointers for us to know the starting address of a string to be
 There is a close relationship between arrays and able to access entire string.
pointers in C++.  The number of bytes allocated for a string is
Consider the declaration. int a[5]; determined by the number of characters within
string.
15. What is the relationship between structures and
pointers? Give example.
 The elements of the array can be referred to in the A: Relationship between structures and pointers
program as a[0], a[1]….a[4].  Pointers to structure variable can be created using
 When the program is compiled, the compiler does pointer.
not save the addresses of all the elements, but only  The pointing() to operator is used to access
the address of the first element, a[0]. structure variables with pointer.
 When the program needs to access any element,  The members of a structure can accessed as:
a[i], it calculates its address by adding i units to ptr member;
the address of a[0]. Example: struct student
 The number of bytes in each “unit” is, in our {
example, equal to the sizeof(int). i.e., 2. In introllno;
general, it is equal to the number of bytes required float fees;
to store an element of the array. };
Ex: #include<iostream.h> student S;
#include<conio.h> student *s = &S;
void main( ) s->rollno = 104; or (*s).rollno = 104;
{ s->fees = 5000.0; or (*s).fees = 5000.0;
int i,n,a[10]; 16. What is the relationship between object and
cout<<”enter the size of array”; pointers? Give example.
cin>>n; A: Relationship between object and pointers
cout<”enter the elements”;  The pointers pointing to objects are referred to as
for(i=0;i<n;i++) object pointers.
cin>>*(a+i); Syntax: class_name *object-pointer;
cout<<”the elements are:”<<endl;  Here, class_name is the name of the class.
for(i=0;i<n;i++) object-pointer is the pointer to an object.

48 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


Example: employee *e; A:
 To access the members of a class using an object  The function is invoked by passing the addresses
pointer, the pointing to or arrow operator of the actual arguments.
()is used instead of dot (.) operator.  These arguments (addresses) are copied into
Ex: egetdata( ); formal arguments (pointers) of the called function.
17. Illustrate the use of self-referential structures  Using these pointers, we can make changes into
with the help of example. the actual arguments of the calling function.
A: The self-referential structures are structures that  Here also, as in pass-by-reference, the called
include an element i.e a pointer to another structure function does not create a copy of the original
of the same type. values. A return statement can return only one
Ex: struct node value to the calling function.
{ Ex: #include<iostream.h>
int data; #include<iomanip.h>
node *link; //Referring the next class exchange
structure of the same type node {
}; public: void swap(int *, int *);
18. Explain with example by passing the reference. };
 When parameters are passed to the functions by void exchange::swap(int *x, int *y)
reference, the formal parameters become {
reference (or aliases) to the actual parameters in int temp = *x;
the calling function. *x = *y;
 Called function does not create a copy of original *y = temp;
values, rather than, it refers to the original values }
by their references. void main()
 Thus the called function works with the original {
data and any change in the values gets reflected exchange E;
to the original data. int a, b;
Ex: cout<<"Enter two numbers: ";
#include<iostream.h> cin>>a>>b;
#include<iomanip.h> cout<<"Before swapping: a = "<<a<<" and b =
class exchange "<<b<<endl;
{ E.swap(&a, &b);
public: void swap(int&, int&); cout<<"After swapping: a = "<<a<<" and b =
}; "<<b;
void exchange::swap(int &x, int &y) }
{ Chapter 12.
int temp = x; DATA FILE HANDLING
x = y;
y = temp; [2m X 1 & 3m X 1 =5Marks]
} 2 Marks Questions
void main( ) 1. Define file and stream.
{ A: File: The information or data stored under a specific
exchange E; name on a storage device, is called a file.
int a, b; Stream: A sequence of bytes is called stream.
cout<<"Enter two numbers: "; 2. What is stream? Name the streams generally used
cin>>a>>b; for file I/O.
cout<<"Before swapping: a = "<<a<<" and b = A: A sequence of bytes is called stream.
"<<b<<endl; There are two streams used for I/O
E.swap(a, b); ifstream: This stream class used to read from
cout<<"After swapping: a = "<<a<<" and b = files & it provides input operations for file.
"<<b; ofstream: This stream class used to write on files
} & it provides output operations for file.
3. What are input and output streams?
A: Input Stream: The stream that supplies data to the
program is known as input stream.
19. Explain with example by passing the pointers. Output Stream: The stream that receives data from

49 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


the program is known as output stream.  tellp()
4. Name the stream classes supported by C++ for file  tellg( )
input and output. 11. Why are get() and put()functions used?
A: The stream classes supported by C++ for file input A: get( ): The get() member function belongs to the class
and output are: ifstream and the function get( ) reads a single
 ifstream class. character from the associated stream.
 ofstream class. put( ): The put() member function belongs to the
5. Write the member functions belonging to ifstream class ofstream and writes a single character to the
class. associated stream.
A: get( ), getline( ),read( ),seekg & tellg( ) 12. Write the purpose of any two functions used for
6. Write the member functions belonging to ofstream file handling.
class. A: read( ): The read() member function belongs to the
A: put( ), write( ),seekp( ) & tellp() class ifstream and which is used to read binary data
7. Which are the character I/O operations used in from a file.
files? Syntax: ifstream_object.read((char *) &variable,
sizeof (variable)) ;
 get() function Ex: fin.read ((char*) &s, sizeof(s));
 put() function write( ): The write() member function belongs to the
8. Differentiate between ifstream class and ofstream class ofstream and which is used to write binary data
class. to a file.
Syntax: ofstream_object.write((char *) &variable,
sizeof (variable));
Ex: fout.write((char*) &s, sizeof(s));
13. Differentiate between read( ) and write( ).
A: read( ): The read() member function belongs to the
class ifstream and which is used to read binary data
from a file.
Syntax: ifstream_object.read ((char *) &variable,
sizeof (variable));
Ex: fin.read((char*) &s, sizeof(s));
9. Mention the methods of opening file within C++ . write( ): The write() member function belongs to the
Discuss any one. class ofstream and which is used to write binary data
A: A file can be opened by using two methods: to a file.
 Opening file using constructor Syntax: ofstream_object.write((char *) &variable,
 Opening file using open( ) member function. sizeof(variable));
Opening file using constructor: Ex: fout.write((char*) &s, sizeof(s));
The syntax of opening a file for input purpose only 14. Differentiate between get( ) and getline( ).
using an object of ifstream class and the constructor A: get( ):
is as follows: i) The get() member function belongs to the class
ifstream ifstream _object(“file_name”); ifstream and the function get( ) reads a single
Ex: ifstream fin(“results.dat”); //input only character from the associated stream.
The syntax of opening a file for output purpose only Syntax: ifstream_object.get(ch);
using an object of ofstream class and the constructor Ex: fin.get(ch);
is as follows: getline( ) function:
ofstream ofstream _object(“file_name”); ii) It is used to read a whole line of text. It belongs to
Ex: ofstreamfout(“results.dat”); //output only. the class ifstream.
Syntax: fin.getline(buffer, SIZE);
10. Write the member functions belonging to fstream
Ex: fin.getline(book, SIZE);
class. 15. Differentiate between seekg( ) and seekp( ).
 get( ) function A: seekg():
 getline( ) function  Move the get pointer to a specified location
 put( ) function from the beginning of afile.
 read( ) member function There are two types:
 write( ) member function seekg(long);
 seekg( )  seekg(offset, seekdir);
 seekp( )

50 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


seekg(long): Moves the get pointer to a specified  Put pointer is manipulate the functions such as
location from the beginning of a file. seekp( ) & tellp( ).
Ex: inf.seekg(20) ; 21. How do we close the file within C++?
seekp( ): Move the put pointer to a specified location A: close( ) function is used to close a file in c++.
from the beginning of a file. This function removes the linkage between the file &
There are two types: the stream object.
 seekp(long); Syntax: streamobject.close( )
 seekp(offset, seekdir); Ex: fin.close( ); fout.close( );
The seekp(long) moves the put pointer to a specified
location from the beginning of a file. 3 Marks Questions
Ex: inf.seekg(20) ; 1. What is significance of fstream.h header file.
16. Differentiate between tellg ( ) and tellp ( ). A: Significance of fstream.h header file.
A: tellg( ):  The fstream base is derived from the basic class
1. The ifstream class provides the member ios.
function name tellg().  ifstream class :The stream that supplies data to
2. The purpose of the function is to return the program is known as input stream. It provides
current position of the get pointer. input operations for file.
Syntax: int position;  It inherits the function get( ), getline( ),read(
position = fin.tellg(); ),seekg & tellg( ).ifstream.h is the header file for
tellp( ): ifstream class
1. The ifstream class provides the member  ofstream class : The stream that receives data
function name tellp( ). from the program is known as output stream. This
2. The purpose of the function is to return stream class used to write on file. it provides
current position of the put pointer. output operations for file.
Syntax: int position;  It inherits the function put( ), write( ),seekp( ) &
position = fin.tellp(); tellp().ofstream.h is the header file for ofstream
17. What are the advantages of saving data in Binary class
form. 2. Name the stream classes supported by C++ for file
A: The advantages of saving data in Binary form: input and output.
In binary files, no delimiters are used for a line. A: If stream:
In binary files, no translations occur here.  Stream class to read from files. It provides input
18. Mention Basic operation on performed on operations for file. It inherits the function get( ),
binary file in C++. getline( ),read( ),seekg & tellg( ).
A: Basic Operation on Binary File: ofstream:
1. Searching.  Stream class to write on files. It provides output
2. Appending data. operations for file. It inherits the function put( ),
3. Inserting data in sorted files. write( ),seekp( ) & tellp()
4. Deleting a record 3. Differentiate between ifstream class and ofstream
5. Modifying data class.
19. Differentiate between ios::in and ios::out.
A: ios::in : This mode open file for reading only.It
belongs to ifstream class.
ios::out:This mode open file for writing only.It
belongs to ofstream class.
20. Explain types of file pointers.
A: get pointer:
 A pointer that points to the element to be read in
next input stream is called get pointer & this
pointer belongs to ifstream class.
 Get pointer is manipulate the function such as 4. Mention the methods of opening file within C++
seekg( ) and tellg(). program. Discuss.
put pointer: A: File can be opened by using two methods:
 A pointer that points to the location where the  Opening file using constructor
next element has to be written is called put  Opening file using open( ) member function.
pointer. & this pointer belongs to ofstream calss. 1. Opening file using constructor:

51 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


 The syntax of opening a file for input purpose only  ofstream, like ostream, has a pointer known as
using an object of ifstream class and the the put pointer that points to the location where
constructor is as follows: the next element has to be written.
ifstream ifstream _object(“file_name”);  Member function of put pointer are: seekp(
Ex: ifstream fin(“results.dat”); //input only )&tellp()
 The syntax of opening a file for output purpose 8. Explain any three file modes.
only using an object of ofstream class and the  ios::in :This mode open file for reading only .It
constructor is as follows: belongs to ifstream class.
ofstream ofstream _object(“file_name”);  ios::out :This mode open file for writing only. It
Ex: ofstreamfout(“results.dat”); //output only belongs to ofstream class.
2. Opening file using open( ):  ios::app: This mode Append to end of file. It
 The syntax for opening a file for input purpose only belongs to ofstream.
using an object of ifstream class and open( )  ios:binary: This mode Opening a binary file. It
member function is as follows: ifstream- belongs to ifstream & ofstream.
object.open(“filename”)
 ios::ate: This mode Open file for updation. It
 Ex: ifile.open(“text.dat”); The syntax for opening a
belongs to ifstream & ofstream.
file for output purpose only using an object of
ofstream class and open( ) member function is as 9. Write the syntax and example of close( ) / eof( ).
follows: A: Close( ) / eof( ):
ofstream-object.open(“filename”)  eof ( ) function is used to detect the end of a file.
 eof() returns true (non zero) if end of file is
 Ex: ofile.open(“text.dat”);
encountered while reading, otherwise return
5. Mention the types of file. Explain any one.
false(zero).
A: The information / data stored under a specific name
if(fin.eof())
on a storage device, is called a file.
{
Types of Files:
statements;
 Text file
}
 Binary File
 This is used to execute set statements on reaching
Text File:
the end of the file represented by the object fin.
 It is a file that stores information in ASCII
while (!fin.eof())
characters.
{
 In text files, each line of text is terminated with a
special character known as EOL (End- of-line) statements;
character or delimiter character. }
 When this EOL character is read or written,
certain internal translations take place.
The advantages of saving data in Text form: Chapter 13.
 It is a file that stores information in ASCII DATABASE CONCEPTS
characters.
[1m X 1,2m X 1, 3m X 1 & 5m X 1 =11Marks ]
 In text files, each line of text is terminated with a
special character known as EOL (End- of- 1 Mark Questions
line)character or delimiter character. 1. What is data?
 When this EOL character is read or written, A: A collection of facts, figures, statistics which can be
certain internal translations take place. processed to produce meaningful information is
7. Explain the different types of file pointer. called data.
A: The file I/O operations are associated with the two file 2. What is information?
pointers, known as get pointer and the put pointer. A: A processed data with definite meaning is called
Different tyopes of File Pointers: information.
get pointer: 3. What is database?
 ifstream, like istream has a pointer known as the A: A collection of logically related data organized in a
get pointer that points to the element to be read in way that data can be easily accessed, managed &
the next input operation. updated is called database.
 Member function of get pointer are: seekg( 4. What is data model?
)&tellg( ) A: An abstract model that describes how data is
put pointer: represented & used is called data model.
5. Expand DBMS.
A: Data Base Management System
52 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
6. What is DBMS? A: A field in a one table that uniquely identifies the
A: Software that allows creation, definition & row of another table is called foreign key.
manipulation of database. 26. What is a candidate key?
7. Give an example for DBMS software. A: Any set of one or more columns whose combined
A: MySql, Oracle, Sybase, MS Access. values are unique among all occurrences is called
8. Write the goal of DBMS. candidate key.
A: The primary goal of DBMS is to provide a way to 27. What is an alternate key?
store & retrieve database information in convenient A: A candidate key which is not currently selected as
& efficient way. the primary key is called alternate key.
9. What is a field? 28. Define Schema.
A: Each column is identified by a distinct header called A: Database objects that contain data govern or
field. perform operation on data is called schema.
10. What is an attribute? 29. What is ER (Entity Relationship)diagram?
A: Each column is identified by a distinct header called A: A visual representation of data that describes how
an attribute. data is related to each other.
11. What is a record? 30. What is join operation?
A: A single entry in a table is called record. A: JOIN is used to combine related tuples from two
12. What is tuple? relations.
A: A single entry in a table is called tuple. 31. Give one symbol notation for project.
13. What is an entity? A: Symbol notation for project is: ð
A: A real world object is called as an entity. 32. What is data ware house?
14. What is an instance? A: A repository of an organization‟s electronically
A: Each row of a table is called as an instance of entity. stored data is called data warehouse.
15. What is domain? 33. Define metadata.
A: Set of values for an attribute in that table is called A: Metadata is used to inform operators & uses of the
domain. data warehouses about its status & information.
16. What is a relation? 34. What is data mining?
A: A table with rows & columns is called relation. A: A technique, which is concerned with the analysis &
17. What is a table? picking out relevant information is called data
A: A collection of data elements organized in terms of mining.
rows & columns is called table. 2 Marks Questions
18. What is relation algebra? 1. How database help us?
A: Relational algebra the formal description of how a
 Data available in the database is a reliable data.
relational database operates.
 Data duplication is reduced in database.
19. What is normalization?  Database becoming the backbone of all the
A: The process of organizing the data in a database is
software.
called normalization.
2. How do we get data?
20. What is aggregation?
A: Procedure to get data:
A: A process when relation between two entities is
 The fact is available in organization or outside
treated as a single entity is called aggregation.
organization or any part of the universe.
21. Define generalization.  The process of converting fact to data will be first
A: A bottom up approach in which two lower level
task for any person in database.
entities combine to form a higher level entity is
 The human intervention is compulsory for
called generalization.
converting from fact to data form.
22. Define specialization.  Data may be in the form of letters, numbers,
A: A top down approach in which one higher level
symbols, images ,sounds etc.
entity can be broken down into two lower level
3. Name the data types supported by DBMS.
entities is called specialization.
A: Data types supported by DBMS:
23. What is a key?  Integer: It contains whole numbers without
A: A set of one or more columns whose combined
fractions.
values are unique among all occurrences in a given
 Characters: It contains letter, number, spaces,
table is called key.
symbols & punctuations.
24. What is a primary key?  Strings: It contains sequence of characters.
A: A key that uniquely identify each record in a table is
 Text fields: It contains data in alpha-numeric text
called primary key.
format.
25. What is foreign key?  Date fields: It contains the data in date format.
53 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
4. Define primary key & foreign key. 10. What is the difference between serial & direct
A: Primary Key: A key that uniquely identify each access file organization?
record in a table is called primary key.
Foreign Key: A field in a one table that uniquely
identifies the row of another table is called foreign
key.
5. What is a candidate key & alternate key?
A: Candidate key: Any set of one or more columns
whose combined values are unique among all
occurrences is called candidate key.
Alternate key: A candidate key which is not currently
selected as the primary key is called alternate key. 11. Give the advantages of index sequential access
6. Define generalization & specialization. method.
A: Generalization A bottom up approach in which two A: Advantages of index sequential access method
lower level entities combine to form a higher level  Provides flexibility for users who need both type
entity is called as generalization. of accesses with the same file
Specialization: A top down approach in which one  Permits efficient and economic use of sequential
higher level entity can be broken down into two processing technique when the activity rate is high.
lower level entities is called as specialization. 12. Give the disadvantages of index sequential access
7. What is generalization? method.
A: Generalization: A: Disadvantages of index sequential access method:
 A bottom up approach in which two lower level  Extra storage space and processing time for the
entities combine to form a higher level entity is indexing is required.
called as generalization.  Hardware and software used are relatively
 In generalization, the higher level entity can also expensive.
combine with other lower level entity to make 13. Classify various types of keys used in database.
further higher level entity. A: Keys used in database:
Ex:  Primary key / super key,
 Secondary key,
 Candidate key
 Foreign key.
14. What is relation algebra?
A: Relational algebra:
 The formal description of how a relational
8. What is specialization? database operates.
A: Specialization:  An interface to the data stored in the database
 A top down approach in which one higher level itself.
entity can be broken down into two lower level  The mathematics which supports SQL operations.
entities is called as specialization. 15. Give an example for relation selection with
 In specialization, some higher level may not have example.
lower level entity sets at all. A: Assume a table,
Ex: student(Reg.no, name, combination, dob, marks)
SELECT * FROM STUDENT;
 It displays all tuples from the student table.
SELECT NAME, COMBINATION, MARKS
FROM STUDENT WHERE MARKS >=35;
16. Explain the projection operation with example.
A: Projection operation:
9. What is aggregration?  The PROJECT operation is used to select a
A: A process when relation between two entity is subset of the attributes of a relation by specifying
treated as a single entity is called aggregration. the names of the required attributes.
 Symbol notation for project is: ð
Ex: PROJECT name, empno (employee)

54 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


17. What is Cartesian product? It provides an infrastructure that could changes
A: Cartesian product: to data.
 An operator which works on two sets is called as It enhances end user access to reports &
Cartesian product. analysis of information.
 The Cartesian product is also called as cross 22. What are the disadvantages of data warehouse?
product or cross join. A: Disadvantages of data warehouse:
 It combines the tuples of one relation with all the Extracting, cleaning & loading data could be
tuples of the other relation. time consuming.
Ex: Requires training for end users.
Security could develop into a serious issue.
Data warehouses can get outdated quickly.

3 Marks Questions
1. Mention the applications of database.
A: Applications of database. :
1) Banking: Used to store customer information,
accounts, loans & banking transactions.
2) Colleges: Used to store student information,
course registration & grades. Water meter billing:
Used to store the RR number & all details. It is
18. What is join operation? connected to the server based works.
A: Join operation: 3) Rail & airlines: Used to store reservations &
 JOIN is used to combine related tuples from two schedule information.
relations. 4) Finance: Used to store information about holdings
 In its simplest form the JOIN operator is just the & sales.
cross product of two relations. 5) Sales: Used to store customer, product & purchase
 As the JOIN becomes more complex then tuples information.
are removed within the cross product to make the 6) Human resources: Used to store information
result of the JOIN more meaningful. about employees, salary, payroll taxes & generation
 JOIN allows to evaluate a join condition between of pay checks.
the attributes of the relations on which the join is 7) Manufacturing: Used to store information of
undertaken supply chain & tracking production of items in
 The notation of JOIN is: R JOIN join condition S factories, inventories of items.
19. What is data warehouse? 8) Credit & transactions: Used to store information
A: Data warehouse: of purchases on credit cards & generating monthly
 A repository of an organization‟s electronically statements.
stored data is called data warehouse. 9) Telecommunication: Used to store records of
 Data ware house are designed to facilitate calls made, generating monthly bills & information
reporting & supporting data analysis. about the communication networks.
Fundamental stages of data ware house: 2. Explain any three advantages of database
Offline operational database management system.
Offline data warehouse A: Advantages of database management system:
Real time data warehouse a) Controlled data redundancy: During data base
20. List the components of data warehouse. design various files are integrated & each logical data
Components of data warehouse item is stored at central location. This reduces the
Data sources data replication or duplication of data item in
Data transformation different files & saves the storage space.
Reporting b) Enforcing data integrity: In database approach
Metadata enforcing data integrity is much easier. Data integrity
Operations. refers to the validity of data & it can be compromised
21. What are the advantages of data warehouse? in a number of ways. Data integrity can be enforced
A: Advantages of data warehouse: automatically by the DBMS.
It increases data consistency. c) Data sharing: The data stored in the database can
It increases productivity & decreases computing be shared by multiple users or application programs.
costs. Due to shared data it is possible to satisfy the data
Able to combine data from different sources.
55 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
requirements of the new applications without having
to create any additional data.
3. Give the difference between manual & electronic
file systems. Attributes:
Attributes which specifies properties or
characteristics of entities. The eclipse symbol is used
to represent the attribute in the ER diagram.

Relationship:
Relationship describes relations between entities.
4. Explain Boyce and Codd normal form (BCNF). Relationship is represented using diamonds.
A: Boyce and Codd normal form:
 BCNF is a higher version of the third normal
form (3NF).A 3NF table which does not have
multiple overlapping candidate keys is said to be
in BCNF.
 When a relation has more than one candidate key
then anomalies may result even though the
relation is in 3NF.
 3NF does not deal with the case of a relation with 6. Give the different notations for E-R diagram.
overlapping candidate keys.
 BCNF is based on the concept of a determinant.
 A determinant is any attribute on which some
other attribute is fully functionally dependent.
 A relation is in BCNF then every determinant is a
candidate key.
o Ex:
 R(a,b,c,d)
 A,cb,d
 A,db
 Here the first determinant suggests that the
primary key of R could be changed from a,b to
a,c.
5. Explain any three components of E-R diagram.
Entity
A: Entity:
Entity is a real world object or concept about which
data is stored. The symbol use to represent the entity
in the ER diagram is rectangle.

7. What is a relationship? Classify & give example.


A: A Relationship describes relations between entities.
Relationship is represented using diamonds.

Weak Entity:
Weak entity is an entity that depends on another
entity. Weak entity doesn’t have key attribute of their There are three types of relationship that exist
own. Double rectangle represents weak entity. between Entities.

56 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


Binary Relationship 0. .. 1 zero or one (optional )
Recursive Relationship (1,n) one or more (mandatory)
Ternary Relationship (0,n) zero or more (optional)
Binary Relationship (1,1)one and only one (mandatory)
 Binary Relationship means relation between two 1. Explain physical data independence.
A:
Entities.
1. An ability of a database to modify a schema
 This is further divided into three types.
definition at internal (physical) level without
One to One :
affecting a schema in the next level is called
 This type of relationship is rarely seen in real physical data independence.
world. 2. There are three file organizations used in physical
data independence such as sequential, direct &
indexed sequential access method.
3. All schemas are stored in bit format on the disk
namely hard disk, floppies etc.
 The above example describes that one student can 10. Explain ISAM with example.
enroll only for one course and a course will also A: ISAM:
have only one Student. 1. ISAM: Indexed sequential access method.
One to Many : 2. ISAM is the hybrid between sequential & direct
 It reflects business rule that one entity is access file organization.
associated with many number of same entity. 3. The records within the file are stored sequentially
 The example for this relation might sound a little but direct access to individual records by using
weird, but this means that one student can enroll index. Indexing permits access to selected
to many courses, but one course will have one records without searching the entire file.
Student. Advantages
ISAM permits efficient & economical use of
sequential processing techniques when the activity
ratio is high.
It permits direct access processing when the
activity ratio is low.
 The above diagram represents that many students Disadvantages
can enroll for more than one courses. Relatively expensive hardware & software
8. Explain Chen style & Martin style of relation. resources are required.
A: Chen style Access to records may be slower than direct
access method.
Less efficient in the use of storage space.
11. Explain various database users.
A: Different types of Database users
a) Application programmers & system analysts:
1. System analysts determine the requirements of
end users & parametric end users.
2. Application programmers implement these
parameters in programs.
1: N(n=0,1,2,3…) b) End users: People who require access to the
One to zero or more database for querying updating & generating reports.
M:N (m and n=0,1,2,3,4..) c) Database administrator (DBA):
Zero or more to zero or more 1. DBA is responsible for authorization access to the
(many to Many) database for coordinating & monitoring its use.
2. DBA is also responsible for acquiring the needed
1:1 software & hardware resources.
One to One d) Database designers:
Martin Style Database designers are responsible for identifying the
1-one, and only one(mandatory) data to be stored in the database for choosing
*- many (zero or more-optional) structures to represent & store the data.
1…* one or more( mandatory)

57 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


12. Explain hierarchical data model. Any changes done here will directly be done on
A: Hierarchical Data model: DBMS itself.
 The hierarchical data model is the oldest type of  It does not provide handy tools for end users &
data model. This model is developed by IBM. preferably database designer & programmers
 The hierarchical data model organizes the data in use single tier architecture.
a tree like structure in which each child node can
have only one parent node.
 The top of the tree structure contains a single
node that does not have any parent node is called
root node.

15. Briefly explain two-tier architecture.


A: Two-tier Architecture:
 Two-tier architecture is used for user interface
program & application programs that runs on
client side.
13. Explain relational data model.  An interface called ODBC provides an API that
A: Relational Data Model: allows client side program to call the DBMS.
 The relational data model was developed by EF  In this architecture some variation of client is
Codd in 1970. also possible.
 In the relational data model, there are no physical
links. All data is maintained in the form of tables
contains rows & columns.
 Each row represents an entity & a column
represents an attribute of the entity.
 The relationship between the two tables is
implemented through a common attribute in the 16. Explain outer join with example.
tables. This makes the querying much easier in a A: Outer Join:
relational database system.  An outer join retains the information that would
 Thus relational model has become more have been lost from the tables, replacing missing
programmer friendly & much more dominant & data with nulls.
popular in both industrial & academic scenarios.  There are three forms of the outer join, depending
 Oracle,Sybase,DB2 are few of the relational on which data is to be kept.
DBMS software. LEFT OUTER JOIN - keep data from the left-
 In this model, data is organized in two- hand table
dimensional tables called relations. The tables or RIGHT OUTER JOIN - keep data from the
relation are related to each other. right-hand table
FULL OUTER JOIN - keep data from both
tables

14. Briefly explain one-tier architecture.


A: One-tier Architecture:
 In 1-tier architecture, DBMS is the only entity
where user directly sits on DBMS & uses it.

58 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


17. List the components of data warehouse. keyboard, mouse, scanners, microphone, digital
A: Components of Data Warehouse: camera.
 Data sources: Data sources refer to any  In general data must be converted to computer
electronic repository of information that contains readable form such as binary language.
data of interest for management use or analytics.
Processing:
 Data transformation: The data transformation  The processing is series of actions or operations
layer receives data from the data sources & loads from input data to generate outputs. Some of the
it into the data repository. operations are based on condition, calculation,
 Reporting: The data in the data warehouse must sorting, indexing & accessing data.
be available to the organisation’s staff by  The operations are processed by CPU.
reporting application tool. Storage:
 Metadata: Metadata is used to inform operators  The used data & information are stored in
& uses of the data warehouses about its status & storage medium. There are two types of storage
information. such as primary and secondary storage.
 Operations: Data warehouses operations  The primary storage is the circuitry that
comprises of the processes of loading, temporarily stores the data. The secondary
manipulating & extracting data from the data storage is permanently stores the data.
warehouse. Output:
23. Compare relational algebra & SQL  The result obtained after processing must be
presented to the user in human readable form.
 The results may be in the form of softcopy or in
hard copy.
Communication:
 The data may be transferred & processed in a
remote area by using wire or wireless
communication.
 The processed data is stored in several different
places & then transmitted by modem.
2. Explain normalization with classifications &
5 Marks Questions example.
1. Explain data processing cycle. A: Normalization is a process of organizing the data in
A: Data Processing Cycle: database.
The way information is processed in a computers Normalization is divided into 4 types:
information management system is called data  First normal form(1NF)
processing cycle.  Second normal form(2NF)
 Third normal form(3NF)
Data  BCNF(Boyce and Codd Normal Form)
Information
First normal form(1NF):
 A row of data cannot contain repeating group of
data or each column must have a unique value.
Data Data  Each row of data must have a unique identifier
Output Input called as primary key.
 Some rules of first normal forms are
a) Each column value must be a single value only.
Data b) All values for a given column must be of the
Processing same type
c) Each column name must be unique.
d) No two rows in a table can be identical
Communication
Example :

Data processing cycle contains five specific steps:


Input:
 This is any kind of data such as letters, numbers,
symbols, shapes, images etc. Input data is
entered into a computer using input devices like

59 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


BCNF(Boyce and Codd Normal Form):
 Above table has more than one value within a  BCNF is a higher version of the third normal
column. To bring it into the first normal form we form(3NF).A 3NF table which does not have
can split the values. multiple overlapping candidate keys is said to be
in BCNF.
 When a relation has more than one candidate key
then anomalies may result even though the
relation is in 3NF.
 3NF does not deal with the case of a relation with
overlapping candidate keys.
 BCNF is based on the concept of a determinant.
 A determinant is any attribute on which some
Second Normal Form(2NF): other attribute is fully functionally dependent.
 A table is in second normal form(2NF) if it is in  A relation is in BCNF then every determinant is a
the first normal form and all of its non-key candidate key.
column Are functionally dependent on all of the Ex:
key or the whole key and not part of the key. R(a,b,c,d)
 A table is in second normal form if it is free from A,cb,d
partial-key dependences A,db
 Table that have a single column for a key are  Here the first determinant suggests that the
automatically in 2NF. In below table the primary primary key of R could be changed from a,b to
key column are Ecode and Pcode columns. But a,c.
department column does not functionally depend 3. Explain cardinality with example.
on the Pcode The above table can be split into A: Cardinality:
the following two relations  Cardinality specifies how many instances of an
entity relate to one instance of another entity.
 Ordinality is also closely linked to cardinality.
 Cardinality specifies the occurrences of a
relationship but ordinality describes the
relationship as either mandatory or optional.
 Cardinality specifies the maximum number of
relationships & ordinality specifies the absolute
minimum number of relationships.
 When the minimum number is zero then
relationship is usually called optional & when the
minimum number is one or more then
relationship is usually called mandatory.
connectivity

Third normal form(3NF):


 Third normal form applies that every non-prime
attribute of table must be dependent on primary
key.
 The transitive functional dependency should be 4. Explain data independence in detail.
removed from a the table. A: Data Independence:
Transitive Dependency :  An ability of a database to modify a schema
 Three attributes with the above dependencies. definition at one level without affecting a schema
 To arrive into third normal form, eliminate fields in the next higher level is called data
that do not depend on the key. independence.
 Any time the content of a group of fields may  There are two types in Data independence
apply to more than a single record in the table, Logical Data independence
consider placing those fields in a separate table. Physical Data independence

60 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


Self-direct addressing
 In self-direct addressing ,a record key is used as
its relative address.
 Therefore anyone can compute the record’s
address from the record key & the physical
address of the first record in the file.
Advantage of self-addressing:
No need to store an index.
Disadvantages:
 All schemas are logical & actual data is stored in The records must be of fixed length .If some records
bit format on the disk such as hard disk, floppy are deleted the space remains empty.
disks, tapes etc. Random access method
 The three commonly used file organizations used  Records are stored on a disk by using hashing
in data processing applications are sequential, algorithm.
direct and indexed sequential method.  The key field is fed through hashing algorithm &
 An ability of a database to modify a schema relative address is created.
definition at conceptual (logical) level without  This address gives the position on the disk where
affecting a schema in the next level is called the record is stored.
Logical Data independence.  The desired records are directly accessed by
 An ability of a database to modify a schema using randomized procedure or hashing.
definition at internal (physical) level without  Randomizing procedure provide for converting
affecting a schema in the next level is called the record key number to a physical location
physical Data independence. represented by a disk address through a
5. Discuss file organization with respect to physical computational procedure.
data independence. Advantages
A: Serial file organization The access & retrieval of a record is quick &
 In Serial file organization records are arranged direct.
one after another in no particular order. Transactions need not be stored & placed in
 Records are arranged in chronological order. sequence prior for processing.
 Serial file organization is commonly found in the Best used for online transaction.
transaction data. Disadvantages
 Where records are created in a file in the order in
which transaction takes place. accessing each records due to hashing algorithm.
Advantages:
Fast access to next records in sequence. than sequential file organization.
Records are stored in economical storage media. Indexed sequential access method(ISAM)
Easy to do the backup facility.  ISAM is the hybrid between sequential & direct
Disadvantages access file organization.
le organization updating is slow.  The records within the file are stored sequentially
Sequential file organization: but direct access to individual records by using
 Records are stored one after another in an index.
ascending or descending order determined by the  Indexing permits access to selected records
key field of the records. without searching the entire file.
 Sequentially organized files are processed by Advantages
computer system & stored on storage media such o ISAM permits efficient & economical use of
as magnetic tape, punched cards etc. sequential processing techniques when the
Random or Direct access file organization activity ratio is high.
 Direct access file organization allow immediate o It permits direct access processing when the
direct access to individual records on the file. activity ratio is low.
 The record are stored & retrieved using a relative Disadvantages
record number which gives the position of the Relatively expensive hardware & software
record in the file. resources are required.
 This type of organization also allow the file to Access to records may be slower than direct
accessed sequentially. access method.
 The primary memory of CPU provides the direct Less efficient in the use of storage space.
access.

61 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


6. Explain the advantages of database system. hides the certain details of how data are stored &
OR maintained.
Explain the features of database system.  There are three levels in database system
A: Features / Advantages of database system:
a) Controlled data redundancy:
 During data base design various files are
integrated & each logical data item is stored at
central location.
 This reduces the data replication or duplication of
data item in different files & saves the storage
space.
b) Enforcing data integrity:
 In database approach enforcing data integrity is
much easier.
 Data integrity refers to the validity of data & it
can be compromised in a number of ways ,data
integrity can be enforced automatically by the 1) Internal level:
DBMS.  Internal level is the lowest level of data
c) Data sharing: abstraction that deals with the physical
 The data stored in the database can be shared by representation of database on the computer.
multiple users or application programs.  Hence this level is also called as physical level.
 Due to shared data it is possible to satisfy the  This level describes how the data is physically
data requirements of the new applications stored & organized on the storage medium.
without having to create any additional data.  At this level various aspects are considered to
d) Ease of application development: achieve optimal runtime performance and storage
 The application programmer needs to develop the space utilization.
application programs according to the user’s 2) Conceptual level:
needs.  This level deals with the logical structure of the
 The other issues such as access, security etc are entire database.
handled by the RDBMS itself.  Hence this level is also called as logical level.
e) Data security:  This level describes the what data is stored in the
 Since data is stored centrally, enforcing security database & relationship among these data.
constrains is much easier.  The conceptual view is the overall view of the
 The RDBMS ensures that the only means of database & it contains all
access to the database is through an authorized the information that is going to represented in the
channel only. database.
 Hence data security checks can be carried out 3) External level:
whenever access is attempted to sensitive data.  This level is the highest level of the data
f) Multiple user interface: abstraction that deals with the user’s view of the
 DBMS provides different types of interfaces such database.
as query languages, application program  Hence this level is also called as view level.
interfaces &graphical user interfaces(GUI).  The external level describes the part of the
g) Backup & recovery: database for a particular group of users.
 RDBMS provides backup & recovery subsystem  It permits the users to access the data according
that is responsible for recovery from hardware & to user’s needs.
software failures.  This level provides a powerful & flexible security
7. Explain DBMS architecture. mechanism by hiding the parts of the database.
OR 8. Explain entity relationship in detail.
Explain data abstraction concept. OR
A: DBMS Architecture / Data Abstraction: What is a relationship? Classify & give example.
 The process of representing essential features A: A Relationship describes relations between entities.
without including background details or Relationship is represented using diamonds.
explanations called data abstraction.
 A main purpose of database system is to provide
the abstract view of data to the users but it is

62 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


There are three types of relationship that exist Hierarchical Model
between Entities.  The hierarchical data model is the oldest type of
Binary Relationship data model. This model is developed by IBM.
Recursive Relationship  The hierarchical data model organizes the data
Ternary Relationship in a tree like structure in which each child node
Binary Relationship can have only one parent node.
Binary Relationship means relation between two  The top of the tree structure contains a single
Entities. This is further divided into three types. node that does not have any parent node is
One to One : called root node.
 This type of relationship is rarely seen in real
world.

 The above example describes that one student


can enroll only for one course and a course will
also have only one Student.
One to Many :
 It reflects business rule that one entity is Network Model
associated with many number of same entity.  The network data model is that a parent node
 The example for this relation might sound a little can have many child nodes & a child node also
weird, but this means that one student can enroll have many parent nodes.
to many courses, but one course will have one  The network data model permits many to many
Student. relationships in data.
 In the network model, entities are organized in a
graph, in which some entities can be accessed
through several path.

Many to Many :

 The above diagram represents that many students


can enroll for more than one course.
Recursive relationship Relational Model
When an entity is related with itself is called as  The relational data model was developed by EF
recursive relationship. Codd in 1970..
 In the relational data model, there are no physical
links.
 All data is maintained in the form of tables
contains rows & columns.
 Each row represents an entity & a column
represents an attribute of the entity.
9. Explain database model.  The relationship between the two tables is
A: Database Model: implemented through a common attribute in the
 A database model is an abstract model that tables. This makes the querying much easier in a
describes how the data is represented & used. relational database system.
 A Database model defines the logical design of  Thus relational model has become more
data. The model describes the relationships programmer friendly & much more dominant &
between different parts of the data. popular in both industrial & academic scenarios.
 Database model is classified into three types:  Oracle,Sybase,DB2 are few of the relational
Hierarchical Model DBMS software.
Network Model
Relational Model

63 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


 If say, some file supporting table were renamed
or moved from one disk to another, it should not
affect the application.
Rule 9 : Logical Data Independence
 If there is change in the logical structure(table
structures) of the database the user view of data
should not change.
 Say, if a table is split into two tables, a new view
10. Explain Codd’s rules for database should give result as the join of the two tables.
management.(Write any 6 rules) This rule is most difficult to satisfy.
A: Codd’s rules: Rule 10 : Integrity Independence
Rule zero :  The database should be able to enforce its own
 This rule states that for a system to qualify as an integrity rather than using other programs.
RDBMS, it must be able to manage database  Key and Check constraints, trigger etc should be
entirely through the relational capabilities. stored in Data Dictionary. This also make
Rule 1 : Information rule RDBMS independent of front-end.
 All information(including metadata) is to be Rule 11 : Distribution Independence
represented as stored data in cells of tables.  A database should work properly regardless of its
 The rows and columns have to be strictly distribution across a network.
unordered.  This lays foundation of distributed database.
Rule 2 : Guaranted Access Rule 12 : Non subversion rule
 Each unique piece of data(atomic value) should  If low level access is allowed to a system it
be accesible by : should not be able to subvert or bypass integrity
Table Name + primary key(Row) + rule to change data.
Attribute(column).  This can be achieved by some sort of looking or
Rule 3 : Systematic treatment of NULL encryption.
 Null has several meanings, it can mean missing 11. What is data warehouse? Explain its components.
data, not applicable or no value. A: A repository of an organization’s electronically stored
 It should be handled consistently. data is called data warehouse.
 Primary key must not be null. Components of Data Warehouse:
 Expression on NULL must give null. Data sources: Data sources refer to any electronic
Rule 4 : Active Online Catalog repository of information that contains data of
 Database dictionary(catalog) must have interest for management use or analystics.
description of Database. Data transformation: The data transformation
 Catalog to be governed by same rule as rest of layer receives data from the data sources & loads it
the database. into the data repository.
 The same query language to be used on catalog Reporting: The data in the data warehouse must
as on application database. be available to the organization’s staff by reporting
Rule 5 : Powerful language application tool.
 One well defined language must be there to Metadata: Metadata is used to inform operators &
provide all manners of access to data. uses of the data warehouses about its status &
 Example: SQL. If a file supporting table can be information.
accessed by any manner except SQL interface, Operations: Data warehouses operations
then its a violation to this rule. comprises of the processes of loading, manipulating
Rule 6 : View Updation rule & extracting data from the data warehouse.
 All view that are theoretically updatable should 12. Explain the advantages & disadvantages of data
be updatable by the system. warehouse.
Rule 7 : Relational Level Operation A: Advantages of Data Warehouse:
 There must be Insert, Delete, Update operations It increases data consistency.
at each level of relations. Set operation like It increases productivity & decreases computing
Union, Intersection and minus should also be costs.
supported. Able to combine data from different sources.
Rule 8 : Physical Data Independence It provides an infrastructure that could changes
 The physical storage of data should not matter to to data.
the system. It enhances end user access to reports & analysis
of information.

64 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


Disadvantages Data Warehouse:
o Extracting, cleaning & loading data could be time
consuming.
o Requires training for end users.
o Security could develop into a serious issue.
o Data warehouses can get outdated quickly.
13. What is data mining? Explain the phase of data
mining.
A: Data mining: A technique, which is concerned with 5. Explain DML commands.
the analysis & picking out relevant information is
called data mining.
Phases:
a) Selection: Selecting or segmenting the data
according to some criteria.
b) Pre-processing: This is the data cleaning stage
where certain information is removed which deemed
unnecessary.
c) Transformation: The data is not merely 6. Explain DCL commands.
transferred but transformed.
d) Interpretation & evaluation: The patterns
identified by the system are interpreted into
knowledge which can be used to support human
decision.
Chapter 14. 7. Write the functions of DDL.
SQL DDL defines the conceptual schema providing a
(STRUCTURED QUERY LANGUAGE) link between the logical and physical structures of
the database.
[2m X 1 & 5m X 1 = 7Marks] DDL describes the schema & subschema.
2 Marks Questions 8. Write the functions of DML.
1. Write any two features of SQL DML provides the data manipulation techniques
A: a) It allows users to access data in relational database like selection, insertion, deletion etc.
management systems DML facilitates the use of relationship between
b) It allows users to describe the data the records.
1. Classify Numeric and Character string data types 9. Write the syntax & example for CREATE
in SQL. command.
Numeric datatype classified into two types (i) Int, A: Create command is used to create a new table.
(ii)Numeric Syntax:
String datatype also classified into two types (i) CREATE TABLE table_name (column1 datatype,
Char,(ii) Varchar column2 datatype……. columnN datatype,
2. Give the difference between char and varchar PRIMARY KEY(one or more columns));
datatypes. Ex: CREATE TABLE student(sno number(4),
A: char: char is a fixed length non-Unicode characters, name varchar2(20),
so any remaining space in the field is padded with sub varchar2(5),
blanks. fees number(5),
varchar: varchar is a variable length non-Unicode PRIMARY KEY(sno));
data, so it holds only the characters you assign to it. 10. What is create view command?
3. Write the classification of SQL commands. A: Create View command
Data Definition Language(DDL)  Database views are created using the CREATE
Data Manipulation Language(DML) VIEW statement.
Data Control Language(DCL)  Views can be created from a single table,
Transaction Control Language(TCL) multiple tables, or another view.
4. Explain DDL commands with example. Syntax is:
A: DDL defines the conceptual schema providing a link CREATE VIEW view_name as
between the logical and physical structures of the SELECT column1, column2…
database. FROM table_name WHERE [condition];
65 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
11. Write the syntax & example for ALTER 18. Write the syntax & example for SELECT
command. command.
A: Alter command is used to modify an existing A: Select command is used to fetch the data from a
database object, such as a table. database table.
Syntax: ALTER table Table tablename Syntax: SELECT column1, column2 …. columnN
(columnname datatype (size); FROM table_name;
Ex: ALTER table student modify name Ex: SELECT sno, name, fees FROM student
varchar2(25); WHERE fees>20000;
12. Write the syntax & example for DROP command. If we want to fetch all the fields from a database then
A: Drop command is used to deletes an entire table, a Syntax: SELECT * FROM table_name;
view of a table or other object in the database. Ex: SELECT *FROM student;
Syntax: DROP TABLE table_name; 19. How do you modify the column name and width
Ex: DROP TABLE student; for existing table?
13. Write the syntax & example for INSERT A: ALTER command used to modify existing table.
command. Syntax: ALTER TABLE table name MODIFY
A: Insert command is used to add new rows of data to a column Name <new datatype>
table in the database. Ex: ALTER TABLE customer MODIFY fees
Syntax: float(5);
INSERT into table_name (column1, column2 20. Write the syntax for DISTINCT command In
….columnN) VALUES (value1, value2…valueN) ; SQL.
Ex: INSERT into student value(sno, name, sub, fees) A: SELECT DISTINCT column1, column2, …..
VALUES (123,’amar’,’PCMC’,25000); columnN FROM table_name WHERE [condition];
14. Write the syntax & example for DELETE 21. Write the syntax for COMMIT command In
command. SQL.
A: DELETE command is used to delete the existing A: COMMIT command is the transactional command
records from a table. used to save changes invoked by a transaction to the
Syntax: DELETE FROM table_name WHERE database.
condition; Syntax: COMMIT;
Ex: DELETE FROM student WHERE 22. Give the difference between DROP and DELETE
SID=5; commands
15. Write the syntax & example for UPDATE A: Drop command is used to deletes an entire table, a
command. view of a table or other object in the database.
A: UPDATE command is used to modify the existing DELETE command is used to delete the existing
records in a table. records from a table.
Syntax: UPDATE table_name SET column1 = 23. Give the difference between ALTER and
value1, column2 = value2 ….. columnN = valueN UPDATE commands.
WHERE condition; A: Alter command is used to modify an existing database
Ex: UPDATE student SET fees=25000 WHERE object, such as a table.
SID=5; UPDATE command is used to modify the existing
16. Write the syntax & example for GRANT records in a table.
command. 24. What are ORDER BY and GROUP BY clauses in
A: Grant command Gives the privilege to user. SQL?
Syntax: GRANT privilege_name ON object_name A: ORDER BY: This clause is used to sort the data in
TO {user_name|PUBLIC|role_name} ascending or descending order, based on one or more
[WITH GRANT OPTION]; columns.
Ex: GRANT SELECT ON employee TO user1; GROUP BY: This clause is used in collaboration
17. Write the syntax & example for REVOKE with the SELECT statement to arrange identical data
command. into groups.
A: Revoke command Takes back privileges from user. 25. What is the use of NULL value?
Syntax: REVOKE privilege_name ON object_name  The SQL NULL is used to represent a missing
FROM {user_name|PUBLIC|role_name} value.
[WITH GRANT OPTION];  A field with a NULL value has no value.
Ex: REVOKE SELECT ON employee FROM user1;  It is different than zero value or a field that
contains spaces

66 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


26. What is dual table? Group functions: these functions group the rows of
 This is a single row and single column dummy data based on the values returned by the query.
table provided by Oracle. Built-in function associated with Group functions in
 This is used to perform mathematical calculations SQL are : COUNT, MAX, MIN, AVG, SUM,
without using a table. DISTINCT.
Ex: Select * from DUAL 34. Write any two single-row built-in functions in
OUTPUT: SQL.(Any two)
DUMMY X A:
27. List the components of SQL architecture  Numeric Functions: ABS(x), CEIL(x),
A: (a) Query dispatcher FLOOR(X) etc.
(b) Optimization engines  Character or TEXT functions: LOWER(string),
(c) Classic Query engine UPPER(string), LENGTH(string) , etc
(d) SQL query engine  Date Functions :DAY(),NOW(), WEEK(),
28. Classify various SQL operators. YEAR(), etc
A: Arithmetic Operators  Conversion Functions: To_CHAR(),
Comparison Operators TO_DATE(), NVL(x,y), etc.
Logical Operators 35. Write any two group built-in functions in SQL.
Operators used to negate conditions A: COUNT, MAX, MIN, AVG, SUM, DISTINCT
29. Which are the logical operators in SQL? 36. What is the use of Join command?
A: ALL, AND, ANY, BETWEEN, EXISTS, IN, LIKE, A:
NOT, OR, IS NULL, UNIQUE  Join command is used to combine records from
30. Explain with an example Boolean expression in two or more tables in a database. Join command
SQL. is used to get data from two or more tables based
A: on a join condition.
 SQL Boolean Expression get the data on the  JOIN command is performed in the WHERE
basis of matching single value. clause.
Syntax: SELECT column1, column2….column n  Several operators can be used to join tables , such
FROM table_name WHERE SINGLE VALUE as =, <, >,<>, <=, >=, !=, BETWEEN, and NOT.
MATCHING EXPRESSION; 37. What are privileges and rules?
Example: SELECT * FROM employee WHERE A: Privileges define the access rights provided to a user
age= 45; on a database object. There are two types privileges
31. Explain AND operator using where in SQL .  System privileges: this allows the user to
A: The AND operator allows the existence of multiple CREATE, ALTER, or DROP database Objects.
conditions in an SQL statements WHERE clause.  Object Privileges: This allows the user to
Syntax: EXECUTE, SELECT, INSERT, UPDATE, Or
SELECT column1, column2, column FROM DELETE data from database objects to which the
table_name WHERE [condition1] AND privileges apply.
[condition2]… AND[condition]; RULES: Rules are a set of privileges grouped
Ex: Select id, name, salary from Employees where together.
salary>35000 AND age<45; 5 Marks Questions
32 . List the built- in function associated with Group 1. Explain the features of SQL
functions in SQL A: Features of SQL:
A: COUNT, MAX, MIN, AVG, SUM, DISTINCT  It allows users to access data in relational
33. Classify various built-in functions in SQL. database management systems
A: There are two types of functions on SQL  It allows users to describe the data
Single Row Functions : This functions return a  It allows users to define the data in database and
value for every row that is processed in a query. manipulating that data
Numeric Functions:  It allows embedding within other languages
ABS(x), CEIL(x), FLOOR(X) etc. using SQL modules, libraries and pre-compilers
Character or TEXT functions: LOWER(string),  It allows users to create and drop databases and
UPPER(string), LENGTH(string) , etc tables
Date Functions :DAY(),NOW(), WEEK(),  It allows users to create views and functions in a
YEAR(), etc database
Conversion Functions: To CHAR(),  It allows users to set permission on tables,
TO_DATE(), NVL(x, y), etc. procedures and views
 It allows users to set permission on tables,
67 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
procedures and views. Syntax:
2. Explain SQL constraints with example [CONSTRAINT constraint_name] UNIQUE
A: SQL Constraints: EX:
 Constraints are the rules enforced on data columns CREATE TABLE employee(id number(5)
on table. CONSTRAINT nm_nn UNIQUE, name
 These are used to limit the type of data that char(20), dept char(10), age number(2) );
can go into a table. Check Constraint:
 The constraints available in SQL are primary Key,  This constraint defines a business rule on a
foreign Key, Not Null, Unique, column. All the rows must satisfy this rule.
 Check The constraints can be defined in two Syntax:
ways: [CONSTRAINT constraint_name] CHECK
a) The constraints can be specified immediately (condition)
after the column definition. This is called Ex:
column level definition. CREATE TABLE employee(id number(5),
b) The constraints can be specified after all the name char(20), dept char(10), age number(2)
columns are defined. This is called table-level check age<100
definition. );
SQL Primary key: 3. Explain the data types used in SQL.
 This constraint defines a column or combination A: Numeric data type:
of columns which uniquely identifies each row in  Numeric data type classified into two types
a table. (i) Int (ii)Number
Syntax: Int:
[CONSTRAINT constraint_name] PRIMARY  This data type is used to store integers in a
KEY column.
Ex: CREATE TABLE employee ( id number(5) Number:
PRIMARY KEY, name char(20), age number(2)  This data type is used to store numerical data in a
); column.
Foreign key or Referential Integrity:  It may be integer, decimal or float value.
 It establishes a relationship between two columns General syntax:
in the same table or between different tables. NUMBER(n,d)
 For a column to be defined as a Foreign key it  Where n represents the number of digits & d
should be defined as a Primary key in the table specifies the number of digits after the decimal
which it is referring. point.
Syntax: Character & string data type:
[CONSTRAINT constraint_name] REFERENCES Character & string data type classified into two types.
Referenced_Table_name(column_name) Char
Ex: CREATE TABLE product Varchar or varchar2
(product_id number(5) CONSTRAINT pd_id_pk Char:
PRIMARY KEY, product_name char(20),  This data type is used to store characters in a
supplier_name char(20), column.
);  char data type can hold maximum 255 characters.
Not Null Constraint: General syntax: char(size)
This constraint ensures all rows in the table contain a  Where size represents the number of charecters in
definite value for the column which is specified as a column.
not null. Varchar or varchar2:
Syntax:  This data type is used to store characters in a
[CONSTRAIN constraint name] NOT NULL column.varchar2 data type can hold maximum
Ex: 2000 characters.
CREATE TABLE employee(id number(5), General syntax:varchar2(size)
name char(20) CONSTRAINT nm_nn NOT  Where size represents the number of charecters in
NULL, dept char(10), age number(2) a column.
); Date data type:
Unique key:  This data type is used to store date in a column.
This constraint ensures that a column or a group of  The SQL supports various date format dd-mm-
columns in each row have a distinct value. yy.
Ex: dob DATE

68 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


Time data type: Ex: SELECT SUM(salary) FROM employee;
 This data type is used to store time in a column. 6. Discuss any five character (text) built-in functions
The SQL supports various time format hh-mm-ss. in SQL.
Ex: day TIME
Long data type:
 This data type is used to store variable length up
to 2GB size.
4. Write a note SQL logical operators
A: SQL Logical Operators:
1) AND: This operator allows the existence of
multiple conditions in an SQL statements.
2) OR: This operator is used to combine multiple
conditions in an SQL.
3) NOT: This operator is used to reverse the meaning
of the logical operator with which is used.
4) ALL: This operator is used to compare a value to 7. Explain create command & insert command with
all values in another value set. syntax & example in SQL.
5) ANY: This operator is used to compare a value to A: CREATE: create command is used to create a new
any applicable value in the list according to table.
condition. Syntax:
6) BETWEEN: This operator is used to search for CREATE TABLE table_name (column1 datatype,
values that are within a set of values. column2 datatype……. columnN datatype,
7) EXISTS: This operator is used to search for the PRIMARY KEY(one or more columns));
presence of a row in a specified table. Ex: CREATE TABLE student (sno number(4),
8) IN: This operator is used to compare a value to a name varchar2(20),
list of literal values. sub varchar2(5),
9) LIKE: This operator is used to compare a value to fees number(5),
similar values using wildcard operators. PRIMARY KEY(sno));
10) IS NULL: This operator is used to compare a INSERT:
value with a NULL value.  Insert command is used to add new rows of data to
11) UNIQUE: This operator is used to search every a table in the database.
row of a specified table for uniqueness. Syntax:
5. Explain the various group functions in SQL. INSERT into table_name (column1, column2...
A: Group Functions: column) VALUES (value1, value2……..valueN);
Group functions are built in SQL functions that Ex:
operate on groups of rows & return one value for the INSERT into student (sno, sname, ssub, sfees)
entire group. VALUES (123, ’amar’, ’PCMC’, 25000);
COUNT( ):This function returns the number of rows 8. Expand SQL. Give the syntax & example for
in the table that satisfies the condition in the WHERE insert & delete commands in SQL.
condition. A: SQL: Structured Query Language
Ex: SELECT COUNT (*) FROM employee; INSERT: Insert command is used to add new rows
DISTINCT( ):This function is used to select the of data to a table in the database.
distinct rows. Syntax: INSERT into table_name (column1,
Ex: SELECT COUNT (DISTINCT name) FROM column2 ... column) VALUES value1, value2 ……..
employee; valueN);
MAX( ):This function is used to get the maximum Ex: INSERT into student (sno, name, sub, fees)
value from a column. VALUES (123, ’amar’, ’PCMC’, 25000);
Ex: SELECT MAX(salary) FROM employee; DELETE: DELETE command is used to delete the
MIN( ):This function is used to get the minimum existing records from a table.
value from a column. Syntax: DELETE FROM table_name WHERE
Ex: SELECT MIN(salary) FROM employee; condition;
AVG( ):This function is used to get the average Ex: DELETE FROM student WHERE SID=5;
value of a numeric column.
Ex: SELECT AVG(salary) FROM employee;
SUM( ):This function is used to get the sum of a
numeric column.
69 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
9. What is data definition language? Explain select Syntax:
& update commands. SELECT column1, column2
A: Data Definition Language: FROM table_name
Data definition language defines the conceptual WHERE [conditions]
schema providing a link between the logical & the GROUP BY column1, column2
physical structures of the database. Ex: Select name, sum (salary) from customers
SELECT: Select command is used to fetch the data group by name;
from a database table. 11. Explain with example to create details of
Syntax : SELECT column1, column2….columnN employees and give the minimum and maximum
FROM table_name; in the salary domain.
Here column1, column2 …. columnN are the fields of A: CREATE TABLE Employee (Id integer(5) Primary
a table. Key,
Ex: SELECT sno,sname,sfees FROM student Name Char(25),
WHERE sfees>20000; Age Integer(3),
If we want to fetch all the fields from a database then Salary float(10,2));
Syntax: SELECT * FROM table_name; INSERT INTO Employee Values( 101, ‘Ganesh’, 25,
Ex: SELECT * FROM student; 35000);
UPDATE:UPDATE command is used to modify the INSERT INTO Employee Values( 102, ‘Mahesh’, 28,
existing records in a table. 25000);
Syntax: UPDATE table_name INSERT INTO Employee Values( 103, ‘Suresh’, 27,
SET colimn1 = value1, column2 = value2 ….. 18500);
columnN = valueN WHERE condition; INSERT INTO Employee Values( 104, ‘Yogish’, 35,
Ex: UPDATE student SET sfees = 25000 WHERE 32000);
SID=5; INSERT INTO Employee Values( 105, ‘Dinesh’, 45,
10. Write the differences between order by and 21000);
group by with example. SELECT MAX(salary) From Employee;
A: ORDER BY: This clause is used to sort the data in SELECT MIN(Salary) From Employee;
ascending or descending order, based on one or more 12. Write the SQL statements to create a student
columns. database with 3 fields studID, studname,
Syntax: avgmarks. Add 2 records. Display the student
SELECT column_list records whose avgmarks is greater than or equal
FROM table_name to 60.00.
[WHERE consition] A: Create a student database with 3 fields studID,
[ORDER BY column1, column2 … column studname, avgmarks.
N][ASC|DESC];
EX: Select id, name, salary from employee order by CREATE TABLE student
salary; (
studid int primary key,
studname varchar2(20),
avgmarks number(5)
);
Add 2 records
INSERT INTO student (studID, sudname, avgmarks)
VALUES (1234,’amar’,98);
INSERT INTO student (studID,s udname, avgmarks)
VALUES (5647, ’anup’, 79);
INSERT INTO student (studID, sudname, avgmarks)
VALUES (1256,’ajay’,70);
Display the student records whose avgmarks is
greater than or equal to 60.00
SELECT * FROM student WHERE avgmarks>=60;

GROUP BY: This clause is used in collaboration


with the SELECT statement to arrange identical data
into groups.

70 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


Chapter 15. 17. Define ring/circular topology.
A: A topology in which each node is connected to two
NETWORKING CONCEPTS and only two neighbouring nodes and is transmitted
[1m X 2, 2m X 1 & 5m X 1 = 9Marks] onwards to another is called ring/circular topology.
1 Mark Questions 18. Define tree topology.
1. What is networking? A: A topology in which shape of the network is that of
A: An interconnection of two or more computers that are an inverted tree with the central root branching and
able to exchange information is called networking. sub branching to the extremities of the network is
2. What is internet? called tree topology.
A: Internet is an interconnection of large and small 19. Define graph topology.
networks around the globe A: A topology in which nodes are connected together
3. Name the first computer network. in an arbitrary fashion is called graph topology.
A: Advanced Research Project Agency 20. Define mesh topology.
Network(ARPANET). A: A topology in which each node is connected to
4. What is client? / What is Workstation? more than one node to provide an alternative root
A: A computer that is attached to a network and is in the case the host is either down or too busy is
seeking to share the resources of the network is called mesh topology.
called as workstation. 21. Name the different transmission media.
6. What is server? A: Twisted pair cable, Coaxial cables, Optical fibers,
A: A very fast computer with a large RAM & storage Radio wave, Satellite, Infrared and Laser.
space along with a fast network interface card is 22. Name the different guided media.
called server. A: Twisted pair cable, Coaxial cables, Optical fibers.
7. What is data gram? 23. Name the different unguided media.
A: The protocol which deals with unit of data is called A: Radio wave, Satellite, Infrared and Laser.
data gram. 24. What do you mean by hotspot?
8. What is data channel? A: A venue that offers Wi-Fi access is called hotspot.
A: A channel refers to a physical transmission medium 25. What are transponders?
is called data channel. A: Satellite has multiple independent receiving &
9. What is packet? transmitting device is called transponder.
A: A physical thing, appearing on an Ethernet or some 26. What is the use of internet gateway?
wire is called packet. A: Gateway is used as backbone in internet working
10. What is an interspace? systems.
A: A client/server software program that allows 27. What is the use of network protocol?
multiple users to communicate online with real-time A: Network Protocol defines the rules for
audio, video and text chat in dynamic 3D communication between network devices.
environments is called interspace. 28. What is Radio Wave?
11. Give an example for simplex communication A: The transmission making use of radio frequencies is
mode. called as radio-wave.
A: Radio & TV channel. 29. What is a communication mode?
12. Give an example for half duplex communication A: Data can flow depending upon the type media used is
mode. called communication mode.
A: Walkie-Talkie, Marine /Aviation. 30. What is the function of modem?
13. Give an example for full duplex communication A: Modem allow user to combine the power of
mode. computer with the global reach of the telephone
A: Modern telephone system. system.
14. What is topology? 31. What is ethernet card?
A: The actual appearance or layout of networking is A: The computers that are part of Ethernet have to
called topology. install a special card is called ethernet card.
15. Define star topology. 32. What is hub?
A: A topology consists of a central node to which all A: A hardware device used to connect several
other nodes are connected by a single path is called computers together is called a hub.
star topology. 33. What is switch?
16. Define bus/linear topology? A: A device that is used to segment networks into
A: A topology consists of a single length of the different sub networks called subnets or LAN
transmission medium onto which the various nodes segments is called switch.
are attached is called bus topology.
71 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
34. What is repeater? Network Viruses
A: A device that amplifies a signal being transmitted 50. Name any two anti-viruses.
on the network is called repeater. A: Kaspersky , Quick heal, K7, Norton ,AVG, Panda,
35. What is bridge? Avast, McAFee etc.,
A: A device that let you link two networks together is 51. What is Cloud technology?
called bridge. A: Cloud technology or cloud computing is a
36. What is router? computing platform widely used by Information
A: A device that works like a bridge but can handle Technology(IT) Service Companies.
different protocols is known as a router. 52. Expand
37. What is Gateway? A: 2G-Second Generation
A: A device that connects dissimilar networks is called ARPANET-Advanced Research Projects Agency
gateway. Network (ARPANET)
38. What is SIM card? OSI-Open System Interconnection
A: Subscriber Identity Module is a chip card, the size TCP/IP -Transmission Control Protocol/Internet
of a postage stamp. Protocol
39. What is video conference? HTTP -Hypertext Transfer Protocol
A: A live & visual connection between two or more MIME -Multipurpose Internet Mail Extension
people residing in separate locations for the purpose FTP-File Transfer Protocol
of communication is called video conference. PPP-Point to Point Protocol
40. What is firewall? SLIP-Serial Line Internet Protocol
A: A system designed to prevent unauthorized access LCP -Link Control Protocol
to or from a private network is called firewall. NCP -Network Control Protocol
41. What are the types of firewall techniques? MAN -Metropolitan Area Network
A: LAN-Local Area Network
WAN -Wide Area Network
VGM-Voice Grade Medium
DGM -Data Grade Medium
42. What is proxy server? UTP -Unshielded Twisted Pair
A: A server intercepts all messages entering and STP -Shielded Twisted Pair
leaving the network. GSM -Global System for Mobile communications
43. What is chatting? SIM – Subscriber Identity Module
A: Real time communication between two users via CDMA - Code Division Multiple Access
computer is called chatting. TDMA-Time Division Multiple Access
44. What are cookies? WLL-Wireless in Local Loop
A: Messages that a web server transmits to a web GPRS- General Packet Radio Service
browser so that a web server can keep track of the EDGE- Enhanced Data rates for Global Evolution
user’s activity on a specific web site is called SMS -Short Message Service
cookies. Wi-Fi - Wireless Fidelity
45. What is Crackers? Modem -Modulator and Demodulator
A: Malicious programmers who break into secure
systems is called crackers.
46. What are Hackers? 2-Marks Questions:
A: Malicious programmers who break into secure 1. List the goals for networking.
systems & more interested in gaining knowledge A: Resource Sharing
about computer systems is called Hackers. Reliability
47. What is cyber law? Cost Factor
A: A generic term, which refers to all the legal and Communication Medium
regulatory aspects of internet and the WWW is 2. What are the needs of networking?
called cyber law. A: File sharing
48. What is a virus? Print sharing
A: A malicious program that requires a host and is email tools
designed to make a system sick is called as virus. Remote access
49. Name the different types of virus? Sharing database
A: File Infectors 3. What do you mean by transmission modes?
Boot Sector Viruses A: The communication mode defines in which data can
Macro Viruses flow depending upon the type media used.

72 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


Ex: Simplex, Half Duplex and Full Duplex. 10. Explain packet switching technique.
4. Explain simplex communication mode. A: Packet Switching Technique.
A: Simplex communication mode:  With message switching, there is no limit on
 On this panel there is only one interface that is a block size, in contrast, packet switching places a
transmitter and all other interfaces is a receiver. tight upper limit on block size.
 The full bandwidth is completely for signals  A fixed size of packet which can be transmitted
travelling across transmitter to receiver or across the network is specified.
receivers. 11. Explain the HTTP.
 On this channel transmitting interface cannot A: HTTP:
receive and receiving interface cannot transmit.  The Hypertext Transfer Protocol (HTTP) is an
 For example Radio, TV, etc uses Simplex application-level protocol with the lightness and
channels. speed necessary for distributed, collaborative,
4. Explain half duplex communication mode. hypermedia information systems.
A: Half duplex communication mode:  HTTP allows an open-ended set of methods to be
 On this channel each interface works as used to indicate the purpose of a request. It builds
transmitter and receiver, but only one interface on the discipline of reference provided by the
can transmit at a time. Uniform Resource Identifier (URI).
 The full bandwidth of a channel is available to 12. Explain the FTP
the transmitting interface which will not receive A: File Transfer Protocol:
while transmitting.  Files of any type can be transferred, although you
 Generally it is used in Walkie-Talkies, may have to specify whether the file is an ASCII
Marine/Aviation, etc use Half Duplex channel. or Binary file.
5. Explain full duplex communication mode.  They can be transferred to any system on the
A: Full duplex communication mode: internet provided that the permissions are set
 This channel has two ends, each serving as accordingly.
transmitter and receiver. 13. Write any two advantages of FTP
 Each interface can transmit and receive at the A: Advantages of FTP:
same time.  It is very useful to transfer the files from one
 The modern telephone system use Full Duplex network to another.
channels.  It is popular way to share information over the
 It is more expensive due to hardware for internet. FTP works as a client/server process.
increased number of channels and bandwidth. 14. What is an interspace?
7. Which are the switching technologies used? A: Interspace:
A: Circuit switching  A client/server software program that allows
Message switching multiple users to communicate online with real-
Packet switching time audio, video and text chat in dynamic 3D
7. Explain circuit switching technique. environments is called interspace.
A: Circuit Switching Technique.  Interspace provides the most advanced form of
1. In this technique, first the complete physical communication available on the Internet today.
connection between two computers is established 15. Name the different types of servers.
and then data are transmitted from the source  Non-dedicated servers
computer to the destination computer.  Dedicated Servers.
2. The important property of switching technique is 16. Name the different types of networks.
to setup an end to end connection between A: Types of Networks:
computers before any data can be sent.  Local Area Network (LAN)
9. Explain message switching technique.
 Wide Area Network (WAN)
A: Message Switching Technique.
 In this technique, the source computer sends the  Metropolitan Area Network (MAN)
data or the message to the switching office first, 17. Name the different types of topology.
which stores the data in the buffer. A: Types of Topology:
 It then looks for a free link to another switching  Bus/linear topology
office and then sends the data to this office.  Ring/circular topology
 This process is continued until the data is  Star topology
delivered to the destination computers.  Tree topology
 Graph topology
 Mesh topology
73 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
18. What are the differences between LAN and use of repeaters.
WAN?  It supports maximum data rates 1 Mbps without
conditioning and 10 Mbps with conditioning.
26. Name the different types of twisted pair cable.
A: Types Of Twisted Pair Cable:
 Shielded twisted pair cable (STP)
 Unshielded twisted pair cable (UTP)
26. Name the different types of Coaxial Cables
A: Types Of Coaxial Cables:
 Thicknet
 Thinnet
27. Write any two advantages of optical fibers.
A: Advantages Of Optical Fibers
19. Write any two advantages of star topology.
 It is immune to electrical and magnetic
A: Advantages of star topology:
interference.
 Ease of service.
 It is highly suitable for harsh industrial
 One device per connection.
environments.
20. Write any two advantages of bus/linear
 It guarantees source transmission.
topology.
28. Write any two disadvantages of optical fibers.
A: Advantages of Bus/Linear Topology: A: Disadvantages Of Optical Fibers
 Short cable length and simple wiring layout.  Microwave propagation is susceptible to
 Resilient Architecture. weather effects like rains, thunder storms, etc.
 Easy to extend.  Bandwidth allocation is extremely limited.
21. Write any two disadvantages of bus/linear  The cost of design, implementation and
topology. maintenance of microwave links is high.
A: Disadvantages of Bus/Linear Topology: 29. Write any two advantages of radio wave.
 Fault diagnosis is difficult. A: Advantages Of Radio Wave.
 Fault isolation is difficult.  Radio-wave transmission offers mobility.
 Repeater configuration.  It proves cheaper than digging trenches for
 Nodes must be intelligent. laying cables .
22. Write any two advantages of ring/circular  It offers freedom from land acquisition rights that
topology. are required for laying, repairing the cables.
A: Advantages of Ring/Circular Topology:  It offers case of communication over difficult
 Short cable length. terrain.
 No wiring closet space required 30. Write any two disadvantages of radio wave.
 Suitable for optical fibers. A: Disadvantages Of Radio Wave.
23. Write any two disadvantages of ring/circular  It is an insecure communication.
topology.  It is susceptible to weather effects like rains,
A: Disadvantages of Ring/Circular Topology: thunder storms, etc.
 Node failure causes network failure. 31. Write any two advantages of satellite (Satellite
 Difficult to diagnose faults. Microwave).
 Network reconfiguration is difficult. A: Advantages Of Satellite:
24. Write any two advantages of twisted pair cable.  The area coverage through satellite transmission
A: Advantages Of Twisted Pair Cable: is quite large.
 It is simple and physically flexible.  The laying and maintenance of intercontinental
 It can be easily connected. cable is difficult and expensive and this is where
 It is easy to install and maintain. the satellite proves to be the best alternative.
 It has a low weight.  The heavy usage of intercontinental traffic makes
 It is inexpensive. the satellite commercial attractive.
25. Write any two disadvantages of twisted pair 32. Write any two disadvantages of satellite (Satellite
cable. Microwave).
A: Disadvantages Of Twisted Pair Cable: A: Disadvantages Of Satellite:
 Its low bandwidth capabilities make it unsuitable  Technological limitations preventing the
for broadband applications. deployment of large, high gain antennas on the
 Because of high attenuation, it is incapable of satellite platform.
carrying a signal over long distances without the  Over-crowding of available bandwidths due to
74 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
low antenna gains. 39. List the different types of hub.
 The high investment cost and insurance cost A: Types Of Hub.
associated with significant probability of failure.  Active Hubs: Electrically amplify the signal as it
 High atmospheric losses above 30 GHz limit moves from one connected device to another.
carries frequencies. Active concentrators are used like repeaters to
33. What is Infrared? extent the length of a network.
A: The infrared light transmits data through the air &  Passive Hubs: Allow the signals to pass from one
will not penetrate walls. The infrared computer to another without any change.
transmission has become common in PDAs 40. Write short note on router?
(Personal Digital Assistants) e.g., hand held devices A: Router:
like palm pilots etc.  A device that works like a bridge but can handle
34. Mention different network devices. different protocols is known as a router.
A: Network Devices:  If the destination is unknown to a router it sends
 Modem (Modulator and Demodulator) the traffic to another router which knows the
 Ethernet Card destination.
 Hub  A router differs from a bridge in a way that
 Router former uses logical addresses and the latter uses
 Repeater physical addresses.
35. Write short note on Modem? 41. How does Router functions?
A: Modem: A: Router functions:
 Modulator and Demodulator allow you to  Routers use a more complete packet address to
combine the power of your computer with the determine which router or workstation should
global reach of the telephone system. receive each packet next.
 Modem converts digital signals to audio  Based on a network road map called a routing
frequency tones which are in the frequency range table & routers can help ensure that packets are
that the telephone lines can transmit and also it travelling the most efficient paths to their
can convert transmitted tones back to digital destinations.
information. 42. Write short note on gateway.
36. List the different types of Modem. A: Gateway:
A: Types of Modem  A gateway is a device that connects dissimilar
 Internal modems: The modems that are fixed networks. A gateway operates at the highest layer
within the computer. of network abstraction.
 External modems: The modems that are  It expands the functionality of routers by
connected externally to a computer as other performing data translation and protocol
peripherals are connected as other peripherals are conversion.
connected. 43. What is SIM card ?
37. Explain the working of modem. A: SIM Card:
A: Working Of Modem:  The SIM is Subscriber Identity Module.
 Modem converts digital signals to audio  SIM is a chip card, the size of a postage stamp.
frequency tones which are in the frequency range  A SIM is a tiny computer chip that gives a
that the telephone lines can transmit and also it cellular device its unique phone number.
can convert transmitted tones back to digital  It has memory, a processor and the ability to
information. interact with the user.
 After the power is turned On in DTE (Data 44. What is GPRS?
Terminal Equipment) and DCE (Data A: General Packet Radio Service.
Communication Equipment), the terminal runs  GPRS is used for wireless communication using
for self-check. a mobile device.
38. Write short note on hub.  With this service you can access the internet,
A: Hub: send emails and large data, real time news,
 A hub is a hardware device used to connect download games and watch movies.
several computers together. A hub that contains 45. How does GPRS work?
multiple independent but connected modules of A:
network and internetworked equipment.  In GPRS, the information is split into the smaller
 A similar term is concentrator. units or packets and sent through the network and
is reassembled at the receiving end.

75 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


 GPRS is used for wireless communication using
a mobile device. 5 Marks questions
46. What are the key attributes 4G? 1. What is network? Mention different network
A: Key Attributes 4G: goals.
 Support for Multiple Applications and Services A: An interconnection of two or more computers that
 Quality of Service are able to exchange information is called
 Network Detection and Network Selection networking.
47. What are the advantages of EDGE? The network goals are :
A: Advantages Of EDGE: (i) Resource Sharing: The aim is to make all the
 The EDGE air interface has been developed programs, data and peripherals available to anyone
on the network irrespective of the physical location
specifically to meet the bandwidth needs of 3G.
of the resources and the user.
EDGE is a ratio based mobile high speed data
(ii) Reliability: A file can have copies on two or
standard.
three different machines, so if one of them is
 It allows data transmission speeds of 384 kbps.
unavailable, the other copies could be used.
48. List the different Applications of networking. (iii) Cost Factor: Personal computers have better
 SMS price/performance ratio than microcomputers.
 Chat (iv) Communication Medium: Using a network, it
 Video Conferencing is possible for managers, working far apart, to
 Wi-Fi prepare financial report of the company.
49. What is network security? 2. Classify and explain servers.
 Network security is used to make sure that only A: A very fast computer with a large RAM & storage
legal or authorized user and programs gain access space along with a fast network interface card is
to information resources like databases. called server.
 Under this type of security, mechanisms like 1. Non-dedicated Servers
authorization, authentication, encrypted smart  On small networks, a workstation that can
cards, biometrics and firewalls etc are double as a server is known as non-dedicated
implemented. server.
50. Mention different protection methods of  Such servers can facilitate the resource-sharing
network. among the work stations on a proportionately
A: Protection Methods Of Network: smaller scale.
 Authorization  The networks using such a server are known as
 Authentication PEER-TO-PEER networks.
 Encrypted Smart Cards 2. Dedicated Servers
 Bio Metric Systems  On bigger networks, there is a computer
 Firewall reserved for server’s job and its only job is to
51. Mention different types of firewall techniques. help workstations access data, software and
A: Types Of Firewall Techniques. hardware resources & It does not double-up as a
 Packet Filter workstations and such a server is known as
 Application gateway dedicated server.
 The networks using such server are known as
 Circuit Level Gateway
MASTERSLAVE networks.
 Proxy Server 3. Explain different network services (different need
52. Mention the types of virus? for network).
A: Types Of Virus: A: Network Services:
 File Infectors 1. File sharing provides sharing and grouping of
 Boot Sector Viruses data files over the network.
 Macro Viruses 2. Print sharing of computer resources such as
 Network Viruses hard disk and printers etc.
53. What are the characteristics of a computer 3. email tools for communication with the e-mail
virus? address.
A: Characteristics Of A Computer Virus: 4. Remote access able to access data and
 It is able to replicate information, around the globe.
 It requires a host program as a carrier 5. Sharing database to multiple users at the same
 It is activated by external action time by ensuring the integrity.
 Its replication ability is limited to the system.

76 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


4. Explain the types of networking.  Unshielded Twisted Pair (UTP) Cable
A: Types Of Networking:  Shielded Twisted Pair (STP) Cable
Local Area Network (LAN) Types of Coaxial Cables
 Small computer networks that are confined to a The two most commonly used types of coaxial cables
localized area (e.g., an office, a building or a are Thicknet and Thinnet.
factory) are known as Local Area Networks Optical Fibers
(LANs). Optical Fibers consist of thin strands of glass or glass
 The key purpose of a LAN is to serve its users like material which are so constructed that they carry
in resource sharing. light from source at one end of the fiber to a detector
 The hardware as well as software resources are at the other end.
shared through LANs. 6. List the differences between simplex, half duplex
 For instance, LAN users can share data, and full duplex.
information, programs, printer, hard disks, A: The communication mode defines in which data can
modems, etc. flow depending upon the type media used.
Metropolitan Area Network (MAN)
 Metropolitan Area Networks (MANs) are the Ex: Simplex, Half Duplex and Full Duplex.
networks spread over a city. Simplex
 For example, cable TV networks that are  On this panel there is only one interface that is a
spread over a city can be termed as transmitter and all other interfaces is a receiver.
 Metropolitan Area Networks (MANs). The  The full bandwidth is completely for signals
purpose of a MAN is also the sharing of the travelling across transmitter to receiver or
hardware and the software resources among its
receivers. On this channel transmitting interface
users.
Wide Area Network (WAN) cannot receive and receiving interface cannot
 The networks spread across the countries are transmit. For example Radio, TV, etc uses
known as WANs. Simplex channels.
 A Wide Area Networks (WANs) is a group of Half Duplex
computers that are separated by large distances  On this channel each interface works as
and tied together. transmitter and receiver, but only one interface
 It can even be a group of LANs that are spread
can transmit at a time.
across several locations and connected together
to look like one big LAN.  The full bandwidth of a channel is available to
 The WANs link computers to facilitate fast and the transmitting interface which will not receive
efficient exchange of information at lesser cost while transmitting.
and higher speeds.  Generally it is used in Walkie-Talkies,
5. Explain different types of cables used in Marine/Aviation, etc use Half Duplex channel.
transmission?
Full Duplex
A: Types Of Cables Used In Transmission:
 This channel has two ends, each serving as
1. Twisted pair cable
The most common form of wiring in data transmitter and receiver.
communication application is the twisted pair cable.  Each interface can transmit and receive at the
Advantages of Twisted pair cable: same time.
It is simple and physically flexible.  The modern telephone system use Full Duplex
It can be easily connected. channels.
It is easy to install and maintain.  It is more expensive due to hardware for
It has a low weight.
It is inexpensive. increased number of channels and bandwidth.
Disadvantages of Twisted pair cable: 7. Explain the applications of networking?
 Its low bandwidth capabilities make it A: Applications Of Networking:
unsuitable for broadband applications. SMS: Short Message Service (SMS) is the
 Because of high attenuation, it is incapable of transmission of short text messages to and from a
carrying a signal over long distances without the mobile phone, fax machine and/or IP address.
use of repeaters.
Chat: Real-time communication between two users
 It supports maximum data rates 1 Mbps without
conditioning and 10 Mbps with conditioning. via computer.
Types of Twisted Pair Cables

77 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


Video Conferencing: A video conference is a live & end. It also determines type of services to provide to
visual connection between two or more people the session layer.
residing in separate locations for the purpose of The Session Layer
communication. The session layer allows users on different machines
to establish sessions between them. It includes dialog
Wi-Fi: Wi-Fi refers to Wireless Fidelity, which lets control, token management and synchronization. The
you connect to the internet without a direct line from Presentation Layer
your PC to the ISP. The presentation layer concerned with the syntax and
Wi-Fi Hotspots: A hotspot is a venue that offers Wi- semantics of the information transmitted concerned
Fi access. The public can use a laptop, Wi-Fi phone with moving bits around the layer.
or other suitable portable devices to access the The Application Layer
The application layer contains a variety of protocols
internet through a WiFi Hotspot.
that are commonly needed by the user. For example,
WiMax: WiMax is a wireless digital HTTP (Hyper Text Transfer Protocol) which is the
communications system. WiMax can provide bases for the World Wide Web (WWW) to access
Broadband Wireless Access (BWA) up to 30 miles web pages.
(50 km) for fixed stations and 3-10 miles (5-15 km) 9. Explain the working of TCP/IP?
for mobile stations. A: TCP/IP (Transmission Control Protocol/Internet
8. Explain the working of OSI Model? Protocol):
 TCP/IP is a layered set of protocols.
A: Open System Interconnection model has 7 layers
 This protocol assumes that there is a way to
communicate reliably between the two
computers.
 TCP is responsible for making sure that the
commands get through to the other end.
 It keeps track of what is sent, and retransmits
anything that did not get through.

Host- to-Network layer: This layer is also called as


network access layer. It sends TCP/IP packets on the
The Physical Layer network medium.
The physical layer is concerned with transmitting raw Internet layer: This layer responsible for addressing,
bits over a communication channel. It also deals with packaging & routing.
mechanical, electrical and timing interfaces. Transport layer: This layer provides the
The Data Link Layer communication services.
The main function of the data link layer is to Application layer: The application layer contains a
transform a raw transmission facility into a line that variety of protocols that are commonly needed by the
appears free of undetected transmission errors to the user. For example, HTTP (Hyper Text Transfer
network layer. Protocol) which is the bases for the World Wide Web
The Network Layer (WWW) to access web pages.
The network layer controls the operation of the
subnet. The main function is to determine how
packets are routed from source to destination.
The Transport Layer
The basic function of transport layer is to accept data
from above layer and split it up into smaller units if
needed, and pass these to the network layer and
ensure that the pieces all arrive correctly at the other
78 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
10. Explain various networking devices used?( Advantages of the Star topology
Explain the hardware requirement for 1. Ease of service
networking.) 2. One device per connection
A: Networking Devices / Hardware: b)The Bus or Linear Topology:
Modem (Modulator and Demodulator)  Another popular topology for data networks is
 Modems allow you to combine the power of the linear. This consists of a single length of the
your computer with the global reach of the transmission medium onto which the various
telephone system. nodes are attached.
 Modem converts digital signals to audio  The topology is used in traditional data
frequency tones which are in the frequency communication network where the host at one
range that the telephone lines can transmit and end of the bus communicates with several
also it can convert transmitted tones back to terminals attached along its length.
digital information. Advantages of the linear topology
There are two types: 1. Short cable length and simple wiring layout.
Internal modems 2. Resilient Architecture.
External modems 3. Easy to extend.
Ethernet Card Disadvantages of the linear topology
 The computers that are part of Ethernet have to 1. Fault diagnosis is difficult.
install a special card called Ethernet card. 2. Fault isolation is difficult.
 An Ethernet card contains connections for either 3. Repeater configuration.
Coaxial or Twisted pair cables (or both). 4. Nodes must be intelligent.
Hub c)The Ring or Circular topology:
 A hub is a hardware device used to connect  The third topology that we will consider is the
several computers together. ring or the circular.
 A hub that contains multiple independent but  In this case, each node is connected to two and
connected modules of network and only two neighbouring nodes and is transmitted
internetworked equipment. onwards to another.
 A similar term is concentrator. Advantages of the Ring topology
There are two types: 1. Short cable length.
o Active Hubs 2. No wiring closet space required.
o Passive Hubs 3. Suitable for optical fibers.
Switch Disadvantages of the Ring topology
A switch is a device that is used to segment networks 1. Node failure causes network failure.
into different sub networks called subnets or LAN 2. Difficult to diagnose faults.
segments. 3. Network reconfiguration is difficult.
Repeater d)The Tree Topology:
 A repeater is a device that amplifies a signal  A variation of bus topology is the tree topology.
being transmitted on the network.  The shape of the network is that of an inverted
 It is used in long network lines, which exceed the tree with the central root branching and sub
maximum rated distance for a single run. branching to the extremities of the network.
Bridge  Transmission in this topology takes place in the
A bridge is a device that lets you link two networks same way as in the bus topology.
together. e)Graph Topology:
Router  In this topology, nodes are connected together in
A device that works like a bridge but can handle an arbitrary fashion.
different protocols is known as a router.  A link may or may not connect two or more
11. What is topology? Explain in detail. nodes. There may be multiple links also.
A: The actual appearance or layout of networking is  It is not necessary that all the nodes are
called as topology. connected.
a)The Star Topology: f)Mesh Topology:
 This topology consists of a central node to  In this topology, each node is connected to more
which all other nodes are connected by a than one node to provide an alternative root in the
single path. case the host is either down or too busy.
 It is the topology used in most existing  It is an extension to P-P network.
information networks involving data  The mesh topology is excellent for long distance
processing or voice communications. networking because it provides extensive backup.

79 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


12. What is gateway? Explain.  Authentication involves accepting credentials
A: Gateway: from the entity and validating them against an
 A Gateway is a device that connects dissimilar authority.
networks. 3. Encrypted Smart Cards:
 A gateway operates at the highest layer of  Passwords in a remote login session generally
network abstraction. pass over the network in unencrypted form.
 It expands the functionality of routers by  Any hacker can simply record it and can use it
performing data translation and protocol later maliciously to corrupt data/files or to harm
conversion. anyone etc.
 It is needed to convert Ethernet traffic from the  To counter such threats newer approaches are
LAN, to SNA (Systems Network Architecture) suggested such as encrypted smart cards.
traffic on a legacy system.  An encrypted smart card is a hand held smart
 A gateway is actually a node on a network that card that can generate a token that a computer
serves as an entrance to another network. system can recognize.
 In enterprises, the gateway is the computer that  Every time a new and different token is
routes the traffic from a workstation to the generated, which even though cracked or
outside network that is serving the web pages. hacked, cannot be used later.
 In homes, the gateway is the ISP that connects 4. Bio Metric Systems:
the user to the internet.  They form the most secure level of
 In enterprises, the gateway node often acts as a authorization.
proxy server and a firewall.  The Biometric systems involve some unique
 The gateway is also associated with both a aspects of a person’s body such as finger prints,
router, which use headers and forwarding tables retinal patterns, etc to establish his/her identity.
to determine where packets are sent, and a 5. Firewall:
switch, which provides the actual path for the  A system designed to prevent unauthorized
packet in and out of the gateway. access to or from a private network is called
13. Explain the network security in detail? firewall.
A: Network Security:  They can be implemented in both hardware and
 Network security is used to make sure that only software or a combination of both.
legal or authorized user and programs gain access There are several types of firewall techniques.
to information resources like databases. (i) Packet Filter: Looks as each packet entering or
 Under this type of security, mechanisms like leaving the network and accepts or rejects it based
authorization, authentication, encrypted smart on user defined rules.
cards, biometrics and firewalls etc are (ii) Application gateway: It apples security
implemented. mechanisms to specific applications, such as FTP
 The problems encountered under network and Telnet Servers.
security can be summarized as follows: (iii) Circuit Level Gateway: It applies security
1. Physical security holes. mechanisms when a connection is established.
2. Software security holes. (iv) Proxy Server: It intercepts all messages
3. Inconsistent usage holes. entering and leaving the network.
Protection methods 14. Explain different network protection methods.
1. Authorization: A: Network Protection Methods:
 It determines whether the service provider 1. Authorization:
has granted access to the web service to the  It determines whether the service provider has
requestor. granted access to the web service to the
 Basically, authorization confirms the service requestor.
requestors’ credentials.  Basically, authorization confirms the service
 Authorization is performed by asking the user requestors’ credentials.
a legal login ID.  Authorization is performed by asking the user a
 If the user is able to provide a legal login ID, legal login ID.
he/she is considered an authorized user.  If the user is able to provide a legal login ID,
2. Authentication: he/she is considered an authorized user.
 It ensures that each entity involved in using a 2. Authentication:
web service– the requestor, the provider and the  It ensures that each entity involved in using a
broker is what it actually claims to be. web service– the requestor, the provider and the
broker is what it actually claims to be.
80 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
 Authentication involves accepting credentials 16. What is compute virus? Write the symptoms
from the entity and validating them against an (characteristics) of computer
authority. A: Computer Virus is a malicious program that
3. Encrypted Smart Cards: requires a host and is designed to make a system
 Passwords in a remote login session generally sick. The following are characteristics of a computer
pass over the network in unencrypted form. virus.
 Any hacker can simply record it and can use it 1. It is able to replicate
later maliciously to corrupt data/files or to harm 2. It requires a host program as a carrier
anyone etc. 3. It is activated by external action
 To counter such threats newer approaches are 4. Its replication ability is limited to the system.
suggested such as encrypted smart cards. 17. Write the Features of 5G Technology.
 An encrypted smart card is a hand held smart A: Features of 5G Technology:
card that can generate a token that a computer  5G technology offer high resolution for crazy
system can recognize. cell phone user and bi-directional large
 Every time a new and different token is bandwidth shaping.
generated, which even though cracked or  5G technology also providing subscriber
hacked, cannot be used later. supervision tools for fast action.
4. Bio Metric Systems:  The high quality services of 5G technology
 They form the most secure level of based on Policy to avoid error.
authorization.  5G technology is providing large broadcasting of
 The Biometric systems involve some unique data in Gigabit which supporting almost 65,000
aspects of a person’s body such as finger prints, connections.
retinal patterns, etc to establish his/her identity.  5G technology offer transporter class gateway
5. Firewall: with unparalleled consistency.
 A system designed to prevent unauthorized  The traffic statistics by 5G technology makes it
access to or from a private network is called more accurate.
firewall.  The 5G technology is providing up to 25 Mbps
 They can be implemented in both hardware and connectivity speed.
software or a combination of both.  The 5G technology also support virtual private
There are several types of firewall techniques. network.
(i) Packet Filter: Looks as each packet entering or  The new 5G technology will take all delivery
leaving the network and accepts or rejects it service out of business prospect
based on user defined rules.  The uploading and downloading speed of 5G
(ii) Application gateway: It apples security technology touching the peak.
mechanisms to specific applications, such as
FTP and Telnet Servers.
(iii) Circuit Level Gateway: It applies security
mechanisms when a connection is established.
Chapter 16.
(iv) Proxy Server: It intercepts all messages
entering and leaving the network. INTERNET AND OPEN SOURCE
15. Give the measures for preventing virus. CONCEPTS
A: Measures For Preventing Virus [1mX 1 & 3m X 1 = 4Marks ]
1. Never use a “Foreign” disk or CD without 1 Mark Questions
scanning it for viruses. 1. What is open source software?
2. Always scan files downloaded from the internet A: Software whose source code is available to customers
or other sources. & it can modified & redistributed without limitations
3. Never boot your PC from a floppy unless you open source soft.
are certain that it is virus free. Or
4. Write protects your disks. It is a category of software which can be freely used
5. Use licensed software. but need not be free of charge.
6. Password protects your PC to prevent 2. What is free software?
unattended modification. A: The software that is freely accessible and freely
7. Install and use antivirus software. used, changed, improved, copied and distributed by
8. Keep antivirus software up to date. all free software.

81 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


3. What is OSS ? 20. Expand WIPO.
A: OSS refers to open source software whose source A: World Intellectual Property Organization.
code is available to customers and it can be modified 3 Marks Questions
and redistributed without any limitations. 1. What is open source software?
4. Expand FLOSS? A: Open Source Software
A: FLOSS refers to Free Libre and Open source software  OSS refers to open source software whose source
or Free Livre and Open source software. code is available to customers and it can be
5. Expand FSF. modified and redistributed without any
A: Free Software Foundation. limitations.
6. What is WWW?  OSS can be freely used but it does not have to be
A: A set of protocols that allows you to access any free of charge.
document on the net through a naming system based  Here the company constructing the business
on URLs is called WWW (World Wide Web). models around OSS may receive the payments
7. What is freeware? concerning support, further development.
A: A software which is available free of cost and which 2. Write any three criteria of open source
allows copying and further distribution, but not software.(Any three)
modification and source code is not available is A: Criteria Of Open Source Software:
called freeware. 1. Free redistribution: The license shall not
8. What is proprietary software? restrict any party from selling or giving away the
A: Software that is neither open nor freely available is software as a component of an aggregate
called proprietary software. software distribution containing programs from
9. What are web browsers? several different sources.
A: A software that navigates though the world wide 2. Source Code: The program must include source
web(www) and displays web pages is called web code and must allow distribution in source code
browser. as well as complied form.
10. Name any two web browsers. 3. Derived works: The license must allow
A: Google Chrome modifications and derived works, and must allow
Mozilla Firefox them to be distributed under the same terms as
Internet Explorer the license of the original software.
11. What is web server? No discrimination against persons or groups:
A: A www server that responds to the requests made The license must not discriminate against any person
by web browsers is called web server. or group of persons.
12. What are web pages? No discrimination against fields of Endeavor:
A: The documents residing on web sites are called The license must not restrict anyone from making use
web pages. of the program in a specific field of endeavor.
13. What is URL? 3. What are the advantages of www?
A: HTTP uses internet addresses in a special format or A: advantages of www:
an address of a file on internet is called URL.  It allows the user to access any document on the
14. Write the syntax of URL. net to a naming system based on URLs.
A: URL:Uniform Resource Locator Path://address/path  It also specifies a way to request and send a
15. What are telnet? document over the internet.
A: An older internet utility that lets user log on to  It is used for obtaining textual and graphic
remote computer system is called telnet. intensive information also.
16. What is a domain? 4. What is telnet?
A: A name that identifies computer or computers on  It is an olden internet utility that lets user log on
the internet. to remote computer system.
17. What is domain affiliation?  It gives a character based terminal window on the
A: Most common domains are dedicated to some other system.
purposes like commercial, education, govt. etc.  User gets a login prompt on that system. If
18. Define e-commerce. permitted access user can work on that system.
A: The trade of goods and services with the help of 5. Write a note on web servers.
telecommunication and computer is called e-  Web server that responds to the requests made by
commerce. web browsers.
19. Expand IPR.  It stores the pages of the web site Eg: Apache,
A: Intellectual Property Rights IIS.

82 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur


11. What are the advantages of e-commerce?
6. Explain free software. A: Advantages Of E-Commerce
A: Free Software  Easier entry into markets especially remote
 It means software is freely accessible, free to use, markets.
changed, improved, copied, distributed without  Global participation.
any payments.  Optimization of resource.
 It is distributed along with its source code and is  Reduce the time to complete business
released under a software license that guarantees transaction.
the users freedom to run the software for any 12. Explain the IPR in India.
purpose. A: IPR related issues in India like patents, trademarks,
 It is often developed by volunteer computer copyrights, designs and geographical indications are
programmers. governed by Patents Act 1970 and Patent Rules 2003,
7. Explain URL. Trademarks Act 1999 and the Trademarks Rule
A: URL: 2002, Indian Copyrights Act 1957, Design Act 2000
 HTTP uses internet addresses in a special format and Rules 2001 and the Geographical Indications of
called uniform resource locator. Goods Act 1999 and the Geographical Indication of
 URL’s looks like type://address/path Goods Rules 2002.
 Example: http://www.pue.kar.nic.in/results.asp 13. Write a note on WIPO.
8. How e-commerce works?  WIPO means World Intellectual Property
A: a) The merchant submits a credit card transaction to Organization. WIPO related issues in World like
the NMAPAY payment gateway on behalf of a patents, trademarks, copyrights, designs and
customer via secure website connection, retail geographical indications are governed by WIPO.
store MOTO centre or wireless device.  Recent initiatives have been at the international
a) NMAPAY receives the secure transaction level including the OECD.
information and passes it via a secure connection
to the Merchant Bank’s Processor.
b) National Merchants Association submits the Chapter 17.
transaction to the credit card network (a system
of financial entities that communicate to manage
Web Designing
the processing , clearing and settlement of credit [1m X 1 & 3m X 1 = 4Marks]
card transactions.) 1 Mark Questions
8. Explain types of e-commerce 1. What is HTML?
A: types of e-commerce A: HTML is a Hyper Text Markup Language which
 Business to Business: The exchange of services , makes it possible to present information on the
information or products from one business to internet.
another business partners. Example: Ebay.com 2. What HTML stands for?
 Business to Consumer: The exchange of A: Hyper Text Markup Language
services , information or product from a business 3. What will be the extension of hypertext markup
to consumer. language file?
 Consumer to Business: Consumer directly A: .html
contact business vendors by posting their project 4. Who invented the HTML?
work with set budge online , so that the needy A: Tim Berners Lee
companies review it and contact the customer 5. What is the use of web page?
directly with bid. A: Web page is used to display in attractive manner.
 Consumer to Consumer: Electronic commerce HTML is used to create web pages & websites.
is an internet facilitated form of business. 6. What do you mean by domain?
10. Explain the technologies & services used in e- A: A domain is a unique name that identifies a website.
commerce. 7. What do you mean by hosting?( What is web
A: Technologies & Services Used In E-Commerce: hosting?)
 Electronic Data Interchange (EDI). A: Web Hosting is a means of hosting web-server
 E-mail application on a computer system through which
 Electronic Funds Transfer(EFT) electronic content on the Internet is readily available
 Electronic Benefits Transfer(EBT) to any web-browser client.
 Digital cash(DC) 8. What is web scripting?
 Electronic Banking(EB) A: The process of creating and embedding scripts in a
web page is known as Web Scripting.
83 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
9. What is form?  PUE/support_html/academic-directory name
A: A webpage which allows the user to enter  Sylb.htm-file name. PHP ,VBScript,
information JavaScript, ASP, PHP, PERL, JSP
10. What is XML? 3 Marks Questions
A: XML is an eXtended Markup Language for 1. Explain the structure of HTML.
documents containing structured information. A: Structure Of HTML:
Structured information contains both content and <html> It indicates beginning of HTML.
some indication of what role that content plays. <head> It indicates beginning of head section .
11. What is DHTML? <title>…..</title>> It indicates the title name of
A: Dynamic HTML is a collective term for a HTML.
combination of Hypertext Markup Language </head> It indicates the end of the heading section.
(HTML) tags and options that can make Web pages <body> ……… It indicates the body of the HTML
more animated and interactive than previous versions document.
of HTML. ………
12. Name any one server side scripting language. </body> It indicates the end of the body section.
A: PHP ,VBScript, JavaScript, ASP, PHP, PERL, JSP </html> It indicates the end of the HTML document.
13. What is use of PHP files? 3. Write the steps for creating webpage.
A: PHP is a Hypertext Pre-Processor & widely used
A: Steps To Create Webpage
open source programming language for server side
application and developing web content. 1) Open any text editor such as notepad.
14. Which tag is used to insert an image in HTML? 2) Create HTML program & save file with extension
A: <img> tag. .html
15. With the help of syntax include images in web 3) To view created HTML document use any web
page. browser.
A: <img src=”C:\1.jpg”>
3. What are steps used in creating Web Hosting?
16. How to resize the images in HTML? A: Steps To Create Web Hosting:
A: <img src=”C:\1.jpg” height=”100” width=”100”>  Open the FileZilla application and from the top
17. Write the example to add border to image in menu, select File and click on Site Manager
HTML. (ctrl + S).
A: <img src=”C:\1.jpg” border=”4”>  In the Site Manager window, click on the New
18. How to add background color to HTML page? Site button. Enter the name of your site, like
A: <body bgcolor=”green”> Signature Solutions.
19. How to add background image to HTML page?  Click in the text field for Host and your Host IP,
A: <body background=”C:\1.jpg”> like ftp.signature.co.in
20. How to use image as link in HTML?  Select Normal from the drop down for Logontype
A: <a href=”1.html”><img src=”C:\1.jpg”>  In the User text field, enter the FTP Username.
21. Which attribute is used to let the background  In the Password text field, enter your FTP
fixed even if user scrolling downs the page? Password.
A: Bgproperties=”fixed”  Now click on Connect button to establish a
22. Give the purpose of anchor tag.  connection with your hosting Server.
A: Anchor tag is used to create hyperlink. After successfully connecting to the server,
23. Which tag is used for hyperlink in HTML? FileZilla will list all the files on your computer in
A: <a> or anchor tag. the left window and the files on your server in the
Ex:<a href=www.google.com> right window.
24. Which tag is used to insert a table in HTML?  To upload files, browse to the destination
A: <table> directory on the server in the right window.
25. Write the opening and closing tags?  You should be able to see the upload progress in
A: <html> is an opening tag. the bottom window.
</html> is closing tag.  To download files, select the destination
26. What are the components of the following URL: directory
A: from the left window and the source directories .
http://www.pue.kar.nic.in/PUE/support_html/academ  Files related to your website is kept under
ic/sylb.htm public_html, www or documents directory.
 http-protocol name ends with :  Always remember to Disconnect after you finish
 www.pue.kar.nic.in-domain name or server the upload or download.
name prefixed with //  To connect again, go to Site Manager (ctrl + S),
84 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
select the account and click on the Connect elements
button.  DHTML contains only text, therefore it takes up
4. How do you register a domain? less memory.
A: Domain Name System(DNS) consists of a 10. Write differences between HTML & XML
hierarchically organized directory of all the domain
names.
Steps for domain name registration are:
1. Determining name
2. Think about the name
3. Getting an ISP and Web host
4. Domain Name Server (DNS)
5. Register
6. Why should I setup a domain name 11. Write a note on Client-side scripting
7. What is a domain name alias or domain alias? A: Client-Side Scripting:
5. What is web scripting?  Client-Side scripting enables interaction within a
A: Web Scripting: web page.
 The process of creating and embedding scripts in  The client-side scripts are downloaded at the
a web page is known as Web Scripting. client-end and then interpreted and executed by
 A script or a computer-script is a list of the browser.
commands that are embedded in a web-page  The client side scripting is browser dependent.
normally and are interpreted and executed by a Client-side scripting is used when the client-side
certain program or scripting engine. interaction is used.
 The programming languages in which scripts are Uses of client-side scripting:
written are called scripting languages. a. To get data from users screen or browser
Types of web scripts: b. Online games
-side Scripts 12. Write a note on server-side scripting?
-side scripts A: Server-Side Scripting:
6. What is use of PHP files?  Server-side scripting enables the completion or
carrying out a task at the server end and then
A: Use Of PHP Files:
sending the result to the client end.
 Password protection.  In server side script, the server does all the work,
 Browser customization. so it doesn’t matter which browser is being used
 Form processing. at client end.
7. Give the features of XML  Server side scripting is used when the
A: Features Of XML: information is sent to a server to be processed at
the server end.
 XML Is A Text-Based Markup Language
Uses of server side scripting:
 XML Document Is Always Constrained To Be 1. Password protection
Well Formed. 2. Browser customization
 XML Has No Tags. 3. Form processing
 XML Is Case Sensitive. 13. Write the differences between client side
8. Give the features of DHTML scripting & server side scripting.
A: Features Of DHTML:
 An object-oriented view of a Web page and its
elements
 Cascading style sheets and the layering of
content
 Programming that can address all or most page
elements
 Dynamic fonts
9. Give the merits of DHTML
A: Merits Of DHTML:
 DHTML makes documents dynamic.
 An object-oriented view of a Web page and its 14. What are advantages of web designing?
elements  It is an interactive marketing tool on internet.
 Programming that can address all or most page  Easily grab the attention of the users.
85 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
 possible to communicate with customers directly. Ex: < small> t e x t < /small>
15. What are the advantages of www? <h1>: Writes the text in biggest heading.
A: Advantages Of Www: Ex: < h1> t e x t < /h1>
 Free availability of information. 21. Explain any three text layout tags.
 Provides easy communication facility. A: Text Layout Tags:
 Accessible from anywhere. <p>: This tag adds a paragraph break after the text.
 It is the global media. Ex: <p>text</p>
16. What are the disadvantages of www? <center>:This tag place the text to center.
A: Disadvantages Of Www: Ex:<center>text</center>
 It requires an efficient information search plan. <br>:This tag adds the single line break .
Ex: Text<br>
 No guarantee of finding what one is looking for.
22. Explain the program to include table in Web
 There is a lot of it appears that unconnected page.
information. <html>
17. What is web hosting? Mention different types of <body>
web hosting. <table style=”width: 300px”>
OR
Explain hosting a website. <tr>
A: Hosting web-server application on a computer system <th>First Name</th>
through which electronic content on the Internet is <th>Last Name</th>
readily available to any web-browser client is called <th>Marks in HTML </th>
web hosting or website hosting. </tr>
Types of website hosting
1. Free Hosting 2. Virtual or Shared Hosting 3. <tr>
Dedicated Hosting 4. Collocation Hosting <td>Aditya</td>
18. Explain the types of web hosting. <td>Ajay</td>
A: Types Of Web Hosting: <td>50</td>
1. Free Hosting: This type of hosting is available </tr>
with many prominent sites that offer to host some
web pages for no cost. <tr>
2. Virtual or Shared Hosting: This type of hosting <td>Dheeraj</td>
is provided under one’s own domain name. <td>S</td>
3. Dedicated Hosting: In this type of hosting, the <td>94</td>
company wishing to go online, rents an entire </tr>
web server from the hosting company. This is
suitable for companies hosting larger websites, <tr>
maintaining others’ sites or managing big online <td>John</td>
mall etc. <td>Matthew</td>
4. Co-location Hosting: For those who do not fit <td>80</td>
the dedicated– server mold, hosting companies </tr>
offer a similar, but less restrictive hosting, known
as co-location hosting. </table>
19. Explain any three formatting tags. </body>
A: Formatting Tags: </html>
<b>: This tag is used to display text as bold. 23. Explain number listing in HTML
<i>: This tag is used to display text as italic. A: Following number options:
<u>: This tag is used to display text with underline. Plain numbers
<small>:This tag is used to decrease the size of the Capital Letters
text. Small Letters
<big>: This tag is used to increase the size of the Capital Roman Numbers
text. Small Roman Numbers
20. Explain any three resizing text tags.
A: Resizing Text Tags:
<big>:Increases the size by one.
Ex: < big> t e x t < / big >
<small>:Decreases the size by one.
86 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur
24. Explain any three tags used in the forms.
OR
Explain the HTML tags to create any three forms
tags
A: HTML tags:
1. Text field: These are one line text area that
allows the user to input text.
Ex:
<form> <inputtype=”text” name = ” firstname ” /
> < / form >
2. Checkbox field: This field is used when more
than one option is required to be selected.
Ex:
<form><input type = ” checkbox ” name = ”
computer science ” value = ” on ” > computer
science < / form >
3. Radio buttons: This field is used when only one
option is required to select from many options.
Ex:
<form> <input type = ” radio ” name = ” subject ”
value = ” computer science ” > computer science
</form>
4. Password field: This also single line text input
but it masks the character as soon as user enters
it.
Ex:
<form> password <input type = ” password ”
name = ” password ” > </form>

87 | P a g e Dept. of Computer Science| Excellent PU Science College, Vijayapur

You might also like