You are on page 1of 103

STRICTLY BASED ON LATEST SYLLABUS

(30% LESS DURING COVID-19)

2023

FOR 100% SURE SUCCESS

COMPUTER SCIENCE
CLASS-X
ØekeâeMekeâ :
Strictly based on latest (one paper)
examination pattern as adopted
by UPMSP, Prayagraj
27-Gulshan Vihar, Jansath Road,
Muzaffarnagar-251001 (U.P.)
Phone : 0131-2660440
e-mail : aviralpublications@gmail.com
time
Your faithful partner on way of success...

Dear Students,
is based on latest examination
pattern as adopted by UPMSP w.e.f. 2018-
19. Each chapter includes objective type,
very short answer type, short answer type
© Publisher and long answer type questions alongwith
5 unsolved test papers for practice
To check the level of preparation five
Pre-Board Online Question Papers will be
available on shribalajibooks.com before
Board Examination. Students may
download these papers time to time
scanning the QR code printed at the title.
Topics deleted for session 2022-23 due
to Covid-19, have been deleted.
We hope that will cater your
efkeâmeer Yeer $egefš kesâ efveJeejCe nsleg hee"keâeW kesâ megPeeJe meeoj needs and will ensure your grand success.
Deeceefv$ele nwQ~
efkeâmeer Yeer heefjJeeo kesâ efueS vÙeeefÙekeâ #es$e cegpeheäheâjveiej
nesiee~ — Publisher
Fme hegmlekeâ keâes $egefšjefnle ØekeâeefMele keâjves keâe hetCe&
ØeÙeeme efkeâÙee ieÙee nw, efheâj Yeer Ùeefo DeefveÛÚe mes FmeceW
keâesF& $egefš jn ieF& nes, lees Gmemes Glhevve efkeâmeer Yeer #eefle
kesâ efueS uesKekeâ, ØekeâeMekeâ leLee cegõkeâ keâe keâesF& oeefÙelJe
veneR nesiee~
Syllabus
Note : Topics under bold area have been deleted due to Covid-19 for 2022-23 Board Examinations.

Note: There will be a question paper of 70 marks in this subject to be solved in three hour.
PART-I
1. Computer and Communications 15 Marks
Communication Channel: Sender, Receiver, Media and Protocol, Types of Communication Channels,
Communication Media: WIRED and WIRELESS; Simplex and Full duplex, Networks: LAN and WAN Internet.
2. Linux Operating System 15 Marks
Advanced Function/ Features
Command Line Interface (CLI) and Graphic User Interface (GUI)
File Search and Text Search
Messaging Over LAN
Text Processing Command: CAT, GREP etc.
Vi Text Editor
Introduction to Linux Desktop
Security Management and its type in Linux.
3. Binary Arithmetics and Logic Gates 15 Marks
Bits, Nibble, Bytes Arithmetic: Word Length, Character Representation ASCII Characters Code, Simple Binary
Arithmetic: Addition, Subtraction, Multiplication and Division, Computer Logics, Boolean Operations, Logical
Operators: NOT, AND, OR, NOR, NAND and Truth Table.
PART-II
4. Advance Programming in ‘C’ 25 Marks
(a) Subscripted Variables (ARRAYS)
(i) Introduction
(ii) Single and Double Subscripted Variables
(iii) Searching and Sorting
(b) Arrays and Strings
(c) Functions and Subroutines, Library Function
(d) String Manipulations
String Functions: Direction to Switch between Numeric and String
Concatenation: To Add Characters in Word
(e) File Operation
Use of Sequential Files
Use of Random Files
Practical and Project Work 30 Marks
There will be Internal Examination of 30 marks on Computer Science for the session 2011-12.15 marks have
been allotted for Practical Work and 15 marks for Project Work.
Practical Work: Practical will done in different modules front chapter 2 and 4.15 marks have been allotted for
practical work. There will be Internal assessment of practical work at school level.
Project Work: Teachers are expected to have at least three projects from the prescribed list compulsorily
prepared by the students. The teachers may also ask the students preparing projects on same, other topics not
included in the prescribed list. There will be internal examination of project work at school.
Contents
1. Development of Computer, History and Introduction 5-8

2. Kinds and Medium of Communication 9-17

3. Internet 18-21

4. CLI Form of Linux 22-27

5. Discrete Mathematics [Character Representation, Binary 28-35


Arithmetic and Logic Operations]
6. Introduction to ‘C’: Array Searching and Sorting 36-42

7. String in ‘C’ (Deleted for 2022-23 Examinations) 43-47

8. Function in ‘C’ 48-52

9. File Operations in ‘C’ (Deleted for 2022-23 Examinations) 53-56

10. Programs Based on ‘C’ Language 57-75

Project Work 76-82

Solved Paper 83-95

Unsolved Paper 96-103


5

Chapter Development of

1 Computer, History and


Introduction

Multiple Choice Questions

Q.1 Who is known as ‘Father of Computer’?


(a) Charles Babbage (b) Herman Hollerith (c) Blaise Pascal (d) John W. Mauchly
Q.2 Computers that work by counting are known as:
(a) Analog computers (b) Hybrid computers (c) Both (a) and (b) (d) Digital computers
Q.3 The first electromechanical machine is:
(a) Mechanical calculator (b) Abacus (c) Mark-I (d) Difference Engine.
Q.4 The Model of Difference Engine is represented by:
(a) Pascal (b) Charles Babbage (c) Labniz (d) Howard
Q.5 The first mechanical device used for calculations and counting is:
(a) Calculator (b) Abacus (c) Computer (d) none of these
Q.6 Which of the following is not an input device? (2018)
(a) Key board (b) Printer (c) Mouse (d) Joy-stick
Q.7 Which of the following is not a hardware device? (2018)
(a) Memory (b) Cache (c) Excel (d) Processor
Q.8 Example of word processor is:
(a) Excel (b) RDBMS (c) Foxpro (d) MS-Word

Answers
1. (a) 2. (d) 3. (c) 4. (b) 5. (b) 6. (b) 7. (c) 8. (d)

Very Short Answer Type Questions

Q.1 Who developed the first electromechanical computer?


Ans. Howard Alken.
Q.2 Name the first computer programmer.
Ans. Lady Ada Augusta.
Q.3 What are the full forms of ENIAC and EDVAC?
Ans. ENIAC— Electronic Numerical Integrator and Calculator.
EDVAC—Electronic Discrete Variable Automatic Computer.
Q.4 Give two examples of each Mainframe and Super computers.
Ans. Medha, Sperry (Mainframe) and ETA, CRAY (Super).
Q.5 Classify the computers on the basis of sizes.
6

Ans. On the basis of sizes computers are classified into four catagories:
(a) Micro computer (b) Mini computer (c) Main- frame computer (d) Super computer.
Q.6 Classify the computer on the basis of objective.
Ans. On the basis of objective computers are classified into two catagories:
(a) General objective computers and
(b) Specific objective computers.

Short Answer Type Questions

Q.1 Write the types of computers briefly.


Ans.
TYPES OF COMPUTERS

COMPUTERS COMPUTERS
ON THE BASIS ON THE BASIS
OF INPUT OF SIZE

MICRO MINI MAIN FRAME SUPER

DEGITAL ANALOG HYBRID


Q.2 Draw a block diagram of a computer and write the names of each block. (2016)

M.U.
Memory Unit

A.L.U.
Arithmetic
Input unit Output unit
Logic Unit

C.U.
Control Unit

Ans. Each computer has three following parts mainly:


(i) Input/outpur unit
(ii) Central processing unit:
(a) Arithmetic logic unit
(b) Control unit
(iii) Memory unit:
(a) Primary storage unit
(b) Secondary storage unit
Q.3 Explain the printer. (2018)
Ans. It is a kind of an output device, which is used to print any data and information on the paper, received by
computer. It may print black and white as well as coloured documents. The quality of printing depends on the
quality of a printer.
The speed of a printer in measured in character per second (i. e. , CPS), line per minute (i. e. , LPM) and pages per
minute (i. e. , PPM). While the quality of a printer is measured in dotes per inch (i. e. , DPI).
7

Q.4 Write a short note on mouse. (2018)


Ans. Mouse: It is a pointing device which is used while the user working with a display based package. It is a
push-button control device that eliminates the need to type computer commands. Instructions are given by the
user to the computer by pointing an arrow on the screen to a picture (or word) and then pushing the button on
the mouse. The user moues the arrow on the screen by sliding the mouse across the desktop. It is generally used
for selection, dragging, drawing, playing games, etc.
Q.5 Describe the characteristics of computers.
Ans. Characteristics of computer systems can be categorised as follows:
(i) Accuracy, (ii)Speed, (iii)Storage, (iv) Diligence, (v) Versatility.
(i) Accuracy: Computer always provide 100% accurate results. Wrong results from computer system are the
result of either wrong data or incorrect procedures used by the users.
(ii) Speed: Processing speed of computers is very fast. It can perform operations and activities in few seconds
that would require many days if done manually. The processing speed of computers is measured in Bits per
seconds i. e. , bps.
(iii) Storage: The storage capacity of computers is quite vast. Computers can store large volumes of data on its
secondary storage devices. Entire library of around 1000 books of different sizes can be stored on few CD-ROMs.
The storage capacities are measured in KB, MB, GB and TB.
Bits = 0 and 1
Byte= Collection of 8 bits to represent any one character (or a symbol)
1 KB= 1024 Bytes; 1 MB= 1024 KB;
1 GB= 1024 MB; 1 TB= 1024 GB
(iv) Diligence: Computer is a very hard working machine. Its efficiency and accuracy does not go down by its
usage for longer periods. It works effectively and efficiently during longer working periods and results are not at
all affected by it.
(v) Versatility : Computer is a very varsatile machine. It means that use of computer is not restricted to any
single application or a single field. Computers are used in almost every field.

Long Answer Type Questions

Q.1 Describe in detail about application areas of computers.


Ans. Being versatile in nature , computers are used in every field now-a-days. Some of the application areas area as
follows:
(i) Computers have become an integral part in education system in the country now. In schools, computers are
used for various purpose. They are used for teaching computer science as a subject along with other official
work.
(ii) Railways and Airlines reservation systems are now-a-days fully operated by the computers only.
(iii) Medicine is another very important field where computers have become indispensable. In hospitals and
research institutes they are playing significant roles.
(iv) Computers in various offices have become a vital component. There they are used for different jobs. This may
include working on text through work processors or performing calculations by using any accounting
package.
(v) Computers in banking has been very widely used. Funds, transactions and now-a-days updations are done
with the help of computers only.
(vi) Computers are used for designing, automobiles and buildings by the engineers and architects.
(vii) Children are able to enjoy animated movies on the computers. Publishing, textile designing, fashion
designing, transportation, tourism, electricity department, telephone department etc. Systems are some
other appliacation areas of computers apart from many more.
8

(viii) Weather forecasting is another important activity which is easily available to us because of the use of
computers only.
(ix) In different scientific applications and researches computers have become a mandatory electronic device.
Q.2 Explain in details the classification of computers on the size and processing basis.
Ans. Classification of computers on the basis of size and processing speed :
(i) Micro Computers (ii) Mini Computers
(iii) Mainframes computers (iv) Super Computers
(i) Micro Computers : These are the smallest size of computers. They use microprocessor as their main
component in a computer system that’s why they named as micro computers. Now-a-days commonly used
computers belong the category of micro computers. Micro computers are also known as Personal Computers
(PCs). These are depending upon their size, and divided into following categories:
(a) Desktop PC
(b) Laptop PC
(ii) Mini Computers: These computers are bigger than microcomputers in size. The processing speed of these
computers is five times faster than microcomputers. They have bigger main memory of 250KB to 12MB and word
length of 12/32 bits. These minicomputers are multi-user in nature i. e. , more than one users can work on the
system at a time. They are designed for 4 to 8 users to work at a time. These systems are used in organisations,
business and commercial applications like banks and shopping complexes.
(iii) Mainframe Computers: These are very large computers with huge storage capacity and very high
processing speed. They allow 128 users to work at a time.
These systems are used in applications, which require networking and connectivity with multiple micro and mini
computers.
(iv) Super Computers: They are highly sophisticated computer systems. These systems use multiple
microprocessors and supports parallel processing at extremely faster rates. These systems are used in applications
in which very complex calculations are need to be done and in applications where time factor is a critical aspect.
These systems can perform 10 12 floating-point operations per second and with 100% accuracy rate.

qqq
9

Chapter

2 Kinds and Medium of


Communication

Multiple Choice Questions

Q.1 Which is not a protocol ? (2014)


(a) TCP/IP (b) HTIP (c) X-25 (d) ISP
Q.2 In which media, transponders are used ? (2012, 14)
(a) Satellite (b) Microwave (c) Fibre optic (d) Twisted cable
Q.3 In which transmission medium the data transmits in the form of light waves ? (2017)
(a) Copper wire (b) Coaxial cables
(c) Telephone lines (d) Optical Fibre Cable
Q.4 Whose communication range is high among the following ?
(a) Cable communication (b) Microwave communication
(c) Satellite communication (d) Radio communication
Q.5 Which types of communication takes place in computer communication ?
(a) Simplex (b) Full duplex (c) Half-duplex (d) Quarter (1/4) duplex
Q.6 Through which communication medium, data is transmitted in the form of the waves ? (2017)
(a) Copper wire (b) Co-axial cable (c) Telephone line (d) Optic fibre cable
Q.7 Which of the followings has maximum expansion range ? (2019)
(a) Cable communication (b) Microwave communication
(c) Satellite communication (d) Radio communication
Q.8 In which topology one mode is fail all node will be fail ?
(a) BUS (b) Ring (c) Star (d) For all of these
Q.9 In the following which data communicate medium has faster data transmission ?
(a) Telephone line (b) Coaxial cable (c) Twested wire (d) Fiber optics
Q.10 In India which data communication medium is mostly used in TV Transmission ?
(a) Coaxial cable (b) Telephone line (c) Satellite (d) Fiber optics
Q.11 Which connection is available through telephone lines ?
(a) Dial-up (b) Leased-lines (c) ISDN (d) both (a) and (b)
Q.12 In the following which device is used for modulation and demodulation?
(a) Satellite (b) Modem (c) Main plaxer (d) Network Node.

Answers
1. (d) 2. (a) 3. (b) 4. (c) 5. (a) 6. (d) 7. (c) 8. (c) 9. (d) 10. (d)
11. (d) 12. (b)
10

Very Short Answer Type Questions

Q.1 Write a short note on communication system. (2016)


Ans. Communication is the process of establishing connection or link between two points for information exchange.
Q.2 Explain the types of communication briefly. (2016)
Ans. Communication is of two types :
(a) Oral communication
(b) Written communication.
Q.3 Describe communication medium briefly. (2014, 16)
Ans. Through the medium, communication is possible between the sender and the receiver, is known as
communication medium. These are of two types :
(a) Guided media
(b) Unguided media
Q.4 How many layers are there in ISO model ? (2016)
Ans. There are seven layers in ISO model.
Q.5 What is optical fibre cable ? (2015)
Ans. In this technology for data communication we use specific glass or plastic fibre instead of metal wire. This cable is
used for telecommunication and networking.
Q.6 Explain wireless communication briefly. (2016, 18)
Ans. The communication, held without wire, is known as wireless communication.
Q.7 Discuss on the unit of data communication. (2019)
Ans. Data communication means—give and take of informations. Hardware and software both are essential for data
communication.
Q.8 Explain bandwidth ? (2018)
Ans. Bandwidth is used to determine the rate of data transfer. It’s unit is cycle/sec. (CPS) or Hertz (Hz).
Q.9 Which transmission channel has highest bandwidth ?
Ans. Broad band channel.
Q.10 In which type of transmission, collection of 8 wires is needed to transmit 8 bits ? (2011)
Ans. Parallel transmission.
Q.11 Describe simplex briefly. (2016)
Ans. In simplex communication, data flows in the same direction always, e. g. , radio, T.V. etc.
Q.12 Explain duplex briefly. (2016)
Ans. Duplex is such a communication medium, in which data flows in both directions. It is of two types :
(i) Half-duplex
(ii) Full duplex
Q.13 Write short notes on the followings : (2016, 18)
(i) LAN
(ii) WAN
Ans. (i) LAN (Local Area Network) : It is a network which is designed to operate over a small physical area such
as an office, factory or a group of buildings. LANs are very widely used in a variety of applications.
(ii) WAN (Wide Area Network) : Wide area networks are basically packet switching networks. A WAN
provides long distance transmission of data, voice image and video information over larger geographical
area.
11

Q.14 Write full names of the followings : (2019)


(i) CDMA
(ii) GPS
Ans. (i) CDMA—Code Division Multiple Access
(ii) GPS—Global Positioning System
Q.15 Draw the figure of Ring Topology. (2017)

Ans.

Ring

Ring Topology

Short Answer Type Questions

Q.1 Explain data communication. (2017)


Ans. Communication means the electronic transmission of any type of electronic information encompasses telephone
communication, the transmission of television signals, data communication of all forms, electronic mail, etc.
Data communication is the movement of encoded information from one point to another by means of electrical or
optical transmission system, such types systems generally called data communication networks. The speed of
transfer of data is measured in bit per second (BPS).
Q.2 What do you mean by Modem ? (2012, 15, 18)
Ans. Modem : A modem is a device or program that enables a computer to transmit data over telephone lines.
Computer information is stored digitally, whereas information transmitted over telephone lines is transmitted. In
the form of analog waves. A modem converts between these two forms. These are three types of modems :
Internal, external and fax modem.

Modem

It changes the digital data from your computer into analog data, a format that can be carried by telephone lines. In
a similar manner, the computer receiving the data converts analog data to digital data through a modem. The
12

process of converting digital signals to analog is called modulation and analog to digital signal is called
demodulation.
Q.3 What is computer network ? (2013)
Ans. A computer network is a group of computer systems and other computing hardware devices that are linked
together communication channels to facilitate communication and resource-sharing among a wide range of
users. Networks are commonly categorized based on their characteristics.
Q.4 What is data transmission speed ? (2016)
Ans. In computer communication, the amount of data transferred from one place to another in one second is known as
data transmission speed. It is measured in bps (bits per second), kbps (kilo bytes per second), mbps, etc. There are
three communication channels on the basis of data transmission speed :
(i) Narrow band transmission—45 to 300 bps
(ii) Voice band transmission—upto 9600 bps
(iii) Broad band transmission— 10 6 bps or more
Q.5 Write a short note of network topology. (2012)
Ans. The term network topology refers to the way in which the nodes (computers or other devices that need to
communicate) of a network are linked together. It determines the data paths, which may be used between any
pair of nodes in the network. This would help to transmit data between them.
Q.6 Explain the ISO reference model. (2016)
Ans. An interconnected protocol for computer to computer communication as recommended by ISO (International
Standards Organisation) is receiving wide acceptance. It is an approach based on defining a number of distinct
layers each addressing itself to one aspect of linking. this is known as the ISO model for Open System
Interconnection. It is a seven layer architecture and defines a separate set of protocols for each layer.
Q.7 Differentiate between Protocol and Topology. (2014)
Ans.

S. No. Protocol Topology


(i) These are some set of rules-regulations and It is a structure defined by the interconnection scheme.
guideline.
(ii) It is a smooth network to communicate. It is not a smooth network to communicate.

Q.8 What are the types of communication ? Also write the applications of communication. (2016)
Ans. Communication basically are of two types :
(i) Oral communication
(ii) Written communication
(i) Oral Communication : In this type of communication, data or information is send in the oral form or we
can say that audio is use as message (data) to be transmitted over the channel. In oral communication we
use various method for transmission of data. Conversation between two person are the best of oral
communication.
Following are different form of oral communication are :
Telephone, Intercom, Mobile phone, Voice talk by computer, mail/chatting, etc.
(ii) Written communication : In this type of communication, data is send from one place to another in
written form which means if information in written form is send from one place to another then this type of
communication is called written communication.
Written communication is more important as well as efficient because there is always record of written
communication which send or receiver can use when ever they needed. This also act as important in
computer depended communication.
13

Following are the different form of written communication :


Fax, E-mail, SMS, Pager, etc.
Applications of communication :
(a) Electronic Banking Service
(b) E-shopping
(c) Video Conferencing
(d) Air/Railway Reservation
(e) E-correspondance
(f) E-education
Q.9 Explain the followings in short :
(i) Types of communication (ii) Communication medium (2012)
Ans. (i) Types of communication : Please see the answer in Question-8
(ii) Communication medium : Communication medium is kind of medium from sender to the receiver over
which they can give and take data. The communication medium is called communication line or
communication channel. This could be of different kind. For data communication there are different kind of
communication medium or channel, which is different from each-other and more over they have different
working.
Communication medium are of two type :
1. Guided Communication Medium
2. Unguided Communication Medium
Q.10 Explain the types of Modulation. (2012)
Or
Explain the modulation. (2016)
Or
Explain the following :
(i) Modulation
(ii) Demodulation (2011)
Ans. The message signal so obtained cannot be transmitted as such over long distance. So to overcome this difficulties.
The signal is super imposed on high-frequency wave, some characteristic of which varies as a function of the
instantaneous value of the audio signal and the resulting wave so produced is transmitted which is called
modulating signal. This process is called modulation.
Demodulation is just reverse of modulation. It is the process of separating the audio signal from the modulated
wave. The signal on being amplified and led to a loudspeaker reproduces the original speech or music.
Types of Modulation :
1. Amplitude Modulation (AM): In this type of modulation, message signal modulating wave is
superimposed on a high frequency carrier signal in such a manner frequency of the carrier remain the same
but amplitude of the carrier signal varies in accordance with instantaneous amplitude of the modulating
wave (message signal).

Message Signal Carrier Signal (Wave) Amplitude Modulated Wave


14

2. Frequency Modulation (FM) : In this type of modulation, message signal is superimposed on the carrier
wave in such a manner only frequency of this carrier signal varies accordance with instantaneous frequency
of the message signal while all other perimeter of carrier wave remain the same.

Message Signal Carrier Signal Frequency Modulated Wave (Signal)

3. Phase Modulation (PM) : In this type of modulation, when message signal is superimposed on the
carrier signal then there a change in the phase angle of the carrier signal due to the message signal.

Amplitude Amplitude Amplitude

Time Time Time

Phase Modulated Wave

Q.11 Show the difference between LAN and WAN. (2014, 16)
Ans.

S. No. LAN WAN


1. The LAN is owned by a person, college factory etc. WAN can be private or it can be public leased type network.
It is a privately owned network.
2. LAN is designed to operate over a small physical WAN is used for the network that spans over a large distance
area such as office, factory or group of buildings. such as system spanning states countries etc.
3. LANs are easy to design and easy to maintain. WAN is not so easy to design and maintain.
4. The communication medium used for The communication medium used in WAN can be PSTN or
interconnection is a simple co-axial cable. satellite links due to longer distances involved.
5. Due to shorter distances, problems such as Due to long distances involved, the problems such as
propagation delay do not exist. So, LAN can be propagation delay, variable signal travel time do exist. So,
used for time critical applications. WAN cannot be used for the time critical applications.
6. LAN can operate on very high data rates of around WAN operates on low data rates of around 1 MBPS.
0.1 to 100 MBPS.
7. In a LAN each station can transmit and receive In WAN, each station cannot transmit.
over the communication medium.
8. Local area network operates on the principle of WAN operates on the principle of switching.
broadcasting.
9 Change of error in LAN is very low (almost zero) As the distance is long so there is high chance of error or loss
nor there is loss of data. of data while transmission.
15

Q.12 Write the names of elements of computer network. (2019)


Ans. Elements of Computer Network : A network is a combination of different components. The most essential
components of a single network are :
(i) Servers : Servers are the faster computers to run different software/programs, stores and process
information and to provide a human interface of the users to be able to use the networked computers.
(ii) Nodes : Nodes are the computers on the Network which are provided to the users to carry out their tasks
using the network.
(iii) LAN Cable : This is the medium over which the information travels from computer to computer.
(iv) Network Operating System : It is used to control the movement of information on the network.
(v) Network Interface Card : This is used to connect the cables to the computers.

Long Answer Type Questions

Q.1 Write note on the followings :


(i) Sender (2013)
(ii) Communication medium (2013)
(iii) Communication Protocol (2009, 13)
(iv) Receiver (2013)
(v) Simplex (2010, 11)
(vi) Duplex (2010, 11)
Ans. (i) Sender : In data transmission, system or person who broadcast transmit data over the channel is called
sender. If data is send between two computer, then the organisation, person or firm send data or information
is called sender. For example, person, computer, etc.
(ii) Communication Medium : For sending data or information from sender to receiver we need a medium
which is called communication medium. It is also called communication channel. In communication system,
we use many kind of medium such telephonic lines, fiber cable, co-axial cable etc, according to need.
(iii) Communication Protocol : For sending data over the channel safely and properly we use
communication protocol and more on computer hardware as well as software should work synchronised
with each other. For their synchronisation protocol are used so that receiver should get proper data.
(iv) Receiver : A part or system of the communication system, where message or signal send from sender end is
received is called receiver. In other word we can say that personal organisation who receive message is
called receiver.
(v) Simplex : If transmission is simplex, communication can take place in only one direction. Devices
connected to such a circuit are either a send-only or a receive-only device. For example, a data collection
terminal on a factory floor (send only) or a printer (receive only). At first thought that might appear
adequate for many types of applications in which flow of information is unidirectional. However, in almost
all data processing applications, communication in both directions is required.
(vi) Duplex : Du means double while plex means structure. It has two following types :
(a) Half Duplex : A half duplex system can transmit data in both directions, but only in one direction at a
time. Hence, a half duplex line can alternately send and receive data. It requires two wires. This is the
most common type of transmission for voice communication because only one person is supposed to
speak at a time. It is also used to connect a terminal with a computer. The terminal might transmit data
and then the computer responds with an acknowledgement.
(b) Full Duplex : In a half duplex system, the line must be “turned-around” each time the direction is
reversed. This involves a special switching circuit and requires a small amount of time. With
16

high-speed capabilities of the computer, this turn-around time is unacceptable in many instances. Also, some
applications require simultaneous transmission in both directions. In such case, a full duplex system is used,
which allows information to flow simultaneously in both directions on the transmission path. Use of a full
duplex line improves efficiency, because the line turn-around time required in a half duplex arrangement is
eliminated. It requires four wires.
Q.2 Draw a block diagram of communication system and label all the block. (2019)
Or
Draw a simple model of primary communication system and explain the functions of its block
in detail. (2010)
Ans. Block Diagram :
msg msg msg msg
Sender Encoding Channel Decoding Receiver

Feed back

Elements of Primary communication model :


(i) Sender : Please see the answer in Question-1.
(ii) Encoding : User binds it in clear words and symbols when idea etc. are decided. The process to convert
ideas into words, figures, symbols, and in the form of table is known as encoding.
(iii) Message : It is the information or data to be communicated. It can consist of text, numbers pictures,
sound or video or any combination of these.
(iv) Medium : Please see the answer in Question-1.
(v) Decoding : Under this process, receiver cracks the message according to his capability and tries to
understand the motive of sender.
(vi) Receiver : Please see the answer in Question-1.
(vii) Protocol : It is a set of rules that govern the communication between the devices. Both sender and
receiver follow same protocols to communicate with each other.
Q.3 What is topology in computer network ? Write its types. (2019)
Or
Explain the various types of computer network. (2016)
Ans. Topology : Please see the answer of Short Answer Type Question No. 5.
Kinds of Network Topology : Although the number of possible network topologies is seemingly limitless, the
five major ones are :
1. Bus Topology
2. Star Topology
3. Ring Topology
4. Completely Connected Topology (or Mesh Topology)
5. Tree Topology
1. Bus Topology : In this kind of structure, there is no central host computer. There is a single data cable
which is shared by the workstations. It allows flexible networking as devices can be easily attached. It is
economical because single cable is involved but possibility of data collision occurs.
2. Star Topology : In star arrangement of a computer network, multiple computers are connected to a host
computer. That is the computers in the network are not linked directly to each other and can communicate
17

only via the host computer. The routing function is performed by the host computer, which centrally controls
communication between any two other computer by establishing a logical path between them.
3. Ring Topology : In the circular or ring arrangement of a computer network, each computer has
communicating subordinates, but there is no master computer for controlling other computers. A node
receives data from one of its two adjacent nodes. The only decision a node has to take is whether the data is
for its own use. If it is addressed to it, it utilizes it. Otherwise, it merely passes it on to the next node.
4. Completely Connected Topology : A completely connected network has a separate physical link for
connecting each node to any other node. Hence, each computer of such a network has a direct dedicated
link, called a point-to-point link, with all other computers in the network. The control is distributed with
each computer deciding its communication priorities.
5. Tree Topology : It is also known as hierarchical or vertical network. There may be more than one central
nodes as it follows tree like architecture. If one center fails, the network can continue to be partially
operational. This kind of structure is used in remote access networks.

qqq
18

Chapter

3 Internet

Multiple Choice Questions

Q.1 Which of the followings is not protocol? (2014)


(a) TCP/IP (b) ISP (c) HTTP (d) TELNET
Q.2 What is web browser? (2017)
(a) Memory card (b) Software program (c) Modem (d) Compiler
Q.3 Which type of function is file transfer protocol? (2012)
(a) Network (b) Session (c) Transport (d) Presentation
Q.4 Who governs the Internet as a whole?
(a) USA (b) Australia (c) India (d) None of these
Q.5 Which software you need to access www?
(a) Gopher (b) Archie (c) Winsock (d) Browser
Q.6 Internet in which type of network?
(a) LAN (b) MAN (c) WAN (d) None of these
Q.7 Which is not Internet Service?
(a) E-mail (b) News (c) Postal mail (d) Chat
Q.8 What is the full name of FTP?
(a) File transfer protocol (b) First type process (c) File transfer process (d) File typing process
Q.9 Indonet is developed by :
(a) IBM (b) CMC (c) HCL (d) None of these
Answers
1. (b) 2. (b) 3. (a) 4. (d) 5. (d) 6. (c) 7. (c) 8. (a) 9. (b)

Very Short Answer Type Questions

Q.1 What is www? Explain. (2019)


Ans. www is an internet server which supports hypertext and multimedia to access several internet protocol on a single
interface. It's full form is World Wide Web.
Q.2 Which language is used to make webpage? (2017)
Ans. HTML language is used to make a webpage.
Q.3 What is login process? (2014)
Ans. When a user enters in his account through his user name and password, Then this process is known as login
process. It is a process which provides the safety to a user on internet.
19

Q.4 Write full form of ATM. (2013)


Ans. ATM — Automated Tailor Machine.
Q.5 What is the meaning of server Computer?
Ans. A server is a computer program and a device that provides functionality for other programs or devices.

Short Answer Type Questions

Q.1 Define the Internet. (2011)


Or What is Internet? (2012, 16)
Or Definations of Internet. (2012)
Ans. The Internet is a huge network of computers, which links many different types of computer all over the world. It is
a network of networks, which share a common mechanism for addressing (identifying) computers and a common
set of communication protocols for communications between two computers on the network.
Q.2 Explain the search engine? (2014)
Ans. A search engine is a software program (or script) available through the Internet that searches documents and
files for keywords and returns the results of any files containing those keywords. Today, there are thousands of
different search engines available on the Internet, each with their own abilities and features. The first search
engine ever developed is considered Archie, which was used to search for FTP files and the first text-based search
engine is considered Veronica. Today, the most popular and well-known search engine is Google,yahoo.
Q.3 Explain the e-mail? (2012, 16)
Ans. Electronic mail or e-mail is information stored on a computer that is exchanged between two users over
telecommunications. More plainly, e-mail is a message that may contain text, files, images or other attachments
sent through a network to a specified individual or group of individuals. The first e-mail was sent by Ray
Tomlinson in year 1971. By the year 1996, more e-mail was being sent in comparison to postal mail.
Q.4 What is File Transfer Protocol ? Explain its utility. (2012)
Ans. The File Transfer Protocol service (known as FTP is short) allows an Internet user to move a file from one
computer to another on the Internet. A file may contain any type of digital information – text document, image,
artwork, movie, sound,software, etc. Hence, anything that can be stored on a computer can be moved with FTP
service. Moving a file from a remote computer to ones own computer is known as downloading the file and
moving a file from ones own computer to a remote computer is known as uploading the file.
By using the FTP service, a file transfer takes place in the following manner :
(i) A user executes the ftp command on his/her local computer, specifying the address of the remote computer.
(ii) An FTP process running on the user’s computer (called FTP client process) establishes a connection with an
FTP process running on the remote computer (called FTP server process).
(iii) The user is then prompted for login name and password to ensure that the user is allowed to access the
remote computer.
(iv) After successful login, the desired file(s) are downloaded or uploaded.
Q.5 Write the full form of following : (2013)
(i) URL, (ii) TCP/IP, (iii) DNS, (iv) ISP, (v) www, (vi) FTP.
Ans. (i) URL — Uniform Resources Locater
(ii) TCP/IP — Transmitions Control Protocol/Internet Protocol
(iii) DNS — Domain Name System
(iv) ISP — Internet Service Provider
(v) www — World Wide Web
(vi) FTP — File Transfer Protocol.
20

Q.6 What is www ? What is a 'web-server' ? What are webpages? (2010, 16, 17)
Ans. www (World Wide Web) : It is a section of internet where related files are interlinked. This facility is similar to
magazine which consists of websites and webpages through which user can get the information about different
topics. www is a vast ocean of informations regarding almost every topic, place, country, etc. is available on it. In
fact the information about different topics and places is stored on bigger and efficient computers which provide
this, information to other connected computers. These computers with better efficiency are called
'web-servers'. Almost every country has its own web-server which stores the information about the country and
these servers are connected to each other to share their information and provide it to the other connected
computers.
The page on which information is written on www are called webpages. These webpages are designed by
skilled web-designers and then launched on it. The collection of webpages related to some place or topic is called
website. There are different types of sites available on it, e.g.,
.com — commercial sites
.edu — educational sites
.mil — military sites, etc.
.gov — government sites
.net — netwoking sites
There are several search engines available on Internet which work as interface between www and internet user
because they are helpful in searching the sites related to any content.
Q.7 What is main function of ISP?
Ans. The two main functions of ISP are given below :
(i) Provide a link : They provide a link to a company or individuals which enables them to access, www and
send Internet e-mail. They are entities that provide individual and institutional subscribers with access to
Internet.
(ii) Hosting : They host websites or publish a company’s website content to enable other companies or
consumers access to it, e.g., a person who is interested in launching a website will first obtain an account with
a hosting service provider and then will upload webpages onto his web site which is physically located on the
host’s ‘server’.
Q.8 What are the advantages of Internet? (2010, 12, 15)
Ans. Internet is an Information Highway and it has enormous advantages, few of them are listed below :
(i) Information can be transferred from a place to another place.
(ii) User can talk to a person sitting in any part of the world.
(iii) Lots of facilities available for entertainment viz. games, movies, online programs, etc.
(iv) User can do besiness on internet and this facility is called e-commerce.
(v) User can get information on any topic regarding education and can search the job too.
(vi) It is a great time and money saver. One can maintain his bank account through internet.
(vii) Billings and reservations can be done using internet.
(viii) News, live matches, concerts, etc. can be seen through internet.

Long Answer Type Questions

Q.1 What is internet? What are its tools or applications? (2011, 12, 13, 16)
Or Write a short note on ‘Application of Internet’. (2016)
Or Describe Internet briefly. (2017)
Ans. Internet : Refer to short Answer type question no. 1
21

The worldwide scope of the Internet makes it perhaps, the single most valuable tool for use in many significant
ways by both non-profit and commercial organizations. Some of the important current strategic uses of the
Internet are listed below :
1. On-line communication : The electronic mail service on the Internet is extensively used today by
computer users around the world to communicate with each other. With this facility, the Internet has proved
to be a rapid and productive communication tool for millions of users.
2. Software sharing : The Internet provides access to a large number of shareware software development
tools and utilities. For example, a set of such shareware tools is available via ftp from the Internet site
sunsite.unc.edu. The Free Software Foundation also provides a wealth of GNU software tools on the Internet,
which that can be downloaded free of charge.
3. Exchange of views on topics of common interest : The Internet has a number of news groups. Each
news group allows a group of users to exchange their views on some topic of common interest.
4. Posting of information of general interest : The Internet is also being extensively used as a large
electronic bulletin board on which information of general interest can be posted to bring it to the attention of
interested users around the world. Some commonly posted information includes career opportunities,
conference and event announcements and calls for papers for conferences and journals.
5. Product promotion : Several commercial organizations are effectively using the Internet services for
promoting their products.
6. Feedback about products : Commercial organizations are also using the Internet to gather information
about user satisfaction of existing products, market opportunities of new products and ideas for potential
new products.
7. Customer Support Service : Many organizations are also using the Internet to provide timely customer
support. The combined electronic mail, ftp and other services on the Internet provide all of the enabling tools
necessary to provide such first-rate customer support.
8. On-line journals and magazines : The Internet now has literally thousands of electronic subscriptions,
which can be found both for free and low cost. Researchers are working in the direction to extend this idea to
support full-fledged electronic libraries on the Internet.
9. On-line shopping : The Internet has also facilitated the introduction of a new market concept, which
consists of virtual shops. These shops remain open 24 hours all the year round and are accessible to
purchasers all around the world. They provide information about products or services for sale through www
servers.
10. Worldwide video conferencing : Worldwide video conferencing is an emerging service on the Internet,
which allows a group of users located around the globe to talk and interact with each other as if they were
sitting and discussing in a single room. The parties interacting can see each other talking on their computer
screens and can hear each other’s voice through a special audio-device fixed in their computer.

qqq
22

Chapter

4 CLI Form of Linux

Multiple Choice Questions

Q.1 Which of the following is an operating system? (2018)


(a) Modem (b) Inkjet (c) Pendrive (d) Disk operating system
Q.2 Which of the following is not a software? (2013)
(a) Linux (b) Unix (c) LAN (d) Windows
Q.3 Linux is equivalant to : (2014)
(a) Disk operating system (b) Windows
(c) Unix (d) None of these
Q.4 Fundamental part of Linux operating system is known as: (2014)
(a) shell (b) kernel (c) utility (d) service program
Q.5 GUI is: (2017)
(a) graphical up interface (b) graphical user internet
(c) graphical user interface (d) interface of graphical
Q.6 Which of the following options is used to apply the separator before each line?
(a) –b (b) – r (c) –s (d) –t
Q.7 Which type of command files are stored in/etc directory?
(a) cat (b) write (c) more (d) wall
Q.8 Which of the following in not linux command?
(a) cut (b) paste (c) ggep (d) more
Q.9 Which of the following is not icon of K desktop environment?
(a) Autostart (b) Trash (c) Printer (d) Document
Q.10 The key used to insert text before curser is:
(a) I (b) i (c) a (d) A
Q.11 An important login tool of linux is:
(a) CHROOT (b) SYSLOGD (c) Tripwire (d) Vlock
Q.12 What is tripwire in linux?
(a) Internet tool (b) Password protected screensaver
(c) File system IDS (d) Login tool
Q.13 Which key is used to move into command mode from insert mode in: ( 2015)
(a) Ins (b) Esc (c) Tab (d) Enter

Answers
1. (d) 2. (c) 3. (c) 4. (b) 5. (c) 6. (a) 7. (d) 8. (c) 9. (d) 10. (b)
11. (b) 12. (c) 13. (b)
23

Very Short Answer Type Questions

Q.1 Describe windows OS in brief. (2018)


Ans. It is graphical user interface operating system developed by Microsoft. It is used in all personal computers mostly.
Q.2 Define command line.
Ans. The line, at which command is typed, is known as command line.
Q.3 What is the other name of gateway address?
Ans. Broadcast.
Q.4 Write the commands to see directory, to make directory, to destory directory and to copy
directory in linux operating system. (2019)
Ans. To see directory— 1s
To make directory— mkdir
To destory directory—rmdir
To copy directory— cp
Q.5 Why is $ grep singleword* used?
Ans. This statement is used to search a character in a file in any directory.
Q.6 What is the form to load Vi editor with the file?
Ans. $ Vi filename.
Q.7 Write any two component of desktop environment.
Ans. (i) File management (ii) Customize menu
Q.8 Write a security tool in Linux. (2017)
Ans. CHROOT
Q.9 What do you mean by IDS? Why is it used?
Ans. IDS means— Intrusion detection system. It is used as a security tool, which prevent the network.
Q.10 Write the full form of CLI.
Ans. Command line interface.
Q.11 What is meaning of IDS?
Ans. Intrusion detection system.
Q.12 What is the file manager of LINUX? (2012)
Ans. Nautilus is the name of the file manager of LINUX.
Q.13 Write the name of a safety tool in Linux. (2017)
Ans. Clam AV.

Short Answer Type Questions

Q.1 Write the different types of Linux. (2017)


Ans. (i) Cent OS (ii) Red Hat (iii) Fedora (iv) Ubuntu (v) open SUSE (vi) Debian
(vii) Linux Mint (viii) Arch Linux (ix) Slackware (x) Puppy Linux
Q.2 Describe the utility of Linux. (2014)
Or
Write the advantages of Linux. (2016)
Ans. (i) All software and source codes of this operating system is very easily available to all user.
(ii) It can combine with GUI which enable user operate GUI software such as text editor, open office, etc.
(iii) This operating system is more secure and reliable than the other operating system.
(iv) This can be used in any hardware and it is not limited to a selected one.
24

(v) In Linux, user can select any kind of text in Linux according to the need of the user in a given program.
Q.3 Write the drawbacks of Linux. (2016)
Ans. In Linux operating system, there are many important feature but it also have some limitation which are as follows:
(i) It is very difficult to work on this.
(ii) It is very difficult to install new software in Linux.
(iii) It is very difficult to connect new hardware because some other operating system such as DOS window
already have driver install in it but Linux does not have.
(iv) For using Linux must follow the instruction and remembered the syntax.
(v) This is case sensitive or we can say that small alphabet (a, b, c,...) and bigger (A, B, C,...) are both different for
Linux.
Q.4 Explain X-Windows in LINUX operating system. (2019)
Ans. X-Windows: Linux is the powerful framework for working with graphical applications and it is referred to as
X-windows system. X handles the function of opening X-based graphic user interface (GUI) applications and
displaying them on an X-server process. LINUX has an X-based Desktop environment to provide a desktop
metaphor and Windows manager to provide the GUI application like icons, window frames, menus and colours,
or a combination of these items called themes.
Q.5 Describe the directory. (2018)
Ans. In Linux structure, the upper most directory is called root directory. It does not have any name and is represented
by a symbol (/). Every directory is called the parent directory of all sub-directory made in it and these
sub-directory are called child directory. The directory in which we are doing work, these directory are called
current directory.
Q.6 What do you mean by Vi text editor in LINUX ? Describe it. (2008, 19)
Or
What is an ‘Editor’? Explain in detail the features in the context of Vi Text Editor. (2009)
Ans. Vi-text Editor: An editor is a utility program enabling the user to create (or modify) text files. The visual editor
or Vi-displays a window of text for edit operations. The Vi editor is used by the following command:
# vi filename
By defult, the Vi-editor will be open in command mode. The ESC key is used to switch over from command mode
to edit mode. The Vi editor has three modes: command, insert, and last line mode, firstly the Vi editor opens in
command mode, where you can move the cursor around, delete or append text: When you are in inert mode, you
can insert text. You cannot move cursor around while you are in insert mode. Whereas last line mode is for
commands beginning with;, as well as comm-and starting with/,? or !. Whenever you type a last line command,
your cursor moves to the last line of your screen.
Vi commands are case sensitive, the ‘a’ command is different from ‘A’ command.
Editing a New File: To create a new file, the syntax is: vi< filename> ¿
type i , start typing the text you want to insert. Do not press Return key after typing the i; only start typing your
input text.
Saving Your File: To save a file type: wq, when you type:, your cursor will move to the bottom of the screen. zz
is the alternate command to save but it is not safer than wr, zz is easier! Normally, you shouldn’t have problems
using zz.: q! is used to exit from Vi editor without saving.
Some of the most commonly Used Vi commands:
Command Meaning
<Esc> Used to return from command mode.
<Ret> Used to go to the first non-blank character of the next line.
<–> Go to the first non-blank character of the previous line.
<a> Used to append text after the cursor.
<A> Used to append text at the end of the current line.
<dd> Used to delete the current line.
25

<D> Used to delete.


<u> Used to undo the last change.
<U> Used to undo all changes to the current line.
<x> Delete the current character.
<zz> Used to save changes and exit.
Q.7 What is GNOME desktop in LINUX? (2010, 14, 15)
Ans. GNOME Desktop: It is a stable and reliable desktop environment, with a few cool features in it. To use your
GNOME desktop, you should know about the components listed below
(1) Metacity: This is the default window manager for GNOME in Red Hat Linux. It can provide you the themes,
windows, borders and window controls.
(2) Nautilus: It is a File Manager or Graphical shell. It provides window opens and displays the contents of the
selected folder. It can also display other types of content, such as, shared folders from windows computer on the
network.
(3) GNOME Panel: It is intended to be the place from which you manage your desktop, and by this panel you
can start applications. You can also change the panel by many ways by adding applications or monitors, by
changing the placement. The GNOME panel menu contains lot of functions, and these are— the menu, Add to
panel, Delete this panel, Properties, desktop application launchers, a workspace switcher window list, a clock,
Help and About GNOME.
(4) Desktop Area: The windows and icons you use are arranged on the desktop area. It supports a
drag-and-drop between applications, a desktop menu, and icons for launching applications.
Q.8 What is command line interface in Linux operating system? Write its applications. (2019)
Ans. Command Line Interface (CLI) in LINUX: Shell in Linux works as CLI.It displays a prompt on the screen at
which we can give various commands to perform various tasks. This prompt is known as shell prompt. The shell
interface provides a way to run programs, work with the file system, compile computer code and manage the
computer. The line where we enter command along with its options, command arguments is known as
‘‘Command line’’. A command line usually ends with a new-line character. The command line completes only after
the user has hit the enter key. The ‘\’ symbol placed at the end of a line continues the command to the next line,
ignoring the hit of enter key. Several commands may be written in a single command line. They must be separated
by semicolon (;).
e. g. , $ who; date.
Linux commands: A command is an instruction given to the shell; the kernel will obey that instruction. Linux
provides several commands for its users to easily work with it. The important Linux commands are grouped
according to their functions as follows:
Application:
Directory Oriented Commands:
Is: This command is used to display the names of the files and sub-directories in a directory.
Syntax® Is [-options] [directory-name]

Long Answer Type Questions

Q.1 Describe the safety system, their features and their advantages in Linux. (2019)
Ans. Linux needs safety more, because Linux is made with the help of several distributions. Various program and
applications are added to it time to time, as a result linux needs more safety.
In Linux operating system with the help of checklist we provide security to our Linux system. This can be
understand by following terms:
26

1. To Change the Telnet Banner: When any user access it’s server through Telnet then he has to use Telnet. Due
to this, cracker will provide different important information related to your system. So, if you provide the user
with availability Telnet connection then it is important to change the Telnet banner yourself.
2. By disable ctrl + Alt+ Del: In default state, this service is available in maximum system and distributry, by the
console mode any with the help of three keys of keyboard can shut down the system. These keys are:
Ctrl + Alt + Delete
For security reason, this feature should be disabled.
3. By upgrading the Kernel: For establishing new Linux every time new Kernel (latest version) is used. And is
also remember as that only latest software should be downloaded.
4. Remove user Account: At the time of system installation undesired user account and group or default account
etc. should be removed.
5. Increase the login Level: Improvement should be made login level. For this, system should be configuration
in a such way that system could write.
6. By enable Net Filter: It is also known as I.P. Tables with the help of Netfilter provide filtering service to
Kernel— Label package, statefull and NAT. If the Linux— system is connected to firewall, then also user can use
the local network rules for traffic.
7. To disable by give take init: init is parent process in Linux. This can be used by given instruction to change
run-label of the operating system of the user. As user change run-label it will bring the system in
‘Single-user-mode’ which is a type of denial of service, i. e. , DOS. In opposite of this, services which are not secure
are enable for the other.
8. Remove History File: In every user account, one command should setup in Log-off search which will delete of
the history file after the user has logout. By doing this, if any undesired user some how enter in the command line
will not be able to check the work you have done or enable to see important information stored in the system.
9. To establish Vlock: It is an important service like ‘password protected screensaver’. This service is available at
terminal of Linux. This service can be used withoug logout in between the working session to login.
10. To establish Tripwere: This is an IDS file system and is used as very important tool in security.
11. Use CHROOT: It is used to prevent any service from working in any particular region. It is FTP (File Transfer
Protocol), here user is only able to see only root file from whole.
12. Use SYSLOGD: In Linux SYSLOGD is one of the important log-in tool. And it the first who point the undesired
user as they try to login.
13. To the Network Services: If any body want to give establish system security, then it is very important to
disable unwanted network services. By doing this, you reduce the number of option due to which load on system
management will also reduce. It is also very help while upgrading the system.
14. To establish Short: This is also IDS. It is very important in identification of attack done. It is used with the
firewall in the screen.
Advantages of Safety Arrangements in Linux:
(i) Linux has sufficient safety arrangements in it to stop an unauthorized user to work. Any user may access the
files only by inserting correct user name and password.
(ii) Specially firewall of Linux assures that any unauthorized user may not harm your files.
(iii) In linux, the identity of sender and receiver is assured at the time of exchange of e-mail messages.
Q.2 Write the name of various desktops available in Linux and explain any one of them. (2014)
Or
What do you mean by K-desktop environment? Explain its various components.
Ans. As you login Linux operating system it’s desktop can be seen on the computer screen. On desktop, there is stripe at
bottom of the desktop which we called pannel on this there is icon, button and menu, etc. of the program on the
right of pannel, there is a clock which show present time.
Most popular GUI interface of the Linux operating system is as follow:
(i) K-Desktop Environment
27

(ii) Gnome Desktop Environment


K-Desktop Environment
It is the most popular window manager software/desktop of open Linux. This is use very simply with the help of
mouses as done in Window. It provide graphical window to the user so that it can perform various kind of
function. At the bottom of the screen there is a pannel which contain different kind of ico ns such Autostart, Trash
etc.
User can use any icon present on desktop with the help of mouse. To use this icon which represent any
application, user have to bring the pointer and click with the hep of mouse. In Linux operating system, desktop
has a very special property that work by a program of a particular desktop can be done in any other desktop
following work can be done in K-Desktop:
1. With the help of drag and drop user can Cut, Copy and Paste any Text.
2. Graphical configuration of Keyboard, Mouse etc. can be done.
3. User can change, background of desktop, sound, etc.
4. Files and folder can be represent using icon.
5. Web-page, printer, CD-ROM, etc. can be changed and configured.
Various components of K-desktop
Environment: It’s components are as follows:
(i) File management (ii) Capacity to make icons
(iii) Graphical tools (iv) Drag and Drop features
(v) 3-D support (vi) Customize menu
(vii) Text editor (viii) Mutual relationship among computer hardwares.
(ix) Capability to make icons

qqq
28

Discrete
Chapter Mathematics

5
[Character Representation,
Binary Arithmetic and
Logic Operations ]

Multiple Choice Questions

Q.1 The binary equivalent of the number (15)10 . ( 2014)


(a) (1101) 2 (b) (1110 ) 2 (c) (1111) 2 (d) (1000 ) 2
Q.2 The value of the binary number (1010 ) 2 would be?
(a) (14)10 (b) (12)10 (c) (10 )10 (d) (11)10
Q.3 What is the decimal value of binary number (1101) 2 ? (2012)
(a) (11)10 (b) (9)10 (c) (7)10 (d) (13)10
Q.4 What is binary equivalent of [31]10 ? ( 2017)
(a) (10000 ) 2 (b) (11111) 2 (c) (100000 ) 2 (d) (11110 ) 2
Q.5 What will be the value of (FF)16 in binary number? (2016)
(a) (10101010 ) 2 (b) (11111111) 2 (c) (11001100 ) 2 (d) (01010101) 2
Q.6 The value of binary number (1111) 2 is: (2016)
(a) ( 4)10 (b) (8)10 (c) (12)10 (d) (15)10
Q.7 Which of the following is equal to the addition of binary numbers (1010 ) 2 and (111) 2 ? (2013)
(a) (10101) 2 (b) (1111) 2 (c) (10001) 2 (d) (10011) 2
Q.8 Which of the following is a single input logic gate? (2018)
(a) NAND (b) AND (c) NOT (d) NOR
Q.9 Which logic gate has only one input and one output? ( 2015)
(a) NOT (b) NOR (c) OR (d) AND
Q.10 The value of A(A + B) in Boolean algebra is: ( 2019)
(a) AA (b) AB (c) A (d) A+B
Q.11 The value of AA ¢ + BB ¢ + C is : ( 2017)
(a) A (b) B (c) C (d) 0
Q.12 Which of the following is a universal gate? ( 2016)
(a) AND (b) NOR (c) NOT (d) OR

Answers
1. (a) 2. (c) 3. (d) 4. (b) 5. (b) 6. (d) 7. (c) 8. (c) 9. (a) 10. (c)
11. (c) 12. (b)

Very Short Answer Type Questions

Q.1 What is the full form of ASCII? (2014)


Ans. The full form of ASCII is American Standard Code for Information Interchange.
29

Q.2 Write full form of EBCDIC. (2017)


Ans. Extended Binary Coded Decimal Interchange Code.
Q.3 Give name of the Boolean operators. (2014)
Ans. AND Operator, OR operator and NOT operator.
Q.4 Write the full form of ASCII and EBCDIC. (2014, 17)
Ans. ASCII- American Standard Code for Information Interchange.
EBCDIC- Extended Binary Coded Decimal Interchange Code.
Q.5 Which is the most popular and widely accepted computer code?
Ans. ASCII.
Q.6 What digits are used in binary number system?
Ans. 0,1
Q.7 What is the base of octal number system?
Ans. 8
Q.8 Which method is used by computers to subtract binary digits?
Ans. Complement number method.
Q.9 Write the name of Boolean operations? (2014)
Ans. AND, NOT, OR
Q.10 Write the output of the logic diagram given below: (2019)
A
Y=?

A
Ans. Y

B(suppose)

Y = (A ¢)B + A ¢B ¢ = AB + AB = A B
Q.11 Draw the symbol of OR Gate.
A
Ans. R
B
OR gate

Q.12 If A = 0 and B = 1, then find the value of Y from the following expression:
Y = (A × B)
Ans. Y = (0 .1)
Y =0 =1
Q.13 Differentiate between Nibble and Byte. (2013)
Ans. Nibble: Group of 4 bit is called nibble or 4 bits make 1 nibble.
Byte: Group of 8 bit is called Byte or 8 Bits or 2 nibble make 1 byte.
1 byte=8 bits= 2 nibble
Q.14 |110000|2 - |100010|2 = | ?|2 (2019)
Ans. 110000
-100010
001110
|110000|2 - |100010|2 = |001110|2
30

Short Answer Type Questions

Q.1 Write a short note on ASCII code. (2010, 16)


Ans. ASCII Code: Another computer code, which is widely used is the American Standard Code for Information
Interchange (ASCII). ASCII has been adopted by several American computer manufacturers as their computer’s
internal code. This code is popular in data communications, is used almost exclusively to represent data internally
in microcomputers.
ASCII is of two types — ASCII-7 and ASCII -8.
Q.2 Explain the fundamental components of BCD code. (2013)
Ans. BCD Code: The Binary Coded Decimal (BCD) code is one of the early computer codes. It is based on the idea
converting each digit of a decimal number into its binary equivalent, rather than converting the entire decimal
value into a pure binary form and store in the memory. Thus, a code, for that particular character, is stored in
memory.
Q.3 Explain the law of addition in binary number system. Give an example too. (2012, 13)
Ans. Laws of binary addition:

A+B Answer Carry

0+0 0 0

0+1 1 0

1+0 1 0

1+1 0 1

Example: 1101011
+ 001001
1110100
Q.4 Explain truth table. (2016)
Ans. Truth table list all possible combination of input binary variable, to produce the corresponding output of a logical
system. A truth table contain many row and column which depend on the boolean variables.
For example: If in an expression, there are two Boolean variable then truth table will have total possibilities
( 2 ´ 2 = 4 rows).

X Y ¬ Variable
0 0 ü
0 1 ï
ï
ý Truth value
1 0 ï
1 1 ïþ

Q.5 What is distributive law?


Ans. Distributive law, in mathematics, the law relating the operations of multiplication and addition, stated
symbolically, a( b + c) = ab + ac; that is, the monomial factor a is distributed, or separately applied, to each term of
the binomial factor b + c, resulting in the product ab + ac.
31

Q.6 Which are universal gate and why are they called universal gate? (2017, 18)
Ans. Such gates by using those only any circuit design can be made, are called universal gates. NAND and NOR gates
are such gates. NAND and NOR gates can give output equivalent to AND, OR and NOT gates, so they are called
universal gates.
Q.7 What do you mean by character representation ? (2016, 18)
Ans. Character Representation:We know computer perform it’s each function in binary form before storing any
kind of data is first converted into binary form then it is stored. For converting data into binary data different kind
of computer code are used which convert the data into binary form. Following are popular code used for this
purpose.
1. Binary Coded Decimal Code (BCD): In this process each character is assigned in decimal number.
2. Extended Binary Coded Decimal Interchange Code (EBCDIC): It is also called 8 bit BCD code.
3. American Standard Code for Information Interchange Code (ASCII): In this process code is
predecided for character, digit and sign.
Q.8 Prove that AB + AC + BC = AB + AC (2017)
Ans. AB + AC + BC = AC + AB + AC + BC × 1
= AC + AB + BC(A + A) (From complement law)
= AC + AB + ABC + ABC (From distributive law)
= AC + ABC + AB + ABC (From commutative law)
= AC(1 + B) + AB(1 + C) (From distributive law)
= AC × 1 + AB × 1 (From the property of 1)
= AC + AB Proved.
Q.9 Prove in Boolean algebra AB + A + AB = 0 (2019)
Ans. AB + A + AB = 0
= (AB) × A × AB (From Demorgan law)
= AB × A × AB (From envulation law)
= AB × AB × A (From commutative law)
=0×A (From complement law)
= 0 Proved. (From the property of 0 )
Q.10 Draw Logic Figure of the given logic equation and write its truth table. (2019)
Y = (A + B)(B + C)(A + C)
Ans. Logic Diagram:
A (A+B)
B

(B+C)
Y
C

(A+C)

Truth Table
A B C (A+B) (B+C) (A+C) Y=(A+B) (B+C) (A+C)

0 0 0 0 0 0 0

0 0 1 0 1 1 0

0 1 0 1 1 0 0
32

0 1 1 1 1 1 1

1 0 0 1 0 1 0

1 0 1 1 1 1 1

1 1 0 1 1 1 1

1 1 1 1 1 1 1

Q.11 Prove with the help of Boolean’s law. (2019)


(A + B)(A + C)(B + C) = (A + B)(A + C)
Ans. L.H.S. = (A + B)(A + C)(B + C)
= (A ¢ + B)[AB + AC + BC + C × C] (From Distributive law)
= (A ¢ + B)[AB + AC + C(B + 1)] (From Distributive law)
= (A ¢ + B)[AB + AC + C × 1] (From the property of 1 )
= (A ¢ + B)[AB + AC + C] (From the property of 1 )
= (A ¢ + B)[AB + C(A + 1)] (From Distributive law)
= (A ¢ + B)[AB + C × 1)] (From the property of 1 )
= (A ¢ + B)[AB + C] (From the property of 1 )
= AAB + AC + BAB + BC (From Distributive law)
= 0 × B + AC + BA + BC (From Complement law))
= AC + BA + BC (From the property of 0 )
R.H.S. = (A + B)(A + C)
= A × A + AC + BA + BC (From Distributive law)
= 0 + AC + BA + BC (From Complement law)
= AC + BA + BC
LHS=RHS

Long Answer Type Questions

Q.1 What is the rule of De-Morgan? (2012, 14)


Ans. Theorem (a): De Morgan’s Theorems:
(x + y)¢ = x ¢ × y ¢
Proof: The truth table for proving this theorem is provided below:
=

x y x¢ y¢ x+y (x + y) ¢ x¢ × y ¢

0 0 1 1 0 1 1

0 1 1 0 1 0 0

1 0 0 1 1 0 0

1 1 0 0 1 0 0

From the above truth table, it is clear that both sides of theorem are equal, Hence, the theorem is proved.
33

Theorem (b): (x + y)¢ = x ¢ + y ¢


Proof: The truth table for proving this theorem is provided below:
=

x y x¢ y¢ x×y (x × y) ¢ x¢ × y ¢

0 0 1 1 0 1 1

0 1 1 0 0 1 1

1 0 0 1 0 1 1

1 1 0 0 1 0 0

From the truth table, it is clear that both sides of theorem are equal. Hence, the theorem is proved.
Theorems (a) and (b) are very important and useful. They are known as De Morgan’s theorems. They can be
extended to n variables as given below:
(x 1 + x 2 + x 3 + .....+ x n )¢ = x 1¢ × x ¢2 × x ¢3 ......... x ¢n
(x 1 × x 2 × x 3 × ..... x n )¢ = x 1¢ + x ¢2 + x ¢3 +.........+x ¢n
Q.2 Write AND Laws, OR laws and NOT Laws (2017)
Or
Explain the working procedure of NOT and OR gate and also write their truth table. (2011)
Or
Explain the working procedure of NOR and NAND gate. Also explain their uses and truth tables.
(2010, 11, 12)
Or
By drawing logic symbol of NAND and NOR gate, write their truth table. (2019)
Ans. AND Gate
An AND gate is the physical realization of the logical multiplication
(AND) operation. It is an electronic circuit which generates an output
Input A B Output
signal of 1, only if all input signals are also 1.
To have a conceptual idea, let us consider the case of Figure. Here, two Two or more switches connected in
switches A and B are connected in series. It is obvious that the input series behave as an AND gate
current will reach the output point, only when both the switches are in
the on(1) state. There, will be no output (output = 0), if either one or both the switches are in the off (0) state.
Hence, two or more switches connected in series behave as an AND gate.

A
C=A· B
B

Inputs Output
A B C = A×B
0 0 0
0 1 0
1 0 0
1 1 1

Block diagram symbol and truth table for an AND gate


34

OR Gate
An OR gate is the physical realization of the logical addition (OR)
operation. It is an electronic circuit, which generates an output A
signal of 1, if any of the input signals is also 1.
Two or more switches connected in parallel behave as an OR gate. Input Output
It can be seen from Figure, that the input current will reach the
output point, when any one of the two switches are in the on(1)
B
state. There will be no output, only when both the switches (A and
Two or more switches connected in parallel
B) are in the off (0) state.
behave as an OR gate
The truth table and the block diagram symbol for an OR gate, for
two input signals, are shown in Figure below. Observe that, an
output of 1 is obtained, when any of the input signals is 1. It is 0, only when both the inputs are 0.

A
C =A+ B
B

Inputs Output
A B C=A+B
0 0 0
0 1 1
1 0 1
1 1 1

Block diagram symbol and truth table for an OR gate


NOT Gate
A NOT gate is the physical realization of the complementation operation. It is an electronic circuit, which
generates an output signal, which is the reverse of the input signal. A NOT gate is also known as an inverter
because it inverts the input.
The truth table and the block diagram symbol for a NOT gate are shown in Figure below. NOT gate always has a
single input. Figure also shows that connecting two NOT gates in series gives an output equal to the input and this
is the gating counterpart to the law of the double complementation, A = A .

A A

(a)

Input Output
A A
0 1
1 0

A
A A=A

(b)
(a) Block diagram symbol and truth table for NOT gate, and
(b) Two NOT gates in series
35

NAND Gate
A NAND gate is a complemented AND gate. That is the output of NAND gate will be a 1, if any one of the inputs is a
0 and will be a 0, only when all the inputs are 1.
The truth table and the block diagram symbol for a NAND gate are shown in Figure. The symbol ‘ ­ ’ is usually
used to represent a NAND operation in Boolean expressions. Hence, A ­ B = A × B = A + B .

A
C = A ­ B = A·B = A + B
B

Inputs Output
A B C=A+B
0 0 1
0 1 1
1 0 1
1 1 0

Block diagram symbol and truth table for a NAND gate

A A·B
A·B = A + B = A ­ B
B
NAND gate realization with an AND gate and a NOT gate
NOR Gate
A NOR gate is a complemented OR gate. That is the output of a NOR gate will be a 1, only when all inputs are 0
and it will be a 0, if any input is a 1.
The truth table and the block diagram symbol for a NOR gate are shown in Figure. The symbol ‘¯’ is usually used
to represent a NOR operation in Boolean expressions. Hence, A ¯ B = A + B = A × B .

A
C=A¯B=A+B=A· B
B

Inputs Output
A B C = A ×B
0 0 1
0 1 0
1 0 0
1 1 0

Block diagram symbol and truth table for a NOR gate

A A+B
A+B=A·B=A¯B
B
NOR gate realization with an OR gate and a NOT gate
qqq
36

Chapter

6
Introduction to ‘C’ : Array
Searching and Sorting

Multiple Choice Questions

Q.1 Which of the following character is constant? (2013)


(a) ‘B’ (b) “2b4a” (c) –8421 (d) +100.21
Q.2 % s is used for :
(a) character data type (b) numeric data type (c) string data type (d) float data type
Q.3 ‘!=’ is a/an :
(a) arithmetical operator (b) relational operator (c) logical operator (d) assigning operator
Q.4 Which header file is used for scanf ( ) and printf ( ) ?
(a) conio.h (b) stdio.h (c) math.h (d) both (a) and (b)
Q.5 Which of the following declaration is not valid in C language ? (2013)
(a) float rate; (b) int a; (c) double percentage (d) int a, c;
Q.6 Double dimensional array is a collection of numeric value in the form of :
(a) TABLE (b) WAP (c) SORT (d) none of these
Q.7 The maximum width of a ‘C’ variable name can be :
(a) 5 characters (b) 8 characters (c) 10 characters (d) 20 characters
Q.8 What will be the index number of nth location of an Array?
(a) n (b) n - 1 (c) n + 1 (d) 2n

Answers
1. (a) 2. (c) 3. (b) 4. (d) 5. (c) 6. (a) 7. (a) 8. (b)

Very Short An swer Type Questions

Q.1 From where the compilation of program starts?


Ans. From main () function.
Q.2 Who developed ‘C’ language and when? (2014)
Ans. In 1972, Dennis Ritchie and Ken Thompson developed ‘C’ language.
Q.3 Which data type consists of fractional values?
Ans. Float.
Q.4 What should be the first character of variable in ‘C’ language? (2012)
Ans. The first character should be first letter of alphabat.
Q.5 What do you mean by sorting? (2012)
37

Ans. Sorting is the process of arranging the data in some order.


Q.6 What is searching? What are its main method? (2011)
Ans. Finding a desire element from the data is called searching. Following is the two main searching methods :
(i) Sequential search (ii) Binary search.
Q.7 What do you mean by sorting?
Ans. Arrangement of data in increasing or decreasing order is called sorting. Sorting are of three types :
(i) Selection sorting (ii) Bubble sorting (iii) Insertion sorting.
Q.8 Explain subscripted variables. (2017)
Ans. A variable with a subscript is known as subscripted variable and it refers to one value in the array. e. g. , stu_age
[0], stu_age [1], etc.

Short Answer Type Questions

Q.1 Define one-dimensional and two-dimensional array with example. (2019)


Ans. One-dimensional array: One-dimensional or single dimensional have only one subscript. Subscript is written
between the [ ] which is after the array name. Element of an array is like a variable or we can say that which can
only represented by an unique subscript.
For example: int arr [5];
Two-dimensional array: In it, data is stored in the form of table.
For example: int arr [4] [5];
float arr 1 [5] [5];
Q.2 Explain stacks. (2018)
Ans. Stack is a primitive data structure, in which some conditions applied. Stack means—to store. Technically stack is
known as LIFO data structure. LIFO stands for Last In First Out, i. e. , information is added in last of the list and
erase first.
Q.3 Explain High Level Language (HLL). (2018)
Ans. HLL languages are not based on internal working procedure of computer. Some selected words of English and
signs used in elementary mathematics are used in these language. To find the error and to remove those are very
easy in it, but it is necessary to translate or compile the programs written in these languages. Generally, computer
programes are written in HLL.
Q.4 What do you mean by subscript? (2012)
Ans. To gain access to a single element within the array, a subscript is used. A subscript may be a numeric constant or
an integer valued variable, is enclosed in parentheses which identifies the position of a given element in the array.
For example, the first element of array TEST (containing the value 15) is referred to as TEST[0]. The second test
score is as TEST[1], the third test score is as TEST[2], and so on. Therefore, the following statements are true :
TEST[0] = 15
TEST[1] = 25
TEST[2] = 5
TEST[3] = 81
TEST[4] = 75
Here, 0, 1, 2, 3 and 4 within parentheses are known as subscript.
Q.5 Describe the generation of programing language. (2018)
Ans. The five generation of programing language are as follows :
(i) The first generation language or 1 GL are lower level languages e. g. , machine language.
(ii) The second generation or 2GL are lower level language which are originated by assembly language.
(iii) The third generation or 3GL are higher level languages e. g. , ‘C’ language.
38

(iv) The fourth generation or 4GL is easy for user and helps to make new application programes. This
generation language is used in database and scripting programing.
(v) The fifth generation or 5GL are programing language that contain visual tools to help develop a programe
e. g. , OPS5 and prolog.

Long Answer Type Questions

Q.1 What is array? What are its types? Write a programe in C language by using array which
calculates average value of 50 whole numbers placed in array. (2019)
Or
What is array? Explain one dimensional and two dimensional array with examples. (2016, 17)
Ans. A single array is the group of same type of data, which could be represented by same name-important thing in this
is that data stored in array are of same type as well as same size. In the array, every element is stored in it with the
help of subscript which written in [ ] after name of Array. This is also called index variable or we can say each
element stored in array is self contained.
Array are of two types :
(a) One-dimensional Array
(b) Two-dimensional Array
(a) One-dimensional Array : One-dimensional or single dimensional have only one subscript. Subscript is
written between the [ ] which is after the array name. Element of an array is like a variable or we can say that
which can only represented by an unique subscript.
Let us understand this with the help of a example, how it is declared and it’s syntax.
Syntax :
< Type of an Array > < Name of an Array > [Element/size];
For example :
int arr [5];
char name [10];
means
arr =
[0] [1] [2] [3] [4]
name =
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]
Here arr[5] means 1-dimensional array of int type, which will store integer value or we can say every element of
array such as arr [0], arr [1], arr [2], etc. will only be represent by one subscript such as 0, 1, 2, etc. In this way
arr[ ] is a 1-dimensional type of array.
Char name [10] means name is char type of 1-dimensional array which is the group of 10 characters or 10
characters are stored.
Means char name [10] = “ALLAHABAD”

A L L A H A B A D ‘\0’
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]
As we known, one int variable take 2 Byte space. So array of 5 element need 10 byte (2 × 5 = 10) space. In the
same way, 1 char variable take 1 byte space which means Array of 8 element need 8 byte space.
(b) Two-dimensional Array: Like one-dimensional array which has only one subscript,in the same way,
two-dimensional Array have two subscript.This also called as Matrix. As in a matrix, every element is pointed by
39

it’s row as well as column, in the same way, for pointing the element two subscript are used in which first subscript
is called row while second subscript is called column.
For example :
First column Second Third column
column
[0] [1] [2]
First row [0] [0] [0] [0] [1] [0] [2]
Second row [1] [1] [0] [1] [1] [1] [2]
Third row [2] [2] [0] [2] [1] [2] [2]

Declaration of Two-dimensional Array : Two-dimensional Array can be represented as :


Syntax :
<Type of Array> <Name of Array> <Number of Row> <Number of Column>
For example :
int arr [4] [5];
float arr 1 [5] [5];
In the above example, int arr [4] [5] means that arr is of int type of two-dimensional, which has 4 rows and 5
column and have total element is 20 [4 × 5 = 20].
In the same way, float arr 1 [5] [5] means that arr 1 is float type two-dimensional. Array in which there is 5 rows
as well as 5 column and the total element are 25 [5 × 5 = 25].
where int [4] [4] means :
First column Second Third column Fourth
column column
First row [0] [0] [0] [1] [0] [2] [0] [3]
Second row [1] [0] [1] [1] [1] [2] [1] [3]
Third row [2] [0] [2] [1] [2] [2] [2] [3]
Fourth row [3] [0] [3] [1] [3] [2] [3] [3]

Initialization of Two-dimensional Array : Initial value can be given to the two-dimensional array only at
the time of declaration. Initial value to this array can be given as follows :
Syntax :
<Type of Array> <Name of Array> [No. of row] [No. of column] = [Value 1, Value 2...]
OR <Type of Array> <Name of Array> [No. of row] [No. of column]
= {{Value of first row} {Value of second row}};
For example :
int num [2] [2] = {6, 18, 23, 30};
OR int num [2] [2] = {{6, 18}, {23, 30}};
In the above example, int num [2] [2] = {6, 18, 23, 30}; first value written between { }, i.e., (6) will be the first
element or it will stored at num [0] [0]. And in the same way 18, 23 and 30 are stored in continuous order(way).
If the address of num [0] [0] is 1048 in memory then,
40

num[0][0] num[0][1] num[1][0] num[1][1]


6 18 23 30 ¬¾ Value
1048 1050 1052 1054 ¬¾ Address

Programe in C language which calculates average value of 50 whole numbers placed in an array.
#include<stdio.h>
#include<conio.h>
void main ( )
{
int n = 50, i, a [50], sum = 0, avg;
clrscr ( );
printf (“Enter the 50 whole numbers”);
for (i = 0; i<n; i++)
{
scanf (“%d”, &a[i]);
}
for (i = 0; i<n; i++)
{
sum = sum + a [i];
}
avg = sum/n;
printf (“%d”, avg);
getch ( );
}
Q.2 Explain searching, sorting and merging and give example of each. (2019)
Or
What is searching and sorting? Explain their technique available in C language. (2018)
Ans. Searching : Searching means find or select. To find some text or written information or group of data according
to the need of the user in programming language is called searching.
Example: The given program searches the number chose by sequential search out of a positive whole number test
list.
Program: This can be explained by following example :
#include <stdio.h>
main ( )
{
int num [50], n, i;
int temp, flag = 0;
printf ("Enter the size of the list :\n");
scanf ("%d", &n);
printf ("Enter the integer number :\n");
for (i = 0; i< n; i++)
{
scanf("%d", & num [i]);
printf ("Enter the number search for :")
scanf ("%d", temp)
41

for (i=0; i<n; i++)


{
if (num [i] = = temp)
{
flag = 1;
printf ("Number is found in the list at % dth position", i + 1);
break;
}
}
if (flag = = 0)
printf ("Sorry! Number is not present in the list);
}
Result : Enter the size of the list
5
Enter the integer numbers
26
23
30
18
15
Enter the number search for : 18
Number is found in the list at 4 th position.
Sorting: Arrangement of data in increasing or decreasing order is called sorting.
Example : Write a program to arrange the element present in array in increasing order.
#include <stdio.h>
main ( )
{
int num [10], temp, i, j;
for (i=0, i<10; i++)
{
printf ("Enter the number \n")
scanf("%d", & num [i]);
}
for (i = 0; i < 10; i++)
{
for (j=i+1; i<10; j++)
{
if num [i] > num [j]
{
temp = num [i]
num [i] = num [j];
num [j] = temp;
}
}
}
42

Merging: The procedure, to add two array with third array, is known as merging.
Program:
#include<stdio.h>
#include<conio.h>
void main ( )
{
int a[50], b[50], c[50], i, k, sizel, size2, size3;
clrscr ( );
printf (“Enter the size of first array”);
scanf (“%d”, &sizel);
printf (“Enter the elements of first array \n”);
for (i=0; i<size1; i++)
{
scanf (“%d”, &a[i]);
}
printf (“Enter the size of second array”);
scanf (“%d”, &size2);
printf (“Enter the elements of second array \n”);
for (i=0; i<size2; i++)
{
scanf(“%d”, &b[i]);
}
printf (“Elements of third array after merge \t”);
for (i=0; i<size1; i++)
{
c[i]=a[i];
}
size3 = size1 + size2;
for (i=0, k=size1; k<size3 && i<size2; i++, k++)
{
c[k]=b[i];
}
for (i=0; i<size3; i++)
{
printf (“%d\t”, c[i]);
}
getch ( );
}
qqq
43

Chapter

7 String in ‘C’

Multiple Choice Questions

Q.1 A variable name must start with :


(a) An alphabet (b) A number (c) $ symbol (d) # sign
Q.2 The correct pattern to declare string variable is :
(a) char Add; (b) int num[20]; (c) char string_name[size]; (d) char[10] Add;
Q.3 % is used for :
(a) String data type (b) Character data type (c) Numeric data type (d) Float data type
Q.4 Output of statement char ch = ‘B’ ; printf("%d, ch +2); is :
(a) 65 (b) 68 (c) B (d) b
Q.5 Which header file is used for scanf( ) and printf( ) ?
(a) stdio.h (b) conio.h (c) math.h (d) Both (a) and (b)
Q.6 getchar( ) function is used to read how many characters?
(a) one (b) two (c) three (d) four
Q.7 Correct form of function strrev( ) is :
(a) n = strrev( ); (b) strrev(string); (c) strrev( ); (d) strrev(string,ch);

Answers
1. (a) 2. (c) 3. (a) 4. (b) 5. (b) 6. (a) 7. (b)

Very Short Answer Type Questions

Q.1 Why does function gets( ) use?


Ans. It is used to read string with space.
Q.2 What is string? (2011, 12)
Ans. Any numeric value, word or specific sign written under sign (" ") is called string e.g., "Umang", "OS", "*" etc.
Q.3 Which function is used to find the length of a string? (2017)
Ans. strlen( ) function.
Q.4 What is the name of the function which is used to copy a string into another?
Ans. strcpy( ) function.
Q.5 Function to check the time of the day. (2012)
Ans. time ( ).
44

Short Answer Type Questions

Q.1 Explain concatenation of two strings with example. (2012, 14)


Or What is the addition of two strings? Explain with example. (2010, 11)
Ans. Two strings cannot be added as mathematical addition, e.g., String 3 = String 1 + String 2 (incorrect)
To add two strings, first of all we have to define two strings separately and then copy in Third string, for this the
size of third string should be enough that both string may copy in it.
Two strings are added with function strcat( ).
Syntax : strcat (string1, string2);
Example : #include<stdio.h>
#include<string.h>
void main( )
{
char a[100], b[100];
printf("Enter the first string");
gets(a);
printf("Enter the second string");
gets(b);
strcat(a, b);
printf("String obtained on concatenation is %s", a);
}
Output : Enter the first string Programming
Enter the second string Language
String obtained on concatenation is Programming Language
Q.2 What is string? Explain its types. (2018)
Or Explain any two string functions with examples. (2017)
Or What is strlen( ) in ‘C’ language? (2011)
Ans. String : Refer to Q.2 (VSA type questions)
Types of string :
(i) Strcat( ) Function : With the help of the function two different string can be connected with each other which
mean this function take first string and connect (join) second string at the end of the first string. Process of
connecting two string is called concatenation.
(ii) Strcpy( ) Function : With the help of this function we can copy on string into the another string or we can say
that this can copy first string in place of second string.
(iii) Strcmp( ) Function : With the help of this string function we can compare two string. If both string is same than
it provide ‘O’ else if both are different then both string are compared not on the bases of length but on the bases of
element stored.
(iv) Strlen( ) Function : With the help of this function we determine the length of strings or number of element
present in the string.
(v) Strcat( ) : This function appends or concatenates copy of source string to the end of target string.
For example : if source string is ‘‘Bhardwaj’’ and target string is ‘‘Neeraj’’ then strcat will return ‘‘Neeraj
Bhardwaj’’.
(vi) Strrev( ) : This function is used to reverse all the characters of string. It means the position of the characters will
be reversed by using this function.
(vii) Strlwr( ) : This function is used to convert string of upper case to lower case.
45

(viii) Strupr( ) : This function is opposit of strlwr function as it is used to convert lower case (a to z) to upper case (A to
Z).

Long Answer Type Questions

Q.1 Write name and uses of four functions used on strings. (2011, 12)
Ans. Following are the four functions used on string :
1. strcat( )
2. strcpy( )
3. strcmp( )
4. strlen( )
1. Strcat( ) Function : With the help of the function two different string can be connected with each other which mean
this function take first string and connect (join) second string at the end of the first string. Process of connecting two string is
called concatenation.
Syntax :
strcat (str1, str2)
OR
strcat (to, from);
Example :
.......................
char str1[20] = "BALAJI";
char str2 [20] = "PUBLICATION";
str (str1, str2);
puts (str1);
Result : BALAJI PUBLICATION
Example : To connect two string given by the user.
#include <stdio.h>
#include <conio.h>
#include <string.h>
main( )
{
char str1 [20], str2 [20];
clrscr;
printf("Enter the first string\n");
gets (str1);
printf("Enter the second string");
gets (str2)
strcat (str1, str2);
printf(string after concatenation : %s", str 1);
}
2. Strcpy( ) Function : With the help of this function we can copy on string into the another string or we can say that
this can copy first string in place of second string.
Syntax :
strcpy (str1, str2);
OR
strcpy (to, from);
....................
char str1 [30] = "It is Wednesday today";
char str2 [30] ="It is Thursday today";
....................
strcpy (str2, str1);
puts(str2);
Result : It is Wednesday today.
Example : To copy first string into the second string enter by the user.
46

#include <stdio.h>
#include <string.h>
#include <conio.h>
void main ()
{
clrscr( );
char str1 [30], str2 [30];
printf("Enter the first string");
gets(str1);
strcpy (str2, str1);
printf("After coping first string is: %s", str2);
}
3. Strcmp ( ) Function : With the help of this string function we can compare two string. If both string is same than it
provide ‘O’ else if both are different then both string are compared not on the bases of length but on the bases of element
stored.
Syntax :
strcmp (str1, str2);
char str1 [20] = "ABCD";
flag = strcmp (str1, "BCDE");
Here, value of flag will be less than 0.
flag = strcmp ("India", "india");
Here, value of flag will be 0.
Example : Write a program, to compare two given string by the user.
#include <stdio.h>
#include <string.h>
main ( )
{
char str1 [25], str2 [25];
printf ("Enter the first string\n");
gets (str1);
printf ("Enter the second string\n");
gets (str2);
if (strcmp (str1, str2) = = 0)
printf ("Strings are equal\n");
else
printf ("Strings are not equal\n");
}
Result :
Enter the first string
Sharanya
Enter the second string
Ananya
Strings are not equal
4. strlen( ) Function : With the help of this function we determine the length of strings or number of element present in
the string.
Syntax :
strlen (string);
...............
char name [25] = "BALAJI PUBLICATION"
n = strlen (name);
Result : 19 (19 will print on screen)
Example : Write a program, to determine the length of string input by user.
#include <stdio.h>
#include <string.h>
47

void main ( )
{
char city [20];
int num;
printf ("Enter the string or city name;\n");
gets (city);
num = strlen (city);
printf ("The length of city is : %d", num);
}
Example :
main( )
{
char name [25];
printf ("Enter your name\n");
gets (name);
printf ("The length of name is = %d", strlen (name));
}

qqq
48

Chapter

8 Function in ‘C’

Multiple Choice Questions

Q.1 Language used to design web pages is : (2014)


(a) C++ (b) BASIC (c) HTML (d) JAVA
Q.2 Which of the following is not numeric function?
(a) tan (x) (b) strlen ( ) (c) tanh (x) (d) sqrt ( )
Q.3 Parameter is also known as :
(a) argument (b) function (c) list (d) array
Q.4 To call other function in a function is known as :
(a) recursive function (b) numeric function (c) string function (d) nesting function
Q.5 Functions which are compiled into object modules are known as : (2012)
(a) Library functions (b) Recursive functions (c) User-defined functions (d) None of these
Q.6 Default return type of a user-defined function is :
(a) void (b) float (c) char (d) int.

Answers
1. (c) 2. (b) 3. (a) 4. (d) 5. (a) 6. (a)

Q.1 What is numerical function? (2016)


Ans. The functions, used for various mathematical operation on the numbers, are called numeric functions, e. g. ,
pow(x), tan(x) etc.
Q.2 Why function exp(x) is used?
Ans. To determine exponential of a number (x).
Q.3 Which function is necessary in a valid ‘C’ program?
Ans. main ( ).
Q.4 Where are the prototypes of Library functions?
Ans. Header files.
Q.5 Name any two arithmetic functions.
Ans. (i) abs(x) (ii) fabs(x)
49

Short Answer Type Questions

Q.1 What is function? Explain. (2017)


Ans. The process to devide a large work into several small works while programing, is known as function. Function is
an independent part of a program, which is used for a specific work. Each function has a unique name in a
program.
Q.2 Explain about library function. (2018)
Or
Give two examples of library function. (2019)
Ans. These are such functions, participate mainly in ‘C’ language. These functions are recognised by their names and
used. Necessary informations in the form of parameters are provided with these functions. These functions are
called library functions or built-in-functions.
Examples: (i) scanf() and (ii) printf()
Q.3 Describe any four character functions used in ‘C’ language.
Ans. Various character functions, whose header file is ctype.h, used in ‘C’ language. Four character functions are as
follows :
(i) is lower (C) true, if ‘C’ is small letter of alphabat.
(ii) is upper (C) true, if ‘C’ is capital letter of alphabat.
(iii) is alpha (C) true, if ‘C’ is a letter of alphabat.
(iv) is digit (C) true, if ‘C’ is a number.
Q.4 How does a function defined in ‘C’ language?
Ans. Syntax :
function_name (parameter list)
Parameter declaration;
{
local variable declaration;
Statement 1;
Statement 2;
return (expression);
}
Q.5 Describe recursion with example. (2012)
Ans. When a function calls itself in its definition, then such situation is known as recursion and function is called
recursive function.
Example : Write a program to find factorial of a given number.
#include <stdio.h>
main ( )
{
int n;
printf ("Enter any number");
scanf ("%d, =%d", n, fact (n));
}
int fact (int x)
{
if (x = =0)
return (1);
50

else
return (x *fact (x-1));
}
Result : Enter any number = 5
5! = 120

Long Answer Type Questions

Q.1 What are numeric functions in ‘C’ language? Explain any four. (2017)
Or
What are library functions? Write their uses with examples. (2010, 14, 16)
Or
Describe necessities of user defined functions and their uses with examples. (2019)
Or
What are user defined functions? What factors should be keep in mind in such functions?
Ans. Function is a part of main program and generally used for calculations of main program. There are following two
types of functions in ‘C’ language :
(i) Buil-in-function or Library function and (ii) User defined function
(1) Buil-in-function (or Library function)
These are such functions, which participate mainly in ‘C’ language. These are recognized with their names and
used. We provide essential information with these functions in the form of parameters.
Different types of library functions are given below:
(i) Arithmatic function: Such type of functions are used for arithmatic operations.
Þ abs ( ): Prototype < math.h> of this function is available in header file. This function is used for returning the
absolute value of a number.
Þ sin ( ): Prototype <math.h> of this function is available in header file. This function is used for returning the
values of sin of given angle in radian.
Example: #include<stdio.h>
#include<math.h>
void main ( )
{
double a, b, angle;
printf (“Enter the Angle in radians:”);
scanf (“%1f ”, &angle);
a = (3.14/180)*angle;
b = sin (a);
printf (“Sine value of %1f is %1f ”, angle, b);
}
Output: Enter the Angle in radians : 60
Sine value of 60.000000 is 0.865760
Þ exp ( ): Prototype <math.h> of this function is available in header file. This function is used to determine the
exponential of a number.
Þ sqrt ( ): Prototype <math.h> of this function is available in header file. This function is used to find square
root of a number.
(ii) String function: Such functions are used on strings.
51

Þ strlwr ( ): Prototype <string.h> of this function is available in header file. This function is used to change
small letters of alphabat.
Þ strcmp ( ): Prototype <string.h> of this function is available in header file. This function is used to compare
two strings.
Þ strcat ( ): Prototype <string.h> of this function is available in header file. This function is used to add two
strings.
(iii) Character function: Such functions are used on characters.
Þ isupper (c): Prototype <ctype.h> of this function is available in header file. This function ensures true
return, if character (c) is capital letter of alphabat.
Example: #include<stdio.h>
#include<ctype.h>
void main ( )
{
char s;
printf (“Enter the string”);
scanf (“%c ”, &s);
if (isupper (s))
printf (“This is in upper case”);
else
printf (“This is not in upper case”);
}
Output: Enter the string g
This is not in upper case
Enter the string G
This is in upper case
Þ isdigit (c): Prototype <ctype.h> of this function is available in header file. This function ensures true return if
character (c) is a number.
Þ tolower ( ): Prototype <ctype.h> of this function is available in header file. This function converts character
(c) into small letters of alphabat.
(2) User defined functions
These functions are written according to the requirement of the user e. g. , Main () function.
We have to consider the following three elements while using this function :
(i) To define functions :
Syntax : function_type function_name (parameter list)
{
local variable declaration;
executable statement1;
executable statement2;

return statement;
}
Example: int add (int x, int y)
{
int a;
a = x+y;
return (a);
}
52

Parameters (or arguments) are separated by their data type by applying comma.
(ii) To call the function: A function may be call in a program by only giving its name and by putting its actual
parameter or list of argument (if any) in a bracket.
Syntax: function_name (parameter list);
Example: To call the function add ( ) defined above.
Main ( )
{
int s;
s = add (4, 5);
printf (“%d”, s);
}
(iii) To declare the function: All functions used in a ‘C’ program are declared before their usage (like variables).
Syntax: function_type function_name (parameter list);
Example: int add (int, int);
qqq
53

Chapter

9 File Operations in ‘C’

Multiple Choice Questions

Q.1 Which of the followings function is appropriate function to close the file ? (2016)
(a) CLOSE (b) END (c) EOF (d) FILE END
Q.2 Which of the followings command is used to read character in a file ?
(a) putc( ) (b) getw( ) (c) getc( ) (d) putw( )
Q.3 Which of the followings command is used to set the file pointer in the file initially ?
(a) ftell( ) (b) fseek( ) (c) rewind( ) (d) feof( )
Q.4 Which function sets the file pointer associated with a strem to a new position ?
(a) fseek( ) (b) perror (c) rename (d) rewind
Q.5 Syntax of command getw is :
(a) getw (FILE *filepointer); (b) getw (FILE)
(c) getw (*filepointer); (d) int getw (FILE *filepointer);

Answers
1. (a) 2. (c) 3. (c) 4. (a) 5. (a)

Very Short Answer Type Questions

Q.1 Which is the faster mode to access a file ?


Ans. Random mode.
Q.2 Differentiate between r and r+ mode.
Ans.
r r+ mode
It is used to read the records of the file. It is used to read and write (both) the records of the file.

Q.3 Which statement is used to close a file ?


Ans. fclose( ) statement.
Q.4 When data is to be written on a file, in which mode it should be opened ? (2016)
Ans. ‘w’ mode (for writing).
Q.5 Why does command fprintf ( ) used ?
Ans. Command fprintf ( ) is used to write the value of data in a file.
54

Q.6 Write syntax of command fscanf ( ).


Ans. Syntax of command :
fscanf (FILE *filepointer, constant char *format_string);

Short Answer Type Questions

Q.1 Explain about Random data files. (2014, 18)


Ans. Such files, in which we can approach directly to any record, are called random data files. To make and use such
files is comparatively hard but if we use it, we can save a lot of time. Such files can be make on disc only.
Q.2 Write short notes on :
(i) putw ( ) command
(ii) getw ( ) command
Ans. (i) putw ( ) command is used to write an integer in a file.
Syntax : putw (int variable, FILE *filepointer);
(ii) getw ( ) command is used to read an integer in a file.
Syntax : getw (FILE *filepointer);
Q.3 What are sequential data files ? Explain its characteristics. (2014)
Ans. These are such types of files, in which operations of reading and writing the data is done by starting of its first
record to final respectively. The files made on a disc or magnetic tape are the examples of sequential files. It is very
easy to make and use such types of files, but there is a major drawback in such files that user cannot approach any
data directly.
Characteristics : (i) Data is collected sequentially in this file.
(ii) In a single attempt, user either read the file or write the file.
(iii) These files use blank space properly.
(iv) The data written in these files neither read directly nor written on specific place in the files.
(v) Making and usages of these files is very easy.
Q.4 What is file? Explain functions fscanf ( ) and fgetc ( ) in ‘C’ language. (2017)
Ans. A file is such a place on a disc, where a group of related data is stored. This data storage is unstable.
fscanf ( ) function : It is used for handling files. This function is used to read any type of data.
syntax : fscanf (FILE *filepointer, constant char *format_string);
fgetc ( ) function : It is used to read a character from the file.
syntax : int fgetc (FILE *filepointer);
Q.5 Explain functions fflush ( ) and fseek ( ) with examples. (2017)
Ans. fflush ( ) function : It is used to clean file or buffer.
syntax : int fflush (FILE *pointer);
In ‘C’ program, we can use this function as :
fflush (buffer); where buffer is unstable variable or pointer.
fseek ( ) function : It is used to open a file at a certain place.
syntax : int fseek (FILE * file pointer, long offset_int origin);
55

Long Answer Type Questions

Q.1 Explain the file in ‘C’ language and write its type. Explain the main functions of ‘C’ language to
read data. (2013, 19)
Or
Explain the input/output operations in a file. (2016)
Or
What do you mean by file operation in ‘C’ language? (2016)
Or
Explain the following functions : (2019)
(i) fseek ( ) (ii) rewind ( ) (iii) feof ( )
Ans. File : A file is such a place on a disc where a group of related data is stored. This data storage is unstable.
Types of file : There are two types of files :
(1) Program file : Programs written in a programing language are stored in the files, these files are known as
program files.
(2) Data file : The files in which data, used for input/output programs, is stored are known as data files. These
files are categorised in several categories. Following two are main types :
(i) Sequential data files : Refer to Q. 3 (Short Answer Type Questions)
(ii) Random data files : Refer to Q. 1 (Short Answer Type Questions)
Define a file : Data structure of file is defined in the form of FILE in the library of definitions of standard input/
output functions. It is an already defined data type. General for to declare a file is as follows :
FILE * afile;
Here variable afile is a pointer for data type FILE
Various file operation : These are the functions, by which we can open the disc file, we can add or subtract
and close the file. For any type of operation, first of all we have to open the file.
For this first of all we have to declare the file. Several operations are as follows :
(a) fopen ( ) command : It is used to make a new file or to open or start a file in memory. Here file can be open
in several mode, e. g. ,
r (read) mode
r+ (read/write) mode
w (write) mode etc.
syntax : fopen (“filename”, “mode”);
(b) fclose ( ) command : It is used to close an opened file. By using this command a user can close more than
one files simultaneously.
syntax : fclose (FILE * filepointer);
(c) getc ( ) command : It is used to read a character from a file.
syntax : getc (FILE * filepointer);
(d) putc ( ) command : It is used to write a character in a file.
syntax : putc (character, FILE * filepointer);
(e) fgetc ( ) command : It is used to read a character from the file.
syntax : int fgetc (FILE * filepointer);
(f) fprintf ( ) command : It is used to write the value of data in a file.
syntax : fprintf (FILE * filepointer, constant char *format_string);
56

(g) fscanf ( ) command : It is used to read data value in a file.


syntax : fscanf (FILE * filepointer, constant char *format_string);
(h) getw ( ) and putw ( ) command : Refer to Q. 2 (Short Answer Type questions)
(i) feof ( ) command : It is used to examine that file pointer reached at the end of the file or not.
syntax : int feof (FILE * filepointer);
(j) fflush ( ) command : Refer to Q. 5 (Short Answer Type questions)
(k) fseek ( ) command : Refer to Q. 5 (Short Answer Type questions)
(l) ftell ( ) command : It is used to know the number of bytes used from starting to end of a file.
syntax : long ftell (FILE * file pointer);
(m) rewind ( ) command : It is used to set the file pointer in the starting of the file. Its advantage is that we can
read or write a file again and again without open or close it.
syntax : void rewind (FILE * filepointer).
Q.2 Explain the random excess function in the file. (2016)
Ans. Random data files : Refer to Q. 1 (Short Answer Type questions)
Types of random excess function :
(i) fseek ( ), ftell ( ) and rewind ( ) : Refer to above questions.

qqq
57

Chapter

10
Programs Based on ‘C’
Language

Q.1 To find the sum of n natural numbers.


Ans. #include <stdio.h>
#include <conio.h>
main( )
{
int n,i,sum;
sum=0
printf("Enter any integer \n");
scanf("%d", &n);
for (i=0; i<=n; i++)
{
sum=sum+i;
}
printf("Sum of the natural numbers is %d", sum);
getch( );
}
Output Enter any integer
10
Sum of the natural numbers is 55

Q.2 To find and print the prime numbers from 1 to 100. (2010)
Ans. #include <stdio.h>
#include <conio.h>
main ()
{
int n,i,j;
float r;
for (i=1; i<=n;i++)
{
for (j=2;j<=i/2;j++)
{
R=i%j;
if(r = =0)
}
break;
}
}
if (r!=0)
58

}
Printf ("\n%d",i)
}
getch( );
}
Output 1 3 5 7 11 13 17 19 23 29 31 37 41 43 47 ........

Q.3 To find the largest of three numbers.


Ans. #include<stdio.h>
#include<conio.h>
main( )
{
int x, y, z;
printf("Enter the value of x,y and z\n");
scanf("%d%d%d", &x, &y, &z);
if (a>b)
{
if (a>c)
{
printf ("A is greatest among three\n");
}
else
{
printf ("C is greatest among three\n");
}
else if (b>c)
{
printf ("B is greatest among three\n");
}
else
{
printf ("C is greatest among three\n");
}
getch( )
}
Output Enter the value of x, y and z
23 40 26
B is greatest among three

Q.4 To check whether a given integer is palindrome or not.


Ans. #include <stdio.h>
#include <conio.h>
main ( )
{
int num,rev,found,temp,digit;
rev = 0;
59

found = 0;
printf("Enter an integer\n");
scanf("%d", &num);
temp=num;
while (num > 0)
{
digit=num%10;
rev=rev*10+digit;
num/=10;
}
Printf("Given number is =%d\n", temp);
if (temp = = rev)
Printf("Number is palindrome\n");
else
Printf ("Number is not palindrome\n");
getch( );
}
Output Enter an integer
1 2 3 2 1
Number is palindrome

Q.5 Linear search .......


Ans. #include <stdio.h>
#include <conio.h>
main( )
{
int array [10];
int i,n,key,found=0;
printf("Enter the value of N\n")
scanf("%d", &n);
printf("Enter the elements one by one\n");
for (i=0; i<=n; i++)
{
scanf("%d",&array[i]);
printf("Enter the number to be searched\n");
scanf("%d", &key)"
/*searching begins .....*/
for (i=0; i<=n; i++)
{
If (key = =array[i])
{
found = 1;
break;
}
}
60

If (found= = 1)
printf("Number is find Successfully!\n");
else
printf("Number is not found!\n");
getch( );
}
Output Enter the value of N
5
Enter the elements one by one
56
32
85
12
35
Enter the number to be searched
85
Number is find Successfully!

Q.6 Linear search .....


Ans. #include <stdio.h>
#include <conio.h>
main( )
{
int array[max size];
int i,j,n, temp;
clrscr( );
printf("Enter the value of n\n");
scanf("%d", &n);
printf("Enter the elements of an array\n");
for (i=0; i<=n; i++)
{
scanf("%d", &array[i]);
}
printf("input array is \n");
for (i=0; i<=n; i++)
{
printf("%d",array[i]);
}
/* Bubble sorting technique*/
for(i=0; i<=n; i++)
{
for(j=0; j<(n-i-1); j++)
{
if (array[j]>array[j+1]);
temp =array [1]
array[j] = array[j+1];
61

array[j+1] = temp;
}
}
}
Printf ("Sorted array is \n");
for (i=0; i<=n; i++)
{
printf("%d\n", array[i]);
}
getch( );
}
Output Enter the value of n
6
Enter the elements of an array
30
23
18
26
87
34
The stored array is ........
18
23
26
30
34
87

Q.7 To reverse the list of given numbers.


Ans. #include <stdio.h>
#include <conio.h>
#define max 20
main( )
{
int num [max];
int rev_num [max];
int n,i,j;
printf("Enter the number (not more than 20):");
scanf("%d", &n);
printf("Enter %d integer numbers:");
for (i=0; i<n; i++)
scanf("%d", &num[i]);
for (j=0; i=n–1; j<n; j++, i ³ 0 i– –)
rev_num[j] = num[i];
printf("Reversed numbers are :)
for (i=0; i<n; i++)
62

printf("%d", rev_num[j]);
}
Output Enter the number (not more than 20):
5
Enter 5 integer numbers :
5 6 7 8 9
Reversed numbers are :
9 8 7 6 5

Q.8 To print the table of first 10 numbers.


Ans. #include <stdio.h>
#include <conio.h>
int main( )
{
int table[10][10];
int i,j ;
for (i=0; i<10; i++)
{
for (j=0; j<10; j++)
{
table[i][j]=(i+1)*(j+1);
}
}
Printf("The table of first 10 numbers as follows :........");
for (i=0; i<10; i++)
{
for (j=0; j<10; j++)
{
Printf("%\n", table [i][j]);
}
}
return 0;
}
Output The table of first 10 numbers as follows : .......
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
3 6 9 12 15 18 21 24 27 30
4 8 12 16 20 24 28 32 36 40
5 10 15 20 25 30 35 40 45 50
6 12 18 24 30 36 42 48 54 60
7 14 21 28 35 42 49 56 63 70
8 16 24 32 40 48 56 64 72 80
9 18 27 36 45 54 63 72 81 90
10 20 30 40 50 60 70 80 90 100
63

Q.9 Object : To sum of two 3 * 3 table integers number.


Ans. #include <stdio.h>
#include <conio.h>
main( )
{
int num_1[3][3];
int num_2[3][3];
int sum_num[3][3];
int i,j;
printf("Enter the elements of first table:\n");
for (i=0; i<3; i++)
{
for (j=0; j<3; j++);
{
scanf("%d", &num_1[i][j]);
}
}
printf("Enter the elements of second table:\n");
for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
{
scanf("%d",&num_2[i][j]);
}
}
/*sum of table*/
for (i=0; i<3; i++)
{
for(j=0; j<3; j++);
{
sum_num[i][j] = num_1[i][j] + num_2[i][j];
}
}
/*print the table of sum is as fallows .......*/
for (i=0; i<3; i++)
{
for (j=0; j<3; j++)
{
Printf("The sum of first and second table ...");
Printf("%3d", sum_num[i] [j]);
Printf("\n");
}
}
getch( );
}
64

Output Enter the elements of first table :


3 5 2
1 3 2
2 1 3
Enter the elements of second table :
3 2 1
2 3 2
3 1 2
The sum of first and second table .....
6 7 3
3 6 4
5 2 5

Q.10 To multiplication table of two 3 * 3 table integers number.


Ans. #include <stdio.h>
#include <conio.h>
main( )
{
int num_1[3][3];
int num_2[3][3];
int multi_table[3][3];
int i,j;
printf("Enter the elements of first table:\n");
for (i=0; i<3; i++)
{
for (j=0; j<3; j++)
{
scanf("%d",&num_1[i][j]);
}
}
printf("Enter the elements of second table:\n");
for (i=0; i<3; i++)
{
for (j=0; j<3; j++)
{
scanf("%d",&num_2[i][j]);
}
}
/*multiplication of table */
for (i=0; i < 3; i++)
{
for (j=0; j<3; j++)
{
multi_table[i][j] = num_1[i][j] * num_2[i][j];
}
}
65

/*print the table of sum is as follows .....*/


for (i=0; i<3; i++)
{
for (j=0; j<3; j++)
{
Printf("The multiplication of first and second table ...");
Printf("%3d", multi_table[i][j]);
Print("\n");
}
}
getch( );
}
Output Enter the elements of first table :
3 3 2
2 3 2
2 3 3
Enter the elements of second table :
3 2 1
2 3 2
3 3 2
The sum of first and second table .....
9 6 2
4 9 4
6 9 6

Q.11 To print the following :


*
* *
* * *
* * * *
* * * * *
Ans. #include <stdio.h>
#include <conio.h>
main( )
{
int i,j;
for (i=0; i<5; i++)
{
for (j=0; j<=i; j++)
{
printf("*");
printf("\n");
}
}
getch( );
}
66

Q.12 To print the following :


1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Ans. #include <stdio.h>
#include <conio.h>
main ( )
{
int i,j;
for (i=0; i<5; i++)
{
for(j=1; j<=i; j++)
{
print("%d\t", i);
printf ("\n");
}
}
getch();
}
Q.13 To find the greatest among two using function.
Ans. #include <stdio.h>
#include <conio.h>
int great (int x, int y);
void main( )
{
int x, y, m;
Printf ("Enter any two integers\n");
Scanf("%d%d",&x,&y);
m=great(x,y);
printf("The greatest number is %d", m);
getch( );
}
int great(int a, int b)
{
if (a > b)
return (a);
else
return (b);
}
Output Enter any two integers:
23
18
The greatest number is 23
67

Q.14 To read a string and write it in reverse order.


Ans. #include <stdio.h>
#include <conio.h>
#include <string.h>
void main( )
{
char str 1[20], str 2[20];
int i,j,m,n;
printf("\n Enter any string.....:");
scanf("%s", &str1);
m=strlen(str1);
for(i=m-1; j=0; i>=0; j£ m-1; i– –; j++)
{
str2[j] = str1[i];
}
str2[j]='\0';
Printf("\n The reversed string is : %s", str2);
getch( );
}
Output Enter any string .... jaya
The reversed string is : ayaj

Q.15 To sort the list of strings.


Ans. #include <stdio.h>
#include <conio.h>
#include <string.h>
main( )
{
char text[10][30];
char temp[20];
int i,j;
printf("\n Please enter any ten friends name:\n");
for (i=0; i<10; i++)
gets(text[i]);
for(i=0; i<10; i++)
{
for(j = 9; j>=i; – – j)
{
if (strcmp(text[j–1], text[j]))>0
{
strcpy(temp,text[j–1]);
strcpy(text[j–1],text[j]);
strcpy(text[j], temp);
}
}
}
68

Printf(The sorted list of names are:\n");


for(i=0; i<10; i++)
puts(text[i]);
getch( )
}
Output Please enter any ten friends name:
roma
archana
swati
santosh
jaya
ravi
pyush
gaurabh
yati
anushaka
The sorted list of names are :
anushaka
archana
gaurabh
jaya
pyush
ravi
roma
santosh
swati
yati

Q.16 /* To count the numbers of words in a sentence */


Ans. #include <stdio.h>
#include <string.h>
main( )
{
char string-n [50];
int i=0, count =0;
printf ("Please enter any sentence:");
gets(string-n);
while (string-n [i]! = '\0')
{
if (string-n [i] = = ‘ ’)
{
count ++;
{
i++;
{
count ++
69

Printf("The total no of words in given sentence)%d" are count);


{
Output Please enter any sentence i like computer
The total no of words in given sentence 3

Q.17 /* To count the no. of Alphabets and number in given string */


Ans. #include <stdio.h>
#include <string.h>
#include <conio.h>
main( )
{
char text [50];
int i=0,c-alpha=0, c-num=0;
printf("Please enter any string:");
gets(text);
while (text [i]! = '\0')
{
if {(text[i] >= 'a' && text[i] <= z) :: (text[i] >='A' && text [i] <='Z'))
{
c-alpha ++;
{
if (text [i] = '0'&& text[i] <='9')
{
c-num++;
{
i++;
{
printf("in No of alphabets = %d", c-alpha);
printf("No of digits = %d", c-num);
getch( );
{
Output Please enter any string : Balaji 18
No. of alphabets = 6
No. of digits = 2

Q.18 Write a program in 'C' language which input 20 numbers and print them in descending order.
(2016)
Ans. #include<stdio.h>
void main ( )
{
int num [30], s, i, j, temp;
printf ("Enter the size of the list : ") ;
scanf ("%d", &s) ;
printf ("Enter the positive numbers upto size:in") ;
for (i=0; i<s; i++)
70

scanf ("\n%d", &num [i]) ;


for (i=0; i<s; i++)
for (j=i+1; j<s; j++)
{
if (num[j] >num [i])
{
temp=num[i];
num[i]=num[j];
num[j]=temp;
}
}
printf ("The list in descending order:\n");
for (i=0; i<s; i++)
printf ("\n%d", num[i]);
}
Output
Enter the size of the list: 20
Enter the positive numbers upto size:
52
46
27
46
45
22
13
07
13
67
78
92
90
12
10
87
23
44
65
23
The list in descending order:
92
90
87
78
67
65
52
71

46
46
45
44
27
23
23
22
13
13
12
10
7
Q.19 Write a program in ‘C’ language which may searh that specific data is available or not in a
string.
(2016)
Ans. #include<stdio.h>
void main ( )
{
char c [1000], ch;
int i, count=0;
printf ("Enter a string: ");
gets (c);
printf ("Enter a character to find frequency: ");
scanf ("%c", &ch);
for (i=0; c[i] !='\0' ;++i)
{
if (ch==c[i])
++count;
}
printf {"Frequency of %c = %d", ch, count) ;
}
Output
Enter a string : Program
Enter a character to find frequency : g
Frequency of g = 1
Q.20 Write a program in ‘C’ language, which may print in the form of an array in ascending order by
being input of 10 digits. (2016)
Ans. #include<stdio.h>
void main ( )
{
int num [100], s, i, j, temp;
printf ("Enter the size of the list:");
scanf ("%d", &s) ;
printf ("Enter the positive numbers upto size : in") ;
for (i=0; i<s; i++)
72

scanf ("\n%d", &num[i]) ;


for (i=0; i<s; i++)
for (j=i+1; j<s; j++)
{
if (num[j] <num [i])
{
temp=num [i];
num [i] = num [j] ;
num [j] =temp;
}
}
printf ("The list in the ascending order : ") ;
for (i=0; i<s; i++)
printf ("\n%d", num [i]) ;
}
Output
Enter the size of the list : 10
Enter the positive numbers upto size:
56
34
98
22
34
65
45
99
29
31
The list in the ascending order:
22
29
31
34
34
45
56
65
98
99
Q.21 Write a program in ‘C’ language, which counts the words of a sentence. (2016)
Ans. #include<stdio. h>
#include<string. h>
void main ( )
{
char s [200] ;
int count = 0, i;
73

printf ("Enter the string\n") ;


gets (s) ;
for (i = 0; s=[i] ! = '\0'; i++)
{
if (s [i] == ' ')
count++;
}
printf ("Number of words in given string are:%d\n", count + 1) ;
Output
Enter the string
Balaji Publications Muzaffarnagar
Number of words in given string are : 3
Q.22 Write a propram using ‘C’ language which will find that how many words are there in a string
and tell which word has maximum character ? (2018)
Ans. #include<stdio. h>
#include<string. h>
void main ( )
{
char a [50], b [20], c [20] ;
int i, j = 0, 1 = 0, count = 0, n;
printf ("Enter a string: \n") ;
gets (a) ;
for (i = 0; a [i] !='\0' ; i++)
{
if (a [i] ==' ')
count++;
}
printf ("Number of words in given string are : %d/n", count + 1) ;
for (i = 0; i < = strlen (a) ; i++)
{
if (a [i] ! = 32 && a [i] ! = '\0')
b [j ++] = a [i] ;
else
{
b [j] ='/0' ;
if (strlen (b) > 1)
{
strcpy (c, b) ;
1 = strlen (b) ;
}
j = 0;
}
}
printf ("The longest word is. ") ;
puts (c) ;
n = strlen (c) ;
74

printf ("The maximum number of characters in word: %d", n) ;


Output
Enter the string:
Balaji Publications Muzaffarnagar
Number of words in given string are:3
The longest word is : Muzaffarnagar
The maximum number of characters in a word : 13
Q.23 Write a program in ‘C’ language which reads the data of a file whose name is ‘‘Student.txt’’ and
write in the next file whose name is ‘‘Record.txt’’ and print on the screen also. (2019)
Ans. #include<stdio. h>
#include<conio. h>
#include<stdlib. h>
void main ()
{
File *fptr1, *fptr2;
char ch;
clrscr ();
printf (''Open the file for reading");
fptr1 = fopen ("Student. txt", "r");
if (fptr1 == NULL)
{
printf (" Cannot open the file");
exit (0);
}
print f ("Open the file for writing");
fptr2= fopen ("Record. txt", "w");
if (fptr 2 == NULL)
{
printf ("Cannot open the file");
exit (0);
}
ch=fgetc (fptrl);
while (ch! = EOF)
{
fputc (ch,fptr2);
}
printf ("Content copied");
printf ("%c", ch);
fclose (fptr1);
fclose (fptr2);
getch ();
}
Q.24 Write a program in ‘C’ language, which write the names of 20 students of a class and in front of
each name write the average marks of four subjects also. (2019)
Ans. #include<stdio. h>
#include<conio. h>
75

void main ()
{
int i, j, marks, sum = 0;
float avg;
char name [30];
clrscr ();
for (i=1 ; i<20; i++)
{
printf (" Enter the student name\t");
scanf ("%s", name);
sum = 0 ;
printf ("\n Enter subject marks of %s", name);
for (j=1, j<=4, j++)
{
scanf ("%d", &marks);
sum = sum+marks;
avg = sum/4;
}
printf ("Average marks = % f\n", avg);
}
getch ();
}

qqq
76

Project Work

PROJECT WORK - 1
What is communication media? What are it’s various types? Explain it’s advantage and uses?
General Introduction : Early the information or message are send by writing on paper and send them from one
place to another by somebody. As science develop, the human develop many new and fast method for transmission of
information. By this means of communication we meant different technique used for giving/taking information/data.
To send data/information from one end to another we always need communication medium or in other word we can
say that to transmit data from sender to the receiver we need communication medium which we called communication
channel.
Communication media is that path which use electrical and electromagnetic wave to send data/information.
In computer, the work of give and take of network signal is done by communication medium. This is of different type
which you can understand by following figure.

Twisted pair

Electric current spectrum


Co-axial cable

FM Radio & TV
Telephone service
AM Radio
Microwave
Optical fibre
Satellite

Radio
Microwave Infrared Ultra violet
Capacity of any network depend on communication medium.

Types of Communication Media


Communication medium are of two types :
(1) Wire Communication
(2) Wireless Communication
1. Wire Communication : In this, transmission between sender and receiver is done through a wire or Q cable.
So this is also called as guided communication media. For this we need electromagnetic signal.
In this type of communication, we use three types of wire which are as follows :
(a) Twisted pair cable
(b) Co-axial cable
(c) Optical fiber cable
77

(a) Twisted pair Cable : A twisted-pair were consist of two bunches of thin copper
wire, each bunch enclosed separately in a plastic insulation, then twisted around
each other to reduce interference by adjacent were as shown is figure. It is also
called unshielded twisted pair (UTP) cable because other than the plastic coating
around the two individual bunches of copper wire they are normally used to
connect terminals to the main computer, if they are placed at short distance from
the main computer data transmission speed of up to 9600 bits per second can be
achieved. The thickness of these cable is 0.016 to 0.036 inch.
Use : It is used in telephone, intercom, etc. Twisted pair Cable

(b) Co-axial Cable : Co-axial cable are groups of specially wrapped and
insulated were line, which are able to transmit data at high rates.
As shown in figure, they consists of control copper wire surrounded by a PVC
insulator over which a sleeve of a copper mesh is placed the metal sleeve is
again shield by an outer shield of thick PVC material. The signal is transmitted
by the inner copper wire and is electrically shield by the outer metal sleeve.
Co-axial cables offer much higher bandwidth the UTP cables, and are capable
of transmitting digital signal at rates of 10 mega bits per second.They are
extensively used in long distance telephone lines and as cables for cable T.V. It
is also used for LAN etc. Co-axial Cable

(c) Optical Fiber Cable : It is the most advance media used for transmission
of data. And this is also used for maximum internet services.
It is very flexible and thin and used light signal for transmission of data or it
convert electromagnetic signal into light signal then transmit it. Optical
fibers are hair-thin threads of glass or plastic which has thousand in number.
Bundle of this optical fibers are covered with plastic.
Use of Optical Cable : Internet services use optical fiber for it’s work. Data
speed in optical fiber is in few GB per second.
2. Wireless Communication : In this system of transmission is not done
through wire but we use wave for message (or data) transmission. Following are the Optical Fibre Cable
wave which are used for this purpose :
(a) Radio wave : These are those electro-magnetic which has frequency in between 3KHz to 16Hz. By radio wave
data is transfer through air or sky with the help of Antenna. In this, transmitting antenna transmit signal in air in
all the direction which can be receive by any other antenna. Radio wave are of the following category.
(i) Short wave radio
(ii) Very high frequency (Use in T.V. and FM etc.)
(b) Microwave : Microwave are basically electromagnetic waves have frequency between 1 to 300 GHz. It is a
line-of-sight propagation. As matter of fact, the microwave band is wide (299 GHz) and so it is possible to allot
wides band.
Microwave communication are of two types :
(i) Terrestrial Microwave
(ii) Artificial Satellite Microwave
78

(i) Terrestrial Microwave : These system use directional


parabolic, antennas to transmit and receive in the lower giga-hrtz
range from 4-6 GHz and 21 to 23 GHz. It can support a bandwidth
from 1 to 10 mbps.
The signal are highly focused and physical path must be line of
sight, smaller terrestrial microwave system can be used within a
building which can be inexpensive but long distance system are
relatively expensive.
Now-a-days T.V. transmission, F.M radio, computer network etc.
are using this. Terrestrial Microwave
(ii) Artificial Satellite Microwave : It is that kind of
communication system which can transmit data or information to
any corner of the world.
In this, first the data or information are send to the satellite from the
place where has to be transmitted in the form of microwave.
These satellite are the space-station which are situated in there fixed
orbit which is around 36000 KM above the earth surface where the
revolves about the earth. They revolve about the earth with the same
speed as that of earth due to which it’s position remain the same
w.r.t. earth.
Now the signal which these satellite has receive, amplify it and send it back
to the earth to all or particular receiver.
Because of the following reason the microwave is popular :
Artificial Satellite Microwave
(i) Transmission of data through this is very fast (it is microwave
frequency bounds).
(ii) Signal can be send by sender or receiver or from any kind of area.
This can be use for T.V., radio broadcasting, mobile phone, etc. things.
(c) Infra-red Light : It is one of the most important medium for transmission of data in unguided communication
medium. In this type of communications a special kind of diode is used. And is used for the small or open area,
because they can’t penetrate through wall or any things else. It frequency range is between 300 GHz to 400 THz.
It is used in wireless keyboard and mouse.

PROJECT WORK - 2
What is an function? Explain it’s main type with suitable example?
Function : Function is independent or self contained group of statement which is made to perform a particular type
of function (or work). When a bigger program is break into smaller program and is executed according to the main
program, these small sub-program are called the function.
If a statement is repeated several times in the program, then it is written in any function and use it, there is no need
to write it again and again. By dividing the bigger program into small function it makes program easy to understand
simple to execute.
For example :
main ( )
{
GOPALA ( );
printf ("\n Don’t be silly.");
{
Gopala ( )
79

{
printf ("\n it’s my pleasure");
}

Output : It’s my pleasure


Don’t be silly.
Advantages of Function
(1) It is easy to understand a bigger program through smaller function by which it is formed.
(2) The statement which is repeated several time is put into a function then use it. By this we don’t have to write it
again and again.
(3) After dividing a bigger program into small, simple and easy function make it easy to read.
(4) By making these small program it become easy to change it and to find error. And test also become simple.
(5) A user can also makes it’s own library.

Types of Function
Function in C-language are of two types :
Function

Built-in-library User-defined
function function

Built in library Function : These function which are pre-define or we can say that those function in C-language is
already described. User can use these function directly in program. These function are prepared by various hader file.
(a) Stdio.h : This header file contain standard input/output functions prototype.
For example :
printf ( ) Scanf ( ) putc ( ) getc ( )
putchar ( ) getchar ( ) puts ( ) gets ( )
(b) String.h : This header file contain the prototype of functions related to the strong.
For example :
strlen ( ) strcpy( ) strcat () strcrop ( )
(c) conio.h : This header file contain prototype of function related to screen.
clrscr ( ) getch ( )
(d) Math.h : This header file store the prototype of function related mathematical operation and it’s definition.
For example :
squrt ( ) cos ( ) sin ( )
pow ( ) log ( ) abs ( )
(e) ctype.h : This header file contain the prototype of the function related to manipulation of character.
For example :
tolower ( ) toupper ( ) isupper ( )
Some use of built in library function of ‘C’ Language
(1) Input/output Function : This function is use to give input and take output. These are as follows :
(a) printf( ) : This function is used to print any work, sentence, character, symbol etc; as it is on screen.
For example : #include <stdio.h>
main( )
{
printf("we are Indian");
}
80

Output :We are Indian.


(b) Scanf( ) : This function is use to give input to the program.
For example : #include <stdio.h>
main( )
{
int m, n;
printf("Enter any two number\n");
scanf("%d%d", sum,&n);
}
(c) abs( ) : This function shows the result of the integer value.
For example : #include <stdio.h>
#include <math.h>
main( )
{
int n, absval;
n = –2818;
absval = abs(n);
printf("The absolute value of %d is = %d", absval);
}
(d) islower ( ) : This function is used to know the case of the character wheather it is lower case or not.
For example : #include <stdio.h>
#include <string.h>
main ( )
{
char ch;
printf ("Enter any character");
ch = getchar ( );
if (islower (ch));
printf("The character is a lower case letter");
else
printf("The character is not a lower case letter");
}
(e) toupper ( ) : This function is used to change lower case character into upper case character.
For example : #include <stdio.h>
#include <string.h>
main( )
{
char ch;
printf("Enter any character");
ch = getchar ( );
printf("In the converted character is");
put char (toupper (ch));
}
User-define function : User make different type of function according to it’s need or work, these function so
prepared are called user defined function. Every function is use as main function, but it’s name is not the main and is
given by the user. In other word these function prepared by user are called sub-program or user define function.
81

Syntax :
<type> <Function-name> (Parameters/Argument)
{
...................
...................
}
In above syntax,
<Type> It show the type of return value after function is executed.
<Function-name> This is used in the user function at the time of call the function.
(Parameter/Arguments) These are those variable parameters which is send by calling function on which function
can work.
Value between { } (curly braces) is called function body.
Important facts Regarding function :
• Every function should have a unique name by which it can be identified.
• Function is made to fulfil (or complete) any particular work or function.
• Both function and variable will follow the rules given by identifier.
• For declaration of any function, semicolon (:) is not used.
• Generally, function declaration is done under main ( ) and it’s definition is written outside the main ( ).
Syntax & Function Declaration
Function-name (Parameters list)
or
variable-name = Function-name (Parameters list);
Function Definition :
Function-name (Parameters list)
Parameter declaration;
{
Local variable declaration;
Statement 1;
Statement 2;
return (expression);
}

Function Prototype
In ‘C’ language every function written by the user under main ( ), then written its prototype is also important. Every
variable is define before using them in the program. Function prototype is written before main ( ) and it look same as
header function.
Syntax :
<type> <function-name> (parameters list);
For example :
intsum-num (int a, int b);
int add (int a, int b); etc.
Example of Function Definition
• Write a program, in which user in input temperature in Celsius and out of that will be in Fahrenheit.
Void-facts ( )
{
float cel, fah;
printf ("Enter the temperature in Celsius");
82

scanf ("%f", & cel);


fan = (cel*9/5) + 32;
printf ("\n the converted temperature in Fahrenheit = %f", fah);
}
• Write a sum-num function, which take two value a and b from calling function and return the sum of a and b.
int sum-num (int a, int b)
{
int s;
s = a + b;
return (s);
}
From the above example, it is explained that, return statement will return the result to main ( ) function.
Parameter/Argument Passing in Function

Function Arguments / Parameters

Actual parameters Formal parameters

1. Formal Parameter : Formal Parameter are those parameter which are written in Header of the function.
2. Actual Parameter : In the statement of the function, parameters written in the braces ahead of the function
name are called Actual Parameter.
For example :
#include <stdio.h>
int average (int a, int b);
void main ( )
{
int x, y, z;
printf ("Enter any two numbers");
scanf ("%d %d", &x, &y);
z = average (x, y);
printf ("Average of two no. is = %d", z);
}
int average (int a, int b)
{
int c;
c = (a + b)/2;
return (c);
}
Output :
Enter any two numbers
26
30
Average of any two no is 28
Note : In above program, x and y are Actual parameters and a and b are formal parameter.

qqq
83

Solved Paper-1
Computer Science (Class-10)
Time : 3 hrs. 15 min. M.M. : 70
Instructions :
(i) First 15 minutes are allotted for reading the question paper.
(ii) All questions are compulsory.
(iii) Please clear your answer with labelled diagram if required.
(iv) The fixed marks of all questions are mentioned in front of them.

1. Select and write the correct answer : 5×1=5


(i) Which of the followings has maximum expansion range ?
(a) Cable communication (b) Microwave communication
(c) Satellite communication (d) Radio communication
Ans. (c) Satellite communication
(ii) The value of A(A + B) in Boolean algebra is:
(a) AA (b) AB (c) A (d) A+B
Ans. (c) A
(iii) Which of the followings function is appropriate function to close the file ?
(a) CLOSE (b) END (c) EOF (d) FILE END
Ans. (a) CLOSE
(iv) Which of the following is not an input device?
(a) Key board (b) Printer (c) Mouse (d) Joy-stick
Ans. (b) Printer
(v) GUI is :
(a) graphic up interface (b) graphical user internet
(c) graphical user interface (d) interface of graphical user
Ans. (c) graphical user interface
2. Answer in brief the following : 5×1=5
(a) Write the output of the logic diagram given below:
A
Y=?

A
Ans. Y

B(suppose)

Y = (A ¢)B + A ¢B ¢ = AB + AB = A B
(b) Write short notes on the followings : (i) LAN (ii) WAN
Ans. (i) LAN (Local Area Network) : It is a network which is designed to operate over a small physical area
such as an office, factory or a group of buildings. LANs are very widely used in a variety of applications.
84

(ii) WAN (Wide Area Network) : Wide area networks are basically packet switching networks. A WAN
provides long distance transmission of data, voice image and video information over larger geographical
area.
(c) Write the commands to see directory, to make directory, to destory directory and to copy directory in linux
operating system.
Ans. To see directory— 1s
To make directory— mkdir
To destory directory—rmdir
To copy directory— cp
(d) Which function is used to find the length of a string?
Ans. strlen( ) function.
(e) What is www? Explain.
Ans. www is an internet server which supports hypertext and multimedia to access several internet protocol on a
single interface. It's full form is World Wide Web.
3. Answer the following questions : 5×2=10
(a) Draw a block diagram of a computer and write the names of each block.

M.U.
Memory Unit

A.L.U.
Arithmetic
Input unit Output unit
Logic Unit

C.U.
Control Unit

Ans. Each computer has three following parts mainly:


(i) Input/outpur unit
(ii) Central processing unit: (a) Arithmetic logic unit (b) Control unit
(iii) Memory unit: (a) Primary storage unit (b) Secondary storage unit
(b) What do you mean by Modem ?
Ans. Modem : A modem is a device or program that enables a computer to transmit data over telephone lines.
Computer information is stored digitally, whereas information transmitted over telephone lines is
transmitted. In the form of analog waves. A modem converts between these two forms. These are three types
of modems : Internal, external and fax modem.

Modem
85

It changes the digital data from your computer into analog data, a format that can be carried by telephone
lines. In a similar manner, the computer receiving the data converts analog data to digital data through a
modem. The process of converting digital signals to analog is called modulation and analog to digital signal
is called demodulation.
(c) Explain the e-mail?
Ans. Electronic mail or e-mail is information stored on a computer that is exchanged between two users over
telecommunications. More plainly, e-mail is a message that may contain text, files, images or other
attachments sent through a network to a specified individual or group of individuals. The first e-mail was
sent by Ray Tomlinson in year 1971. By the year 1996, more e-mail was being sent in comparison to
postal mail.
(d) What is file? Explain functions fscanf ( ) and fgetc ( ) in ‘C’ language.
Ans. A file is such a place on a disc, where a group of related data is stored. This data storage is unstable.
fscanf ( ) function : It is used for handling files. This function is used to read any type of data.
syntax : fscanf (FILE *filepointer, constant char *format_string);
fgetc ( ) function : It is used to read a character from the file.
syntax : int fgetc (FILE *filepointer);
(e) Write the different types of Linux.
Ans. (i) Cent OS (ii) Red Hat (iii) Fedora (iv) Ubuntu (v) open SUSE (vi) Debian
(vii) Linux Mint (viii) Arch Linux (ix) Slackware (x) Puppy Linux
4. Answer all parts : 5×2=10
(a) Explain the fundamental components of BCD code.
Ans. BCD Code: The Binary Coded Decimal (BCD) code is one of the early computer codes. It is based on the
idea converting each digit of a decimal number into its binary equivalent, rather than converting the entire
decimal value into a pure binary form and store in the memory. Thus, a code, for that particular character, is
stored in memory.
(b) Define one-dimensional and two-dimensional array with example.
Ans. One-dimensional array: One-dimensional or single dimensional have only one subscript. Subscript is
written between the [ ] which is after the array name. Element of an array is like a variable or we can say that
which can only represented by an unique subscript.
For example: int arr [5];
Two-dimensional array: In it, data is stored in the form of table.
For example: int arr [4] [5];
float arr 1 [5] [5];
(c) Explain about library function. Give two examples.
Ans. These are such functions, participate mainly in ‘C’ language. These functions are recognised by their names
and used. Necessary informations in the form of parameters are provided with these functions. These
functions are called library functions or built-in-functions.
Examples: (i) scanf() and (ii) printf()
(d) Explain concatenation of two strings with example.
Ans. Two strings cannot be added as mathematical addition, e.g., String 3 = String 1 + String 2 (incorrect)
To add two strings, first of all we have to define two strings separately and then copy in Third string, for this
the size of third string should be enough that both string may copy in it.
Two strings are added with function strcat( ).
Syntax : strcat (string1, string2);
86

Example : #include<stdio.h>
#include<string.h>
void main( )
{
char a[100], b[100];
printf("Enter the first string");
gets(a);
printf("Enter the second string");
gets(b);
strcat(a, b);
printf("String obtained on concatenation is %s", a);
}
Output : Enter the first string Programming
Enter the second string Language
String obtained on concatenation is Programming Language.
(e) Explain data communication.
Ans. Communication means the electronic transmission of any type of electronic information encompasses
telephone communication, the transmission of television signals, data communication of all forms,
electronic mail, etc.
Data communication is the movement of encoded information from one point to another by means of
electrical or optical transmission system, such types systems generally called data communication networks.
The speed of transfer of data is measured in bit per second (BPS).
5. Answer all the parts : 3×4=12
(a) What are the types of communication ? Also write the applications of communication.
Ans. Communication basically are of two types :
(i) Oral communication
(ii) Written communication
(i) Oral Communication : In this type of communication, data or information is send in the oral form
or we can say that audio is use as message (data) to be transmitted over the channel. In oral
communication we use various method for transmission of data. Conversation between two person are
the best of oral communication.
Following are different form of oral communication are :
Telephone, Intercom, Mobile phone, Voice talk by computer, mail/chatting, etc.
(ii) Written communication : In this type of communication, data is send from one place to another in
written form which means if information in written form is send from one place to another then this
type of communication is called written communication.
Written communication is more important as well as efficient because there is always record of written
communication which send or receiver can use when ever they needed. This also act as important in
computer depended communication.
Following are the different form of written communication :
Fax, E-mail, SMS, Pager, etc.
Applications of communication :
(a) Electronic Banking Service
87

(b) E-shopping
(c) Video Conferencing
(d) Air/Railway Reservation
(e) E-correspondance
(f) E-education
(b) Prove that AB + AC + BC = AB + AC
Ans. AB + AC + BC = AC + AB + AC + BC × 1
= AC + AB + BC(A + A) (From complement law)
= AC + AB + ABC + ABC (From distributive law)
= AC + ABC + AB + ABC (From commutative law)
= AC(1 + B) + AB(1 + C) (From distributive law)
= AC × 1 + AB × 1 (From the property of 1)
= AC + AB Proved.
(c) Explain High Level Language (HLL).
Ans. HLL languages are not based on internal working procedure of computer. Some selected words of English
and signs used in elementary mathematics are used in these language. To find the error and to remove those
are very easy in it, but it is necessary to translate or compile the programs written in these languages.
Generally, computer programes are written in HLL.
6. Answer all parts : 3×4=12
(a) Prove in Boolean algebra AB + A + AB = 0
Ans. AB + A + AB = 0
= (AB) × A × AB (From Demorgan law)
= AB × A × AB (From envulation law)
= AB × AB × A (From commutative law)
=0×A (From complement law)
= 0 Proved.
(b) What is string? Explain its types.
Ans. String : Refer to Q.2 (VSA type questions) in Chap 7.
Types of string :
(i) Strcat( ) Function : With the help of the function two different string can be connected with each
other which mean this function take first string and connect (join) second string at the end of the first
string. Process of connecting two string is called concatenation.
(ii) Strcpy( ) Function : With the help of this function we can copy on string into the another string or we
can say that this can copy first string in place of second string.
(iii) Strcmp( ) Function : With the help of this string function we can compare two string. If both string is
same than it provide ‘O’ else if both are different then both string are compared not on the bases of
length but on the bases of element stored.
(iv) Strlen( ) Function : With the help of this function we determine the length of strings or number of
element present in the string.
(v) Strcat( ) : This function appends or concatenates copy of source string to the end of target string.
For example : if source string is ‘‘Bhardwaj’’ and target string is ‘‘Neeraj’’ then strcat will return
‘‘Neeraj Bhardwaj’’.
88

(vi) Strrev( ) : This function is used to reverse all the characters of string. It means the position of the
characters will be reversed by using this function.
(vii) Strlwr( ) : This function is used to convert string of upper case to lower case.
(viii) Strupr( ) : This function is opposit of strlwr function as it is used to convert lower case (a to z) to upper
case (A to Z).
(c) Describe recursion with example.
Ans. When a function calls itself in its definition, then such situation is known as recursion and function is called
recursive function.
Example : Write a program to find factorial of a given number.
#include <stdio.h>
main ( )
{
int n;
printf ("Enter any number");
scanf ("%d, =%d", n, fact (n));
}
int fact (int x)
{
if (x = =0)
return (1);
else
return (x *fact (x-1));
}
Result : Enter any number = 5
5! = 120
7. Write a program in ‘C’ language which reads the data of a file whose name is ‘‘Student.txt’’ and write in the next
file whose name is ‘‘Record.txt’’ and print on the screen also. 8
Ans. #include<stdio. h>
#include<conio. h>
#include<stdlib. h>
void main ()
{
File *fptr1, *fptr2;
char ch;
clrscr ();
printf (''Open the file for reading");
fptr1 = fopen ("Student. txt", "r");
if (fptr1 == NULL)
{
printf (" Cannot open the file");
exit (0);
}
89

print f ("Open the file for writing");


fptr2= fopen ("Record. txt", "w");
if (fptr 2 == NULL)
{
printf ("Cannot open the file");
exit (0);
}
ch=fgetc (fptrl);
while (ch! = EOF)
{
fputc (ch,fptr2);
}
printf ("Content copied");
printf ("%c", ch);
fclose (fptr1);
fclose (fptr2);
getch ();
}
Or
(a) Explain the following functions : 4
(i) fseek ( ) (ii) rewind ( ) (iii) feof ( )
Ans. File : A file is such a place on a disc where a group of related data is stored. This data storage is unstable.
Types of file : There are two types of files :
(1) Program file : Programs written in a programing language are stored in the files, these files are known as
program files.
(2) Data file : The files in which data, used for input/output programs, is stored are known as data files. These
files are categorised in several categories. Following two are main types :
(i) Sequential data files : Refer to Q. 3 (Short Answer Type Questions) in Chap 9.
(ii) Random data files : Refer to Q. 1 (Short Answer Type Questions) in Chap 9.
Define a file : Data structure of file is defined in the form of FILE in the library of definitions of standard input/
output functions. It is an already defined data type. General for to declare a file is as follows :
FILE * afile;
Here variable afile is a pointer for data type FILE
Various file operation : These are the functions, by which we can open the disc file, we can add or subtract
and close the file. For any type of operation, first of all we have to open the file.
For this first of all we have to declare the file. Several operations are as follows :
(a) fopen ( ) command : It is used to make a new file or to open or start a file in memory. Here file can be
open in several mode, e. g. ,
r (read) mode
r+ (read/write) mode
w (write) mode etc.
syntax : fopen (“filename”, “mode”);
90

(b) fclose ( ) command : It is used to close an opened file. By using this command a user can close more than
one files simultaneously.
syntax : fclose (FILE * filepointer);
(c) getc ( ) command : It is used to read a character from a file.
syntax : getc (FILE * filepointer);
(d) putc ( ) command : It is used to write a character in a file.
syntax : putc (character, FILE * filepointer);
(e) fgetc ( ) command : It is used to read a character from the file.
syntax : int fgetc (FILE * filepointer);
(f) fprintf ( ) command : It is used to write the value of data in a file.
syntax : fprintf (FILE * filepointer, constant char *format_string);
(g) fscanf ( ) command : It is used to read data value in a file.
syntax : fscanf (FILE * filepointer, constant char *format_string);
(h) getw ( ) and putw ( ) command : Refer to Q. 2 (Short Answer Type questions) in Chap 9.
(i) feof ( ) command : It is used to examine that file pointer reached at the end of the file or not.
syntax : int feof (FILE * filepointer);
(j) fflush ( ) command : Refer to Q. 5 (Short Answer Type questions) in Chap 9.
(k) fseek ( ) command : Refer to Q. 5 (Short Answer Type questions) in Chap 9.
(l) ftell ( ) command : It is used to know the number of bytes used from starting to end of a file.
syntax : long ftell (FILE * file pointer);
(m) rewind ( ) command : It is used to set the file pointer in the starting of the file. Its advantage is that we
can read or write a file again and again without open or close it.
syntax : void rewind (FILE * filepointer).
(b) Explain searching, sorting and merging and give example of each. 4
Ans. Searching : Searching means find or select. To find some text or written information or group of data according
to the need of the user in programming language is called searching.
Example: The given program searches the number chose by sequential search out of a positive whole number test
list.
Program: This can be explained by following example :
#include <stdio.h>
main ( )
{
int num [50], n, i;
int temp, flag = 0;
printf ("Enter the size of the list :\n");
scanf ("%d", &n);
printf ("Enter the integer number :\n");
for (i = 0; i< n; i++)
{
scanf("%d", & num [i]);
printf ("Enter the number search for :")
scanf ("%d", temp)
91

for (i=0; i<n; i++)


{
if (num [i] = = temp)
{
flag = 1;
printf ("Number is found in the list at % dth position", i + 1);
break;
}
}
if (flag = = 0)
printf ("Sorry! Number is not present in the list);
}
Result : Enter the size of the list
5
Enter the integer numbers
26
23
30
18
15
Enter the number search for : 18
Number is found in the list at 4 th position.
Sorting: Arrangement of data in increasing or decreasing order is called sorting.
Example : Write a program to arrange the element present in array in increasing order.
#include <stdio.h>
main ( )
{
int num [10], temp, i, j;
for (i=0, i<10; i++)
{
printf ("Enter the number \n")
scanf("%d", & num [i]);
}
for (i = 0; i < 10; i++)
{
for (j=i+1; i<10; j++)
{
if num [i] > num [j]
{
temp = num [i]
num [i] = num [j];
92

num [j] = temp;


}
}
}
Merging: The procedure, to add two array with third array, is known as merging.
Program:
#include<stdio.h>
#include<conio.h>
void main ( )
{
int a[50], b[50], c[50], i, k, sizel, size2, size3;
clrscr ( );
printf (“Enter the size of first array”);
scanf (“%d”, &sizel);
printf (“Enter the elements of first array \n”);
for (i=0; i<size1; i++)
{
scanf (“%d”, &a[i]);
}
printf (“Enter the size of second array”);
scanf (“%d”, &size2);
printf (“Enter the elements of second array \n”);
for (i=0; i<size2; i++)
{
scanf(“%d”, &b[i]);
}
printf (“Elements of third array after merge \t”);
for (i=0; i<size1; i++)
{
c[i]=a[i];
}
size3 = size1 + size2;
for (i=0, k=size1; k<size3 && i<size2; i++, k++)
{
c[k]=b[i];
}
for (i=0; i<size3; i++)
{
printf (“%d\t”, c[i]);
}
getch ( );
}
93

8. Write a program in ‘C’ language, which write the names of 20 students of a class and in front of each name write
the average marks of four subjects also. 8
Ans. #include<stdio. h>
#include<conio. h>
void main ()
{
int i, j, marks, sum = 0;
float avg;
char name [30];
clrscr ();
for (i=1 ; i<20; i++)
{
printf (" Enter the student name\t");
scanf ("%s", name);
sum = 0 ;
printf ("\n Enter subject marks of %s", name);
for (j=1, j<=4, j++)
{
scanf ("%d", &marks);
sum = sum+marks;
avg = sum/4;
}
printf ("Average marks = % f\n", avg);
}
getch ();
}
Or
What is array? What are its types? Write a programe in C language by using array which calculates average value
of 50 whole numbers placed in array. 8
Ans. A single array is the group of same type of data, which could be represented by same name-important thing in this
is that data stored in array are of same type as well as same size. In the array, every element is stored in it with the
help of subscript which written in [ ] after name of Array. This is also called index variable or we can say each
element stored in array is self contained.
Array are of two types : (a) One-dimensional Array (b) Two-dimensional Array
(a) One-dimensional Array : One-dimensional or single dimensional have only one subscript. Subscript is
written between the [ ] which is after the array name. Element of an array is like a variable or we can say that
which can only represented by an unique subscript.
Let us understand this with the help of a example, how it is declared and it’s syntax.
Syntax : < Type of an Array > < Name of an Array > [Element/size];
For example :
int arr [5];
char name [10];
means
94

arr =
[0] [1] [2] [3] [4]
name =
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]
Here arr[5] means 1-dimensional array of int type, which will store integer value or we can say every element of
array such as arr [0], arr [1], arr [2], etc. will only be represent by one subscript such as 0, 1, 2, etc. In this way
arr[ ] is a 1-dimensional type of array.
Char name [10] means name is char type of 1-dimensional array which is the group of 10 characters or 10
characters are stored.
Means char name [10] = “ALLAHABAD”

A L L A H A B A D ‘\0’
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]
As we known, one int variable take 2 Byte space. So array of 5 element need 10 byte (2 × 5 = 10) space. In the
same way, 1 char variable take 1 byte space which means Array of 8 element need 8 byte space.
(b) Two-dimensional Array: Like one-dimensional array which has only one subscript,in the same way,
two-dimensional Array have two subscript.This also called as Matrix. As in a matrix, every element is pointed by
it’s row as well as column, in the same way, for pointing the element two subscript are used in which first subscript
is called row while second subscript is called column.
For example :
First column Second Third column
column
[0] [1] [2]
First row [0] [0] [0] [0] [1] [0] [2]
Second row [1] [1] [0] [1] [1] [1] [2]
Third row [2] [2] [0] [2] [1] [2] [2]

Declaration of Two-dimensional Array : Two-dimensional Array can be represented as :


Syntax : <Type of Array> <Name of Array> <Number of Row> <Number of Column>
For example : int arr [4] [5];
float arr 1 [5] [5];
In the above example, int arr [4] [5] means that arr is of int type of two-dimensional, which has 4 rows and 5
column and have total element is 20 [4 × 5 = 20].
In the same way, float arr 1 [5] [5] means that arr 1 is float type two-dimensional. Array in which there is 5 rows
as well as 5 column and the total element are 25 [5 × 5 = 25].
where int [4] [4] means :
First column Second Third column Fourth
column column
First row [0] [0] [0] [1] [0] [2] [0] [3]
Second row [1] [0] [1] [1] [1] [2] [1] [3]
Third row [2] [0] [2] [1] [2] [2] [2] [3]
Fourth row [3] [0] [3] [1] [3] [2] [3] [3]
95

Initialization of Two-dimensional Array : Initial value can be given to the two-dimensional array only at
the time of declaration. Initial value to this array can be given as follows :
Syntax :
<Type of Array> <Name of Array> [No. of row] [No. of column] = [Value 1, Value 2...]
OR <Type of Array> <Name of Array> [No. of row] [No. of column]
= {{Value of first row} {Value of second row}};
For example :
int num [2] [2] = {6, 18, 23, 30};
OR int num [2] [2] = {{6, 18}, {23, 30}};
In the above example, int num [2] [2] = {6, 18, 23, 30}; first value written between { }, i.e., (6) will be the first
element or it will stored at num [0] [0]. And in the same way 18, 23 and 30 are stored in continuous order(way).
If the address of num [0] [0] is 1048 in memory then,
num[0][0] num[0][1] num[1][0] num[1][1]
6 18 23 30 ¬¾ Value
1048 1050 1052 1054 ¬¾ Address

Programe in C language which calculates average value of 50 whole numbers placed in an array.
#include<stdio.h>
#include<conio.h>
void main ( )
{
int n = 50, i, a [50], sum = 0, avg;
clrscr ( );
printf (“Enter the 50 whole numbers”);
for (i = 0; i<n; i++)
{
scanf (“%d”, &a[i]);
}
for (i = 0; i<n; i++)
{
sum = sum + a [i];
}
avg = sum/n;
printf (“%d”, avg);
getch ( );
}
96

Unsolved Paper-1
Computer Science (Class-10)
Time : 3 hrs. 15 min. M.M. : 70
Instructions :
(i) First 15 minutes are allotted for reading the question paper.
(ii) All questions are compulsory.
(iii) Please clear your answer with labelled diagram if required.
(iv) The fixed marks of all questions are mentioned in front of them.

1. Select and write the correct answer : 5×1=5


(i) What is Web Browser?
(a) Memory card (b) Software program
(c) Modem (d) Compiler
(ii) In which transmission medium the data transmits in the form of light waves?
(a) Copper wire (b) Coaxial cables
(c) Telephone lines (d) Optical fibre cable
(iii) The value of AA ¢ + BB ¢ + C is :
(a) A (b) B (c) C (d) O
(iv) What is Binary equivalent of [31]10 ?
(a) 10000 (b) 11111 (c) 100000 (d) 11110
(v) GUI is :
(a) Graphic Up Interface (b) Graphical User Internet
(c) Graphical User Interface (d) Interface of Graphical User
2. Describe in brief the following : 5×1=5
(a) Draw figure of Ring Topology.
(b) Write the name of a safety tool in Linux.
(c) Write full form of EBCDIC.
(d) Which language is used in the designing of Web page?
(e) Which functions is used to know the length of a string?
3. Answer the following questions : 5×2=10
(a) Explain WAN.
(b) Explain Data Communication.
(c) What are the universal gates and why are they called universal gates?
(d) Prove that AB + AC + BC = AB + AC
(e) Explain subscripted variables.
4. Answer all parts : 5×2=10
(a) Discuss the advantages of computer networks.
(b) What do you understand by Browser? Give examples.
(c) Write the names of different types of Linux.
(d) Explain what is function?
(e) Differentiate between ‘Cat’ and ‘More’ commands in Linux.
5. Answer all the parts : 3×4=12
(a) Explain linux commands with examples.
97

(b) Write AND laws, OR laws and NOT laws.


(c) Draw the logic diagram of the given Logic equation and write truth table : Y = AB + AB
6. Answer all parts : 3×4=12
(a) What are numeric functions in ‘C’ language? Explain any four.
(b) What do you understand by sorting? Explain Bubble sorting in detail.
(c) Explain f-flush() and f-seek() functions with examples.
7. Write a program in ‘C’ language which finds the area of a rectangle whose length is ‘a’ and breadth is ‘b’. Print the
answer :
“Area of rectangle = .............................. sq. metre.” 8
Or
(a) What is file? Explain the functions f-scanf() and f-getc() in ‘C’ language.
(b) Write any two string functions with example. 4+4
8. Write a program in ‘C’ language which reads the data from file “Student.txt” and copies in the file “Record.text”.
Also show it on the screen. 8
Or
(a) What do you understand by Array? Discuss one-dimensional and two-dimensional arrays with examples.
(b) What is editor? Discuss the options to come in special application of Vi TEST EDITOR (Vi Text Editor). 4+4

Unsolved Paper-2
Computer Science (Class-10)
Time : 3 hrs. 15 min. M.M. : 70
Instructions :
(i) First 15 minutes are allotted for reading the question paper.
(ii) All questions are compulsory.
(iii) Please clear your answer with labelled diagram if required.
(iv) The fixed marks of all questions are mentioned in front of them.

1. Select and write the correct answer : 5×1=5


(i) Bits are transferred sequentially one by one in :
(a) Parallel transmission (b) Analog transmission
(c) Serial transmission (d) None of these
(ii) File transfer is the function of which layer?
(a) Network (b) Session
(c) Transport (d) Presentation
(iii) Decimal value of Binary number (1101) 2 would be :
(a) (11)10 (b) (9)10 (c) (7)10 (d) (13)10
(iv) In C-language, the variable name starts with :
(a) a number (b) an alphabet
(c) s symbol (d) # sign
(v) The command used for copying any file with different name is :
(a) copy (b) cp
(c) cat (d) copy file
98

2. Describe in brief the following : 5×1=5


(a) Define the Internet.
(b) What is the X-windows system?
(c) What is a Truth table?
(d) What are the Identifiers?
(e) What are the Header files?
3. Answer the following questions : 5×2=10
(a) Write the names of various types of communications and explain any one of them.
(b) What do you mean by the System Administrator in LINUX ?
(c) Write the names of various constants in C and explain any one of them.
(d) State the difference between getchar ( ) and scanf ( ) functions.
(e) Discuss the rules of Binary addition with example.
4. Answer all parts : 5×2=10
(a) Describe the merits and demerits of the wired and wireless communication systems.
(b) Explain the difference between Cat and More commands in LINUX.
(c) Sketch the symbols of NAND and NOR gates and give their Truth tabes.
(d) What is the File Transfer Protocol? State its application.
(e) Explain the Recursion with example.
5. Answer all the parts : 3×4=12
(a) Discuss the classification of functions. Write names of any four functions and explain any one.
(b) Write a program in C-language which prints first 10 odd numbers.
(c) Explain in detail the structure of LINUX operating system.
6. Answer all parts : 3×4=12
(a) Name and describe various types of files.
(b) Explain with examples, how an Array is declared and initialized.
(c) State the De Morgan’s laws and prove them with the help of truth tables.
7. What do you mean by string manipulation? Describe with examples the functions strcpy ( ) and strcmp ( ) and
explain the difference between them. 8
Or
Write a program in C-language by using standard function which makes one string by joining two separate
strings. State also the output that will appear on running the program. 8
8. Write the names of main elements of computer network and describe all of them in brief. Give a comparative
study of merits and demerits of LAN and WAN. 8
Or
Write a program in C-language which to multiplication table of two 3*3 table integer number. 8
99

Unsolved Paper-3
Computer Science (Class-10)
Time : 3 hrs. 15 min. M.M. : 70
Instructions :
(i) First 15 minutes are allotted for reading the question paper.
(ii) All questions are compulsory.
(iii) Please clear your answer with labelled diagram if required.
(iv) The fixed marks of all questions are mentioned in front of them.

1. Select and write the correct answer : 5×1=5


(i) Transponders are used in which communication media?
(a) Fibre optic (b) Microwave
(c) Satellite (d) Co-axial cable
(ii) The binary equivalent of the number (15)10 would be :
(a) (1101) 2 (b) (1110 ) 2 (c) (1111) 2 (d) (1000 ) 2
(iii) Which one of the following is not a protocol?
(a) TCP/IP (b) ISP (c) HTTP (d) X.25
(iv) Linux is equivalent to which operating system?
(a) DOS (b) WINDOWS
(c) UNIX (d) None of these
(v) Language used to design web pages is :
(a) C++ (b) BASIC (c) HTML (d) Java
2. Answer all parts : 5×1=5
(a) Write the full form of SACII.
(b) Who developed the ‘C’ language and when ?
(c) Give names of various types of Communication Media.
(d) Give names of Boolean operators.
(e) What is the login process ?
3. Discuss the following : 5×2=10
(a) Frequency Modulation
(b) Wireless Communication Media
(c) Search Engine
(d) Application of Linux
(e) De Morgan’s Theorem
4. Differentiate between the following : 5×2=10
(a) Protocol and Topology
(b) LAN and WAN
(c) CL and Vi Text Editors
(d) Sequential and Binary search
(e) Sequential and Random files.
5. Answer all parts : 3×4=12
(a) Describe the features and applications of e-mail.
(b) Explain the method of concatenation of two strings.
100

(c) Give names of main methods of sorting and explain any one method with example.
6. Answer all parts : 3×4=12
(a) Give names of various desktops available in Linux and describe any one of them.
(b) Define 1’s complement and 2’s complement and describe their applications.
(c) Why are the Library functions ? Describe in details any two types of them.
7. Write a program in C language which tests the imputed number and checks whether the number is even or odd. 8
Or
(a) Explain with examples the basic structure of C program. 4
(b) Describe the main features of printf and getchar functions. 4
8. What do you understand by Array ? What are its different types ? Describe each of them. 8
Or
Write a program in C language which to reuse the list of given numbers. 8

Unsolved Paper-4
Computer Science (Class-10)
Time : 3 hrs. 15 min. M.M. : 70
Instructions :
(i) First 15 minutes are allotted for reading the question paper.
(ii) All questions are compulsory.
(iii) Please clear your answer with labelled diagram if required.
(iv) The fixed marks of all questions are mentioned in front of them.

1. Select and write the correct answer : 5×1=5


(i) On which topology is the Satellite Transmission based ?
(a) Ring (b) Bus (c) Star (d) Tree
(ii) Which one of the following is not a software ?
(a) Linux (b) Unix (c) LAN (d) Windows
(iii) Which of the following is the sum of the binary numbers (1010 ) 2 and (111) 2 ?
(a) (10101) 2 (b) (1111) 2 (c) (10001) 2 (d) (10011) 2
(iv) Which of the following is a character constant ?
(a) ‘B’ (b) ‘2b4a’ (c) –8421 (d) +100.21
(v) Which of the following declarations is not valid in C-Language ?
(a) Float rate (b) int a;
(c) double percentage (d) int a, c;
2. Write the Full forms of the following : 5×1=5
(a) MODEM
(b) ATM
(c) CSMA
(d) FDDI
(e) MAN
3. Explain the following : 5×2=10
(a) Operating system
101

(b) Computer network


(c) Boolean algebra
(d) Control statement
(e) File
4. Differentiate between the following : 5×2=10
(a) Message transmitter and receiver
(b) Nibbe and byte
(c) Searching and sorting
(d) Constant and variable
(e) Sequential and parallel transmissions.
5. Answer all parts : 3×4=12
(a) Sketch the diagram of Primary Communication Model and describe its main components.
(b) Explain the rules of addition and subtraction in Binary Number System.
(c) Differentiate between the Library Function and User Defined Function with examples.

6. Answer all parts : 3×4=12


(a) Explain in brief the structure of Linux Operating System.
(b) What is Internet ? Discuss any two of its applications.
(c) Differentiate between one-dimensional array and two-dimensional array with examples.
7. Write a program in C-language by which the name and marks obtained in four subject of 10 students can be stored
in a data file. 8
Or
(a) Explain the main elements of EBCDIC Code. 2
(b) Explain the 1’s and 2’s complements and differentiate between them with examples. 4
(c) Describe the main features of C-Language. 2
8. Write a program in C-language that prints the sum of all the numbers from one to twenty. Write also, the output of
this program. 8
Or
Write notes on the following : 4×2=8
(a) Logic Gates
(b) Declaration of string and its initialization
(c) Data Transmission Modes
(d) Interfaces of Linux
102

Unsolved Paper-5
Computer Science (Class-10)
Time : 3 hrs. 15 min. M.M. : 70
Instructions :
(i) First 15 minutes are allotted for reading the question paper.
(ii) All questions are compulsory.
(iii) Please clear your answer with labelled diagram if required.
(iv) The fixed marks of all questions are mentioned in front of them.

1. Select and write the correct answer : 5×1=5


(i) What type of communication happens in computer communication?
æ1 ö
(a) Simplex (b) Full duplex (c) Half duplex (d) Quarter ç ÷ duplex
è 4ø
(ii) The value of A( A + B) in Boolean Algebra is :
(a) AA (b) AB (c) A (d) A + B
(iii) Whose communication range is highest among the following?
(a) Cable communication (b) Microwave communication
(c) Satellite communication (d) Radio communication
(iv) What is called the basic part of Linux OS ?
(a) Shell (b) Kernel (c) Utility (d) Service program
(v) What will be the index number of nth location of an Array?
(a) n (b) n - 1 (c) n + 1 (d) 2n

2. Answer in brief the following : 5×1=5


(a) Write the output of the logic diagram given below :
A
Y=?

(b) Describe the unit of Data Communication.


(c) Write full forms of the following :
(i) CDMA (ii) GPS
(d) What is www ? Explain.
(e) Write command to see the directory, make directory, destroy directory and copy directory in Linux operating
system.
3. Answer the following questions : 5×2=10
(a) Draw the block diagram of communication system and label all the blocks.
(b) Prove in Boolean Algebra AB + A + AB = 0
(c) Draw the logic symbols of NAND gate and NOR gate and write their truth tables.
(d) Explain X-window in Linux operating system.
(e) Give two examples of Library functions.
4. Answer all parts : 5×2=10
(a) What is topology in computer network? Write their types.
(b) [110000 ]2 - [100010 ]2 = [?]2
103

(c) What is command line interface in Linux operating system? Write its applications.
(d) Give examples of one-dimensional and two-dimensional arrays.
(e) Write the names of elements of computer network.
5. Answer all the parts : 3×4=12
(a) Draw the logic diagram of the given logic equation and write the truth table.
Y = ( A + B)( B + C )( A + C )
(b) What is editor in Linux? Explain VI-editor and write their modes.
(c) Describe safety system, their features and their advantages in Linux.
6. Answer all parts : 3×4=12
(a) Explain searching, sorting and merging and give example of each.
(b) Discuss the necessity of user defined function with examples of its uses.
(c) Prove by Boolean laws : ( A + B)( A + C )( B + C ) = ( A + B)( A + C )
7. Write a program in ‘C’ language which reads the data of a file whose name is “Student.txt” and write in the next
file whose name is “Record.txt” and print on the screen also. 8
Or
(a) Explain file in ‘C’ language and write its types. Discuss main ‘C’ functions for reading data from a file. 4
(b) Explain the following file functions : 4
(i) fseek () (ii) rewind () (iii) feof() (iv) feof(ft)
8. Write a program in ‘C’ language, which write the names of 20 students of a class and in front of each name write
the average marks of four subjects also. 8
Or
What is “Array” ? What are its different types ? Write a program in ‘C-language’ using array which calculates
average value of 50 whole numbers placed in an array. 8

You might also like