Computer Network Question and Answer (7)
Computer Network Question and Answer (7)
All the
Write two advantages of using an optical fibre cable over an ethernet cable to connect two service packets are stored in the main memory instead of disk. As a result accessing time of packets is reduced.
stations, which are 190 m away from each other. Delhi 2013 While circuit switched networks are based on the direct connection of two computers, with the
Аnswer: connected computers making exclusive use of a single connecting link.
Low power Because signals in optical fibres degrade less, lower power transmitters can be used.
Higher datarate Due to higher bandwidth, data rate of optical fibre is more than the data rate of
Question 7:
ethernet cable (upto 1 Gbps).
Name two transmission media for networking.
Аnswer:
Question 2:
Differentiate between packet switching and message switching technique in network communication.
1. Optical fibre
Delhi 2011
2. Satellite.
Аnswer:
Message Switching In message switching data is stored in buffer form. The message is, sent to the
Question 8:
nearest directly connected switching node. This process continues until data is delivered to the
State two reasons for which you may like to have a network of computers instead of having standalone
destination computer.
computers.
Packet Switching In this form of switching data is transferring into packet form. A fixed size of packet
Аnswer:
that can be transmitted across the network is specified. All the packets are stored in the main memory
The two reasons for networking are:
instead of disk.
Exam Practice
Short Answer Type Questions [1 Mark]
Question 1:
Which type of network (out of LAN, PAN and MAN ) is formed, when you connect two mobiles using
bluetooth to transfer a picture file? Delhi 2014
Аnswer:
When two mobiles are connected using bluetooth to transfer a picture file, a PAN(Personal Area
Network) is created.
Question 2:
What is the difference between HTTP and FTP? All India 2013
Аnswer: Question 5:
FTP is a protocol used to upload files from a workstation to a FTP server or download files from a FTP In networking, what is WAN? How is it different from LAN? All India 2011
server to a workstation. Аnswer:
HTTP is a protocol used to transfer files from a web server onto a browser in order to view a web page The network which connects the different countries network is known as WAN. It can be a group of
that is on the Internet. LANs. The largest existing WAN is Internet. LAN is a group of computers and network devices connected
together, usually within the same building whereas WAN is not restricted to geographical location,
although it might be confined within the bounds of state or country.
Question 3:
Write one advantage of bus topology of network. Also, illustrate how four computers can be connected
with each other using star topology of network? All India 2012 Question 6:
Аnswer: What is the function of modem? Delhi 2011C
Advantage of bus topology In bus topology, computers can be connected with each other using server Аnswer:
(host) along a single length of cable. Function of modem is to convert analog signals into digital signals. Modem also converts digital signal
Four computers can be connected with each other using server in the following way: into analog signal. It is also used to connect Internet.
Question 7:
Name any two components required for networking. Delhi 2011C
Аnswer:
Switch/Hub and Repeaters.
Question 8:
What are repeaters? Delhi 2011C
Question 4: Аnswer:
Write one advantage of star topology of network? Also, illustrate how five computers can be connected Repeaters are electronic devices, that receive a signal and retransmit it at a higher level so that the
with each other using star topology of network? Delhi 2012 signal covers longer distance. It’s required if the distance between source and destination is 90 m or
Аnswer: more.
Advantage of star topology No disruption to the network when connecting or removing devices.
Question 9:
What is a hub? Delhi 2008
Аnswer:
A hub is a hardware device used to connect several computers together.
Question 10:
Expand the following abbreviations: All India 2009
1. HTTP Question 16:
2. ARPANET. A company wants to form a network on their five computers to a server within the company premises.
Represent star and ring topologies diagrammatically for this network.
Аnswer: Аnswer:
Question 11:
What is protocol? Which protocol is used to copy a file from/to a remote server? All India 2009
Аnswer:
Protocol is a set of rules that two or more computers must follow to communicate on network.
FTP (File Transfer Protocol) is used to copy a file from/to a remotely located server.
Question 12:
What is protocol? Which protocol is used to search information from Internet using an Internet
browser? Delhi 2009
Аnswer:
Protocol is a set of rules that two or more computers must follow to communicate on network.
WWW (World Wide Web) is used for searching information from Internet using Internet browser.
Question 13:
What is the advantage of using SWITCH over HUB? Delhi 2012C
Аnswer:
Switch provides a dedicated line at full bandwidth between two devices but hub doesn’t provide a
dedicated line. Hub share the bandwidth.
Question 15:
What is modem? All India 2008
Аnswer:
A modem is a data communication equipment that facilitates data communication through telephone
lines. It is used to convert digital data into analog and vice-versa.
2.
The above layout is based on minimum cable length required, which is 120 metres in the above
case.
3. Satellite Link.
4. Switch.
Question 18:
Granuda consultants are setting up a secured network for their office campus at Fa rida bad for their
day-to-day office and web based activities. They are planning to have connectivity between 3 buildings
and the head office situated in Kolkata. Answer the questions (i) to (iv) after going through the building
positions in the campus and other details, which are given below.
1. Which will be the most appropriate block, where TTC should plan to install their server?
2. Draw a block to block cable layout to connect all the buildings in the most appropriate manner for
efficient communication.
3. What will be the best possible connectivity out of the following, you will suggest to connect the
new set up of offices in Bengalore with its London based office.
o Satellite Link
o Infrared
o Ethernet
4. Which of the following device will be suggested by you to connect each computer in each of the 1. Suggest the most suitable place (i.e. block) to house the server of this organisation. Also, give a
buildings? reason to justify your suggested location.
o Switch 2. Suggest a cable layout of connections between the building inside the campus.
o Modem 3. Suggest the placement of the following devices with justification:
o Gateway (a) Switch
(b) Repeater
Аnswer: 4. The organisation is planning to provide a high speed link with its head office situated in the
Kolkata using a wired connection. Which of the following cable will be most suitable for this job?
(a) Optical fibre
1. TTC should install its server in finance block as it is having maximum number of computers.
(b) Co-axial cable
(c) Ethernet cable
Аnswer:
1. The most suitable place to house the server in JAMUNA because it has maximum number of
computers.
2.
3. (a) Switches are needed in every building to share bandwidth in every building.
(b) Repeaters may be skipped as per above layout, (because distance is less than 100 m) however,
if building RAVI and building JAMUNA are directly connected, we can place a repeater there as
the distance between these two buildings is more than 100 m.
4. (b) Co-axial cable.
Question 19:
Freshminds University of India is starting its first campus in Ana Nagar of South India with its centre
admission office in Kolkata. The university has three major blocks comprising of Office block, Science
block and Commerce block is in 5 km area campus.
As a network expert, you need to suggest the network plan as per (i) to (iv) to the authorities keeping in
mind the distance and other given parameters. Delhi 2010
1. Suggest the authorities, the cable layout amongst various blocks inside university campus for
connecting the blocks.
2. Suggest the most suitable place (i.e. block) to house the server for this university with a suitable
reason.
3. Suggest an efficient device form the following to be installed in each of the block to connect all
the computers,
(a) Modem (b) Switch (c) Gateway
4. Suggest the most suitable (very high speed) service to provide data connectivity between
admission office located in Kolkata and the campus located in Ana Nagar form the following
options:
o Telephone line
o Fixedline dial-up connection
o Co-axial cable network
o GSM
o Leased line
o Satellite connection.
Аnswer:
1.
2. The most suitable place to house the server is Science Block as it has maximum number of
computers. Thus, reducing the cabling cost and increases efficiency of network.
3. (b) Switch is the device to be installed in each of the blocks to connect all the computers.
4. Satellite connection.
Question 20:
Quick Learn University is setting up its academic blocks at Prayag Nagar and planning to set up a
network. The university has three academic blocks and one human resource centre as shown in the
diagram below: Delhi 2011
1. Suggest the most suitable place (i.e. block/centre) to install the server of this university with a
suitable reason.
2. Suggest an ideal layout for connecting these block/centre for a wired connectivity.
3. Which device you will suggest to be placed/installed in each of these blocks/centre to efficiently
connect all the computers with in these blocks/centre ?
4. The university is planning to connect its admission office in the closest big city, which is more
than 250 km from university, which type of network out of LAN, MAN or WAN will be formed?
Justify your answer.
Аnswer:
2. Аnswer:
3. Switch.
4. WAN as it is another city.
1. TUC should install its server in Human Resource Block as it is having maximum number of
Question 21: computers.
Tech Up Corporation (TUC) is a professional consultancy company. The company is planning to set up
their new offices in India with its hub at Hyderabad. /Is a network adviser, you have to understand their
requirement and suggest to them the best available solutions. Their queries are mentioned as (i) to (iv)
below. All India 2014
2.
The above layout is based on the minimum length of cable required, i.e. 140 m.
3. Satellite Link.
4. Switch.
Question 22:
G.R.K International Inc. is planning to connect its Bengaluru Office Setup with its Head Office in Delhi.
The Bengaluru Office G.R.K. International Inc. is spread across an area of approx. 1 square kilometres
consisting of 3 blocks. Human Resources, Academics and Administration. You as a network expert have
to suggest answers to the four queries (i) to (iv) raised by them.
Note Keep the distances between blocks and number of
1. What will the most appropriate block, where TUC should plan to install their server?
computers in each block in mind, while providing them the solutions. 3. Hub/Switch.
4. Satellite.
Question 23:
Expertia Professional Global (EPG) in an online corporate training provider company for IT related
courses. The company is setting up their new campus in Mumbai. You as a network expert have to study
the physical locations of various buildings and the number of computers to be installed. In the planning
phase, provide the best possible answers for the queries (i) to (iv) raised by them. Delhi 2013
1. Suggest the most suitable block in the Bengaluru Office Setup to host the server. Give a suitable
reason with your suggestion.
2. Suggest the cable layout among the various blocks within the Bengaluru Office Setup for
connectiing the blocks.
3. Suggest a suitable networking device to be installed In each of the blocks essentially required for
connecting computers inside the blocks with fast and efficient connectivity.
4. Suggest the most suitable media to provide secure, fast and reliable data connectivity between
Delhi Head Office and the Bengaluru Office Setup.
Аnswer:
Аnswer:
1. EPG should install the server in the Faculty Studio Building as it is having maximum number of
computers.
2.
3. (a) LAN (Local Area Network).
4. (c) Satellite.
Question 24:
Workalot consultants are setting up a secured network for their office campus of Gurgaon for their day-
to-day office and web based activities. They are planning to have connectivity between 3 buildings and
the head office situated in Mumbai. Answer the questions (i) to (iv) after going through the building
positions in the campus and other details, which are given below: All India 2012
1. Suggest the most suitable place (i.e. building) to house the server of this organisation. Also, give a
reason to justify your suggested location.
2. Suggest a cable layout of connections between the buildings inside the campus.
3. Suggest the placement of the following devices with justification :
(a) Switch (b) Repeater
4. The organisation is planning to provide a high speed link with its head office situated in the
Mumbai using a wired connection. Which of the following cables will be most suitable for this
job?
(a) Optical fibre
(b) Co-axial cable
(c) Ethernet cable
Аnswer:
1. Building RED is the suitable place to house this because it has maximum number of computers.
activities. The campus has four compounds as shown in the diagram below: Delhi 2010
2.
3. (a) Switches are needed in every building as they help share bandwidth in every building.
(b) Repeaters may be skipped as per above layout (because distance is less than 100 m), however
if building GREEN and building RED are directly connected, we can place a repeater there as the
distance between these two buildings is more than 100 m.
4. (b) Co-axial cable.
Question 25:
Learn Together is an educational NGO. It is setting up its new campus at Jabalpur for its web-based
Аnswer:
The campus has four buildings as shown in the diagram below: All India 2010
1.
2. The most suitable place to house the server is Training Compound as it has a maximum number
of computers.
3. (a) Repeater As per one layout (shown in (i )), the repeater can be avoided as all distances
between the compounds are <=100 m.
(b) Hub/Switch Training compound as it is hosting the server.
4. (b) Optical fibre.
Question 26:
Vidya for All is an educational NGO. It is setting up its new campus at Jaipur for its web-based activities.
Аnswer:
mind the distances and other given parameters.
1.
2. The most suitable place to house the server for this NGO is Training Building because it has the
maximum number of computers.
3. (a) Repeater As per one layout (shown in (i)),the repeater can be avoided as all distances between
the compounds are <= 100 m.
(b) Hub/Switch Training building as it is hosting the server.
4. (b) Optical fibre.
Question 27:
Eduminds University of India is starting its campus in a small town Pa ram pur of Central India with its
centre admission office in Delhi. The university has three major buildings comprising of Admin building,
Academic building and Research building in 5 km area campus.
As a network expert, you need to suggest the network plan as per (i) to (iv) to the authorities keeping in
1. Suggest the authorities, the cable layout amongst various buildings inside the university campus
for connecting the buildings.
2. Suggest the most suitable place (i.e. building) to house the server of this organisations with a
suitable reason.
3. Suggest an efficient device for the following to be installed in each of the building to connect all
the computers
(a) Gateway
(b) Modem
(c) Switch
4. Suggest the most suitable (very high speed) service to provide data connectivity between
admission building located in Delhi and the campus located in Parampur form the following
options:
o Telephone line
o Fixedline dial-up connection
o Co-axial cable network
o GSM
o Leased line
o Satellite connection.
Аnswer: 2. Suggest the most suitable place (i.e. wing) to house the server, with a suitable reason.
3. Suggest and placement of the following devices with reasons.
(a) Repeater
(b) Switch
4. The Institute is planning to link its study centre situated in Delhi. Suggest an economic way to
connect it with reasonably high speed. Justify your answer.
Аnswer:
1. Since, the distance between Lib Wing and Admin Wing is small. So type of networking is small, i.e.
1. LAN.
2. The most suitable place to house the server is Academic Building as it has maximum number of 2. Since, maximum number of computers are in Student Wing, so suitable place to house the server
computers. Thus, it decreases the cabling cost and increase efficiency of network. is Student Wing.
3. (c) Switch is to be installed in each of building to connect all the computers. 3. (a) Repeater should be installed between Student Wing and Admin Wing as distance is more than
4. Satellite connection. 60 m.
(b) Switch should be installed in each wing to connect several computers.
Question 28: 4. Broadband connection as it is between economical and speedy.
Institute of Distance Learning is located in Pune and is planning to go in for networking of four wings for
better interaction. The details are shown below: Delhi 2009C Question 29:
Bias Methodologies is planning to expand their network in India, starting with three cities in India to
build infrastructure for research and development of their chemical products. The company has planned
to set up their main office in Pondicherry at three different locations and have named their offices as
Back Office, Research Lab and Development Unit. The company has one more research office namely
1. Suggest the type of networking (LAN, MAN, WAN) for connecting Lib Wing to Admin Wing. Justify
your answer.
Corporate Unit in Mumbai. A rough layout of the same is as follows: Delhi 2008 o Optical fibre
o Ethernet cable.
4. Suggest a cable/wiring layout for connecting the company’s local office units located in
Pondicherry. Also, suggest an effective method/technology for connecting the company’s office
unit located in Mumbai.
Аnswer:
4.
An effective method/technology for connecting the company’s offices-unit located in Mumbai is
dial-up or broadband.
Question 30:
China Middleton Fashion is planning to expand their network in India, starting with two cities in India of
provide infrastructure for distribution of their product. The company has planned to set up their main
office units in Chennai at the different locations and have named their offices as Production Unit,
Finance Unit and Media Unit. The company has its Corporate Unit in Delhi. A rough layout of the same is
1. Suggest the type of network required (out of LAN, MAN, WAN) for connecting each of the
following office units.
o Research Lab and Back Office
o Research Lab and Development Unit.
2. Which one of the following device, will you suggest for connecting all the computers with in each
of their office units?
o Switch/Hub
o Modem
o Telephone.
3. Which of the following communication medium, will you suggest to be procured by the company
for connecting their local office units in Pondicherry for very effective (high speed)
communication?
o Telephone cable
as follows: All India 2008 4. Suggest a cable/wiring layout for connecting the company’s local office units located in Chennai.
Also, suggest an effective method/technology for connecting the company’s office unit located in
Delhi.
Аnswer:
4.
An effective method/technology for connecting the company’s office in Delhi and Chennai is
broadband connection.
Question 31:
Gargi Education Service Ltd. is an educational organisation. It is planning to set up its India campus at
Nepal with its head office at Mumbai. The Nepal campus has 4 main buildings- ADMIN, ENGINEERING,
BUSINEES and MEDIA.
You as a network expert have to suggest the best network related solutions for their problems raised in
(i) to (iv), keeping in mind the distance between the buildings and other given parameters.
1. Suggest the kind of network required (out of LAN, MAN, WAN) for connecting each of the
following office units:
o Production Unit and Media Unit
o Production Unit and Finance Unit.
2. Which one of the following device will you suggest for connecting all the computers with in each
of their office units?
o Switch/Hub
o Modem
o Telephone.
3. Which of the following communication media, will you suggest to be procured by the company
for connecting their local office units in Chennai for very effective (high speed) communication?
o Telephone cable
o Optical fibre
o Ethernet cable.
Аnswer:
1. ADMIN is the most appropriate location of the Nepal Campus because it has maximum number of
computers.
2.
3. Firewall.
4. (c) Video Conferencing.
TOPIC – 3
Mobile Telecommunication and
Network Security
Question 1:
Write one characteristics each for 2G and 3G mobile technologies. Delhi 2014
Answer:
Characteristic of 2G mobile technology is that, it has introduced data services for mobile, starting with
text messaging. Characteristic of 3G mobile technology is that it is faster than 2G and supports video
calling.
Question 2:
What is the difference between video conferencing and chat? Delhi 2014
Answer:
Chat generally involves one-to-one communication. On the other hand, video conferencing means more
than two persons are involved in a discussion.
Question 3:
1. Suggest the most appropriate location of the server inside the Nepal Campus (out of 4 buildings), Expand the following:
to get the best connectivity for maximum number of computers. Justify your answer.
2. Suggest and draw the cable layout to efficiently connect various buildings within the Nepal
(i) GPRS
Campus for connecting the computers.
(ii) CDMA (Hi) GSM
3. Which hardware device will you suggest to be procured by the company to be installed to protect
and control the Internet uses within the campus.
4. Which of the following will you suggest to establish the online face-to-face communication Answer:
between the people in the ADMIN office of Nepal Campus and Mumbai Head Office?
(a) Cable TV
(i) GPRS General Packet Radio Services
(b) E-mail
(ii) CDMA Code Division Multiple Access
(c) Video Conferencing
(iii) GSM Global System for Mobile Communication.
(d) Text Chat 4,
Question 4: (i) E-mail
Write two characteristics of Wi-Fi. All India 2014 (ii) VoIP
Answer: (iii) FTP
Characteristics of Wi-Fi are as follows:
Answer:
(i) It is a wireless solution for getting connected to the Internet.
(ii) It is handy as well as available throughout the journey.
(ii) VoIP.
Question 5:
Question 9:
What is the difference between E-mail and chat? All India 2014
Which out of the following does not come under cyber crime? Delhi 2012
Or
How is an E-mail different from a chat? Delhi 2008C
Answer: (i) Stealing a mouse from someone’s computer.
In order to chat, you need have an account on the same service as the person you are chatting with. e.g. (ii) Operating someone’s Internet banking account, without his knowledge.
on the other hand, in case of E-mail, it is not necessary, i.e. you can have an account from any provider (iii) Entering in someone’s computer remotely and copying data, without seeking his permission.
and you can establish your own.
Answer:
Question 6:
Which of the following crime(s) is/are covered under cyber crime? Delhi 2013 (i) Stealing a mouse from someone’s computer.
(i) Stealing brand new hard disk from a shop. Question 10:
(ii) Getting into unknown person’s social networking account and start messaging on his behalf. Which of the following come under cyber crime? All India 2012
(iii) Copying some important data from a computer without taking permission from the owner of the
data.
(i) Operating someone’s Internet banking account, without his knowledge.
(ii) Stealing a keyword from someone’s computer.
Answer: (iii) Working on someone’s computer with his/her permission.
(ii) Getting into unknown person’s social networking account and start messaging on his behalf. Answer:
Question 7: (i) Operating someone’s Internet banking account, without his knowledge.
Which of the following crime(s) does not come under cyber crime? All India 2013
Question 11:
(i) Copying some important data from a computer without taking permission from the owner of the What is VoIP? Delhi 2011
data. Answer:
(ii) Stealing keyboard and mouse from a shop. VoIP (Voice over Internet Protocol) is simply the transmission of voice traffic over IP-based networks.
(iii) Getting into unknown person’s social networking account and start messaging on his behalf. VoIP has been around in one form or another, since 1973 when it began as an experiment by US.
Question 19:
(i) HTTP
Write two applications of cyber law.
(ii) VoIP
Answer:
The two applications of cyber law are:
Answer:
(i) This law should be enforced between the two parties while making an agreement for transactions by
(i) HTTP HyperText Transfer Protocol using the cyber technology.
(ii) VoIP Voice over Internet Protocol (ii) This law forms the basis of any legal penal action to be taken against the party, who has committed
any kind of cyber crime.
Question 15:
Which of the following will come under cyber crime? Delhi 2011 Question 20:
How is a hacker different from a cracker? Delhi 2008
Answer:
(i) Theft of a brand new sealed pack laptop.
Hackers These are the persons who get unauthorised access to the websites and replace them with
(ii) Access to a bank account forgetting in unauthorised money transaction.
other websites or unlawful information.
(iii) Modification in a company data with unauthorised access.
Crackers The person who uses certain software to trap authenticated information or to crack the
(iv) Photo copying a printed copy.
security codes such as user names and password to illegally access the information of computers is
called a cracker.
Answer:
Question 21:
(ii) Access to a bank account for getting in unauthorised money transaction. What is the importance of cyber law?
or
Question 16: What is the significance of cyber law?
What is the difference between virus and worm in the computer? All India 2010 Answer:
Answer: Cyber law forms the basis of an agreement between the two parties making transactions using cyber
The main difference between virus and worm is the method by which they reproduce and spread. A technologies. It is enforced over all activities performed in which computer plays an important role. Any
virus is dependent upon a last life of boot sector and the transfer of files between machines to spread, such activity, which is proved to be happened by breaking the rules of cyber law is punishable act and
while a worm can run completely independent and spread itself through network connection. suitable punishments can be awarded under cyber crime act and sections before the court of law.
Question 18:
Expand the following terminologies: Question 23:
What do you mean by spam mails? How can you protect you mailbox from spams?
Answer:
Spam mails, also known as junk E-mail, is a subset of spam that involves nearly identical messages sent e.g. 1.160.10.240 could be an IP address.
to numerous recipients by E-mail. We can protect our mailbox from spams by creating appropriate A domain name is a name that identifies one or more IP addresses.
filters. e.g. the domain name microsoft.com represents about a dozen IP addresses.
TOPIC – 4 Question 6:
Web Services, Open Source Name one client-side scripting language and one server-side scripting language. Delhi; All India 2012
Software and Cloud Computing Answer:
Client-side scripting language—VB Script
Very Short Answer Type Questions [1 Mark] Server-side scripting language—ASP
Question 1:
Write names of any two popular open source software, which are used as operating system. All India; Question 7:
Delhi 2014 Give one suitable example of each URL and domain name. Delhi; All India 2012
Answer: Answer:
Following are the two popular open source softwares used as operating system: URL http://www.Gabsclasses.ccm/aboutus
Domainname www.Gabsclasses.com
(i) GNU
(ii) OpenSolaris. Question 8:
Name two open source software alongwith its applications. Delhi 2012
Or
Question 2: Give two examples of open source software. Delhi 2012C
Write any two important characteristics of cloud computing. Delhi; All India 2014 Answer:
Answer: Two open source softwares alongwith its applications are open office, used to make documents and
Two characteristics of cloud computing are as follows: Linux is an operating system.
(i) The provider’s computing resources are pooled together to serve multiple consumers with different Question 9:
physical and virtual resources dynamically assigned and reassigned according to the consumer demand. Name two proprietary softwares alongwith their applications. All India 2012
(ii) It supports multi-tenacity, i.e. policy driven enforcement segmentation, isolation governance, service Answer:
levels and chargeback/billing models for different consumer constituencies. Two proprietary softwares alongwith their applications are:
Answer: Answer:
(i) GNU GNU’s NOT UNIX. (i) XML extensible Markup Language
(ii) XML extensible Markup Language. (ii) FLOSS Free Libre and Open Source Software
(iii) HTTP HyperText Transfer Protocol
(iv) FTP File Transfer Protocol.
Question 14:
Write the full form of the following:
Question 19:
Why GNU is known as “GNU Not Unix”?
(i) FTP
Answer:
(ii) FSF
GNU is a recursive acronym for “GNU Not Unix”, which was selected because its design is similar to Unix
but it does not contain actual UNIX code.
Answer:
Short Answer Type Question [2 Marks] TOPIC-1
Data Structures
Question 20: Short Answer Type Questions (2 marks)
Explain the following terms in short:
Question 1:
(i) DHTML Define a data structure.
(ii) ISP Answer:
A data structure is a group of data which can be processed as a single unit. This group of data may be of
Answer: similar or dissimilar data types. Data Structures are very useful while programming because they allow
processing of the entire group of data as a single unit.
(i) DHTML DHTML stands for Dynamic HyperText Markup Language. It refers to the web content that
changes according to user request. It will react the user input without sending requests to the web Question 2:
server. Name the two types of data structures and give difference between them.
(ii) ISP ISP stands for Internet Service Provider. It refers to the company that provides Internet Services. Answer:
Some common examples of ISPs are Airtel, BSNL, Tata docomo, etc. Data structures are of two types: Linear and Non – Linear.
Question 3:
Give difference between an array and a list in Python.
Answer:
An array is defined as a set of contiguous data of similar data type. Python lists are actually arrays of
variable length. The elements of a list are of eterogeneous types which means they are of different data
types.
Question 4:
How are lists implemented in memory?
(or)
How is memory allocated to a list in Python?
Answer:
A list in Python is an array that contains elements (pointers to objects) of a specific size only and this is a
common feature of all dynamically typed languages. For implementation of a list, a contiguous array of
references to other objects is used. Python keeps a pointer to this array and the array’s length is stored
in a list head structure. This makes indexing of a list independent of the size of the list or the value of the
index. When items are appended or inserted, the array of references is resized.
Question 5:
What is sequential allocation of memory? Why do we say that lists are stored sequentially?
Answer:
A list is a allocated memory in sequential manner. This means that the elements of the list are stored in
memory in sequence of their declaration. So, if you want to view the fifth element of the list, you have
to first traverse through first four elements of the list. This is called sequential allocation of memory.
TOPIC-2 the value not present in the list.
Searching Lists Answer:
Short Answer Type Questions-I (2 marks) def binarysrch (nums, x):
high=len (nums)
low=0
Question 1:
while low < high:
How is linear search different from binary search?
mid=(low+high)/2
Answer:
midval=nums [mid]
if midval > x:
1. Binary search requires the input data to be sorted near search doesn’t. low = mid + 1
2. Binary search requires an ordering comparison; linear search only requires equality comparisons elif midval < x:
3. Binary search has complexity 0(log n); linear search has complexity O(n) as discussed earlier. high = mid
4. Binary search requires random access to the data; linear search only requires sequential access else:
(this can be very important – it means a linear search can stream data of arbitrary size). return mid
return -1
Short Answer Type Questions-II (2 marks)
TOPIC-3
Question 1: List Sorting
Accept a list containing integers randomly. Accept any number and display the position at which the Short Answer Type Questions-I (2 marks)
number is found in the list.
Answer:
Question 1:
maxrange = input(“Enter Count of numbers: ’’)
What is bubble sort?
marks=[]
Answer:
flag=False
Bubble sort is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted,
for i in range(0, maxrange):
comparing each pair of adjacent items and swapping them if they are in the wrong order. The pass
marks. append(input(“ ?”))
through the list is repeated until no swaps are needed, which indicates that the list is sorted. The
number = inputfEnter number to be searched”)
algorithm gets its name from the way smaller elements “bubble” to the top of the list. Because it only
for i in range(0, maxrange):
uses comparisons to operate on elements, it is also Called a comparison sort.
if marks [i]==number:
print number,“found at position”,i
flag=True Question 2:
if flag==False: Write an algorithm for selection sort.
print number, “not found in list” Answer:
Selection sort performs the following steps:
Question 2:
What will be the status of the following list after the First, Second and Third pass of the slection sort 1. Starting at index 0, search the entire array to find the next smallest or largest value.
method used for arranging the following elements in descending order? 2. Swap the smallest or largest value found with the value at index 0.
Note : Show the status of all the elements after each pass very clearly underlining the changes. 3. Repeat steps 1 & 2 starting from the next index.
12,14, -54,64,90,24
Answer: Question 3:
Explain insertion sort.
Answer:
Every repetition of insertion sort removes an element from the input data, inserting it into the correct
position in the already-sorted list, until no input elements remain. The choice of which element to
remove from the input is arbitrary and can be made using almost any choice algorithm.
Question 3:
Question 5:
Write a function that takes a sorted list and a number as an argument. Search for the number in the
What will be the status of the following after the First, Second and Third pass of the insertion sort
sorted list using binary search.
method used for arranging the following elements in descending order ?
Answer:
Note: Show the status of all the elements after each pass very clearly underlining the changes.
def binary_search(SORTEDLIST, number):
Answer:
low=0
high=len(SORTEDLIST)
found=False
while(low<high) and found==False:
mid=(int) (low+high/2)
if SORTEDLIST[mid]==number:
print “Number found at”,mid
found=True
break Question 6:
elif SORTEDLIST[mid]<number: Consider the following unsorted list:
99 78 25 48 51 11 for i in range(0, len (DATA_LIST)):
Sort the list using selection sort algorithm. Show the status of the list after every iteration. min = i
Answer: for j in range(i + 1, len(DATA_LIST)):
def selection_sort(DATA_LIST): if DATA_LIST[j][2] > DATA_LIST[min][2]:
for i in range(0, len (DATA_LIST)): min = j
min = i # swapping
for j in range(i + 1, len(DATA_LIST)): DATA_LIST[min] [0] ,
if DATA_LIST[j] < DATA_LIST[min]: DATA_LIST[i] [0] = DATA_LIST[i] [0] ,
min = j DATA_LIST[mm] [0] DATA_LIST[min][l],
# swapping DATA_LIST[i][l] = DATA_LI ST [i] [ 1 ],
temp= DATA_LIST[min] DATA_LI ST [min] [ 1 ] DATA_LIST[min] [2] ,
DATA_LIST[min] = DATA_LIST[i] DATA_LIST[i] [2] = DATA_LIST[i] [2],
DATA_LIST [i]=temp DATA_LIST[min] [2]
print DATA_LIST print DATA_LIST
DATA_LIST = [99 78 25 48 51 11] maxrange=input(“Enter Number of Students: ”)
print “LIST BEFOR SORTING”,DATA_LIST Students=[]
selection_sort(DATA_LIST) for i in range(maxrange):
Details=[]
Details. append(input(“Enter roll_no”))
Question 7:
Details.append(raw_input(“Enter name”))
Consider the following unsorted list Neena Meeta Geeta Reeta Seeta Sort the list using selection sort
Details. append(inprft(“Enter marks”))
algorithm. Show the status of the list after every iteration.
Students.append(Details)
(or)
print Students
Sort a list containing names of students in ascending order using selection sort.
selection_sort(Students)
Answer:
def selection_sort(DATA_LIST):
for i in range(0, len (DATA_LIST)): Question 9:
min = i What will be the status of the following list after the First. Second and Third pass of the insertion sort
for j in range(i + 1, len(DATA_LIST)): method used for arranging the following elements in descending order ?
if DATA_LIST[j] < DATA_LIST[min]: 12,34,46, -34,90,23
min = j Note : Show the status of all the elements after each pass very clearly underlining the changes.
# swapping Answer:
temp= DATA_LIST[min] output of diferent passes Pass One
DATA_LIST[min] = DATA_LIST[i] [12,34,46,-34,90,23], {}
DATA_LIST[i]=temp Pass Two
print DATA_LIST [34, 46, -34, 90, 23} , {12}
NAME_LIST = [‘Neena’,’Beeta’,’Reeta’,’Geeta’,’Seeta’] Pass Three
print “LIST BEFORE SORTING”,NAME_LIST LISTS MANIPULATION AND IMPLEMENTATION
selection_sort(NAME_LIST) [46, -34, 90, 23} , {12, 34} Pass Six
LIST BEFORE SORTING [‘Neena’,‘Beeta’,‘Reeta’, ‘Geeta’, ‘Seeta’] Pass Four {23}, {-34,12, 34, 46, 90}
[‘Beeta’, ‘Neena’, ‘Reeta’, ‘Geeta’, ‘Seeta’]-Pass 1 [-34, 90, 23} , { 12, 34, 46} Pass Seven
[‘Beeta’, ‘Geeta’, ‘Reeta’, ‘Neena’, ‘Seeta’]-Pass 2 Pass Five {} , {-34,12, 23, 34, 46, 90}
[‘Beeta’, ‘Geeta’, ‘Neena’, ‘Reeta’, ‘Seeta’]-Pass 3 {90,23} , {-34,12,34,46} It is the sorted list.
[‘Beeta’, ‘Geeta’, ‘Neena’, ‘Reeta’, ‘Seeta’]-Pass 4
[‘Beeta’, ‘Geeta’, ‘Neena’, ‘Reeta’, ‘Seeta’]-Pass 5
Long Answer Type Questions (4 marks)
Question 8:
Question 1:
A list contains rollno, name and marks of the student. Sort the list in descending order of marks using
Consider the following unsorted list: 90 78 20 46 54 1 Write the list after:
selection sort algorithm. [CBSE Text Book]
Answer:
def selection_sort(DATA_LIST): 1. 3rd iteration of selection sort
2. 4th iteration of bubble sort – Pop # Numeric value for Population instance attributes
3. 5th iteration of insertion sort Ans. Working : -KM # Numeric value
– Ccode # Numeric value
Answer: – Density #Numeric value for Population Density
Working : Methods:
– Dencal() #Method to calculate Density as Pop/KM
– Record() #Method to allow user to enter values Ccode, CName, Pop, KM and call DenCal ( ) method
– View() #Method to display all the members also display a message “Highly Populated City” if the
Density is more than 10000.
Answer:
class CITY:
def_init_(self): self.Ccode = 0
self.CName = self. Pop = 0
self.KM = 0 self.Density = 0
def DenCal (self) :
self.Density = self.Pop/self. KM
def Record (self)
self Ccode=input (“Enter Ccode”)
1. 3rd iteration of selection sort: [1,20,46,78,54,90]
self.CName=raw_input (“Enter CName”)
2. 4th iteration of bubble sort: [1, 20, 46, 54, 90, 78]
self.Pop=input (“Enter population”)
3. 5th iteration of insertion sort: [1, 20, 46, 54, 78, 90
self.KM=input (“Enter KM”)
DenCal(self) //or self.DenCal()
Question 2: def View (self):
Consider the following unsorted list: print Ccode, CName, Pop, KM, Density
10 5 55 13 3 49 36 if self.Density > 10000:
Write the position of elements in the list after: print (“Highly populated city”)
(i) 5th iteration of bubble sort
# OR print (“Highly populated city”)
(ü) 7th iteration of insertion sort
(iii) 4th iteration of selection sort
Answer: Question 4:
Working : A list contains Item_code, Item_name, qty and price. Sort the list :
Answer:
def bubble_sort(DATA_LIST) :
i=0
j=0
l = len(DATA_LIST)
for i in range(l):
print “Bubble Sort Iterations – Asc order of Quantity”
for j in range(i+l,l):
if DATA_LlST[i][3] > DATA_LIST[j][3]:
1. 5th iteration of bubble sort: [3, 5,10,13, 36, 55, 49] # swapping
2. Insertion sort doesn’t have the 7th iteration DATA_LIST[i][0], DATA_LIST[j] [0]=DATA LIST[j] [0],DATA_LIST[i] [0]
3. 4th iteration of selection sort: [3, 5,10,13, 55, 49, 36] DATA_LIST[i][1], DATA_LIST[j][1]=DATA_ LIST[j][l],DATA_LIST[i][l]
DATA_LIST[i] [2], DATA_LIST[j] [2]=DATA_ LIST[j][2],DATA_LIST[i][2]
Question 3: DATA_LIST[i][3], DATA_LIST[j][3]=DATA_ LIST[j][3] ,DATA_LIST[i] [3]
Write a class CITY in Python with following print DATA_LIST
– CName # String Value specifications :
def insertion_sort(DATA_LIST): Answer:
for K in range (1, len(DATA_LIST)): Queue is a first-in, first-out (FIFO) data structure, i.e. the element added first to the queue will be the
temp=DATA_LIST[K][2] one to be removed first. Elements are always added to the rear of the queue and removed from the
ptr=K-1 front of the queue.
print “Insertion Sort Iterations – Desc order of price”
while(ptr>=0) and DATA_LIST[ptr][2] < temp:
Question 4:
DATA_LIST[ptr+1] [0]=DATA_LIST[ptr] [0]
Write all the operations possible in data structure.
DATAJHST [ptr+1] [1]=DATA_LIST[ptr] [1]
Answer:
DATA_LIST[ptr+1][2]=DATA_LIST[ptr][2]
The major operations are:
DATA_LIST[ptr+1] [3]=DATA_LIST[ptr] [3]
ptr=ptr-1
DATA_LIST[ptr+1][2]=temp 1. Traversal
print DATA_LIST 2. Insertion
maxrange = input(“Enter Number of Items: “) 3. Deletion
Items=[] 4. Searching
for i in range (maxrange):
Details=[] Question 5:
Details. append(input(“Enter Item Code”)) What are the two major queue operations?
Details.append(raw_input(“Enter Item name”)) Answer:
Details.append(float(raw_input(“Enter price”))) Addition of element is known as INSERT operation, also known as enqueuing. It is done using rear
Details.append(input(“Enter Quantity”)) Items. append(Details) terminal position, i.e. tail end. Removal of element is known as DELETE operation, also known as
print “BEFORE SORTING”,Items bubble_sort(Items) dequeueing.
insertion_sort(Items)
Short Answer Type Questions-I (2 marks)
TOPIC-4
Stacks And Queues With Lists Question 1:
Very Short Answer Type Questions (1 mark) Write an algorithm to implement push operation.
Answer:
Question 1:
Expand the following: 1. Start
2. Initialize top with -1.
1. LIFO 3. Input the new element.
2. FIFO 4. Increment top by one.
5. stack[top]=new element
Answer: 6. Print “Item Inserted”
7. Stop
1. LIFO: Last-In First-Out
Question 2:
2. FIFO: First-In First-Out
Write an algorithm to implement pop operation.
Answer:
Question 2:
Define stack.
Answer: 1. Start
A stack is a data structure that allows adding and removing elements in a particular order. Every time an 2. If the value of top is -1 go to step 3 else go to step 4
element is added, it goes on the top of the stack; the only element that can be removed is the element 3. Print “Stack Empty” and go to step 7
that was at the top of the stack. 4. Deleted item = Stack[top]
5. Decrement top by 1
6. print “Item Deleted”
Question 3:
7. Stop
Define Queue.
Question 3: Answer:
Write an algorithm to implement insertion opera¬tion of queue. class queue:
Answer: city=[ ]
def Insert (self):
a = raw_input(“Enter city”)
1. Start
queue.city append (a)
2. Check FRONT and REAR value,
def Delete (self):
1. if both the values are -1, then FRONT and REAR are incremented by 1
if (queue, city = = []):
2. other wise Rear is incremented by one.
print “Queue empty”
3. queue [Rear]=new element.
else:
4. Stop
print “Deleted element is”,
queue.city[0]
Question 4:
queue.city.delete ()
Write an algorithm to implement deletion operation of queue.
OR
Answer:
class queue:
city=[ ]
1. Start def Insert(self):
2. Check for underflow situation by checking value of Front=-1 a=raw_input(“Enter city”)
1. If it is display appropriate message and stop queue.a.append(a)
2. Otherwise Deleted item=queue [Front] def Delete(self):
3. If Front=Rear then Front=Rear=-1 Otherwise Front is incremented by one if (queue.city==[ ]):
4. Print “Item Deleted” print (“Queue emtpy”)
5. Stop else
print (“Deleted element is”,queue, city [0])
Question 5:
For a given list of values in ascending order, write a method in Python to search for a value with the help
Question 2:
of Binary Search method. The method should return position of the value and should return -1 if the
Define stack class in Python to operate on stack of numbers.
value not present in the list.
Answer:
Answer:
class Stack:
def Binary Search (list, search):
def_init_(self):
lower_bound=0
self.s = [ ]
upper_bond=len(list) -1
def push(self):
found=false
a = input(“Enter number”)
pos=’x’
self.s. append(a)
while lower_bound< =upper_bond:
def pop(self):
middle_pos=(lower_bound + upper_bond)/2
self.s.pop()
if list [middle_pos] = = search:
def display (self):
pos=middlepos found=True break
l = len(self.s)
elif search < list [middle_pos]:
for I in range(l-1,1,-1):
upper_bound=middle_pos-l else:
print self.s[i]
lower_bound=middle_pos + 1 if found:
print(“The item found”, pos) else:
print (“The item not available”) Question 3:
return (-1) Write a function to push any student’s information to stack.
Answer:
def push(stack):
Long Answer Type Questions (4 marks)
s=[]
print “STACK BEFORE PUSH” display(stack)
Question 1: s.append(input(“Enter student rollno?”))
Write Insert (city) and Delete (City) methods in Python to add City and Romave City considering them to s.append(raw_input(“Enter student name”))
act as Insert and Delete operations of the data structure Queue. s.append(raw_input(“Enter student grade”))
stack, append(s) def delete (self):
def display (stack): if (queue.place==[ ] ):
l=len(stack) print (“Queue empty”)
print “STACK CONTENTS” else:
for i in range(l-1,-1,-1): print (“Deleted element is” queue, place [0])
print stack[i] queue.place.delete ( )
stack=[]
print “Creating Stack”
Question 6:
n = input(“Enter the number of students”)
Write the pop operation of stack containing names using class.
for i in range(n): student = []
Answer:
student.append(input(“Enter student rollno?”))
class stack:
student.append(raw_input(“Enter student name”))
s=[]
student.append(raw_input(“Enter student grade”))
def push (self):
stack, append(student) push(stack)
a=raw_input(“Enter any name :”)
display(stack)
stack.s.append(a)
def pop(self):
Question 4: if (a.s==D):
Write the push operation of stack containing names using class. print “Stack Empty”
Answer: else:
class stack: print “Deleted element is : ”,
s=[] a.s.pop()
def push(self): def display (self):
a=r’aw_input(“Enter any name :”) l=len(stack.s)
stack.s.append(a) print “STACK CONTENTS”
def display(self): for i in range(l-1,-1,-1):
l=len(stack.s) for i in range(l-1,-1,-1): print stack.s[i]
print stack.s[i] a=stack()
a=stackO n= input(“Enter no. of names”)
n= input(“Enter no. of names”) for i in range(n):
for i in range (n): a.push()
a.push() a.pop()
a.display() a.display()
Question 5: Question 7:
Write Insert (Place) and Delete (Place) methods in Python to be add Place and Remove Place considering Write the pop operation of stack containing num-bers using class.
them to act as Insert and Delete operations of the data structure Queue. Answer:
Answer: class stack:
Class queue: place=[] s=[]
def Insert (self): def push(self):
a=raw_input (“Enter city”) a=input(“Enter number :”)
queue.place. append (a) stack.s.append(a)
def delete (self): def pop(self):
if (queue.place = = []): if (a.s==[]):
print “Queue empty” print “Stack Empty”
else: else:
print “Deleted element is”, queue, place [0] print “Deleted element is : ”,a.s.pop()
class queue : def display(self):
place = [ ] l=len(stack.s) print “STACK CONTENTS”
def Insert (self) 1 for i in range(l-1,-1,-1):
a = rawjnput (“Enter place”) queue, a.append (a) print stack.s[i]
a=stack() a.insert()
n= input(“Enter count of numbers”) a.display()
for i in range (n):
a.push()
Question 10:
a.pop()
Write Add(Fruit) and Remove (Fruit) methods in Python to insert name of a Fruit and to delete name of
a. display ()
a Fruit considering them to act as Insert and Delete operations of the data structure Queue.
Answer:
Question 8: def que insert (fruit, Rear) :
Write a function to add any customer’s information to queue. ch=‘y’
Answer: while ch==‘y’ or ch==‘yes’
def insert(queue): customer=[] Frt=input(“Enter a fruit”)
print “QUEUE BEFORE INSERT” display(queue) Rear=Rear + 1
customer.append(input(“Enter customer number?’’)) Fruit, append (Frt)
customer.append(raw_input(“Enter customer name”)) print(“Do you wand to Add more”)
customer.append(input(“Enter customer phone number”)) ch=input ().upper ( )
queue. append(customer) if ch==’N’ or ch==‘No’ :
def display (queue): break
l=len(queue) return rear
fori in range(O.l): print queue[i] def quedelete (Fruit, Rear):
queue=[] if not len (fruist):
print “Creating Queue” print f(“Fruit + list is empty”)
n=input(“Enter the number of customers”) else :
for i in range(n): Rear = Rear – 1
customer=[] Frt = Fruit.pop( )
customer. append(input(“Enter customer number?”)) print(“Fruit is delete from list”)
customer.append(rawjnput(“Enter customer name”)) return Rear
customer.append(input(“Enter customer phone number”))
queue.append(customer)
Question 11:
insert(queue)
Write the deletion operation of queue containing characters using class.
display(queue)
Answer:
class queue:
Question 9: s=0
Write the insertion operation of queue containing character using class. def insert(self):
Answer: a=raw_input(“Enter any letter:”)
class queue: queue.s.append(a)
s=0 def delete(self):
def insert(self): if (a.s==[]):
a=raw_input(“Enter any letter:”) print “Queue Empty”
queue.s.append(a) else:
def display (self): print “Deleted element is: ”,queue.s[0]
l=len(queue.s) del queue.s[0]
print “QUEUE CONTENTS” def display(self): l=len(queue.s)
for i in range(o,l): print “QUEUE CONTENTS”
print queue. s[i] for i in range(0,l):
a=queue() print queue.s[i]
n= input(“Enter no. of letters”) a=queue()
for i in range(n): a.insert() n= input(“Enter no. of letters”)
ch = raw_input(“Do you want to insert more letters”) for i in range (n):
if ch==‘y’: a.insert()
a. delete() Question 4:
a. display () Convert (A+B)*C in to postfix form.
Answer:
AB+C*
Question 12:
Write the deletion operation of queue containing numbers using class.
Answer: Short Answer Type Questions-I (2 marks)
class queue:
s=[]
Question 1:
def insert(self):
Evaluate the following postfix notation of expressio,
a=input(“Enter the number:”)
Show status of stack after every operation.
queue.s.append(a)
12,2,7,34,20,-, +,5, +
def delete(self):
Answer:
if (a.s==Q):
print “Queue Empty”
else:
print “Deleted element is: ”,queue.s[0]
del queue.s[0]
def display(self):
l=len(queue.s)
print “QUEUE CONTENTS”
for i in range(0,l):
print queue.s[i]
a=queue()
n= input(“Enter no. of numbers”)
for i in range(n):
a.insert()
a.delete()
a.display()
TOPIC-5 Question 2:
Applications of Stacks Evaluate the following postfix expression. Show the status of stack after execution of each operation
Very Short Answer Type Questions (1 mark) separately: 2,13, + , 5, -,6,3,/,5,*,<
Answer:
Question 1: Stack contents
Give one example of infix expression.
Answer:
A + B *C / D
Question 2:
Give one example of postfix expression.
Answer:
ABC*D/+ Result: 0
Question 3: Question 3:
Give one example of prefix expression. Evaluate using stack 10, 3,*, 30, 2,*,-
Answer:
+/*BCDA
Answer: Answer:
Question 4:
Evaluate the following Postfix expression :
20,10,-15,3,/, +, 5, *
Answer:
Question 5: Question 6:
Convert A+ (B*C – (D / E A F) * G) * H into postfix form showing stack status after every step. Convert (True And False) OR (False And True) into postfix form using stack.
Answer:
Final Result = 1
Question 9:
Evaluatethefollowingpostixnotationofexpression. Show status of stack after every operation.
12,2, *, 24,20, -, +, 8, –
Answer:
Question 7:
What are the applications of queue in computer?
Answer:
In a single processor multitasking computer, job(s) wait to be processed form a queue. Same happens
when we share a printer with many computers.
Question 10:
Give few applications of stack.
Compiling a HLL code. Answer:
Using download manager, for multiple files also uses queue for ordering the files.
In multiuser OS – job scheduling is done through queue.
1. Expression evaluation
2. Backtracking (game playing, finding paths, exhaustive searching).
Question 8: 3. Memory management, run-time environment for nested language features.
Evaluate the following postfix notation of expression. Show status of stack after every operation.
Answer:
Short Answer Type Questions-II (2 marks)
Question 1:
Write an algorithm to evaluate postfix expression.
Answer:
Step 1: Start
Step 2: Check all symbols from left to right and repeat steps 3 & 4 for each symbol of expression ‘E’ until
all symbols are over.
Question 2:
Write an algorithm to convert infix to postfix.
Answer: