Professional Documents
Culture Documents
for Full Book order online and available at all Leading Bookstores
COMPUTER SCIENCE
m
co
HIGHER SECONDARY FIRST YEAR
VOLUME I & II
s.
ok
Based on the updated new textbook for the year 2019 - 20
o Salient Features
ab
Prepared as per the updated new textbook for the year 2019 - 20
E
xhaustive Additional MCQs, VSA, SA, LA questions with answers are given in
each chapter.
(FMT - 2018), Quarterly Exam - 2018 (QY-2018) and Half Exam (HF -2018)
Questions are incorporated at appropriate sections.
SURA PUBLICATIONS
Chennai
2019-20 Edition
NOTE FROM PUBLISHER
© Reserved with Publishers
It gives me great pride and pleasure in bringing to you
ISBN : 978-93-5330-071-5 Sura’s Computer science Guide (Volume-I & II) for +1 Standard.
A deep understanding of the text and exercises is rudimentary to
Code No : SG 274
m
have an insight into Computer Science. The students and teachers
Author : have to carefully understand the topics and exercises.
Mr. Shanmugasundaram Sura’s Computer Science +1 Standard Guide encompasses
co
(Post Graduate Teacher, Chennai)
all the requirements of the students to comprehend the text and
the evaluation of the textbook.
Head Office:
It will be a teaching companion to teachers and a learning
1620, ‘J’ Block, 16th Main Road, companion to students.
s.
Anna Nagar, Chennai - 600 040.
As the guide has been framed based on the ‘New 100 Marks
Phones : 044-26161088, 26161099.
Pattern’ and the public exam question paper is 70 Marks,
Mobile : 96001 75757 / 81242 01000 /
it provides a precise and clear understanding of text and
ok
81243 01000
exercises from the examination perspective.
Whatsapp : 81242 01000
e-mail : orders@surabooks.com Exhaustive Additional MCQs, VSA, SA, LA questions with
website : www.surabooks.com answers are given in each chapter.
These features will help students practice and learn
Our Guides for XI Standard
o effectively all the sections of the textbook.
✤ Sura’s Tamil
ab
✤ Sura’s English Though these salient features are available in our Sura’s
✤ Sura’s Mathematics (EM/TM ) Computer Science Guide 11 th Standard, I cannot negate the
✤ Sura’s Physics (EM/TM) indispensable role of the teachers in assisting the student to
Sura’s Chemistry (EM/TM)
✤
understand the Computer Science.
✤ Sura’s Biology (EM/TM)
ur
✤ Sura’s Computer Science (EM/TM) I sincerely believe this guide satisfies the needs of the students
✤ Sura’s Commerce (EM/TM) and bolsters the teaching methodologies of the teachers.
✤ Sura’s Economics (EM/TM)
✤ Sura’s Accountancy (EM/TM) I pray the almighty to bless the students for consummate
✤ Sura’s Business Maths (EM)
.s
(ii)
Contents
Chapter
No
Title P. No
m
Volume - I
co
WITH A TYPICAL OPERATING SYSTEMS (WINDOWS & LINUX)
s.
3. Computer Organization 51-67
4. Theoretical Concepts of Operating System 68-81
5. Working with Typical Operating System (Windows & Linux) 82-101
ok
UNIT II - ALGORITHMIC PROBLEM SOLVING
6. Specification and Abstraction 102-111
7. Composition and Decomposition
o 112-121
8. Iteration and recursion 122-128
Volume - II
ab
UNIT III - INTRODUCTION TO C++
Govt. Model Question Paper & Sura’s Model Question Paper 1 - 2 with Answer Key. 319-339
(iii)
TO ORDER WITH US
m
We are grateful for your support and patronage to ‘SURA PUBLICATIONS’
Kindly prepare your order in your School letterhead and send it to us.
co
For Orders contact: 81242 01000 / 81243 01000
DIRECT DEPOSIT
A/c Name : Sura Publications A/c Name : Sura Publications
s.
Our A/c No. : 36550290536 Our A/c No. : 21000210001240
Bank Name : STATE BANK OF INDIA Bank Name : UCO BANK
Bank Branch : PADI Bank Branch : Anna Nagar West
ok
IFSC : SBIN0005083 IFSC : UCBA0002100
The Demand Draft / cheque should be sent with your order in School letterhead.
STUDENTS :
w
SURA PUBLICATIONS
1620, ‘J’ Block, 16th Main Road, Anna Nagar,
Chennai - 600 040.
w
(iv)
m
co
s.
COMPUTER SCIENCE
o ok
ab
VOLUME - I
ur
.s
w
w
w
[1]
Contents
m
co
s.
Chapter
ok
No
Title P. No
[2]
Volume I
UNIT- I
FUNDAMENTALS OF COMPUTER AND
WORKING WITH A TYPICAL OPERATING
m
SYSTEMS (WINDOWS & LINUX)
1I
co
Chapter ntroduction to Computers
s.
CHAPTER SNAPSHOT
o
1.1. Introduction to Computers
ok 1.5.2.1. Arithmetic and Logic Unit
ab
1.2. Generations of Computers 1.5.2.2. Control Unit
1.3. Sixth Generation Computing 1.5.3. Output Unit
1.4. Data and Information 1.5.4. Unit Memory
ur
[3]
Evaluation
Section - A 9. Which one of the following is the main memory?
(a) ROM (b) RAM
Choose the Correct Answer (c) Flash drive (d) Hard disk
m
[Ans. (b) RAM]
1. First generation computers used ……………
(a) Vacuum tubes (b) Transistors 10. Which generation of computer used IC’s?
(c) Integrated circuits (d) Microprocessors (a) First (b) Second (c) Third (d) Fourth
co
[Ans. (a) Vacuum tubes] [Ans. (c) Third]
s.
3. Identify the output device ……………
1. What is a computer?
(a) Keyboard (b) Memory
Ans. (i) A computer is an electronic device that
ok
(c) Monitor (d) Mouse
[Ans. (c) Monitor] manipulates information, or data. It has the
ability to store, retrieve, and process data.
4. Identify the input device …………… [FMT 2018] (ii) Computer works faster than human being and
(a) Printer (b) Mouse
o given the values more accuracy and reliable
(c) Plotter (d) Projector
2. Distinguish between data and information.
[Ans. (b) Mouse]
[FMT 2018]
ab
5. …………… Output device is used for printing Ans. Data Information
building plan, flex board, etc.
Data is defined as an Information is a
(a) Thermal printer (b) Plotter
unprocessed collection collection of facts from
(c) Dot matrix (d) inkjet printer of raw facts, suitable which conclusions may
[Ans. (b) Plotter]
ur
4.
[Ans. (a) Warm booting] Ans. (i) The ALU performs arithmetic operations.
8. Expand POST [FMT 2018] (ii) The result of an operation is stored in internal
w
6. What is the function of memory? 3. What is an input device? Give two examples.
Ans. The primary memory is used to temporarily store the Ans. Input device is used to feed any form of data to the
programs and data when the instructions are ready to computer, which can be stored in the memory unit
execute. The secondary memory is used to store the for further processing.
data permanently. Example: Keyboard, Mouse, Scanner, Fingerprint
scanner, Track Ball, Retinal Scanner, Light pen etc.
m
7. Differentiate Input unit and Output unit.
4. Name any three output devices.
Ans. Input Unit Output Unit
Ans. (i) Monitor (ii) Printer
Input unit is used An output unit is any
(iii) Plotter (iv) Speaker
co
to feed any form of hardware component
data to the computer, that conveys (v) Multimedia projectors are the output devices.
which can be stored in information to users in 5. Differentiate optical and Laser mouse. [HF. 2018]
the memory unit for an understandable form.
Ans. Optical Mouse Laser Mouse
further processing.
s.
Measures the motion Measures the motion and
Example : Example : and acceleration of acceleration of pointer.
Keyboard, mouse etc. Monitor, Printer etc. pointer.
ok
8. Distinguish Primary and Secondary memory. It uses light source Laser Mouse uses Laser
instead of ball to Light.
Ans. Primary Memory Secondary memory judge the motion of
It is used to It is used to store the the pointer.
temporarily store the data permanently.
Optical mouse is less Laser Mouse is highly
programs and data
when the instructions
o sensitive towards sensitive and able to work
surface. on any hard surface.
are ready to execute.
ab
It is volatile, the It is non-volatile, the 6. Write short note on impact printer.
content is lost when content is available even Ans. Impact printers :
the power supply is after the power supply is (i) These printers print with striking of hammers or
switched off. switched off. Eg. ROM, pins on ribbon. These printers can print on multi-
ur
Eg. RAM. CD-ROM, DVD ROM. part (using carbon papers) by using mechanical
Section - C pressure. For example, Dot Matrix printers and
Line matrix printers are impact printers.
Explain in brief
.s
memory and automation and lots of more tasks. Ans. (i) In the Sixth Generation, computers could be
2. Write the applications of computer. defined as the era of intelligent computers based
Ans. The various applications of computers are,
on Artificial Neural Networks.
w
(i) Business (ii) Education (ii) One of the most dramatic changes in the sixth
(iii) Marketing (iv) Banking generation will be the explosive growth of
(v) Insurance (vi) Communication Wide Area Networking.
(vii) Health care (iii) Natural Language Processing (NLP) is a
(viii) Engineering - Robotics, Nano technology, Bio component of Artificial Intelligence (AI).
Engineering (iv) It provides the ability to develop the computer
program to understand human language.
m
elements called PIXELS.
(iii) Monitors may either be Monochrome which a part of the CPU where various computing
display text or images in Black and White or functions are performed on data. The ALU
can be color, which display results in multiple performs arithmetic operations such as addition,
co
colors. subtraction, multiplication, division and logical
(iv) There are many types of monitors available operations.
such as CRT (Cathode Ray Tube), LCD (Liquid
Crystal Display) and LED (Light Emitting Control Unit
s.
Diodes).
(v) The video graphics card helps the keyboard to ALU
communicate with the screen. Input Unit Output Unit
(vi) It acts as an interface between the computer and
ok
Internal
Memory Data Path
display monitor. Control Path
Section - D Main Memory
Explain in detail o Secondary Storage
1. Explain the basic components of a computer with Components of a Computer
a neat diagram. [Govt.MQP, FMT-2018]
ab
Ans. Components of a Computer :
(iv) Control Unit : The control unit controls the
The computer is the combination of hardware and
software. Hardware is the physical component of a flow of data between the CPU, memory and I/o
computer like motherboard, memory devices, mon- devices. It also controls the entire operation of a
itor, keyboard etc., while software is the set of pro- computer.
ur
grams or instructions. Both hardware and software (v) Output Unit : An output unit is any hardware
together make the computer system to function. component that conveys information to users
Every task given to a computer follows an Input- in an understandable form. Example : Monitor,
process - output cycle (IPO cycle).
.s
Printer etc.
(vi) Memory Unit : The Memory Unit is of
two types which are primary memory and
secondary memory. The primary memory is
w
m
Malfunction due to overheat
co
First Generation Computer - ENIAC, EDVAC, UNIVAC 1
ENIAC weighed about 27 tons, size 8 feet × 100 feet × 3 feet and consumed around 150 watts of power
s.
GeneratedLess Heat
Consumed less power compared to first
generation
ok
Punched cards were used
Expert Systems
Able to solve high complex problems
including decision making and logical
reasoning
w
m
Bar Code / QR Code Reader:
for monochrome output. Inkjet printers work by
(i) A Bar code is a pattern printed in lines of
spraying ionised ink at a sheet of paper.
different thickness. The Bar code reader scans
(ii) They use the technology of firing ink by heating
co
it so that it explodes towards the paper in the information on the bar codes transmits to the
bubbles or by using piezoelectricity in which Computer for further processing.
tiny electric currents controlled by electronic (ii) The system gives fast and error free entry of
circuits are used inside the printer to spread ink information into the computer.
in jet speed.
s.
QR (Quick response) Code:
(iii) An Inkjet printer can spread millions of dots of
The QR code is the two dimension bar code
ink at the paper every single second.
which can be read by a camera and processed to
interpret the image.
ok
additional questions and Answers
10. Which of the following is not a form of parallel 19. Which device is very safe and convenient for
computing? security instead of password?
(a) bit level (b) instruction level (a) Scanner (b) Fingerprint Scanner
(c) task parallelism (d) Robotics (c) Track ball (d) Retinal Scanner
[Ans. (d) Robotics] [Ans. (b) Fingerprint Scanner]
m
11. Which of the following holds the data and 20. Which of the following device uses CCD Electronic
instructions during the processing? chip?
(a) Input unit (b) output unit (a) OCR (b) BCR
co
(c) Memory unit (d) Software (c) Voice Input Systems (d) Digital Camera
[Ans. (c) Memory unit] [Ans. (d) Digital Camera]
12. Which unit does the processing of data? 21. In which device the keys are arranged in a cluster?
(a) CPU (b) Registers (a) Keyboard (b) Keyer
s.
(c) Input unit (d) Output unit
(c) Barcode Reader (d) Touch Screen
[Ans. (a) CPU]
[Ans. (b) Keyer]
13. Which of the following is the heart of the
ok
computer? 22. Which Generations of computer used ULSI?
(a) CPU (b) HDD (c) SDD (d) ANN (a) Third (b) Fourth [HF. 2018]
[Ans. (a) CPU]
(c) Fifth (d) Sixth
14. Which of the following operations of ALU promote [Ans. (c) Fifth]
o
decision -making ability of a computer? 23. Who was the inventor of the electronic digital
(a) Logical (b) Relational computer?
ab
(c) Arithmetic (d) Binary (a) John Vincent Atanasoft
[Ans. (a) Logical] (b) J. Presper Eckert
(c) John Mauchly
15. Which of the following is not a non volatile
memory? (d) Charles babbage
ur
(a) ROM (b) Hard disk [Ans. (a) John Vincent Atanasoft]
(c) CD-ROM (d) RAM 24. Which company developed first digital computer?
[Ans. (d) RAM] (a) Atanasoft Berry Computer
.s
16. Which one of the following is Biometric Device? (b) AT & T bell
[QY. 2018] (c) IBM
(a) Scanner (b) Fingerprint Scanner (d) Microsoft
w
(c) Light Pen (d) Mouse [Ans. (a) Atanasoft Berry Computer]
[Ans. (b) Fingerprint Scanner]
25. Which of the following are the computer systems
w
17. Who invented the computer mouse? inspired by the biological neural networks?
(a) Douglas Engelbart (b) Bill English (a) NLP (b) IBM
(c) Apple Lisa (d) Henry Babbage (c) Robotics (d) ANN [Ans. (d) ANN]
w
m
papers?
(d) Natural language processing (a) Scanner (b) Touch Screen
[Ans. (c) Artificial intelligence] (c) Plotter (d) Track ball
co
28. Which of the following is the logical machine which [Ans. (c) Plotter]
interprets and executes software instructions?
38. W
hich code checks partition table for an active
(a) CPU (b) ALU
partition in a computer?
(c) Control Unit (d) Memory Unit
(a) MBR (b) Marse (c) Binary (d) Object
[Ans. (a) CPU]
s.
[Ans. (a) MBR]
29. How many classification of memories in memory
unit? 39. Which of the following is a type of computation
in which many calculations are carried out
(a) 2 (b) 3
ok
simultaneously?
(c) 4 (d) more than 2
(a) NLP (b) ANN
[Ans. (a) 2]
(c) Parallel Processing (d) Parallel Computing
30. How many types of Keyboards used to input the
[Ans. (d) Parallel Computing]
data?
(a) 3 (b) 2 (c) 4 (d) 5
o 40. Which of the following devices not stores the date
[Ans. (a) 3] permanently?
ab
31. How many types of pointing device are there? (a) HDD (b) SSD
(a) 2 (b) 3 (c) 1 (d) Many (c) Tape Drives (d) RAM
[Ans. (a) 2] [Ans. (d) RAM]
41. Which of the following devices stores the data
ur
34. W
hich device is used to produce computer output 1. List I List II
on a big screen?
(i) Expert System 1 Second
(a) Monitor (b) LED
Generation
w
Codes: 4.
List I List II
(i) (ii) (iii) (iv)
(a) 4 1 3 2
(i) Used to feed data to 1 CPU
(b) 1 3 2 4
the computer
(c) 3 4 1 2 (ii) Controls the operation 2 ALU
of memory Unit
m
(d) 4 3 1 2
[Ans. (a) (i)-4, (ii)-1, (iii)-3, (iv)-2] (iii) Computing functions 3 Control
2. are performed on data Unit
List I List II (iv) Controls the flow of 4 Input Unit
co
(i) EDVAC 1 Second Generation data between memory
Computer
unit and I/O Units.
(ii) APPLE 2 Fifth Generation
Computer Codes:
s.
(iii) IBM 1620 3 First Generation (i) (ii) (iii) (iv)
Computer (a) 4 1 2 3
(iv) Expert System 4 Fourth Generation (b) 2 1 4 3
ok
Computer (c) 4 3 1 2
(d) 3 4 1 2
[Ans. (a) (i)-4, (ii)-1, (iii)-2, (iv)-3]
Codes:
(i) (ii) (iii) (iv) 5.
(a) 4 1 3 2
o List I List II
(b) 1 3 2 4
(i) First generation 1 Integrated
ab
(c) 4 3 1 2 Circuits
(d) 3 4 1 2
[Ans. (d) (i)-3, (ii)-4, (iii)-1, (iv)-2] (ii)Second 2 Microprocessor
generation
3. List I List II (iii) Third generation 3 Transistors
ur
(i) Out device 1 Executes Instruction (iv) Fourth generation 4 Vacuum tubes
(ii) CPU 2 Delivers the data Codes:
processed by CPU (i) (ii) (iii) (iv)
.s
m
(d) 2 3 1 4
............... generation computers.
[Ans. (c) (i)-4, (ii)-3, (iii)-1, (iv)-2]
(a) First (b) Second (c) Third (d) Fourth
7. [Ans. (d) Fourth]
co
List I List II 7. The fifth generation computers belongs to ...........
(i) Information 1 Motherboard (a) 1971-1980 (b) 1980-1990
(c) 1964-1971 (d) 1940-1956
(ii) Hardware 2 Set of programs
[Ans. (b) 1980-1990]
(iii) Data 3 Convey some
s.
meaning 8. Name the software introduced in fifth generation
(iv) Software 4 Set of raw facts computers ................... .
(a) Artificial Neural Networks
Codes:
ok
(i) (ii) (iii) (iv) (b) Artificial Intelligence
(a) 1 2 3 4 (c) Robotics
(b) 3 1 4 2 (d) Natural language processing
(c) 4 3 2 1
o [Ans. (b) Artificial Intelligence]
(d) 2 3 1 4 9. Robotics developed in .................. generation.
[Ans. (b) (i)-3, (ii)-1, (iii)-4, (iv)-2] (a) Third (b) Fourth (c) Fifth (d) Sixth
ab
[Ans. (d) Sixth]
III. Choose the Correct Option and Fill in 10. ENIAC was invented by ................. .
the Blanks. (a) John Vincent
1. The first calculating device is ........... . (b) Cliff Berry
ur
(a) ENIAC (b) Analytical Engine (c) Presper Eckert, John Mauchly
(c) EDVAC (d) Abacus (d) Earl R Johnson and Atanasoff
[Ans. (d) Abacus] [Ans. (c) Presper Eckert, John Mauchly]
.s
13. Every task given to a computer-follows a(n) 22. Expansion of CPS is ...................... .
............... cycle. (a) Character Per Second (b) Copy Per Second
(a) BPO (b) IPO (c) Code Per Second (d) Character Per Screen
(c) ANN (d) NLP [Ans. (b) IPO] [Ans. (a) Character Per Second]
14. Expansion of CPU is .................. . 23. The first computer monitor was released in the
m
(a) Control processing unit year .................. .
(b) Central processor unique (a) 1980 (b) 1983 (c) 1963 (d) 1973
(c) Central processing unit [Ans. (d) 1973]
co
(d) Control processor unit 24. The expansion of VLSI is
[Ans. (c) Central processing unit] (a) Verified Logical Scale Integrated Circuits
15. Expansion of ALU is .................... . (b) Very Logical Small Integer Circuits
(c) Very Large Scale Integrated Circuits
(a) Arithmetic Logical Unit
(d) Volatile Large Scale Integrated Circuits
s.
(b) Accumulator Logical Unit [Ans. (c) Very Large Scale Integrated Circuits]
(c) Arithmetic Language Unit 25. The first digital computer name was ............. .
(d) None of these (a) EDVAC (b) UNIVACI
ok
[Ans. (a) Arithmetic Logical Unit] (c) ENIAC (d) IBM 1620
[Ans. (c) ENIAC]
16. The memory unit is of .............. kinds.
(a) 3 (b) 4 (c) 2 (d) 5 26. Artificial neurons are organized in ....... .
[Ans. (c) 2] (a) Nodes (b) Layers
o (c) Signals (d) Units
17. I dentify the Input device [FMT 2018]
[Ans. (b) Layers]
ab
(a) Printer (b) Mouse
(c) Plotter (d) Projector 27. The conversion of data to information is called
[Ans. (b) Mouse] ........... .
(a) Data Digitization
18. Optical Mouse invented in the year.
(b) Data Processing
ur
(a) 1968 (b) 1973 (c) 1988 (d) 1981 (b) Data Management
[Ans. (c) 1988] (d) All of these
19. Laser mouse has as many as ............... buttons. [Ans. (b) Data Processing]
.s
(a) 10 (b) 11 (c) 12 (d) 3 28. A set of instructions given to the computer is
[Ans. (c) 12] called ............. .
20. Expansion of CCD is ................. (a) Information (b) Data
w
(c) Changed Couple Device 29. The mechanical mouse introduced in the year.
(d) Camera changed Divider (a) 1978 (b) 1988 (c) 1968 (d) 1958
[Ans. (c) 1968]
[Ans. (b) Changed Coupled Device]
w
30. T
he Red, Green or Blue led used mouse in
21. Expansion of GUI is .............. . [QY. 2018]
invented by .................
(a) Graphics User Interface
(a) John Mauchly (b) Steve Kirsch
(b) Graphical User Information (c) Henry babbaje (d) Presper Eckert
(c) Geographical User Information [Ans. (b) Steve Kirsch]
(d) Graphical User Interface
[Ans. (d) Graphical User Interface]
m
32. W
hich device is used to enter information directly
into the computer's memory? (a) Visual Graphics Adapter
(a) Keyboard (b) Scanner (b) Video Graphics Adapter
co
(c) Mouse (d) Plotter (c) Video Graphics Array
[Ans. (b) Scanner] (d) Voice Graphics Array
33. The expansion of USB is ................ [Ans. (c) Video Graphics Array]
(a) Universal Serial Bus
42. Which of the following is an impact priners
s.
(b) Uniform Serial Bus
(c) Uniform Serious Bus (a) Inkjet (b) Fax
(d) Universal Serial BIOS (c) Dot Matrix (d) Laser
[Ans. (a) Universal Serial Bus]
ok
34. Which device used CCD chip? [Ans. (c) Dot Matrix]
(a) Light pen (b) Scanner 43. An error will half the boot process found in ..........
(c) Microphone (d) Digital Camera (a) BIOS (b) POST
[Ans. (d) Digital Camera]
o
35. Which device is used to input by pressing one or
(c) HDD
(d) I/O System
[Ans. (b) POST]
more switches?
ab
(a) Keyboard (b) Mouse 44. T
he process of loading an OS in a computer RAM
(c) Touch Screen (d) Keyer is known as ............
[Ans. (d) Keyer] (a) POST (b) BIOS
36. How many types of monitors are there? (c) Booting (d) All of these
ur
(b) Liquid Cluster Display device to display the information. Other three are
(c) Liquid Crytal Display examples of input device.
(d) Live Extract Display 2. (a) Mechanical Mouse (b) Laser Mouse
w
V. Which one of the Following is Not 3. Assertion (A) : icrophone serves as a voice
M
Correctly Matched? Input device.
Reason (R) : Digital camera uses a CCD
1. (a) Impact printers – Dot Matrix printer electronic chip.
(b) Non–Impact printers – Laser printer (a) Both (A) and (R) are true and (R) is the correct
m
(c) Hardware – Keyboard explanation of (A).
(d) Software – CPU (b) Both (A) and (R) are true and (R) is not the
correct explanation of (A).
[Ans. (d) Software – CPU]
(c) (A) is true, but (R) is false.
co
2. (a) Second generation – Transistors (d) (A) is false, but (R) is true.
(b) Third generation – Integrated circuits [Ans. (b) Both (A) and (R) are true and (R) is not
(c) Fourth generation – Vacuum tubes the correct explanation of (A)]
(d) Fifth generation – ULSI
s.
[Ans. (c) Fourth generation – Vacuum tubes] VII. Choose the Correct Statement.
VI. Consider the Following Statement. 1. Which of the following statements are true?
ok
(i) Machine language programs are done in first
1. Assertion (A) : Computers have now become an generation
indispensable part of our lives. (ii) Third generation computers are not more reliable
Reason (R) : Computers have revolutionized (iii) Voice recognition software developed in fifth
o
out lives with their accuracy and generation computer
speed of performing a job, it is (iv) Micro processors are used in fourth generation
ab
truly remarkable. computer
(a) Both (A) and (R) are true and (R) is the correct (a) Only (i) (b) Only (i) and (iv)
explanation of A. (c) Only (iii) and (iv) (d) Only (i) (iii) and (iv)
(b) Both (A) and (R) are true and (R) is not the [Ans. (b) Only (i) and (iv)]
correct explanation of (A).
ur
(c) (A) is true, but (R) is false. Very Short Answers 2 MARKS
(d) (A) is false, but (R) is true.
1. Name the first generation computers.
[Ans. (a) Both (A) and (R) are true and (R) is the
.s
(b) Both (A) and (R) are true and (R) is not the (ii) ENIAC - Electronic Numerical Integrator
correct explanation of A. And Calculator.
(c) (A) is true, but (R) is false. (iii) RAM - Random Access Memory
(d) (A) is false, but (R) is true. (iv) ALU - Arithmetic and Logic unit
[Ans. (b) Both (A) and (R) are true and (R) is not
the correct explanation of (A)]
m
printers. [FMT 2018] Usually the recent motherboard incorporates built in
Ans. Impact : Dot Matrix printer and line dot matrix printer. video card.
Non - Imapct : Laser printer and Inkjet printer.
15. Write the two main categories of Printer.
co
7. Name the types of computer introduced in Fourth
Ans. Printers are divided into two main categories:
generation computers.
Ans. (i) Microcomputer (i) Impact Printers
(ii) Portal Computers. (ii) Non Impact printers
s.
8. Write the developments of Sixth generation
16. What is booting a computer?
computers.
Ans. (i) Parallel Computing Ans. Booting a computer is to load an operating system
ok
(ii) Artificial Neural Networks into the computer's main memory or random access
(iii) Robotics memory (RAM).
(iv) Natural Language Processing
17. What makes Charles Babbage the father of
9. What is NLP? computing?
o
Ans. Natural Language Processing is the ability of a
Ans. Charles Babbage radical ideas and concept of the
computer program to understand human language. It
ab
Analytical Engine (It contained an ALU, basic flow
is a component of artificial intelligence. control and integrated memory) makes him the father
10. Write short note on registers. [FMT 2018] of computing.
Ans. Registers are the high-speed temporary storage 18. What is the goal of neural network approach?
ur
locations in the CPU. Hence, their contents can be Ans. The original goal of the neural network approach was
handled much faster than the contents of memory. to solve problems in the same way that a human brain
11. What is the use of Microphone? would. Over time, attention focused on matching
.s
Ans. Microphone serves as a voice Input device. It specific mental abilities, leading to deviations from
captures the voice data and send it to the Computer. biology.
12. Write a note on Digital Camera. 19. Write the tools in which nano technology was
w
13. Write Demerits of Artificial Intelligence. [QY. 2018] 20. Define IPO Cycle.
w
Ans. (i) Machines need repairing and maintenance Ans. The functional components of a computer performs.
which need plenty of cost. Every task given to a computer follows an Input-
(ii) The increasing number of machines leading to Process- Output Cycle (IPO cycle).
unemployment and job security issues.
21. Name the different keys available in the keyboard. 29. What does reboot mean?
Ans. There are different set of keys available in the Ans. It means to reload the operating system.
keyboard such as character keys, modifier keys,
30. Write the limitations of impact printer.
system and GUI keys, enter and editing keys,
Ans. (1) It is slow as compared to non-impact printers
function keys, navigation keys, numeric keypad and
m
(2) It is not best suited for graphics
lock keys.
(3) It is not possible to obtain colour output.
22. Which device is used to draw a lines?
Ans. Light Pen is an input device which is used to draw Short Answers 3 MARKS
co
lines or figures on a computer screen. It is touched
1. Write a note Vaccum tube.
to the CRT screen where it can detect faster on the
screen as it passes. Ans. (i) Vacuum tubes contain electrodes for controlling
electron flow and were used in early computers
s.
23. Define Pixels. as a switch or an amplifier.
Ans. Pictures on a monitor are formed with picture (ii) Vaccum tubes are big in size and consumed
elements called PIXELS. more power.
ok
24. Name the types of Monitors available. 2. Define Transistor.
Ans. The types of monitors available such as CRT Ans. (i) The transistor ("transfer resistance") is made up
(Cathode Ray Tube), LCD (Liquid Crystal Display) of semi-conductors.
and LED (Light Emitting Diodes).
o (ii) It is a component used to control the amount
25. How the date travel through control bus? of current or voltage used for amplification/
ab
Ans. The date travel in both unidirectional and modulation or switching of an electronic signal.
bidirectional due to the internal connection with in 3. Define Punched cards.
the computer architecture. Ans. Punch cards also known as Hollerith cards are paper
26. Name the type of registers are essential for cards containing several punched or perforated holes
ur
Printers.
(iii) Memory Address Registers
Ans. Impact Printers Non-Impact Printers
(iv) Memory Buffer Register
It uses ribbons / carbon It use ink cartridges and
w
Ans. (a) MAR - Memory Address Register The quality of printing is The quality of printing is
a draft quality. a high quality.
(b) MBR - Memory Buffer Register Striking Mechanism No striking mechanism
used to produce output. used to produce output.
w
m
white printing. printing. [Govt.MQP, FMT-2018]
It makes noise while It is silent while printing. Ans. Booting process is of two types.
printing. (i) Cold Booting (ii) Warm Booting
co
6. What is Machine language? (i) Cold Booting: When the system starts from
initial state i.e. it is switched on, we call it cold
Ans. (i) Machine language is a collection of binary digits
booting or Hard Booting. When the user presses
or bits that the computer reads and interprets.
the Power button, the instructions are read from
(ii) In first generation, machined language was the ROM to initiate the booting process.
s.
used. (ii) Warm Booting: When the system restarts or
7. What is Integrated circuits? when Reset button is pressed, we call it Warm
ok
Ans. (i) IC is short for Integrated Circuit or Integrated Booting or Soft Booting. The system does not
start from initial state and so all diagnostic tests
Chip.
need not be carried out in this case. There are
(ii) The IC is a package containing many circuits,
pathways, transistors, and other electronic
o chances of data loss and system damage as the
components all working together to perform a data might not have been stored properly.
particular function or a series of functions. Differentiate optical mouse and laser mouse.
ab
13. Write a note on Touch Screen.
8. What is Robotics?
Ans. (i) A touch screen is a display device that allows
Ans. (i) Robot is a term coined by Karel Capek in the the user to interact with a computer by using the
1921 play RUR (Rossum's Universal Robots). finger.
(ii) It is used to describe a computerized machine (ii) It can be quite useful as an alternative to a
ur
feature that uses biometric technology. Fingerprint output system runs to determine if the computer
Reader / Scanner is very safe and convenient device keyboard, random access memory, disk drives
for security instead of password, that is vulnerable to and other hardware are working correctly.
fraud and is hard to remember.
(ii) If the necessary hardware is detected and found
11. Write the mechanism of laser mouse. [FMT 2018] to be operating properly, the computer begins to
Ans. (i) Measures the motion and acceleration of pointer. boot.
m
information directly into the computer’s memory. highly sensitive and able to work on any hard
This device works like a xerox machine. The surface.
scanner converts any type of printed or written
information including photographs into a digital 3. Short answer on the following: [QY. 2018]
co
format, which can be manipulated by the computer. a) Data b) Hardware
c) Natural Language Processing
(ii) Finger print Scanner: Finger print Scanner is a
d) Types of Memory
fingerprint recognition device used for computer
e) Bit
s.
security, equipped with the fingerprint recognition
feature that uses biometric technology. Fingerprint Ans. (a) Data : The term data comes from the word
Reader / Scanner is a very safe and convenient datum, which means a raw fact. The data is a
ok
device for security instead of using passwords, fact about people, places or some objects.
which is vulnerable to fraud and is hard to (b) Hardware : Hardware is the physical
remember. component of a computer like motherboard,
memory devices, monitor, keyboard etc.,
Output Devices :
o (c) Natural Language Processing : Natural
(i) Monitor: Monitor is the most commonly Language Processing is a method used in
ab
used output device to display the information. artificial intelligence to process and derive
It looks like a TV. Monitors may either be meaning from the human language.
Monochrome which display text or images in (d) Types of Memory : The memory unit is of two
Black and White or can be color, which display types - Primary memory, Secondary memory.
results in multiple colors. There are many types
ur
(ii) Plotter: Plotter is an output device that is used to (i) These printers print with striking of hammers
produce graphical output on papers. It uses single or pins on ribbon. These printers can print
color or multi color pens to draw pictures. on multi-part (using carbon papers) by using
mechanical pressure.
w
2. Explain in detail the different types of Mouse. (ii) For example, Dot Matrix printers and Line
Ans. (i) Mechanical Mouse : A small ball is kept inside matrix printers are impact printers.
and touches the pad through a hole at the bottom (iii) A Dot matrix printer that prints using a fixed
w
of the mouse. When the mouse is moved, the ball number of pins or wires. Each dot is produced
rolls. This movement of the ball is converted by a tiny metal rod, also called a “wire” or
into signals and sent to the computer. “pin”, which works by the power of a tiny
(ii) Optical Mouse: Measures the motion and electromagnet or solenoid, either directly or
acceleration of pointer. It uses light source through a set of small levers.
instead of ball to judge the motion of the pointer.
m
output. Inkjet printers work by spraying ionised
(i) These printers do not use striking mechanism
ink at a sheet of paper.
for printing. They use electrostatic or laser
technology. (iii) They use the technology of firing ink by heating
it so that it explodes towards the paper in
co
(ii) Quality and speed of these printers are better
than Impact printers. For example, Laser bubbles or by using piezoelectricity in which
printers and Inkjet printers are non-impact tiny electric currents controlled by electronic
printers. circuits are used inside the printer to spread ink
in jet speed.
Laser Printers :
s.
(iv) An Inkjet printer can spread millions of dots of
(i) Laser printers mostly work with similar
ink at the paper every single second.
technology used by photocopiers.
(ii) It makes a laser beam scan back and forth across
ok
a drum inside the printer, building up a pattern.
It can produce very good quality of graphic
images. o
ab
ur
.s
w
w
w
Chapter
2 Number Systems
m
co
CHAPTER SNAPSHOT
2.1 Number Systems - Introduction 2.4.12 Hexadecimal to Binary
s.
2.2 Data Representations Conversion
2.3 Different Types of Number Systems 2.5 Binary Representation for Signed
Numbers
ok
2.3.1 Decimal Number System
2.3.2 Binary Number System 2.5.1 Signed Magnitude representation
2.4
o
Number System Conversions 2.6 Binary Arithmetic
2.6.1 Binary Addition
ab
2.4.1 Decimal to Binary Conversion
2.4.2 Decimal to Octal Conversion 2.6.2 Binary Subtraction
[21]
m
co
s.
COMPUTER SCIENCE o ok
ab
VOLUME - II
ur
.s
w
w
w
[129]
Contents
m
co
Chapter P. No
s.
No
Title
ok
9. Introduction to C++ 129-166
10. Flow of Control 167-186
11. Functions 187-206
12. Arrays and Structures
o 207-227
UNIT IV - OBJECT ORIENTED PROGRAMMING WITH C++
ab
13. Introduction to Object Oriented Programming Techniques 228-235
14. Classes and objects 236-265
15. Polymorphism 266-277
ur
Govt. Model Question Paper & Sura’s Model Question Paper 1 - 3 with Answer Key. 319-339
w
[130]
m
Chapter
9I C++
co
ntroduction to
s.
CHAPTER SNAPSHOT
ok
9.1. Introduction 9.7.2. Working with Dev C++
9.2. Character set 9.8. Types of Errors
9.3. Lexical Units (Tokens)
o Data Types, Variables and Expressions
9.3.1. Keywords 9.10. Introduction
9.3.2. Identifiers 9.11. Concept of Data types
ab
9.3.3. Literals(Constants) 9.12. C++ Data types
9.3.4. Operators 9.12.1. Introduction to
9.3.5. Punctuators fundamental Data types
ur
[131]
Evaluation
Part - I 8. A program written in high level language is called
as?
Choose the Correct Answer: (a) Object code (b) Source code
m
1. Who developed C++? (c) Executable code (d) All the above
(a) Charles Babbage (b) Bjarne Stroustrup [Ans. (b) Source code]
(c) Bill Gates (d) Sundar Pichai 9. Assume a=5, b=6; what will be result of a&b?
co
[Ans. (b) Bjarne Stroustrup] (a) 4 (b) 5
2. What was the original name given to C++? (c) 1 (d) 0
(a) CPP (b) Advanced C [Ans. (a) 4]
(c) C with Classes (d) Class with C
s.
10. Which of the following are called as compile time
[Ans. (c) C with Classes] operators?
3. Who coined C++? (a) sizeof (b) pointer
ok
(a) Rick Mascitti (b) Rick Bjarne (c) virtual (d) this
(c) Bill Gates (d) Dennis Ritchie [Ans. (a) sizeof]
[Ans. (a) Rick Mascitti]
Part - II
4. The smallest individual unit in a program is:
Answer to All the questions : (2 Marks)
(a) Program
o
(b) Algorithm
(c) Flowchart (d) Tokens 1. What is meant by a token? Name the token
ab
[Ans. (d) Tokens] available in C++
5. Which of the following operator is extraction Ans. The smallest individual unit in a program is known
operator in C++? as a Token or a Lexical unit.
(a) >> (b) << C++ has the following tokens:
ur
(a) Keywords are the reserved words convey specific (iv) Operators
meaning to the C++ compiler (v) Punctuators
(b) Reserved words or keywords can be used as an
2. What are keywords? Can keywords be used as
w
identifier name
(c) An integer constant must have at least one digit identifiers?
without a decimal point. Ans. Keywords are the reserved words which convey
(d) Exponent form of real constants consists of two specific meaning to the C++ compiler. They are the
w
7. Which of the following is a valid string literal? (i) 39 (ii) 032 (iii) OXCAFE (iv) 04.14
(a) 'A' (b) 'Welcome' Ans. (i) Integer constant
(c) 1232 (d) "1232" (ii) Octal constant
[Ans. (d) "1232"] (iii) Hexadecimal constant
(iv) Floating point constant.
4. Write the following real constants into the 3. Differentiate “=” and "==”
exponent form:
Ans. = ==
(i) 23.197 (ii) 7.214 (iii) 0.00005 (iv) 0.319
(i) It is an assignment It is a relational
Ans. (i) 0.23197 ×102 ⇒ 0.23197E02 operator. operator.
(ii) 0.7214 ×101 ⇒ 0.7214E01 (ii) It is used to assign
m
It is used to
(iii) 0.5 ×10–4 ⇒ 0.5E.04 a value to a variable compare two values
which is on the and the result will
(iv) 0.0319 ×101 ⇒ 0.0319E01.
left hand side of be either true or
co
5. Assume n=10; what will be result of n>>2;? an assignment false.
statement.
Ans. n = 10 ⇒ (00001010)2
(iii) Eg: a = b Eg: a = = b
n >> 2 ⇒ (00000010)2⇒ 210
(b value is assigned (a value will be
s.
6. Match the following: to a) compared with b
value)
A B
4. Assume a=10, b=15; What will be the value of
(a) Modulus (1) Tokens
ok
a^b?
(b) Separators (2) Remainder of a
Ans. a ^ b
division
10 ^ 15
(c) Stream extraction (3) Punctuators
1010 = 10102
(d) Lexical Units (4) get from
o 1510 = 11112
[Ans. (a) - (2), (b)- (3), (c) - (4), (d) - (1)] 10 1 0 1 0
ab
15 1 1 1 1
Part - III a^B 0 1 0 1
Answer to All the questions :(3 Marks)
a^b = 01012 = 510
ur
Switch, case, for, if name, age, class-12B rules of C++ are operation that takes
etc., etc., violated. place.
(iii) Example: if a Example: if a
w
2. Is C++ case sensitive? What is meant by the term program tries to open program tries to
"case sensitive"? a file which does not open a file which
exist, it results in a does not exist, it
Ans. Yes, C++ is case sensitive. Case sensitive means C++
run time error. results in a run time
treats upper and lower case characters differently. error.
Capital letters ≠ small letters.
m
construct a program. result even though (ii) Relational Operators
the program is
grammatically (iii) Logical Operators
correct. It may be (iv) Bitwise Operators
happened by wrong
co
use of variable / (v) Assignment Operators
operator / order of (vi) Conditional Operator
execution etc. (i) Arithmetic Operators : Arithmetic operators
(ii) Every programming This means, program perform simple arithmetic operations like
language has is grammatically
s.
addition, subtraction, multiplication, division etc.,
unique rules for correct, but it
contains some (ii) Relational Operators : Relational operators
constructing the logical error. are used to determine the relationship between
source code. its operands. When the relational operators are
ok
(iii) Syntax errors occur Semantic error is applied on two operands, the result will be a
when grammatical also called as "Logic Boolean value i.e 1 or 0 to represents True or
rules of C++ are Error".
False respectively. C++ provides six relational
violated. o operators.
7. What is the use of a header file? (iii) Logical Operators : A logical operator is used
Ans. Header files contain definitions of functions and to evaluate logical and relational expressions.
ab
variables, which is used into any C++ program by The logical operators act upon the operands that
using the pre-processor #include statement. It have are themselves called as logical expressions.
an extension ".h" which contains C++ function C++ provides three logical operators.
declaration and macro definitions. (iv) Bitwise Operators : Bitwise operators work
on each bit of data and perform bit-by-bit
ur
directive.
Ans. The preprocessor directive # include tells the
is on the left hand side of an assignment
computer to insert another file in to the source file. statement. = (equal to) is commonly used
as the assignment operator in all computer
w
m
programming language change during the execution of a program.
has unique rules for Therefore Literals are called as Constants.
constructing the source
code. (ii) Three types of integer 1. Decimal 2. Octal
co
Syntax errors occur when 3. Hexadecimal
grammatical rules of C++
are violated. 2. What kind of constants are following?
Example: If you type as (i) 26 (ii) 015 (iii) 0xF (iv) 014.9
follows, C++ will throw an
s.
Ans. (i) Integer
error. cout <<"Welcome
to Programming in C++" (ii) Octal
As per grammatical rules (iii) Hexadecimal
of C++, every executable
ok
(iv) Floating
statement should terminate
with a semicolon. But, this 3. What is character constant in C++?
statement does not end with Ans. A character constant in C++ must contain one
a semicolon.
character and must be enclosed in a single quote.
Semantic Error
o
A Program has not produced
expected result even though Valid character constants : 'A', '2', '$'
the program is grammatically 4. How are non graphic characters represented in
ab
correct. It may be happened C++?
by wrong use of variable/
Ans. Non- printable characters can be represented by using
operator /order of execution
etc. This means, program is escape sequences. An escape sequence is represented
grammatically correct, but it by a backslash followed by one or two characters.
ur
contains some logical error. 5. Write the following real constants into exponent
So, Semantic error is also
form:
called as "Logic Error".
(i) 32.179 (ii) 8.124 (iii) 0.00007
Run-time error A run time error is that
.s
For example, if a program 6. Write the following real constants into fractional
tries to open a file which
does not exist, it results in a form:
run-time error. (i) 0.23E4 (ii) 0.517E-3 (iii) 0.5E-5
w
3. Assume a=15, b=20; What will be the result of the Ans. (i) 0.000023
following operations? (ii) 0.000517
(a) a&b (b) a|b (c) a^b (d) a>>3 (d) (~b) (iii) 0.000005
w
Ans. (a) a&b = (00000100)2 = (4)10 7. What is the significance of null (\0) character in
(b) a|b = (00011111)2 = (31)10 a string?
(c) a^b = (00011011)2 = (27)10 Ans. Sequence of characters enclosed within double quotes
(d) a>>3 = (00000001)2 = (1)10 are called as String literals. By default, string literals
are automatically added with a special character ‘\0’
(e) (~b) = (00001011)2 = (11)10
(Null) at the end.
m
Ans. Operators are used to perform calculations on an
operands that yield a new value. 17. Write an expression involving a logical operator
to test, if marks are 75 and grade is 'A'.
9. What are binary operators? Give examples of
Ans. If (marks > = 75)
co
arithmetic binary operators.
cant << "grade is 'A' ;
Ans. Binary operators are the operators that required two
operands.
Eg : x = a + b - c. Hands on Practice
s.
10. What does the modulus operator % do? Type the following C++ programs in Dev C++
Ans. Modulus operator (%) is used to get the remainder of IDE and execute. If compiler shows any errors,
two integer division. try to rectify it and execute again and again till
ok
Eg : 10% 3 = 1 you get the expected result.
11. What will be the result of 8.5 % 2? 1. C++ Program to find the total marks of three
Ans. 0.5(Reminder is the answer). subjects.
12. Assume that R starts with value 35. What will #include <iostream>
o
be the value of S from the following expression? using namespace std;
S=(R--)+(++R). int main()
ab
Ans. S = 70. {
13. What will be the value of j = - - k + 2k. if k is 20 int m1, m2, m3, sum;
initially ? cout << "\n Enter Mark 1: ";
Ans. j = 59. cin >> m1;
ur
14. What will be the value of p = p * ++j where j is 22 cout << "\n Enter Mark 2: ";
and p = 3 initially? cin >> m2;
Ans. 69. cout << "\n Enter Mark 3: ";
cin >> m3;
.s
2. C++ program to find the area of a circle. 2. int num1, num2; (variable declaration statement
#include <iostream> missing)
using namespace std; 3. cin >> num1 >> num2; (instead of extraction
int main() operator, insertion operator in the statement)
{
4. sum = num1 + num 2; (always the expression
m
int radius;
come in RHS)
float area;
5. cout << "\n The sum = " << sum; (insertion
cout << "\n Enter Radius: ";
cin >> radius; operator is required)
co
area = 3.14 * radius * radius; 6. } (to End the program using curly braces)
cout << "\n The area of circle = " << area; Corrected program :
} #include<iostream.h>
Ans. #include <iostream> int main ()
s.
using namespace std; {
int main()
cout << "Enter a value";
{
ok
cin >> num1 >> num2'
float r, area;
sum = num1 + num2;
cout << "\n Enter Radius: ";
cin >> r; cout << "\n The sum = "<< sum;
area = 3.14 * r * r; }
o
cout << "\n The Area of the circle is " << area; 4. Point out the type of error in the following
}
program
ab
Output:
#include <iostream>
Enter Radius: 6.5
The Area of the circle is 132.665 using namespace std;
int main()
3. Point out the errors in the following program:
ur
}
cin << num1 >> num2
Ans. int h = 10, w = 12;
num+num2=sum;
cout<< "Area of rectangle"<<h + w;
cout >> “\n The Sum= ” >> sum;
w
m
(a) \ t (b) \ b
Choose the Correct Answer: (c) \ 0 (d) \ n [Ans. (d) \ n]
1. How many categories of data types are available
co
in C++? Part - II
(a) 5 (b) 4 (c) 3 (d) 2 Answer to All the questions : (2 Marks)
[Ans. (c) 3]
2. Which of the following data types is not a 1. Write a short note const keyword with an example.
fundamental type?
s.
Ans. Const is the keyword used to declare a constant. It
(a) signed (b) int modifies/restricts the accessibilty of a variable
(c) float (d) char[Ans. (a) signed] Eg: const int n = 200;
What will be the result of following statement?
ok
3.
2. What is the use of setw() format manipulator?
char ch= 'B';
Ans. Setw()manipulator sets the width of the field
cout << (int) ch; assigned for the output. The field width determines
(a) B (b) b (c) 65 (d) 66 the minimum number of characters to be written in
[Ans. (d) 66] output. Syntax : setw(number of characters)
4.
o
Which of the character is used as suffix to indicate
3. Why is char often treated as integer data type?
a floatig point value?
ab
Ans. Character data type is often said to be an integer type,
(a) F (b) C (c) L (d) D
since all the characters are represented in memory by
[Ans. (a) F]
their associated ASCII Codes. If a variable is declared
5. How many bytes of memory is allocated for the as char, C++ allows storing either a character or an
following variable declaration if you are using integer value.
ur
7. Which of the following is not a data type modifier? 5. Consider the following C++ statement. Are they
equivalent?
(a) signed (b) int
char ch = 67; char ch = 'C';
(c) long (d) short [Ans. (b) int]
w
6. What is the difference between 56L and 56? 2. Evaluate x+=x + ++x; Let x=5
Ans. 56 is an integer number. Ans. x + = x + + + x
56L is a long integer number. x = x + x+++ x;
= 5 + 5 + 6 = 16.
7. Determine which of the following are valid
constant? And specify their type. 3. How relational operators and logical operators
m
(i) 0.5 (ii) 'Name' (iii) '\t' (iv) 27,822 related to one another?
Ans. (i) 0.5 - Valid Floating Constant Ans. Logical operators uses AND (&&), OR (¦ ¦)
(ii) 'Name' - Invalid String Constant (Enclosed and NOT(!). These operators yield true or false
depending upon the out come of different relational
co
within Double quotes)
expressions. Relational expressions are formed by
(iii) '\t' - Valid - Non graphic character data type Relational operators.
(iv) 27,822 - Invalid Decimal Constant (Commas 4. Evaluate the following C++ expressions where x, y,
is not allowed). z are integers and m,n are floating point numbers.
s.
8. Suppose x and y are two double type variable that The value of x = 5, y = 4 and m = 2.5;
you want add as integer and assign to an integer (i) n = x + y / x;
variable. Construct a C++ statement to do the above. (ii) z = m * x + y;
ok
Ans. double x; (iii) z = (x ++) * m + x;
double y; Ans. (i) n = x + y / x;
int z = (int) x + (int) y; or int z = (int)(x + y);
n=5+(4/5)
9. What will be the result of following if num=6 n = 5 + 0.8
initially
o n = 5.8
(a) cout << num; (ii) z = m * x + y;
ab
(b) cout << (num ==5);
z = ( 2.5 * 5) + 4
Ans. (a) 6
z =12.5 + 4
(b) 0 z = 16.5
10. Which of the following two statements are valid? z = 16 (z is an integer)
ur
operators. Give example for each of them 1. What do you mean by fundamental data types?
Ans. (i) The operators, which are applied to perform Ans. (i) Fundamental data types are predefined data
arithmetical calculations in a program are types available in C++.
w
known as arithmetical operators. (ii) These are five fundamental data types in C++.
(ii) A unary operator requires a single (one) operand. 2. The data type char is used to represent characters.
Unary +, Unary -, ++, -- are the examples of then why is it often termed as an integer type?
many operators.
Ans. Since all the characters are represented in memory
(iii) A binary operator requires two operands +, -, *,
/, % are the examples of binary operators. by their associated ASCII codes.
m
programmer.
4. The data type double is another floating point
type. Why is it treated as a distinct data type? 13. What is difference between endl and \n?
Ans. In double data type, more fractions can be Ans. endl – Inserts a new line and flushes the buffer (Flush
co
accommodated in double than in float data type. means – clean) ‘\n’ - Inserts only a new line.
5. What is the use of void data type?
14. What is the use of references?
Ans. Void data type is used as a return type for functions
Ans. References means addresses. Address are used to
that do not return any value.
s.
6. What is modifiers? What is the use of modifiers? locate the value in the memory.
Ans. (i) Modifiers can be used to modify (expand 15. What is the use of setprecision ( ) ?
or reduce) the memory allocation of any Ans. It is used to display numbers with fractions in specific
ok
fundamental data type. number of digits.
(ii) Modifier is a qualifiers used along with data Hands on Practice
type.
7. What is wrong with the following C++ statement:
o 1. Write C++ programs to interchange the values of
long float x; two variables.
Ans. Instead of long float x use double x; a. Using with third variable
ab
8. What is a variable ? Why a variable called b. Without using third variable
symbolic variable? Ans. a. Using with third variable
Ans. (i) Variables are user-defined names assigned to #include<iostream.h>
specific memory locations in which the values using namespace.std;
ur
cin>>a; {
cout<<"\n Enter Second number"; float tempC, tempF;
cin>>b; cout<<"\n Enter celcius";
a = a+b; cin>>tempC;
b = a-b; tempF =(tempC * 1.8F)+32;
a = a-b; cout<<"Equivalent temperature of
m
cout<<a<<'\t'<<b; <<tempC <<"in Fahrenheit is"<<
return 0; tempF<<endl;
} return 0;
co
2. Write C++ programs to do the following: }
a. To find the perimeter and area of a quadrant 3. Write a C++ to find the total and percentage of
b. To find the area of triangle marks you secured from 10th Standard Public
c. To convert the temperature from Celsius to Exam. Display all the marks one-by-one along
Fahrenheit with total and percentage. Apply formatting
s.
Ans. a. To find the perimeter and area of a quadrant
functions.
Ans. #include<iostream.h>
#include<iostream.h>
using namespace.std; #include<iomanip.h>
ok
int main () using namespace std;
{ int main ()
float area, peri, r; {
cout<<"\n Enter radius"; char name[30];
cin>>r;
o
area=0.25*3.14*r*r;//Area=1/4πr2
float E,L,M,S,SS,tot, per;
peri=0.5*3.14*r;//perimeter = 1/2πr cout<<"\n Name = ";
ab
cout <<"Area of a quadrant = "<< cin>> name;
area<endl; cout <<"\ Enter English, Language, Maths,
cout<<"Perimeter of a quadant = " << peri Science, Social Marks";
<<endl; cin >> E >> L >> M >> S >> SS;
return 0;
ur
tot = E+L+M+S+SS;
}
b. To find the area of triangle : per = tot/500*100;
#include<iostream.h> cout<<setw(20)<<"Name:"<<setw(10)<<
using namespace.std; name;
.s
M<<endl;
area = 0.5*b*h //Area=1/2bh
cout<<setw(20)<<"Science:"<<setw(10)<<S <<endl;
cout <<"Area of a triangle = "<<
area<endl; cout<<setw(20)<<"SocialScience:"<< setw(10)
w
m
options for the
(c) Operators (d) Constants
below Questions.
[Ans. (a) Keywords]
1. Which of the following is an object oriented 10. Which of the following is not a Keyword in c++?
co
programming?
(a) asm (b) const
(a) C++ (b) C
(c) constant (d) using
(c) Html (d) Windows XP
[Ans. (c) constant]
[Ans. (a) C++]
11. Which of the following statement is not true?
s.
2. Which of the following supports both procedural
(a) C++ is highly portable language [HF. 2018]
and oop concepts?
(b) The language of choice for Multi-device, Multi-
(a) C (b) Java
Platform app developed
ok
(c) C++ (d) Basic[Ans. (c) C++]
(c) C++ has not a function library
3. Which of the following is not a newer versions of (d) C++ is on Object Oriented Programming
languages influenced by c++? Language
(a) C# (b) D. [Ans. (c) C++ has not a function library]
(c) Java
o
(d) Html[Ans. (d) Html] 12. Which of the following is an invalid variable
4. Which of the following application not developed name?
ab
by c++? (a) This (b) num
(a) Android (b) IOS7 (c) Num (d) -sum [Ans. (a) This]
(c) Facebook (d) Amazon 13. How many ways the numeric constants are
[Ans. (b) IOS7] classified?
ur
5. Which of the following are possible in c++? (a) 2 (b) 3 (c) 4 (d) 6
(a) Polymorphism (b) Encapsulation [Ans. (a) 2]
(c) Inheritance (d) All of these 14. How many type of Integer constants are there?
.s
known as?
16. Which of the following is a valid octal constant?
(a) Tokens (b) lexical units
(c) lexical elements (d) a or b or c (a) 0127 (b) 0128 (c) 0911 (d) 0181
w
18. A constant starts with Ox or OX is called? 27. Which is not a logical operator?
(a) Octal constant (a) && (b) !! (c) ! (d) &
(b) Integer Constant [Ans. (d) &]
(c) Real Constant
28. Which is not an logical operator?
(d) Hexadecimal Constant
(a) ++ (b) -- (c) ! (d) &&
m
[Ans. (d) Hexadecimal Constant]
[Ans. (d) &&]
19. In How many forms the real constant can be
29. Which operator is not a logical bitwise operators?
written?
co
(a) & (b) ¦ (c) ^ (d) !
(a) 2 (b) 3 (c) 4 (d) 6
[Ans. (d) !]
[Ans. (a) 2]
30. Which operator denotes shift left bitwise?
20. How many parts are there in exponent form of
real constant? (a) >> (b) >>> (c) << (d) <<<
s.
(a) 1 (b) 2 (c) 3 (d) 4 [Ans. (c) <<]
[Ans. (b) 2] 31. Which operator denotes shift right bitwise?
(a) >> (b) << (c) & (d) !
ok
21. Which of the following is invalid character [Ans. (a) >>]
constants? 32. Which of the following is not a shorthand
(a) 'A' (b) '5' (c) "A" (d) '\a' assignment operator?
[Ans. (c) "A"]
o
22. Which of the following character automatically
(a) + = (b) * =
(c) ! = (d) % = [Ans. (c) ! =]
added at the end of string literal?
ab
33. Which of the following operator used as an
(a) \n (b) \o (c) \a (d) "
alternate if - else control statement?
[Ans. (b) \o]
(a) Unary (b) binary
23. Which operator is used to find the reminder of a (c) Ternary (d) Relational
ur
divisions?
[Ans. (c) Ternary]
(a) / (b) % (c) * (d) ^
[Ans. (b) %] 34. Which operator will return true if only one of the
operand is true?
.s
25. Which of the following are unary operators? (a) , (b) ; (c) : (d) : :
(a) ++, -- (b) &&, ¦ ¦ (c) &, ¦ ¦ (d) ^, && [Ans. (c) :]
[Ans. (a) ++,--]
w
m
(a) Inheritance (b) Encapsulation (a) compile time (b) comma
(c) Polymorphism (d) none of these (c) pointer (d) none of these
[Ans. (b) Encapsulation] [Ans. (a) compile time]
co
40. Which of the following feature avoid name 49. Which C++ is written in Delphi?
collection in C++?
(a) Eclipse (b) Net Beans
(a) Data hiding (b) Data abstraction
(c) Visual C++ (d) Dev C++
(c) Object oriented (d) namespace
[Ans. (d) Dev C++]
s.
[Ans. (d) namespace]
50. Which of the following data type created by the
41. Which of the following possible in C++?
programmer?
(a) Exceptin Handling (b) Over loading
ok
(a) User defined (b) Fundamental
(c) Data hiding (d) all of these (c) built-in (d) derived
[Ans. (d) all of these] [Ans. (a) User defined]
42. Which of the following is not a white space 51. Which of the following is not a datatype in C++?
character in C++? (a) Void (b) int
(a) Balckspace (b) ASCII
o (c) for (d) double [Ans. (c) for]
(c) formfeed (d) Carriage return
ab
52. What is the value stored in C if int c=15.06?
[Ans. (b) ASCII]
(a) 15 (b) 06
43. Which is an identifier example of capital style (c) 1506 (d) 15.06 [Ans. (a) 15]
notation?
53. Which of the following characters accepted by
(a) NUM_ADD (b) NUM_add
ur
char datatype?
(c) NUMADD (d) num_Add
(a) BCD (b) ASCII
[Ans. (d) num_Add]
(c) ISCII (d) EBCDIC
44. Which letter exist between Mantissa and Exponent [Ans. (b) ASCII]
.s
45. Which error is also called logic error? 55. How many hits occupied by long double datatype
w
in Dev C++?
(a) Syntax (b) Semantic
(a) 32 bits (b) 64 bits
(c) Runtime errors (d) all of these
(c) 80 bits (d) 120 bits
[Ans. (b) Semantic] [Ans. (c) 80 bits]
w
46. Which of the following operator bit-by-bit 56. Which of the following keyword restricts the
operation? accessibility of a variable?
(a) Bitwise operator (b) Relational operator (a) access (b) Specifier
(c) Logical operator (d) all of these (c) Modify (d) Const
[Ans. (a) Bitwise operator] [Ans. (d) Const]
57. What is an alternative name for a variable? 66. Which of the following is also called automatic
(a) Specifier (b) Modifier conversion?
(c) Reference (d) none of these (a) Explicit (b) Type promotion
[Ans. (c) Reference] (c) Type casting (d) Implicit
[Ans. (d) Implicit]
58. Which of the following Manipulator belongs to
m
iostream.h? 67. Which of the following is data types is C++?
(a) Setw (b) Setfill (a) long (b) unsigned
(c) Setf (d) endl [Ans. (d) endl] (c) signed (d) void [Ans. (d) void]
co
59. Which of the following Manipulator determines 68. Which of the following is not a derived datatype?
the minimum number of characters to be written (a) Array (b) void
in C++ output? (c) function (d) pointer[Ans. (b) void]
(a) Setf (b) Setfill
s.
(c) Setprecission (d) Setw II. Match List I with List II and Select
[Ans. (d) Setw] the Correct Answer using the Codes given
below.
60. Which of the following Manipulator is used for
ok
filling the empty fields?
(a) Setf (b) Setfill 1.
List I List II
(c) Setw (d) all of these (i) New line 1 Numeric
[Ans. (b) Setfill] (ii) #,{,< 2 Alphabets
o (iii) 59 3 Special characters
61. Which of the following is an invalid real constant?
ab
(iv) Number 4 White space
(a) –13.5 (b) 17/2
(c) 2.0 (d) 0.5E01[Ans. (b) 17/2] Codes:
62. How many operators formed from ASCII (i) (ii) (iii) (iv)
characters in C++? (a) 4 1 3 2
ur
digits is?
(a) 8 (b) 6 2.
List I List II
(c) 32 (d) 7 [Ans. (d) 7] (i) –027 1 fixed point constant
w
64. Which of the following can be stored in the (ii) –27 2 Hexadecimal
character variable? constant
(a) character (b) integer
w
m
(iv) "5000" 4 floating point constnat
Codes: (iv) \o 4 Octal number
(i) (ii) (iii) (iv) Codes:
co
(a) 3 4 1 2 (i) (ii) (iii) (iv)
(b) 1 3 2 4 (a) 3 2 1 4
(c) 4 3 1 2 (b) 2 3 4 1
(d) 4 1 2 3 (c) 2 1 4 3
[Ans. (a) (i)-3, (ii)-4, (iii)-1, (iv)-2] (d) 1 2 3 4
s.
4. [Ans. (d) (i)-1, (ii)-2, (iii)-3, (iv)-4]
List I List II
(i) → 1 Pointer
III. Choose the Correct Option Fill
ok
and in
(ii) :: 2 Conditional
the Blanks.
operator
(iii) &(Address of) 3 Classmember 1. In C++, the ++ denotes
operator (a) plus (b) plus plus
(iv) ?: 4
o
Component (c) addition (d) increment
selection [Ans. (d) increment]
ab
Codes: 2. C++ is standardized by the
(i) (ii) (iii) (iv) (a) OSI (b) ISO
(a) 3 4 1 2 (c) AT & T (d) ANSI[Ans. (b) ISO]
(b) 1 3 2 4
ur
7. Real constants are also called 17. '\n' escape sequence represents
(a) Fixed point constant (a) NULL (b) form feed
(b) Floating point constant (c) tab (d) new line
(c) Integer constant [Ans. (d) new line]
(d) Strong constant 18. An escape sequence character enclosed with in
m
[Ans. (b) Floating point constant] (a) " " (b) < > (c) { } (d) ' '
8. Signed Integers are considered as [Ans. (d) ' ']
co
(a) positive number (b) real number 19. String literals always enclosed with
(c) octal number (d) negative number (a) " " (b) ' '
[Ans. (d) negative number] (c) < > (d) none of these
[Ans. (a) " "]
s.
9. An escape sequence is represented by a
20. The length of the string "School" is
(a) / (b) " " (c) ' ' (d) \
[Ans. (d) \] (a) 6 (b) 7 (c) 8 (d) none
[Ans. (b) 7]
ok
10. A Hexadecimal Constant is always
(a) Negative Number (b) Real Number 21. In the expression x * y, where x and y denotes
(c) Positive Number (d) Integer (a) operators (b) punctuators
[Ans. (c) Positive Number]
o (c) operands (d) constants
11. In the given exponent form of real constant 0.78E6 [Ans. (c) operands]
Where E6 is a_____part
ab
(a) Real (b) Integer 22. Name the type of operator in which % operator
(c) Mantissa (d) Exponent belongs
[Ans. (d) Exponent] (a) Arithmetic (b) Relational
12. In the given exponent form of real constant 0.87E5 (c) Ternary (d) logical
ur
[Ans. (b) 1]
14. A character constant enclosed with in [Ans. (c) 14]
(a) " " (b) { } (c) < > (d) ' '
w
(a) 65 (b) 75 (c) 85 (d) 97 (c) Numerical value (d) Boolean value
[Ans. (a) 65]
[Ans. (d) Boolean value]
16. An escape sequence '\O' represents 26. The relation operator symbol represents "Equal
to" is
(a) Octal number (b) NULL
(a) a = = (b) = (c) ! = (d) = = =
(c) Vertical tab (d) alert bell
[Ans. (b) NULL] [Ans. (a) a = =]
m
(Binary XoR) [Ans. (b) Integrated Development Environment]
(a) & (b) ^ (c) ¦ (d) !
39. Name the software that converts source code to
[Ans. (b) ^]
object code
co
29. If a = 4, b = 5, the value a & b is (a) Application (b) IDE
(a) 910 (b) 510 (c) 010 (d) 410 (c) Linker (d) Compiler
[Ans. (d) 410] [Ans. (d) Compiler]
40. The c++ statement begin with____are treated as
s.
30. If a = 4, b = 5, the value a ^ b is comments.
(a) 010 (b) 110 (c) 910 (d) 110 (a) \\ (b) // (c) */ (d) ##
[Ans. (b) 110] [Ans. (b) //]
ok
31. The conditional operators are 41. The expansion of ASCII is
(a) American Standard code for Information
(a) ++, – – (b) ? : (c) ! = (d) = =
Interchange
[Ans. (b) ? :]
o (b) ANSI Standard code for Information Interchange
32. The logical grouping of an operators are called (c) American Standard code for Interchange
(a) Precedence (b) order Information
(c) association (d) execution (d) American Standard code for Intel Information.
ab
[Ans. (c) association] [Ans. (a) American Standard code for Information
Interchange]
33. Punctuators are also called as
42. Non-printable characters are called
(a) operators (b) seperators
(a) Character (b) String constant
ur
(a) { } (b) < > (c) ( ) (d) [ ] 43. The logical group of an operators are called
[Ans. (d) [ ]] (a) order of precedence (b) association
(c) specifiers (d) modifiers
35. The c++ statements are terminated by
w
36. The operator used to perform output operation is (a) conditional statement (b) control statement
(a) << (b) >> (c) compound statement (d) assignment statement
(c) extraction (d) getfrom[Ans. (a) <<] [Ans. (c) compound statement]
w
37. The symbol used to denote preprocessor directive 45. What is the output for the following
statement is Charch = 'A';
(a) # (b) // (c) @ (d) { Ch=ch+2;
[Ans. (a) #] Cout << ch;
a. A2 b.2A c. C d.A
[Ans. (c) C]
46. Predict the output for the following 55. In a programming language, fields are referred to
Char x = 98; as
Cout << x-1; (a) variables (b) operators
a. A b.97 c. 98 d.a (c) Punctuators (d) constants
[Ans. (d) a] [Ans. (a) variables]
m
47. The expansion of UTF is 56. In a programming language, the values are
(a) Uniform Transformation File referred to as
(b) Unicode Transformation Format (a) variables (b) data
co
(c) Unicode Transfer File (c) function (d) none of these
(d) Uniform Transfer Format [Ans. (b) data]
[Ans. (b) Unicode Transformation Format] 57. More than one variable declared in the statement
48. The memory address are in the form of____values should be separated using
s.
(a) Decimal (b) Octal (a) ; (b) .(dot)
(c) Hexadecimal (d) Binary (c) , (comma) (d) . #
[Ans. (c) Hexadecimal] [Ans. (c) , (comma)]
ok
49. Assigning a first value to a variable is caused
(a) Assignment (b) Initialization
IV. Which one of the Following is Not
(c) declaration (d) Expression Correctly Matched?
[Ans. (b) Initialization]
1. Which one of the following is not correctly
50. Write the output
o matched?
Const int x =120; (a) >> - Bitwise operator
ab
x = x+1; (b) % - Arithmetic operator
cout << x;
(c) && - Logical operator
a. 120 b.121 c.x d.error message
(d) = - Ralation operator
[Ans. (d) error message]
[Ans. (d) = - Ralation operator ]
ur
51. Predict the output :
2. Which one of the following is not correctly
int a =13; matched?
cout << Setw (5) << setfill (o) << a ;
(a) [] - Arrays
.s
a. 13 b.13000
c. 00013 d.13.000[Ans. (c) 00013] (b) () - Termination
(c) {} - Block of a code
52. A real literals are also called
w
(d) // - Comments
(a) integer literals (b) Character literal
[Ans. (b) ( )-Termination]
(c) string literal (d) none of these
[Ans. (d) none of these]
w
(c) pointers (d) statements 1. Which one of the following is correctly matched?
[Ans. (c) pointers] (a) char - 8 bits
54. Evaluate x = ++y+2y if y = 6
(b) int - 32 bits
(a) 18 (b) 19
(c) 23 (d) 21 [Ans. (d) 21]
(c) float - 8 bytes
(d) double - 2 bytes
[Ans. (a) char-8 bits]
VI. Consider the Following Statement. VII. Choose the Correct Statement.
1. Assertion (A) : C++ program statements are 1. Which of the following is a correct statement?
constructed by many different (i) C++ is a Hybrid language
small elements such as commands, (ii) C++ not an object driven language
variables and constants.
m
(iii) C++ supports exception handling
Reason (R) : These individual elements are (iv) Data hiding possible
collectively called as lexical units (a) only (i) (ii) (b) only (i), (iii)
or lexical elements or tokens. (c) only (i), (iii),(iv) (d) only (iii), (ii)
co
(a) Both (A) and (R) are true and (R) is the correct [Ans. (c) only (i), (iii),(iv)]
explanation of (A).
2. Which of the following statement is true?
(b) Both (A) and (R) are true and (R) is not the
(i) int datatype stores 56 as well as 56.78
correct explanation of (A).
s.
(ii) float datatype stores 56.78 as well as 56
(c) (A) is true, but (R) is false.
(iii) Char datatype store both character and integer
(d) (A) is false, but (R) is true.
(a) only (i) (b) only (i) and (iii)
[Ans. (a) Both (A) and (R) are true and (R) is the
ok
(c) only (ii) and (iii) (d) only (i), (ii) and (iii)
correct explanation of (A)]
[Ans. (d) only (i), (ii) and (iii)]
2. Assertion (A) : Keywords are the reserved words
3. (i) Arithmetic operators perform simple
which convey specific meaning to
arithmetic operations like addition,
the C++ compiler.
o
Reason (R) : Tokens are the user defined names
subtraction, multiplication division etc.
(ii) Relational operators are used to determine
given to different parts of the C++
the relationship between its operands.
ab
program viz
(iii) A logical operator is used to evaluate logical
(a) Both (A) and (R) are true and (R) is the correct
and relational expressions.
explanation of (A).
(a) (i) is correct
(b) Both (A) and (R) are true and (R) is not the
(b) (i) and (ii) are correct
ur
3. Assertion (A) : Literals are data items whose 4. (i) Punctuators are symbols, which are used
values do not change during the as delimiters, while constructing a C++
program.
w
execution of a program.
Reason (R) : The symbols which are used to (ii) C++ provides ccoperator to perform output
do some mathematical or logical operation.
(iii) Identifiers are the reversed words that convey
w
(b) Both (A) and (R) are true and (R) is not the (b) (i) and (ii) are correct
correct explanation of (A). (c) (i) and (iii) are correct
(c) (A) is true, but (R) is false. (d) (i), (ii) and (iii) are correct
(d) (A) is false, but (R) is true. [Ans. (b) (i) and (ii) are correct]
[Ans. (b) Both (A) and (R) are true and (R) is not
the correct explanation of (A)]
5. (i) A computer is a tool to solve a wide range of VIII. Point out the Wrong Statement in
problems. the following.
(ii) The solutions to the problems are in the
form of computer programs or application 1. Which of the following statement is false?
software. (i) float data type takes more time to execute
m
(iii) These programs are written using a chosen (ii) Double data type occupies more space
machine language. (iii) float data type executes faster than double data
(iv) A computer program operates on a set of type
known input data items. (iv) Double data type is also used to handle float data
co
(a) (iii) is correct type
(a) only (i) (b) only (ii)
(b) (i) and (iv) are correct
(c) only (iii) (d) only (iv)
(c) (i) and (iii) are correct
[Ans. (c) only (iii)]
(d) (i), (ii) and (iii) are correct
s.
(a) C++ was developed at AT & T Bell laboratories
[Ans. (a) (iii) is correct] in the early 1980s by Bjarne Stroustrup.
6. (i) Programming languages have another (b) C++ also comprises a character set from which
the tokens
ok
useuageas vernacular lang.
(ii) They help us in organizing our ideas about (c) The basic types are collectively called as
TOKENS.
the solution of the problem.
(d) A token is the smallest individual unit in a
(iii) The problems being solved or the applications
oroeram. [Ans. (a) C++ was developed
o
being developed became Complex, this aspect
of programming languages became very
at AT & T Bell laboratories in the early 1980s
by Bjarne Stroustrup.]
important.
ab
(iv) Many programming languages emerged 2. (a) Identifi ers are also called as variables.
to address this issue along with the ease of (b) Variables are memory boxes that hold values or
instructing the computer. constants.
(a) (i) is correct (c) A variable name must begin with an alphabet or
ur
identifi ers.
(iv) Identifi ers are also called as constant. Very Short Answers 2 MARKS
(a) (iv) is correct
w
m
11. What is meant by literals?
3. What is a size of 'x' and "x"?
Ans. Literals are data items whose values do not change
Ans. The size of 'x' is 1 character where as the size of "a"
during the execution of a program. Therefore Literals
is 2 characters.
co
are called as Constants.
4. Name any four applications developed by C++ 12. Write the classification of numeric constants?
Ans. (i) Photoshop
Ans. Numeric constants are further classified as:
(ii) Maya
(i) Integer Constants / Fixed point constants
(iii) Amazon
s.
(ii) Real constants / Floating point constants
(iv) Facebook.
13. Name the three types of integer constant
5. Given the following code segment. Ans. (i) Decimal
ok
Ans. int x = 30;
(ii) Octal
cout << ++ x ;
(iii) Hexadecimal
cout << x ;
14. Write a note on real / floating point constant.
a. What output does the above code segment produce?
Ans. A real or floating point constant is a numeric constant
Answer a .31
o
b.What is the output when ++x replaced x+1;
having a fractional component. These constants may
31 be written in fractional form or in exponent form.
ab
b. 31 15. Name the parts of Exponential form of real
30 constant
Ans. Exponent form of real constants consists of two
6. Write any two difference between c and C++. parts: (1) Mantissa and (2) Exponent
ur
data
17. Define character constant.
7. What is character set?
Ans. A character constant in C++ must contain one
Ans. Character set is the set of characters which are allowed
character and must be enclosed in a single quote
w
20. Given the following expression find the result if 29. Name the kinds of literals used in C++.
the value of a = 5, b = 6, c = 7: Ans. There are different kinds of literals used in C++
(i) (a > b) && (b < c) (Integer, Float, Character, String)
(ii) (a = = b) && (b > c)
30. What are punctuators?
(iii) ! (a > b)
Ans. Punctuators are symbols, which are used as delimiters
Ans. (i) 0 (false)
m
in constructing C++ programs. They are also called
(ii) 0 (false) as "Separators"
(iii) 1 (true)
31. What do you mean by precedence of operators?
co
21. Name the three kinds of bitwise operator. Ans. The hierarchical order in which the operators are used
Ans. (i) Logical bitwise operators for operation is known as precedence of operators.
(ii) Bitwise shift operators 32. Differentiate unary and binary operators.
(iii) One's compliment operators
s.
Ans. Unary operators Binary operators
22. Identify the type of operator for the following
(i) % (ii) & (iii) >> (iv) + = It performs operation It performs operation on
on single operand two operands
Ans. (i) Arithmetic operator
ok
(eg) ++, -- (eg) +, -, *
(ii) Bitwise And Operator
(iii) Bitwise Shift Right Operator 33. What are the values of m and n when the following
(iv) Shorthand assignment operator statements are executed?
int a = 53, b = 26
o
23. What is the use of comma operator in C++?
boolean m = (a>b) ? a:b;
Ans. Comma ( , ) is an operator in C++ used to string int (a<b) ? a: b;
ab
together several expressions. The group of expression
Ans. The statement m = (a >b) ? a: b is wrong. It should be
separated by comma is evaluated from left to right.
m = (a > b) ? true : false ; then
24. Name the operators which is specific to C++. m = true
Ans. : : Scope access / resolution n = 26
ur
(i) Dereference
34. What will be result stored in a after evaluating the
(ii) Dereference pointer to class member following expressions?
25. Write a note on comment statement. int a = 4;
.s
Ans. All statements that being with // are treated as a + = (a++) + (++a) + a;
comments. Comments are simply ignored by Ans. a = 20
compilers. i.e., compiler does not execute any 35. What is the difference between '/' and '%'
w
m
remainder of the division? 47. Write a note on ++ and -- operator?
Ans. (a) B/A (b) B%A Ans. ++ (Plus, Plus) Increment Operator. – –(Minus,
39. Write the output of the following code. Minus) Decrement operator. An increment or
co
int i = 20; decrement operator acts upon a single operand and
int n = i ++ % 5; returns a new value. Thus, these operators are unary
Ans. i = 11 operators. The increment operator adds 1 to its
n=0 operand and the decrement operator subtracts 1 from
s.
its operand.
40. What is the value of i of the following code
executes? 48. What is meant by non-graphical characters?
a) int i = 8; b) int i = 17 Ans. Non-printable characters are also called as non-
ok
int n = i >>=2; i >>=1; graphical characters. Non-printable characters are
Ans. a) 2 those characters that cannot be typed directly from a
b) 8. keyboard during the execution of a program in C++.
41. Write a note on Dev C++.
o 49. If a= 58, find a = a++ + ++a;
Ans. Dev C++ is an open source, cross platform (alpha a = a++ + ++a
version available for Linux), full featured Integrated Ans. a = 58 + 60 = 118
Development Environment (IDE) distributed GNU
ab
50. If m = 12, then find n = m++ * 5 + – – m;
General Public Licence for programming in C and
C++. It is writtern in Delphi. Ans. n = m++ * 5 + – –m
= 12 * 5 + 12
42. Define <iostream.h>.
= 60 + 12 = 72
Ans. iostream header file contains the definition of its
ur
member objects cin and cout. If not included iostream 51. If a = 4, b = 3; find the value of
in your program, an error message will occur on cin c=a++ *6 + ++b*5+10;
and cout; and we will not be able to get any input or Ans. c = a++ *6 + ++b*5+10
send any output.
.s
= 4 * 6 + 4×5 + 10
43. What is the purpose of using preprocess statement = 24+20+10 = 54
in C++?
52. If a= 12, b=8, find the value of
Ans. The C++ programs being with include statements
w
54. What do you mean by precedence of operators? 63. What are the types of casting show in by the
Ans. The hierarchical order in which the operators are used following examples?
for operation is known as precedence of operator. a. double x = 72.5;
in+y=(int)x;
55. Why do you want to declare an identifier as int
datatype? b. int x =24;
long y = 3;
m
Ans. Integer data type accepts and returns only integer
numbers. If an identifier is declared as an int, C++ Ans. a : Explicit type casting
compiler allows storing only integer values into it. b : Implicit type casting
co
56. Write the use of declaring in identifier as float? 64. State one difference between floating point literal
Ans. Float data type is used to produce more accurate and double type literal.
results. Floating point numbers can also be written in Ans. Floating point literal is a fractional number with
exponent notation. sort precision and can range the values from – 3.4
57. What is use of double data type? E+38 to 3.4E+38, where as double type literal is
s.
Ans. The double is also used for handling floating point used for dons precisions and can range the values for
numbers. But, this type occupies double the space –1.7E+308 to 1.7E+308
than float type. This means, more fractions can be 65. State the values of n and ch?
ok
accommodated in double than in float type. The
double is larger and slower than type of float. char c= 'B';
int n = c+1;
58. Name the Modifiers you can use with Integer data
char ch = (char)n;
type?
value of
Ans. short, unsigned short, signed short, int, unsigned int,
signed int, long, unsigned long
o Ans. (i) n = 67 (ii) ch = c
59. How will you declare more than one variable in a 66. What are fundamental datatypes? Write there
ab
single statement? write the syntax example. types.
Ans. Declaration of more than one variable: More than one Ans. Fundamental (atomic) data types are predefined data
variable of the same type can be declared as a single types available with C++. There are five fundamental
statement using a comma separating the individual data type in C++: char, int, float, double and void.
variables. Actually, these are the keywords for defining the data
ur
Ans. keyword modifiers / restricts the accessibility of a categories (1) Fundamental data types (2) User-
variable. So, it is known as Access modifier. defined data types and (3) Derived data types.
61. What is the error message display by Turbo 68. What is datatypes?
w
compiler while executing the following code Ans. A datatype is a classification of the type of data that a
const x = 200; variable can hold in computer programming
x = x=1;
w
m
72. What is the reason of declaring variables? Ans. Declaring a variable without any initial value,
Ans. The most important reasons for declaring a variable the memory space allotted to that variable will be
as a particular data type is to allocate appropriate occupied with some unknown value. These unknown
space in memory. As per the stored program concept, values are called as "Junk" or "Garbage" values.
co
every data should be accommodated in the main
80. What is Initialization? Give example.
memory before they are processed. So, C++ compiler
Ans. Assigning an initial value to a variable while that
allocates specific memory space for each and every
data handled according to the compiler's standards. variable is declared is called as "Initialization"
Examples:
s.
73. What is the use of modifier? int num = 100;
Ans. Modifiers are used to modify the storing capacity of float pi = 3.14;
a fundamental data type except void type. Modifiers double price = 231.45;
ok
can be used to modify (expand or reduce) the memory
allocation of any fundamental data type. They are 81. What is Dynamic Initialization? Give Example.
also called as Qualifiers. Ans. A variable can be initialized during the execution of
74. Name the four modifiers used in C++. a program. It is known as "Dynamic initialization"/
int sum = num1+num2
(1) signed
o
Ans. There are four modifiers used in C++. They are:
82. What is use of Manipulators?
Ans. Manipulators are usd to format the output of any C++
ab
(2) unsigned
(3) long program. Manipulators are functions specifically
(4) short designed to use with the insertion (<<) and extraction
operators.
75. What is the use of suffixes for integer and floating
83. Name the commonly used manipulators in C++
ur
point numbers?
Ans. The Commonly used manipulators are: endl, setw,
Ans. There are different suffixes for integer and floating
point numbers. Suffix can be used to assign the same setfill, setprecision and setf.
value as a different type. For example, to store 45 in 84. Write the members of iomanip.h.
.s
an int, long, unsigned int and unsigned long int, use Ans. setw, setfill, setprecision and setf manipulators are
suffix letter L or U (eigther case) with 45 i.e. 45L or members of iomanip header life.
45U. This type of declaration instructs the compiler
to store the given values as long and unsigned. 85. Write a note on endl
w
Ans. There are two values associated with a symbolic beginning of the next line.
variable; they are R-value and L-value.
86. Differentiate endl and '\n'.
R-value is data stored in a memory location
w
Ans. (i) endl - Inserts a new line and flushes the buffer
L-value is the memory address in which the
R-value is stored. (Flush means - clean).
(ii) '\n'- Inserts only a new line.
77. Define variable.
Ans. Variables are used-defined names assigned to specific
memory location in which the values are stored.
87. Write a note on setfill() manipulator. 95. Can we consider char as an integer datatype? If
Ans. setfill ( ) : This manipulator is usually used after yes, Why?
setw. If the presented value does not entirely fill the Ans. Yes, char can be treated as an integer datatype in the
given width, then the specified character in the setfill sense that at memory level it is stored as one byte
argument is used for filling the empty fields. which is same size as short integer data type. For
example: char ch='A' and char ch=65 statements are
m
88. Write a note on setprecision() manipulator. equal.
Ans. (i) setprecision ( ) : This is used to display numbers Short Answers 3 MARKS
with fractions in specific number of digits.
co
1. Write a note on history of C++
(ii) Syntax : setprecision (number of digits);
setprecision can also be used to set the number Ans. C++ was developed by Bjarne Stroustrup at AT &
of decimal places to be displayed. In order T Bell Laboratory during 1979. C++ is originally
to do this task, to set an ios flag within setf() derived from C language and influenced by many
s.
manipulator. This may be used in two forms: languages like Simula BCPL, Ada, ML, CLU and
(i) fixed and (ii) scientific. ALGOL 68. Till 1983, it was referred "New C" and
89. What is an expression? "C with Classes". In 1983, the name was changed as
ok
Ans. An expression is a combination of operators, C++ by Rick Mascitti.
constants and variables arranged as per the rules of
C++. It may also include function calls which return 2. Write the rules for naming an identifier.
values. o Ans. Rules for naming an identifer:
90. What is pointer variable? The first character of an identifier must been
Ans. A Pointer is a variable that holds a memory address. alphabet or an underscore (_)
ab
Only alphabets, digits and underscore are
Pointer declaration statements.
permitted. Other special characters are not
91. What is Type conversion? Name the types of allowed as part of a name.
conversion? Uppercase and lowercase letters are considered
into another is called as "Type Conversion". C++ Reserved words or keywords cannot be used as an
92. What is Type promotion? reason (i) num-add (ii) This (iii) 2myfile
Ans. If the datatype of the operands differ, the compiler Ans.
Identifiers Valid/ Reason for invalid
converts one of them to match with the other, using Invalid
w
the rule that the "smaller" type is converted to the num-add Invalid Contains special
"wider" type, which is called as "Type Promotion" character (-)
93. What is type casting? This Invalid This is one of the
w
keywords. Keywords
Ans. C++ allows explicit conversion of variables or
cannot be used as
expressions from one data type to another specific identifier names.
data type by the programmer. It is called as "type
w
m
<= Less than or equal to Com = (sales > 15000) ? sale A5/100 : 0;
== Equal to Ans. if (sales > 15000)
!= Not equal com = sales * 5/100;
co
5. Write a note on conditional operator. else
Ans. In C++, there is only one conditional operator that is com = 0;
used. ?: is a conditional Operator. This is a Ternary 11. What are the characters used in C++?
s.
Operator. This operator is used as an alternate to if...
Ans. Alphabets A .... Z, a ....z
else control statement
Numeric 0 .... 9
6. Write a note on input operator.
ok
Special Characters +-*/~!@#$%^
Ans. (i) Input operator C++ provides the operator>>to & [] () {} => < _ \ | ?
get input. It extracts the value through the .,:'";
keyboard and assigns it to the variable on its White space Blank space, Hori-
right;hence, it is called as "Streamextraction" or zontal tab, Carriage
"getfrom" operator.
o return, Newline, Form
(ii) It is a binary operator i.e., it requires two feed
ab
operands. The first operand is the pre-defined Other characters C++ can process any
identifier cin(pronounced as C-In) that of 256 ASCII charac-
identifieskeyboard as the input device. The ters as data
second operand must be a variable.
12. What is the use of assignment operators?
ur
7. Give the output, if the following statement is Ans. Assignment operator is used to assign a value
executed: to a variable which is on the left hand side of an
C = (val + 550 < 1700)? 200 : 400; assignment statement = (equal to) is commonly
used as the assignment operator in all computer
if a. val = 1000
.s
m
large projects. It is a new concept introduced by the cout << "\n The sum of" << num 1 << " and " <<
ANSI C++ standards committee. " is " << sum;
16. Distinguish between a unary, a binary and a return 0;
co
ternary operator? Give examples for each one at }
them?
Ans. A unary operator requires a single operands eg.++,-- 23. Write a C++ program to get the following output
format
A binary operator requires two operands eg.%,/,*
Enter a character : a
A ternary operator requires three operands eg.? :
s.
The Next character : c
17. What type of constant are the following: 15, 012, Ans. #include <iostream>
0x2B, 17, 014, "a"?
using namespace std;
ok
Ans. 15, 17 are Integer constant
int main()
012, 017 are octal constant
Ox2B hexadecimal constant {
"a" is string constant char ch;
cout << "\n Enter a character: ";
o
18. What kind of program elements are the following:
cin >> ch;
13, 'b', 4.38, "b", main ( )?
ch = ch = 2;
ab
Ans. 13 - Integer constant
cout << "\n The Next character: " << ch;
'b' - Character constant
return 0;
"b" - String constant
}
4.38 - floating point constant
main () - function 24. Write a C++ program to find the area of circle?
ur
21. Define the term (i) Source code (ii) object code. cout << "\n The Area of the circle is" << area;
Ans. (i) Source code - A program written High level return 0;
language }
(ii) Object code - Source code converted in to
w
m
Star wars, Spider Man, Lord of the Rings, Stuart
(iii) In case of explicit type conversion, the data gets Little etc.,
converted to another type as per user's choice.
(iv) Amazon.com - Large scale e-commerce
Eg: int a; float b; double c;
co
application
b = (float) (a*c);
(v) Amadeus : running the biggest non-military
26. Differentiate float type and double type datacenter in Europe (in excess of 5000
intiatigations? transactions per second, 2,00,000 terminals
Ans. (i) A float type variable is initialized with a connected, 24/7 operation) is doing most of its
s.
fractional value such as 0.0L where as a double current development in C++. All Unix - based
type variable is initialized with a fractional value server applications are completely C++. Some
as 0.0D. The difference between initialized is of them :
ok
the suffir L and D respectively
Car reservation
(ii) Eg : float a = 0.0f;
double x = 0.0D; Customer profile server
Electronic ticketing
27. What is an expression? o TCP /IP front end
Ans. An expression in C++ is any valid combination
(vi) Facebook - Several high performance and high
of operators, constants and variables ie., a legal
reliability components
combination of C++ tokens.
ab
2. Differentiate C and C++.
28. Name the type of error (syntax, runtime or logical
& error) in each case given below: Ans.
C C++
(i) Division by a variable that contains a value of 0
C is a subset of C++ C++ is a superset of C
ur
Ans. (i) Android - Famous Operating system for smart No Data hinding Encapsulation hides data
phones developed by Java and C++
(ii) Adobe Systems - All major applications are Function driven Object driven
w
m
reference variable variable decimal constant, the compiler will accept only the
Not support virtual and Supports virtual and integer portion of 4.56 ie. 4. It will simply ignore.56.
friend functions friend functions (ii) Octal :
co
No Exception Supports exception 1. Any sequence of one or more octal values
handling handing (0 ...7 ) that starts with 0 is considered as an
3. Write the benefits of C++. Octal constant.
Ans. (i) C++ is highly portable language and is often 2. It may or may not be signed.
s.
the language of choice for multi-device, multi- 3. Decimal points(Dot), Commas and blank spaces
platform app development. are not allowed as part of it.
(ii) C++ is an object-oriented programming Invalid Octal
ok
language and includes classes, inheritance, Valid Octal
constants
polymorphism, data abstraction and 012 05,600 (Comma is not allowed)
encapsulation.
-027 04.56(Decimal point is not
(iii) C++ has a rich function library
allowed)
(iv)
o
C++ allows exception handling, and function
overloading which are not possible in C.
+0231 0158 (8 is not a permissible digit
in octal system)
(v) C++ is a powerful, efficient and fast language.
ab
When you use a fractional number that beings with
It finds a wide range of applications from GUI
0, it will be considered as on integer number not as
applications to 3D graphics for games to real-
Octal.
time mathematical simulations.
(iii) Hexadecimal : Any sequence of one or more
4. Explain the types of integer constants.
ur
be signed or unsigned. Signed integers are are not allowed as part of it.
considered as negative. In C++, there are three
Valid Hexadecimal Invalid Hexadecimal
w
m
with the extension .cpp Operator Operation Description
(iii) Compilation : This is an important step The logical AND
combines two different
in constructing a program. In compilation, relational expressions into
co
compiler links the library files with the source && AND one. It returns 1 (True),
code and verifies each and every line of code. If if both expression are
true, otherwise it returns 0
any mistake or error is found, it will inform you (flase).
to make corrections. If there are no errors, it The logical OR combines
s.
translates the source code into machine readable two different relational
object file with an extension .obj expressions into one. It
(iv) execution : This is the final step of returns 1 (True), if either
││ OR
ok
construction of a C++ Program. In this stage, one of the expression is
true. It returns 0 (false),
the object file becomes an executable file with
if both the expression are
extension .exe. Once the program becomes an false.
executable file, the program has an independent NOT works on a single
o
existence. This means, you can run your expression / operand. It
application without the help of any compiler or simply negates or inverts
ab
IDE. the truth value. i.e., if an
! NOT
6. Explain increment and decrement operator with operand / expression is 1
an example. (true) then this operator
Ans. returns 0 (false) and vice
versa
ur
m
0 0 0 0 0 statement. These statements
Example: together are called as
If a = 65, b=15 "compound statement"
Equivalent binary values of 65 = 0100 0001; Opening and closing
co
parenthesis indicate
15 = 0000 1111 Parenthesis ( ) function calls and function
Operator Operation Result
parameters
a 0 1 0 0 0 0 0 1
b 0 0 0 0 1 1 1 1 Square It indicates single and
& a&b
a&b 0 0 0 0 0 0 0 1
brackets [ ] multidimensional arrays.
s.
(a&b) = 0000 00012= 110
It is used as a separator in
a 0 1 0 0 0 0 0 1 Comma ,
| a|b
b 0 0 0 0 1 1 1 1 an expression
a|b 0 1 0 0 1 1 1 1
Every executable statement
ok
(a|b) = 010011112= 7910
Semicolon ; in C++ should terminate
a
b
0
0
1
0
0
0
0
0
0
1
0
1
0
1
1
1
with a semicolon
^ a^b
a^b 0 1 0 0 1 1 1 0 It is used to label a
(a^b) = 0100 11102= 7810 Colon :
o statement
9. Explain Bitwise Shift operator with an example All statements that begin
with // are treated as
Ans. (i) The Bitwise shift operators: There are two Comments comments. Comments are
ab
bitwise shift operators in C++, Shift left ( << ) simply ignored by compilers.
and Shift right (>>). i.e., compiler does not
// execute any statement that
(ii) Shift left ( << )- : The value of the left operandis
begins with a //
moved to left by the number of bits specified by // Single line comment
/* */
the right operand. Right operand should be an
ur
/* .............*/ Multiline
unsigned integer. comment
(iii) Shift right ( >> )- : The value of the left operand 11. Write a C++ program to find C.S.A of a cylinder
is moved to right by the number of bits specified
(CSA = 2πrh)
.s
CSA = (2*pi*radius)*height;
10. Explain the punctuators used in C++. system("cls");
Ans. Punctuators are symbols, which are used as cout << "\n Radius: " << radius << " cm ";
delimiters, while constructing aC++ program. cout << "\n Height: " << height << " cm ";
They are also called as "Separators". The following cout << "\n Curved Surface Area of a Cylinder is
punctuators are used in C++; most of these symbols " << CSA << " sq.cm ";
are very similar to C and Java. }
m
int radius; endl";
float pi = 3.14; cout << "The simple interest=" << si << endl";
cout << "\n Enter Radius (in cm): "; cout << "The difference between C.I and SI="
co
cin >> radius; <<(float) d << endl";
float perimeter = (pi+2)*radius; }
float area = (pi*radius*radius)/2; 15. Write a C++ program that initializes three
cout <<"\n Perimeter of the semicircle is variable namely hours worked, Pay rate and
s.
"<<perimeter <<" cm"; tax rate and the calculates and prints payment
cout << "\n Area of the semicircle is " << area << amount and Tax payable as hours worked x pay
" sq.cm "; rate and payment amount x tax rate respectively.
} Ans. #include <iostream.h>
ok
void main ( )
13. Write a program to find the area, perimeter and
diagonal of a rectangle. {
int hw = 50;
Ans. #include <math.h>
double pr =40.0;
#include <iostream.h>
void main ( )
o double tr = 0.20;
cout << "Hours Worked" <<hw << endl";
{ cout << "Payment Amount" << (hw*pr) << endl";
ab
int l, b, ar, p; cout << "Tax payable" <<(hw*pr&tr) << endl";
double d; }
l = 20; b = 10;
16. Write a program that compute sum of three given
ar = l * b; numbers and find the largest of the three.
ur
cout << "The diagonal of rectangle" << d << endl"; int large , sum;
} cout << "Sum of" <<a << "and"<< b<< "and" <<C<<
14. Write a program to find the difference between "is"<< sum;
w
Simple Interest and Compound Interest when large = ((a>b)? ((a>c) ? a: c) : ((b>c) ? b: c));
Principal, Rate and Time are given, (Principal = cout << "Largest of " <<a<< ","<<b<< "&"<< C <<
500, Rate = 10, Time = 2) " is" <<large;
w
{
Ans. #include <iostream.h>
int p, t;
void main ( )
double r; si, amt, ci, d;
{
d = 0;
double temp (=100.0;
double tempf;
m
Ans. on Samsung S8 : Discount 15% cin>>p>>b;
on Samsung S9 : Discount 5% h=sqrt (p*p+b*b);
write a C++ program to calculate the discount, if a ar=1.0/2.0*p*b;
co
customer purchase S8 on S9 pm=(p*h*h);
#include <iostream.h> cout << "Hypotenur of the triangle=" <<h<< endl;
void main ( ) cout << "Area of the traingle=" <<ar<< endl;
{ cout << "Perimeter of the traingle=" <<pm<<
s.
int s8=60000, s9=69000; endl;
int r1=15, r2=5; }
double d1, d2, x=0, y=0; 21. Write a program in C++ to accept Employee
ok
d1 = (double) r1/100*s8; number and Basic pay. Find the gross pay of
d2 = (double) r2/100*s9; an employee for the following allowances and
x = s8–d1; deduction. Use meaningful variables:
y = s9–d2; Ans. Dearness Allowance = 25% of Basic pay
cout << "The price of samsung S8 afer discount=" House Rent Allowance = 15% of Basic pay
o <<x<< endl; Providen Fund = 8.33% of Basic pay
cout << "The price of samsung S9 afer discount=" Net pay = Basic Pay +Dearness Allowance +House
ab
<<y<< endl; Rent Allowance
} Gross pay = Netpay - provident fund
19. Write a program in C++ to accept the number #include <iostream.h>
of days and display the result after convering in void main ( )
{
ur
m=b/30; np=gp–pf;
d=b%30; cout << "Employee number" <<en<< endl;
cout << "The number of years=" <<y<< endl; cout << "Gross Pay = Rs:" <<gp<< endl;
cout << "Net Pay = Rs:" <<np<< endl;
w
m
void main ()
p=pow (a+b),3)/(a-b); {
cout << "The value of the expression=" <<p<< float f, c;
endl;
co
cout <<"\n Enter fahrenheit";
}
cin >> f;
23. Evaluate the following C++ expressions where c =(f–32)/1.8;
a,b,c are integers and d,e,f are floating point cout << "celsius = "<<c;
numbers, where a=5, b=3 and d=1.5 }
s.
(i) f = a+b/a
(ii) c = (a++) * d+a (b) #include<iostream.h>
(iii) c = d * a+b void main ()
ok
(iv) c = a – (b++) * (– –d) {
v) (++b) * b – a float r;
Ans. (i) f = 5 +3/5 cout <<"\n Enter radius";
= 5+0
cin >> r;
f = 5.0
o cout<<"volume of a sphere = " << ( 4/3 *
(ii) c = 5*1/5+6 = 7.5+6 = 13.6 3.14 * r*r*r);
ab
c = 13 }
(iii) c = 1/5*5+3
26. What will be the output of following programs?
= 7.5+3
(a) #include<iostream.h>
c =10
void main ()
(iv) c = 5-(3) *(0.5)
ur
{
= 5-(1-5) = 3.5
int i=10, j;
c =3
i > = 5 ? (j=10) : (j=15)
(v) f = 4*4 –5
.s
{
(i) Assign b to temp int a=5, b=6;
(ii) Assign b+1 to b a = = b ? (cout<<a) : (cout<<b)
(iii) Assign d/temp to c
w
}
(iv) Assign b+c to temp Ans. (a) 10
(v) Assign temp -1 to a 10
Ans. (i) temp = b; (b) 6
w
(ii) b = b+1;
(iii) c = d/temp;
(iv) temp = b + c;
(v) a = temp –1;
orders@surabooks.com PH: 9600175757 / 8124201000 / 8124301000
This is only for Sample Materials
for Full Book order online and available at all Leading Bookstores
10
m
Chapter Flow of Control
co
s.
ok
CHAPTER SNAPSHOT
10.1. Introduction 10.4.6. Switch statement
10.2. Statements 10.4.7. Switch vs if-else
10.2.1.
o
Null statement 10.4.8. Nested switch
ab
10.2.2. Compound (Block) 10.5. Iteration statements
statement 10.5.1. Parts of a loop
10.3. Control Statements 10.5.2. for loop
10.4. Selection statements 10.5.3. While loop
ur
[167]
Evaluation
Part - I 10. A loop that contains another loop inside its body:
(a) Nested loop (b) Inner loop
Choose the Correct Answer:
(c) Inline loop (d) Nesting of loop
m
1. What is the alternate name of null statement? [Ans. (a) Nested loop]
(a) No statement (b) Empty statement Part - II
(c) Void statement (d) Zero statement Answers to All the questions : (2 Marks)
co
[Ans. (b) Empty statement]
1. What is a null statement and compound
2. In C++, the group of statements should enclosed statement?
within:
Ans. (i) The "null or empty statment" is a statement
(a) { } (b) [ ]
s.
containing only a semicolon.
(c) ( ) (d) < > [Ans. (a) { }]
(ii) A group of statements enclosed by pair of
3. The set of statements that are executed again and braces {}. This group of statements is called as
ok
again in iteration is called as: a compound statement or a block.
(a) condition (b) loop 2. What is selection statement? write it's types?
(c) statement (d) body of loop Ans. The selection statement means the statement(s) are
[Ans. (b) loop] executed depends upon a condition. If a condition
is true, a true block (a set of statements) is executed
4. The multi way branch statement:
o otherwise a false block is executed. This statement is
(a) if (b) if...else also called decision statement or selection statement
ab
(c) switch (d) for [Ans. (c) switch] because it helps in making decision about which set
of statements are to be executed.
5. How many types of iteration statements?
types are
(a) 2 (b) 3
(i) if statement
(c) 4 (d) 5 [Ans. (b) 3] (ii) if-else statement
ur
6. How many times the following loop will execute? (iii) rested if
for (int i=0; i<10; i++) (iv) switch-case.
(a) 0 (b) 10 3. Correct the following code segment:
.s
statements: p=10;
(a) break (b) switch 4. What will be the output of the following code:
(c) goto (d) continue int year;
w
m
cout << i; }while (v<=10);
Ans. 2 4 6 8 10. 3. Write a C++ program to print multiplication
table of a given number.
6. Write a for loop that displays the number from
co
Ans. #include<iostream>
21 to 30.
using namespace std;
Ans. for (i=21; i<=30; i++)
int main()
cout << i;
{
7. Write a while loop that displays numbers 2, 4, 6,
int num;
s.
8........20
cout<<"Enter Number To Find Multiplication table ";
Ans. int i=2;
cin>>num;
while (i<=20)
for(int a=1;a<=10;a++)
ok
{
{
cout << i;
cout<<num<<" * "<<a<<" = "<<num*a<<endl;
if=2;
}
}
return 0;
8. Compare an if and a? : operator.
o }
4. Write the syntax and purpose of switch statement.
ab
Ans. if ?:
Ans. The switch statement is a multi-way branch statement.
Multiple statements are only one statement It provides an easy way to dispatch execution to
used used. It is an alternative different parts of code based on the value of the
Eg: if (p = = 10) statement for if_else. expression. The switch statement replaces multiple
p = 100; Eg: (p ==10)? p=100; if-else sequence.
ur
statement(s);
if(x >=10) break;
a = m + 5; .
else .
w
a = m; .
.
Ans. a = (x > =10) ? m+5 :m; default:
statement(s);
2. Rewrite the following code so that it is functional:
w
}
v = 5;
do; 5. Write a short program to print following series:
{ (a) 1 4 7 10.....40
total += v; Ans. #include <iostream.h>
cout << total; using namespace std;
while v <= 10 int main()
m
} }
Statement-x;
Part - IV The control flow and flow chart of the while loop is
shown below :
co
Answer to All the Questions: (5 Marks)
1. Explain control statement with suitable example.
Test
[HF. 2018] expression
false
s.
sequence of flow of instructions. If the statements are
True
executed sequentially, the flow is called as sequential
Body of while
flow. In some situations, if the statements alter the Loop
ok
flow of execution like branching, iteration, jumping
and function calls, this flow is called as control flow.
Sequence statement: Statement-X;
Statement 1
↓
Statement 2
o In while loop, the test expression is evaluated and if
↓
Statement 3 the test expression result is true, then the body of the
ab
loop is executed and again the control is transferred
The sequential statement are the statements, that to the while loop. When the test expression result is
are executed one after another only once from top false the control is transferred to statement-x.
to bottom. These statement do not alter the flow of Example :
execution. These statement are called as sequential
ur
#include<iostream>
flow statements. They are always end with a
semicolon (;). using namespace std;
If - else : In if-else statement, first the expression int main ()
or condition is evaluated either true of false. If the {
.s
result is true, then the statements inside true-block int i=1, sum=0;
is executed and false-block is skipped. If the result while(i<=10)
is false, then the statement inside the false-block is {
w
int main() }
{ cout <<"sum of series ="<<(s1-s2);
int n1,n2, a, b, gcd, lcm; return 0;
cout<<"Enter two numbers"<<endl; }
cin>>n1>>n2; (b) # program to find the same of the series
m
a=n1; #include<iostream.h>
b=n2; using namespace std;
while (n1 !=n2) int main ()
{
co
{ if (n1 > n2)
n1 = n1 - n2; int i, x, n, s=0;
else cout<<"Enter the value of x"<<endl;
n2 = n2 - n1; cin>>x;
cout<<"Enter number of terms"<<endl;
}
s.
cin>>n;
gcd = n1;
for (i=1; i<=n; i++)
cout << "GCD=" <<gcd;
s=s+(pow(x,i)/i);
lcm = (a * b) / gcd;
ok
cout<<"The sum="<<s;
cout <<"LCM =" << lcm;
} getch();
4. Write programs to find the sum of the following }
series: o 5. Write a program to find sum of the series:
22 33 44 55 66
xx xx xx xx xx S = 1 + x + x2 + .......+ xn
(a) x- ++ −− ++ −−
22! ! 33! ! 44! ! 55! ! 66! ! Ans. //program to find the sum of series
ab
xx2 2 xx3 3 xxn n #include<iostream.h>
(b) x + ++ ++..... +
..... + using namespace std;
22 33 nn
int main ()
Ans. (a) //To find the sum of the series {
#include<iostream>
ur
int x, n, i, s = 0;
using namespace std; cout<<"Enter the values of x"<<endl;
int main () cin>>x;
{ cout<<"Enter the number of terms"<<endl;
.s
}
the user the option of converting Fahrenheit to
for (i=2; i<=6; i+=2) Celsius or Celsius to Fahrenheit and depending
{ upon user's choice.
int f = 1;
Ans. #include<iostream>
for (j=1; j<=i; j++)
using namespace std;
f=f*j;
int main ( )
s2 = s2+(Math.pow(x, i y f);
m
//if the operator is other than +, -,
switch(a)
* or/, error message is shown
{
cout<<"Error! operator is not
double cel, feh;
co
correct"
case 1: cout<<"Enter The Temperature in break;
Celsiush\n"; cin>>cel; }
feh = (cel*9/5)+32; return 0;
cout<<"\nTemperature in Fahrenheit is = "<<feh; }
s.
break; Output:
case 2: cout<<"Enter The Temperature in Enter operator either + or - or * or divide;-
Fahrenheit\n|; cin>>feh Enter two operands:
3.4
ok
cel = (feh–32)*5/9;
cout<<"\nTemperature in Celsius is = "<<cel; 8.4
break; 3.4-8.4 = 5.0
case 3: exit (0); 3. Program to print whether a given character is an
default:cout<<"\nEnter The Right Choice\n"; uppercase or a lowercase character or a digit or
break;
o any other character. use ASCII codes for it. The
} ASCII codes are as given below:
ab
Characters ASCII Range
return 0;
} '0' - '9' 48 - 57
'A' - 'Z' 65 - 90
2. The program requires the user to enter two
'a' - 'z' 97 - 122
numbers and an operator. It then carries out
other characters 0- 255 excluding the
ur
case '+':
cout<<num1+num2; cout <<"Digt";
break; else
case '-': cout<<"Special Character";
count<<num1-num2; return 0;
break; }
case '*':
m
if(n%i== 0)
{ cout<<i<<"\t",
char ch; }
cout<<"Enter any character:"; return 0;
co
ch=getchar(); }
if (isalpha (ch))
cout<<"Alphabet"; 8. Program to print fibonacci series i.e., 0 1 1 2 3 5 8......
else if (isdigit(ch)) Ans. #include<iostream>
using namespace std;
s.
cout<<"Number";
int main ( )
else
{
cout<<"Special Character";
int n, i, a = θ, b = 1
return 0;
ok
cout<<"Enter number of terms"<<end1;
} cin>>n;
5. Program to calculate the factorial of an integer. cout<"Fibonacci series"<<end1;
Ans. #include<iostream> cout<<a<<"\t"<<b;
using namespace std; for(i=3;i<=n;; i ++)
int main ( )
o {
c=a+b;
{
ab
cout<<c<<"\t";
int n, i, f = 1;
a =b;
cout<<"Enter a number"<<end1; b=c;
cin>>n; }
for (i =1; i<=n; i++) return 0 ;
ur
f=f*i; }
cout<<"Factorial of a given number =" <<f<<end1;
9. Programs to produces the following design using
return 0; nested loops.
}
.s
A B C 5 4 3 # # #
using namespace std; A B C D
int main ( ) 5 4 #
A B C D E
{ A B C D E F 5
w
} {
7. Program to generate divisors of an interger. for(int i = 1; i < = 5; i++)
{
Ans. #include<iostream>
for(int j =5; j>=i; j--)
using namespace std;
{
int main ( ) cout<<j"\t";
{ }
m
using namespace std;
}
int main ( )
{ 10. Program to check whether the square root of a
int n = 65, rows; number is prime or not..
co
cout<<"Enter number of rows: "; Ans. #include<iostream>
cin>>rows; #include<math.h>
for (int i = 65; i<=(65+rows-1); i++) using namespace std;
{ int main ( )
for(int j = 65; j<=i; j++)
s.
{
{ int n, i, m,c ;
cout<<(char)j>>"\t"; cout<<"Enter a number"<<end1;
} cin>>n;
ok
return 0; m=sqrt(n);
} for (i=1;1<m; i++)
(c) #include<iostream> {
using namespace std; if(m%i== θ)
c++;
int main ( )
{
o }
int space, rows; if(c==2)
ab
cout<<"Enter number of rows:"; cout<<"The square root of a given number is
cin>> rows; prime"<<end1;
for (int i = rows, k =θ ; i > = 1; k = θ) else
{ cout<<"The square root of a given number is not
prime"<<end1;
ur
5. Which of the following used to enclose a group of 13. In C++, which of the following is treated as true?
statements? (a) non zero (b) negative numbers
(a) { } (b) ( ) (c) zero (d) both a and b
(c) [ ] (d) < > [Ans. (a) { }] [Ans. (d) both a and b]
6. Which statement used to change the flow of 14. Which of the following causes a one time jump to
m
control? a different part of the program?
(a) Control (b) Selective (i) decision (ii) selection (iii) iteration
(c) Compound (d) Alternative (a) only (i) (b) only (ii)
co
[Ans. (a) Control] (c) both (i) and (ii) (d) only (iii)
7. Which of the statement(s) called as control flow? [Ans. (c) both (i) and (ii)]
(a) branching (b) iteration 15. Which of the following statement executes the
(c) jumping (d) function calls block between two alternatives?
s.
(e) all of these [Ans. (e) all of these] (a) logical if (b) if-else
(c) nested if (d) for [Ans. (b) if-else]
8. Which of the following statements do not after the
flow of execution? 16. Which statement creates branches for multiple
ok
(a) iteration (b) jumping alternatives sections of code depending on single
variable value?
(c) sequential (d) function calls
(a) if (b) if-else
[Ans. (c) sequential]
(c) switch-case (d) do-while
9. Which of the statements executed one after
[Ans. (c) switch-case]
another only one?
o 17. Which of the following is a multi-path decision
(a) iteration (b) sequential
making statement?
ab
(c) jumping (d) functional calls
[Ans. (b) sequential] (a) nested if (b) if-else -if ladder
(c) if-else (d) nested else
10. Which of the following statement are executed [Ans. (b) if-else -if ladder]
depends upon a condition?
ur
(a) Empty (b) Selection 18. Which of the following statement executed if none
of the conditions is true in if-else-if ladder?
(c) Null (d) Compound
(a) if (b) both if and else
[Ans. (b) Selection] (c) else (d) condition
.s
11. Which of the following statement also called [Ans. (c) else]
looping statement? 19. Which of the following is an alternative for 'if else
(a) branching (b) decision statement'?
w
(c) repetition (d) iterative (a) Relational operator (b) Logical operator
[Ans. (d) iterative] (c) Unary operator (d) Conditional operator
[Ans. (d) Conditional operator]
12. Which of the following expression evaluates true
w
m
23. Which of the following statement is optional in converted automatically into
switch? (a) ASCII (b) BCD
(i) case (ii) break (iii) default (c) EBCDIC (d) ISCII
[Ans. (a) ASCII]
co
(a) only (i) (b) only (ii)
(c) both (i) and (iii) (d) both (ii) and (iii) 33. How many types of iteration statements are there
[Ans. (d) both (ii) and (iii)] in C++?
24. Which of the following statement is more flexible (a) 2 (b) 3
than switch statement?
s.
(c) 4 (d) 5 [Ans. (a) 2]
(a) for (b) if
34. What is the output of the following program
(c) while (d) break [Ans. (b) if] snippet if a=11?
ok
25. Which of the following is a selection statement? int a;
(a) for (b) while switch (a)
(c) do-while (d) none of these {
[Ans. (d) none of these] case 0;
cout <<"The number is zero"<<break;
o
26. Which of the following is a selection statement? default;
(i) if-else (ii) switch cout <<"The number is nonzero"<<break;
ab
int b = a% 2;
(iii) for
swith (b)
(a) only (i) (b) only (ii) {
(c) both (i) and (ii) (d) only (iii) case 0;
[Ans. (c) both (i) and (ii)] cout<<"The number is even"<<break;
case 1;
ur
expression for multiple choices? (c) both (ii) and (i) (d) both (ii) and (iv)
(a) if-else (b) switch [Ans. (d) both (ii) and (iv)]
(c) for (d) case[Ans. (b) switch]
w
(c) if-else (d) switch 36. Which of the following is not an iteration
[Ans. (c) if-else] statement in C++?
30. Which of the following statement checks only for (a) for (b) switch
equality? (c) while (d) none of these
(a) for (b) switch [Ans. (b) switch]
(c) if-else (d) default
[Ans. (b) switch]
m
38. How many different statements the for loop (i) for loop (ii) while looop (iii) do-while loop
contains? a. only (i) b.only (ii)
(a) 2 (b) 3 c. only (iii) d. both (i) and (iii)
co
(c) 4 (d) 6 [Ans. (b) 3] [Ans. (c) only (iii)]
39. For loop elements are terminated by
47. Which of the following statement are used to
(a) : (b) ; interrupt the normal flow of program?
(c) , (d) ? [Ans. (b) ;]
(a) selection (b) jump
s.
40. How many times the following loop executes? for (c) branching (d) loop[Ans. (b) jump]
(i=0; i>5; i++)
48. How many types of jump statements are there in
{=
C++?
ok
}
(a) 4 (b) 3
(a) 4 (b) 5
(c) 2 (d) 5 [Ans. (b) 3]
(c) 0 (d) infinite
[Ans. (d) infinite] 49. Which of the following is not a jump statement in
41. Which of the following increase the flexibility and C++?
applicability of for loop?
o (a) goto (b) break
(a) initilization (b) text expression (c) continue (d) if-else
ab
(c) updation (d) variations [Ans. (d) if-else]
[Ans. (d) variations]
50. Which of the following statement used to transfer
42. Which will be the output of the following? the control from one part to another part without
for (i=0, j=0; i == 0, j ==0; i++, --j) any condition?
ur
m
(d) 3 4 1 2 (d) block [Ans. (a) Conditional expression]
[Ans. (d) (i)-3, (ii)-4, (iii)-1, (iv)-2]
9. The expression provided in the switch should
result in a....................
III. Choose the Correct Option Fill
co
and in (a) operator (b) punctuator
the Blanks. (c) variable (d) constant
[Ans. (d) constant]
1. A group of statements enclosed by {} is called
(a) body statement (b) iterative statement 10. On which condition the execution of the loop
terminates
s.
(c) compound statement (d) continue statement
[Ans. (c) compound statement] (a) if (b) else
(c) stop (d) test
2. The null or empty statement is a statement
ok
[Ans. (d) test]
containing only a
(a) semicolon (;) (b) colon (:) 11. In a if statement , condition is enclosed with
(c) comma; (d) bracess {} (a) ( ) (b) { }
[Ans. (a) semicolon (;)] (c) [ ] (d) < > [Ans. (a) ( )]
12. In for loop, multiple elements are seperated by
3. A compound statement is also called
o (a) ; (b) ,
(a) iterative statement (b) block statement (c) : (d) :? [Ans. (a) ;]
ab
(c) alternative statement (d) infinite statement
[Ans. (b) block statement] 13. Which of the following expression is optional in
for loop
4. Programming languages provides statements to (i) initialization (ii) test expression (iii) update
support (a) both (i) and (ii) (b) both (ii) and (iii)
ur
6. Selection statement is also called 15. if no statement in the body loop is called
(a) empty (b) compound (a) empty loop (b) finite loop
(c) continue (d) decision (c) simple loop (d) selection loop
w
place to another place without any condition in a (c) middle (d) right
program. [HF. 2018] [Ans. (a) bottom]
(a) Break (b) go to
(c) continue (d) Switch 17. Conditional operator is also called ................
(a) Ternary operator (b) Relational operator
[Ans. (b) go to]
(c) Logical operator (d) Unary operator
[Ans. (a) Ternary operator]
IV. Which one of the Following is Not (a) only (i) (b) only (ii)
Correctly Matched? (c) both (i) and (iv) (d) only (iii)
[Ans. (d) only (iii)]
1. Which one of the following is not correctly 3. (i) The if else ladder is a multi-path decision
matched? making statement.
m
(a) Null statement - Semicolon (ii) The switch statement is a multi-way branch
(b) Compound - Pair of braces statement.
statement (iii) When a switch is a part of the statement
sequence of another switch, then it is called
co
(c) Iteration - Looping statement
as nested switch statement.
statement
(a) (i) is correct
(d) If statement - Body of the loop (b) (ii) is correct
[Ans. (d) If statement - Body of the loop] (c) (i) and (iii) are correct
s.
(d) (i), (ii) and (iii) are correct
V. Consider the Following Statement. [Ans. (d) (i), (ii) and (iii) are correct]
4. Which of the following statement exist in a true
ok
1. Assertion (A) : A computer program is a set
block of if-statement?
of statements or instructions to
(i) Single statement
perform a specific task.
(ii) Compound statement
Reason (R) : The action may be of variable
(iii) Empty statement
declarations, expression
o
evaluations, assignment operations,
(a) only (i) (b) only (ii)
(c) only (iii) (d) all of these
decision making looping and so on.
ab
[Ans. (d) all of these]
(a) Both (A) and (R) are true and (R) is the correct
explanation of (A). 5. Which of the following statement is true?
(b) Both (A) and (R) are true and (R) is not the (i) continue statement skips the iteration
correct explanation of (A). (ii) Break statement is used only in loops
ur
(c) (A) is true, but (R) is false. (iii) Break statement is not used to terminate the
(d) (A) is false, but (R) is true. execution of loop
[Ans. (a) Both (A) and (R) are true and (R) is the (iv) continue statement used in loops and switch
correct explanation of (A)] case.
.s
1. Which of the following statement is true? 6. Which of the following statement is true?
(i) Break statement in switch is not optional (i) ; is a null statement
(ii) Duplicate case values are allowed (ii) Empty statement are used as placeholders is loop
w
(c) both (i) and (ii) (d) both (iii) and (iv) [Ans. (c) both are true]
[Ans. (d) both (iii) and (iv)] 7. Which of the following statement is true?
2. Which of the following statement is not true? (a) expression 1? expression 2 : expression 3 ;
(i) If nested inside if part (b) expression 1: expression 2 ? expression 3 ;
(ii) If nested inside else part (c) expression 1; expression 2 : expression 3 ?
(iii) for nested inside if part (d) expression 1? expression 2 ; expression 3 ?
(iv) if nested inside both if part and else part [Ans. (a) expression 1? expression 2 : expression 3 ;]
m
(c) both (i) and (iii) (d) all of these while (i<=30)
[Ans. (d) all of these] {
Cout<<’\n’<<i;
co
VII. Point out the Wrong Statement in the i+3;
following. }
1. Which of the following statement is false? }
(i) switch statement is a multi-way branch statement 5. Write the general format of compound statement
s.
in C++.
(ii) if-else-if ladder is a multi-path decision making
Ans. The general format of compound statement is :
statement
{
ok
(iii) null statement consist only : statement 1;
(iv) In swith-case, the default statement is compulsory statement 2;
(a) Both (i) and (ii) (b) Only (iii) and (iv) statement 3;
(c) Both (i) and (iii) (d) Both (ii) and (iv)
o }
[Ans. (b) Both (iii) and (iv)]
6. How the statement are executed in a C++
2. Which of the following statement is false? program?
ab
(i) Conditional operator also called Ternary operator Ans. In a program, statements may be executed
(ii) Conditional operator is an alternative for if-else- sequentially, selectively or interatively.
if ladder 7. What is body of the loop?
(iii) Ternary operator takes four arguments Ans. The set of statements that are executed again and
ur
(iv) The symbols used in ternary operator is? : again is called the body of the loop.
(a) only (i) (b) only (ii) 8. Write the syntax of if statement.
(c) both (ii) and (iii) (d) both (ii) and (iv) Ans. if (expression)
[Ans. (c) both (ii) and (iii)] true-block;
.s
statement-x;
PART - II 9. What is if statement is executed?
Very Short Answers Ans. The if statement evaluates a condition, if the
w
2 MARKS
condition is true then a true-block (a statement or set
1. Define control flow. of statements) is executed, otherwise the true-block
Ans. The flow of control jumps from one part of the code is skipped.
w
Ans. The basics of control structures such as "Selection", condition is satified. These statements are also called
"Iteration" and "Jump" statement. as control flow statements.
3. Write the two kinds of statements used in C++ 11. What is the use of iteration statements?
Ans. There are two kinds of statements used in C++ Ans. Iteration statements is used to reduce the length of
(i) Null statement code, to reduce time, to execute program and takes
(ii) Compound statement. less memory space.
12. Write the three types of iteration? 19. Why do you prefer prefix operator over postfix
Ans. for statement while updating expression in a loop?
(i) while statement (ii) do-while statement Ans. The update expression contains increment/decrement
operator (++ or --). In this part, always prefer prefix
13. Name the elements used in loop
increment/decrement operator over postfix when to
Ans. (i) Initialization expression
be used alone. The reason behind this is that when
m
(ii) Test expression
used alone, prefix operators are executed faster than
(iii) Update expression
postfix.
(iv) The body of the loop
20. Write a program to find sum of first 10 natural
co
14. Write the general syntax of for loop
numbers.
Ans. The general syntax is:
Ans. #include<iostream>
for (initialization(s); test-expression; update
expression(s)) using namespace std;
{ int main ()
s.
statement 1; {
statement 2; int i, sum=0, n;
------------- cout<<"\n Enter The value of n";
}
ok
cin>>n;
Statement-x; i = 1;
15. Write a short note on iteration statement. for ( ; i<=10;i++)
Ans. The iteration statement is a set of statement are }
repetitively executed depends upon a conditions. If sum +=i;
o
a condition evaluates to true, the set of statements }
(true block) is executed again and again. As soon cout<<"\n The sum of 1 to"<<n<<"is<<sum;
ab
as the condition becomes false, the repetition stops. return 0;
This is also known as looping statement or iteration }
statement. Output
Enter the value of n 5
16. What are the three forms of nested if.
The sum of 1 to 5 is 15
ur
m
2. What do you know about switch statement?
}while (n>0);
Ans. There are some important things to know about
}
switch statement. They are
Output
co
(1) A switch statement can only work for quality of
10, 9, 8, 7, 6, 5, 4, 3, 2, 1
comparisons.
24. What is the use of Jump statement? (2) No two case labels in the same switch can have
Ans. Jump statement are used to interrupt the normal flow identical values
of program.
s.
(3) If character constants are used in the switch
25. Write the types of jump statements in C++ statement, they are automatically converted to
Ans. (i) goto statement (ii) break statement their equivalent ASCII codes..
ok
(iii) continue statement (4) The switch statement is more efficient choice
26. What is the significance of using break statement than if in a situation that supports the nature of
in C++? the switch operation.
Ans. A break statement is a jump statement which
o 3. Write a C++ program to find sum of any 5
terminates the execution of loop and the control is numbers.
transferred to resume normal execution after the Ans. #include<iostream>
body of the loop
ab
using namespace std;
27. What is the significance of using continue int main ()
statement in C++? {
Ans. The continue statement works quite similar to the int i=1,num,avg,sum=0;
break statement. Instead of terminating the loop while(i<=5)
ur
int main ()
{ Enter the number : 3
int i, sum=0; Enter the number : 4
for(i=1; i<=10; i++) Enter the number : 5
{ The sum is 15
sum=sum + i;
}
m
{
Syntax 1 Syntax 2 if(expression)
{
goto label; label; True_Part_Statements;
co
-------------------------- -------------------------- }
-------------------------- -------------------------- else
-------------------------- -------------------------- {
label; goto label; False_Part_Statements;
s.
}
5. Differentiate break and continue statement
}
Ans. Difference between Break and Continue
2. Draw the flowchart that shows the working
ok
Break Continue procedure of.
Break is used to Continue is not used to (i) if nested inside if part
terminate the execution terminate the execution (ii) if nested inside else part
of the loop. of loop. o (iii) if nested inside both if part and else part
It breaks the iteration It skips the iteration Ans. (i)
When this statements When this statement False Condition 1 True
ab
is executed, control is executed, it will not
will come out from the come out of the loop False
True
Condition 2
loop and executes the but moves/jumps to the
statement immediate next iteration of loop. Statement 3 Statement 2 Statement 1
after loop.
ur
PART - IV
.s
Nest Statement
Condition
Ans. The syntax of if nested inside both if part and else
part Statement Statement Statement
if(expression)
w
{
if(expression)
{ Statement
m
in C++. int num;
Ans. Rules : cout << "\n Enter week day number:";
(i) The expression provided in the switch should cin >> num;
switch (num)
co
result in a constant value otherwise it would not
be valid. {
(ii) Duplicate case values are not allowed. case1 : cout<<"\n Sunday";break;
(iii) The default statement is optional. case2 : cout<<"\n Monday";break;
(iv) The break statement is used inside the switch to case3 : cout<<"\n Tuesday";break;
s.
terminate a statement sequence. When a break case4 : cout<<"\n Wednesday";break;
statement is reached, the switch terminates, case5 : cout<<"\n Thursday";break;
and the flow of control jumps to the next line case6 : cout<<"\n Friday";break;
ok
following the switch statement. case7 : cout<<"\n Saturday";break;
(v) The break statement is optional, If omitted, default : cout<<"\n Wrong input.....";
execution will continue on into the next
}
case. The flow of control will fall through to
subsequent cases until a break is reached. }
(vi) Nesting of switch statements is also allowed.
o Output:
Enter week day number: 6
4. Explain switch-case with an example.
ab
Friday
Ans. The switch statement is a multi-way branch statement.
5. What are the difference between if-else and
It provides an easy way to dispatch execution to
switch.
different parts of code based on the value of the
expression. The switch statement replaces multiple Ans. (i) Expression inside if statement decide whether to
ur
(v) If expression inside if turn out to be false, cout<"The Number is: zero"<<endl;
statement inside else block will be executed. If break;
expression inside switch statement turn out to default:
be false then default statements are executed. cout<"The Number is a non-zero integer"<<endl;
(vi) It is difficult to edit if-else statements as it is int b = a % 2;
tedious to trace where the correction is required. switch (b)
m
On the other hand, it is easy to edit switch {
statements as they are easy to trace.
case 0:
6. Explain Nested switch with an example. cout<<"The Number is even"<<endl;
co
Ans. When a switch is a part of the statement sequence break;
of another switch, then it is called as nested switch case 1:
statement. The inner switch and the outer switch cout<"The number is odd"<<endl;
contant may or may not be the same. break;
s.
The syntax of the nested switch statement is: }
switch (expression) }
{ 7. Explain For loop with an example.
case constant 1:
ok
Ans. For loop : The for loop is the easiest looping
statement(s);
statement which allows code to be executed
break;
repeatedly. It contains three different statements
switch(expression) (initialization, condition or test-expression and
{ update expression(s) separated by semicolons.
case constant 1:
o The general syntax is
statement(s); for (initialization(s); test-expression; update
ab
break; expression(s))
case constant 2: {
statement(s); Statement 1;
break; Statement 2;
ur
. ................
. }
. Statement-x;
default :
.s
.
. evaluation of update expression part, the control is
default : transferred to the test-expression part.
Example :
w
statement(s);
} #include <iostream>
Example: using namespace std;
switch (a) int main ()
{ {
case 0: int i;
for(i = 0; i< 10; i ++ )
m
Ans. Every loop has four elements that are used for
value of i : 2
different purpose. These elements are
value of i : 3
(i) Initialization expression
value of i : 4
co
(ii) Test expression
value of i : 5
(iii) Update expression
value of i : 6
(iv) The body of the loop
value of i : 7
value of i : 8 (ii) Initialization expression(s): The control
variable(s) must be initialized before the control
s.
value of i : 9
enters into loop. The initialization of the control
8. Write the syntax of Nested loop using. variable takes place under the initialization
(i) for (ii) while (iii) do-while expressions. The initialization expression is
ok
Ans. (i) for : executed only once in the beginning of the loop.
for (initialization(s); test-expression; update (ii) Test Expression: The test expression is an
expression(s)) expression or condition whose value decides
{ o whether the loop-body will be execute or not.
for (initialization(s); test-expression; If the expression evaluates to true(i.e.,1), the
update expression(s) body of the loop executed, otherwise the loop
is terminated. In an entry-controlled loop, the
ab
{
test-expression is evaluated before the entering
statement(s);
into a loop whereas in an exit-controlled loop,
}
the test-expression is evaluated before exit from
statement(s); the loop.
}
ur
do
first then the test-expression is evaluated. If the
{
test-expression is true the body of the loop is
statement(s); repeated otherwise loop is terminated.
w
do
11
m
Chapter Functions
co
CHAPTER SNAPSHOT
s.
11.1. Introduction 11.6.3. Inline function
11.2. Need for Functions 11.7. Different forms of User-
ok
11.3. Types of Functions defined Function declarations
11.4. C++ Header Files and Built-in 11.7.1. A Function without return
Functions value and without parameter
11.4.1. Standard input/ 11.7.2. A function with return value
output(stdio.h)
o and without parameter
11.7.3. A Function without return
ab
11.4.2. Character functions(ctype.h)
11.4.3. String manipulation(string.h) value and with parameter
[187]
m
to attach themselves?
7. Which of the following statement is time according (a) Virus (b) Spyware
to cyber world? (c) Ransomware (d) Worms
(i) Do not use priated software [Ans. (d) Worms]
co
(ii) Do not use unauthorized user a accounts
16. Which of the following can lead to fraud or
(iii) Do not steal others password identity theft?
(a) only (i) (b) only (ii) (a) Phishing (b) Pharming
(c) only (iii) (d) All of these (c) Cookies (d) both a and b
s.
[Ans. (d) All of these] (e) MITM [Ans. (d) both a and b]
8. Which of the following is not the common ethical 17. Which of the following also used to remember
issues?
ok
arbitrary pieces of information that the user
(a) Cyber crime (b) Authorized access previously entered into form fields?
(c) Hacking (d) Piracy (a) Phishing (b) Pharming
[Ans. (b) Authorized access] (c) Cookie (d) Malware
9. Which of the following is an intellectual white- [Ans. (c) Cookie]
collar crime?
o 18. Which can not be used to spread viruses?
(a) Cyber crime (b) Crime over area (a) Programs (b) Trojan
ab
(c) Crime over time (d) Organized crime (c) Worms (d) Cookies
[Ans. (a) Cyber crime] [Ans. (d) Cookies]
10. Which of the following crime that tricking people 19. Which of the following acts as an intermediary
into believing something is not true? between the end user and a web server?
ur
11. Which of the following is not used to prevent 20. Which of the following keep the frequently
unauthorized access? visited site addresses in its cache which improves
(a) Firewalls (b) IDS response time?
w
(c) Malware (d) Virus Scanners (a) Web server (b) Web client
[Ans. (c) Malware] (c) Web browser (d) Proxy server
12. How many types of cyber attacks are there? [Ans. (d) Proxy server]
w
(a) 3 (b) 5 (c) 2 (d) 4 21. Which of the following used to protect data in
[Ans. (d) 4] communication system?
13. Which of the following is not a cyber attack?
w
23. Which type of encryption use the same key for 3. Distribute unwanted email to a large number of
both encryption and description? internet users
(a) Public Key (b) Private Key (a) Scam (b) inbox
(c) Asymmetric Key (d) Symmetric Key (c) BCC (d) Spam
[Ans. (d) Symmetric Key] [Ans. (d) Spam]
m
4. "unauthorized copying of software" is called
II. Match List I with List II and Select (a) virus (b) worms
the Correct Answer using the Codes given (c) Hacking (d) software piracy
below. [Ans. (d) software piracy]
co
5. Expansion of IDS is
1. Match the following.
(a) Identification Detection Systems
Function Crime (b) Intrusion Detection Software
(i) Harassing 1 Spam (c) Intrusion Digital Systems
s.
through online (d) Intrusion Detection Systems
(ii) Overloading a 2 Cyber stalking [Ans. (d) Intrusion Detection Systems]
system with fake 6. The act of gaining illegal access to a computer is
ok
requests called
(iii) Manipulating data 3 identity theft (a) Hacking (b) Cracking
transfer money to (c) Phising (d) Piracy
an unauthorized o [Ans. (a) Hacking]
account
(iv) Criminals 4 Fraud 7. Hacking can be protected by
impersonate (a) Malware (b) Virus
ab
individuals usually (c) Firewalls (d) Piracy
for financial gain [Ans. (c) Firewalls]
Codes: 8. Who breaks into someone else's computer system
(i) (ii) (iii) (iv) called
ur
(d) 3 4 1 2
9. Expansion of IRC
[Ans. (d) (i)-2, (ii)-1, (iii)-4, (iv)-3]
(a) Internet Relay Chat
(b) Internet Religions Chat
w
(a) Malware (b) Cyber Stalking 10. Phishing and pharming and examples of
(c) Fraud (d) Salami slicing (a) Social Engineering (b) Social Media
[Ans. (b) Cyber Stalking] (c) Malware (d) firewalls
w
2. The crime stealing tiny amounts of money from [Ans. (a) Social Engineering]
transaction is [HF. 2018] 11. "Phishing without a trop" called
(a) Salami Slicing (b) Spyware (a) Hacking (b) Cracking
(c) Malware (d) Spam
(c) Pharming (d) Warehouse
[Ans. (a) Salami Slicing]
[Ans. (c) Pharming]
m
(a) GUI (b) Cryptography PART - II
(c) Cipher-text (d) Compiler
Very Short Answers 2 MARKS
[Ans. (b) Cryptography]
co
14. Decrypted text is also called 1. What is meant by computer Ethics?
(a) Cryptography text Ans. Computer ethics deals with the procedures, values
(b) Plain text and practices that govern the process of consuming
computer technology and its related disciplines
s.
(c) Cipher - text
without damaging or violating the moral values and
(d) GUI text [Ans. (c) Cipher-text]
beliefs of any individual, organization or entity.
15. Public Key encryption is also called
2. Write few accepted standards in cyber world.
ok
(a) Symmetric key (b) asymmetric
(c) synchronous (d) all of these Ans. (i) Do not use pirated software.
[Ans. (b) asymmetric] (ii) Do not use unauthorized user accounts.
(iii) Do not steal others' passwords.
16. Expansion of EDI is (ii) Do not hack.
(a) Electronic Data Interlink
o
(b) Electronic Data Information 3. What is cyber crime?
ab
(c) Electronic Data Interchange Ans. Cybercrime is an intellectual, white-collar crime.
(d) Electronic Digital Information Those who commit such crimes generally manipulate
[Ans. (c) Electronic Data Interchange] the computer system in an intelligent manner.
4. What is Malware?
ur
IV. Point out the Wrong Statement in the Ans. Malicious programs that can perform a variety of
following. functions including stealing, encrypting or deleting
sensitive data, altering or hijacking core computing
1. Which of the following statement is false?
.s
computer usage. Ans. Stealing tiny amounts of money from each transaction.
(iv) Users should share any information with
6. What is spoofing?
unauthorized people.
w
Ans. (i) Denial of Service Attack either by using an automated program or can be
(ii) Scam manually realized.
(iii) Spam. 17. What is meant by social engineering?
8. What does software piracy includes? Ans. Social Engineering is a method of getting passwords
and information using human weakness. These
Ans. It includes stealing of codes/ programs and other
m
crackers trick people, not software. They can use just
information illegally and creating duplicate copies the phone for getting information, they can pretend
by unauthorized means and utilizing this data either being your friend and talk to you on Internet Relay
for one's own benefit or for commercial profit. Chat(IRC) or by Instant messenger.
co
9. Write the types of software piracy? 18. What is meant by cyber attacks?
Ans. (i) Duplicating and selling copyrighted programs Ans. Cyberattacks are launched primarily or causing
(ii) Downloading software illegally through significant damage to a computer system or for
network. stealing important information from an individual or
s.
10. What is meant by unauthorized access? from an organization.
Ans. Unauthorized access is when someone gains access 19. What is Cyber security?
to a website, program, server, service, or other system
ok
Ans. Cyber security is a collection of various technologies,
by breaking into a legitimate user account.
processes and measures that reduces the risk of cyber
11. How will you prvent unauthorized access of a attacks and protects organizations and individuals
system? from computer based threats.
Ans. To prevent unauthorized access, Firewalls, Intrusion
o
Detection Systems (IDS), Virus and Content 20. What is Malware?
Scanners, Patches and Hot fixes are used. Ans. Malware is a type of software designed through
ab
12. Which may be done in pursuit of criminal activity which the criminals gain illegal access to software
or hobby? and cause damage.
Ans. Hacking. 21. Name the types of cyber security threats.
13. What is hacking leads to? Ans. (i) Social Engineering
ur
Ans. Hacking leads to Identity theft or gaining personal (ii) Man In the Middle
information. Firewalls, passwords and user Id's, anti (iii) Cookies.
hacking software.
22. What is virus?
.s
m
organizations millions each year. 34. Write the disadvantage of the symmetric key
encryption.
26. What is proxy server?
Ans. The main disadvantage of the symmetric key
Ans. Aproxy server acts as an intermediary between the
co
encryption is that all authorized persons involved,
endusersand a web server.
have to exchange the key used to encrypt the data
27. How proxy servers improves response time? before they can decrypt it. If anybody intercepts the
Ans. Proxy servers keep the frequently visited site key information, they may read all message.
s.
addresses in its cache which leads to improved 35. Write a note on Asymmetric encryption.
response time. Ans. Public Key Encryption :
28. Which determines the functional output of (i) Public key encryption is also called Asymmetric
ok
cryptographic algorithm? encryption. It uses the concept of a key value
pair, a different key is used for the encryption
Ans. In cryptography a key is a piece of information
and decryption process. One of the keys is
(parameter) that determines the functional output of
typically known as the private key and the other
a cryptographic algorithm. is known as the public key.
o
29. Difference between encryption and decryption. (ii) The private key is kept secret by the owner
Ans. Encryption Decryption and the public key is either shared amongst
ab
authorized recipients or made available to the
Encryption is the Decryption is the public at large.
process of translating reverse process of
(iii) The data encrypted with the recipient's
the plain text data converting the cipher-
public key can only be decrypted with the
(plain text) into random text back to plaintext.
corresponding private key.
ur
31. Explain the working of proxy server. 37. What is IT Act 2000?
w
m
date. weakness, achieved by making them to click
malicious links, or by physically accessing the
40. What is authenticity? computer through tricks. Phishing and pharming
co
Ans. The quality of being real or true. are examples of social engineering.
41. Who is called perpetrator? (ii) Phishing : Phishing is a type of computer crime
Ans. A person who carriers out a harmful, illegal, or used to attack, steal user data, including login
immoral act. name, password and credit card numbers. It
s.
42. Define Hacking. occurs when an attacker targets a victim into
Ans. Hacking is gaining unauthorized access to computer opening an e-mailor an instant text message.
system without the owner's permission. The attacker uses phishing to distribute
ok
43. Define cracking. malicious links or attachments that can perform
Ans. Cracking is gaining unauthorized access to computer a variety of functions. including the extraction
systems to commit a crime, such as stealing the code of sensitive login credentials from victims.
to make a copy-protected program run thus denying (iii) Pharming : Pharming is a scamming practice in
service to legitimate users.
o which malicious code is installed on a personal
44. Differentiate freeware and shareware. computer or server, misdirecting users to
ab
Ans. Freeware Shareware fraudulent web sites without their knowledge or
Freeware is a software Shareware is a software permission. Pharming has been called "phishing
available free of that is distributed free without a trap': It is another way hackers attempt
charge. of charge on a trial to manipulate users on the Internet. It is a cyber-
ur
and controls incoming and outgoing network traffic often visitors come to the site and how long
based on predetermined security rules. they remain on the site.
47. Write a note on Janus attack. (iii) It helps to personalize the user's experience on
w
Ans. Man-in-the-middle attack (MITM; also Janus attack) the Web site.
is an attack where the attacker secretly relays and (iv) Cookies can help store personal information
possibly alters the communication between two about users so that when a user subsequently
parties who believe they are directly communicating returns to the site, a more personalized
with each other.
experience is provided.
m
encryption is a technique to use the same key returning a value that is unique to the hashed data.
The encrypted hash, along with other information
for both encryption and decryption. The main
such as the hashing algorithm, forms the digital
disadvantage of the symmetric key encryption
signature. Any change in the data, even to a single
co
is that all authorized persons involved, have to
bit, results in a different hash value.
exchange the key used to encrypt the data before
they can decrypt it. If anybody intercepts the key
information, they may read all message. Depicts
s.
the working of symmetric key encryption.
(iii) Public Key Encryption: Public key encryption
is also called Asymmetric encryption. It uses the
ok
concept of a key value pair, a different key is used
for the encryption and decryption process. One of
the keys is typically known as the private key and
the other is known as the public key. The private
o
key is kept secret by the owner and the public key (iv) This attribute enables others to validate the
is either shared amongst authorized recipients or integrity of the data by using the signer's public
ab
made available to the public at large. The data key to decrypt the hash. If the decrypted hash
encrypted with the recipient's public key can only matches a second computed hash of the same
be decrypted with the corresponding private key. data, it proves that the data hasn't changed since
public key encryption. it was signed.
ur
4. Explain the function of digital signature. (v) If the two hashes don't match, the data has either
Ans. Digital signature : [HF. 2018] been tampered with in some way (indicating a
(i) Digital signatures are based on asymmetric failure of integrity) or the signature was created
.s
cryptography and can provide assurances of with a private key that doesn't correspond to the
evidence to origin, identity and status of an public key presented by the signer (indicating a
electronic document, transaction or message, as failure of authentication).
w
w
w
Chapter
18 Tamil computing
m
co
CHAPTER SNAPSHOT
s.
18.1. Introduction
18.2. Tamil in Internet
ok
18.3. Search Engines in Tamil
18.4. e-Governance
18.5. e-Library
o
18.6. Tamil Typing and Interface Software
18.6.1. Familiar Tamil Keyboard Interface
ab
18.7. Tamil Office Automation Applications
18.8. Tamil Translation Applications
18.9. Tamil Programming Language
ur
[315]
Evaluation
Answer to the following questions :
1. List of the search engines supporting Tamil.
Ans. (i) G oogle
4. What is TSCII?
m
(ii) Bing
Ans. TSCII (Tamil Script Code for Information
(iii) yahoo.
Interchange) is the first coding system to handle our
What are the keyboard layouts used in Android?
co
2. Tamil language in an analysis of an encoding scheme
Ans. (i) Q uerty that is easily handled in electronic devices, including
(ii) Emoji non-English computers. This encoding scheme was
(iii) Sellinam registered in lANA (Internet Assigned Numbers
Authority) unit of ICANN.
s.
(iv) Ponmadal.
3. Write a short note about Tamil Programming 5. Write a short note on Tamil Virtual Academy.
Language. Ans. With the objectives of spreading Tamil to the entire
ok
Ans. Programming languages to develop software to world through internet, Tamil Virtual University was
computers and smart phones are available only established on 17th February 2001 by the Govt. of
in English. Now, efforts are taken to develop Tamilnadu. Now, this organisation functioning with
programming languages in Tamil. Basedon Python the name "Tamil Virtual Academy': This organisation
o
programming language,the first Tamil programming offers different courses regarding Tamil language,
language "Ezhil" (vÊš) is designed. With the help of Culture, heritage etc., from kindergarten to under
ab
this programming language, you can write simple graduation level.
programs in Tamil.
(a) Mobile (b) Computer local language digital content to be more reliable
(c) Internet (d) Laptop than english?
[Ans. (c) Internet] (a) 42% (b) 52%
w
(a) Operating System 16. Which of the following application have more
(b) Compiler than 30000 Tamilwords equivalent to enlglish
(c) Search engines words?
(d) Web clients [Ans. (c) Search engines] (a) Kamban (b) Thamizpori
(c) Vani (d) Ponmozhi
8. Which of the following provide searching facilities
[Ans. (b) Thamizpori]
m
in Tamil?
(a) Google (b) Bing 17. Which of the following language used to design
(c) Safari (d) both a and b ''Ezhil''? Tamil programming language?
[Ans. (d) both a and b] (a) C (b) C++
co
(c) Java (d) Python
9. Which of the following is not provide searching
[Ans. (d) Python]
facilities in Tamil?
(a) Yahoo (b) Safari 18. Which of the following coding systems specially
(c) Bing (d) Google designed for Indian languages?
s.
[Ans. (b) Safari] (a) ASCII (b) TSCII
(c) ISCII (d) EBCDIC
10. Which of the following search engine gives Tamil
[Ans. (c) ISCII]
virtual keyboard?
ok
(a) Bing (b) Yahoo 19. Which encoding scheme is suitable to handle
(c) Safari (d) Google Tamil?
[Ans. (d) Google] (a) ASCII (b) ISCII
11. Which country provides all their services through
o (c) Unicode (d) BCD
the official website in Tamil? [Ans. (c) Unicode]
(a) Srilanka (b) America
20. In India, 42% of users mostly used language in
ab
(c) Singapore (d) Malaysia
india?
[Ans. (a) Srilanka)]
(a) Tamil (b) Kannada
12. Which of the following are portal or website of
(c) Malayalam (d) Telugu
books collection?
[Ans. (a) Tamil]
ur
m
(c) 1991 (d) 1981 small English sentences into Tamil.
[Ans. (c) 1991]
7. Expand
6. The first Tamil programming language is (i) TSCII (ii) ISCII (iii) ASCII
co
(a) Ezhil (b) Kuzhal Ans. (i) T amil Script Code for Information Interchange
(c) Thamizpori (d) kamban (ii) Indian Script Code for Information Interchange
[Ans. (a) Ezhil] (iii) Ameircan Standard Code for Information
Interchange.
s.
PART - II
8. Write a short note on Madurai project.
Very Short Answers 2 MARKS Ans. Project Madurai is an open and voluntary initiative to
ok
collect and publish free electronic editions of ancient
1. What is e-governance?
tamil literary classics. This means either typing-in or
Ans. Getting Government services through internet is
scanning old books and archiving the text in one of the
known as e-Governance. Govt. of Tamilnadu has
most readily accessible formats for use on all popular
been giving its services through Internet. computer platforms.
2. What is the use of e-libraries?
o
9. Write a note on Unicode.
ab
Ans. E-Libraries are portal or website of collection of Ans. Unicode is an encoding system, designed to handle
e-books. Tamil e-Library services provide thousands various world languages, including Tamil. Its first
of Tamil Books as e-books mostly at free of cost. It is version 1.0.0 was introduced on October 1991. While
introduction of this scheme, can be able to handle
the most useful service to Tamil people who live far
nearly 23 languages including Tamil. Among the
ur
m
Section- I
7. Which icon is clicked to see disk drives mounted
Note : (i) All questions are compulsory. in the system
(ii) Choose the most suitable answer from the (a) Computer (b) My Computer
co
given four alternative and write the option
code and the corresponding answer. (c) Drive icon (d) Device driver
(15 × 1 = 15) 8. The default application in Ubuntu similar to
1. Which component is used in the Second generation MS-Excel in Windows is
(a) Spreadsheet (b) Libre Office suite
s.
computers?
(a) Vacuum tube (c) Open Office calc (d) Star office calc
(b) Transistor 9. If i:=7 before the assignment, i:=i*2. The value of
ok
(c) Integrated Circuits i after the assignment is
(d) Microprocessor (a) 2 (b) 7
2. Which one of the following coding system is (c) 14 (d) 49
integrated with Unicode? 10. What are the values of variables m and n after the
(a) BCD (b) ASCII
o assignments in line1 and line3
(c) EBCDIC (d) ISCII
ab
1. m,n:=120,150
3. Match the following
2. —m.n = ?, ?
(a) CD ROM 1. 4.7 GB
3. m,n:= m+3, n-1
(b) DVD 2. 50 GB
4. .—m.n = ?, ?
ur
(c) 4,1,2,3 (d) 1,2,3,4 11. Which refers to the software in which the source
4. Which one of the following is the file system of code is available for free
Linux? (a) Source (b) Source code
w
(a) NTFS (b) DAT (c) Open source (d) Anytime source
(c) Time sharing (d) EXT2 12. Expanding each sub-program into more detailed
w
(c) Android wear (d) All the given (c) Abstraction (d) Refinement
6. Which icon in Windows 10 is same as ‘My 13. A condition in a flowchart is represented by a shape
Computer’ in Windows XP? like
(a) PC (b) My PC (a) Diamond (b) Rectangle
(c) Computer (d) This PC (c) Circle (d) Oval
[319]
320 Sura’s XI Std - Computer Science - Govt. Model Question Paper 2018
14. Given u,v:=u+3,v+3, which of the following is 32. Given the following (S1,S2,S3,S4 &S5 are
invariant? statements)
(a) u-v (b) uv 1 - - Write the control flow
2 - - a,b
(c) u+v (d) u/v
3 S1
m
15. The algorithm design technique closely related to 4 case a=b
iteration but more powerful is 5 S2
(a) Iteration (b) loop invariant 6 case a>b
co
(c) Recursion (d) composition 7 S2
8 else
Section - II 9 S4
10 S5
s.
Answer any Six questions. Question No. 24 is Initially if a=200 and b=30, Write the statements
compulsory. (6 × 2= 12) through which the control flows.
33. King Vikramaditya has two magic swords. With
ok
16. Expand (a)BIOS (b)ENIAC (c)RAM (d)ALU
one, he can cut off 19 heads of a dragon, but after
17. Give ASCII codes for the characters A and Z? that the dragon grows 13 heads. With the other
18. Write note on AND gate. sword, he can cut off 7 heads, but 22 new heads
19. What is GUI?
20.
o
What are the two types of windows available in
grow. If all heads are cut off, the dragon dies. If the
dragon has originally 1000 heads, can it ever die?
ab
Windows XP? (Hint:The number of heads mod 3 is invariant.)
21. Distinguish between a condition and a statement. (or)
22. What is a Launcher in Ubuntu? Design a iterative algorithm to find sum of first n
23. Distinguish between an algorithm and a process. natural numbers. S=1 + 2 + 3 +..... +n
ur
25. Write the sequence of steps in boot process? Convert the following to binary, then convert
w
28. Write a note on Android Operating System. 35. Explain Bubbled AND , Bubbled OR gates.
29. Differentiate between switch user and log off. (or)
30. What is the difference between the statement
(a) What is a clock speed? How it is measured?
b:=a+5 and b=a+5
(b) What is a word size?
31. Write the specification and algorithm to find the
(c) What is MDR?
minimum of two given numbers.
Sura’s XI Std - Computer Science - Govt. Model Question Paper 2018 321
36. How will you copy files and folders to removable 5. (d) All the given
disk? 6. (d) This PC
(or) 7. (b) My Computer
Suppose you want to evaluate y for value of x 8. (b) Libre Office suite
5 x 9. (c) 14
m
using the expression y =
( −3)( −1) 10. (b) 123, 149
Write suitable algorithm specification
11. (c) Open source
co
37. Trace the step by step execution of the algorithm 12. (d) Refinement
for Factorial(3) 13. (a) Diamond
Factorial(n) 14. (a) u-v
- - - inputs: n is an integer, n≥0 15. (c) Recursion
s.
- - - outputs: F=n!
Section- II
F,i:=1,1
While i<n 16. a) BIOS - Basic Input Output System.
ok
F,i:=F*i, i+1 b) ENIAC - E lectronic Numerical Integrator
(or) And Calculater.
Write specification and algorithm using iterative c) RAM - Random Access Memory
statement to find ab.
o d) ALU - Arithmetic and Logic unit
38. Briefly discuss about loop invariant. 17. ASCII codes for the characters
ab
A = 65
(or)
Z = 90
18. The AND gate can have two or more input signals
{
Power can be defined recursively as
1 if n = 0 and produce an output signal. The output is "true"
ur
322 Sura’s XI Std - Computer Science - Govt. Model Question Paper 2018
23. The difference between algorithm and process is 26. (a) -22
that algorithm is a precise step by step plan for 2 22
a computational procedure that possibly begins
2 11 – 0
with an input value and yields an output value in a
finite number of steps while process is a particular 2 5 –1
m
method for performing a task. 2 2 –1
24. An invariant the loop body is known as a loop 1 –0
invariant.
co
Example : The specification and the loop invariant = 101102
are shown as comments. Binary equivalent of + 22 = 10110
power (a, n) 8 bit format = 00010110
-- inputs: n is a positive integer 1’s complement = 11101001
s.
-- outputs: p = an 2’s complement - 22 = +1
p, i := 1 , 0 11101010
while i ≠ n
ok
(b) -35
-- loop invariant: p = a1 2 35
p, i :=p × a, i+1 2 17 – 1
2 8–1
(or) o 2 4–0
Recursion is an algorithm design technique, closely 2–0
1–0
related to induction. It is similar to iteration, but
ab
more powerful. Using recursion, we can solve a Binary equivalent of + 22 = 100011
problem with a given input, by solving the intances 8 bit format = 00100011
of the problem with a part of the input. 1’s complement = 11010101
Example : Customers are waiting in a line at a 2’s complement - 35 = +1
ur
25. Booting process is of two types. PlayStation games and for playing High-Definition
(i) Cold Booting (ii) Warm Booting (HD) movies. A double-layer Blu-Ray disc can
(i) Cold Booting: When the system starts store up to 50GB (gigabytes) of data. This is more
w
from initial state i.e. it is switched on, than 5 times the capacity of a DVD, and above
we call it cold booting or Hard Booting. 70 times of a CD. The format was developed to
When the user presses the Power button, enable recording, rewriting and playback of high-
w
the instructions are read from the ROM to definition video, as well as storing large amount
initiate the booting process. of data. DVD uses a red laser to read and write
(ii) Warm Booting: When the system restarts data. But, Blu-ray uses a blue-violet laser to write.
w
Sura’s XI Std - Computer Science - Govt. Model Question Paper 2018 323
specialized user interface. Variants of Android are (or)
also used on game consoles, digital cameras, PCs Input : n = 3
and other electronic gadgets. Output : 10
29. Switch User: Switch to another user account on Sum of first natural numbe r: 1
the computer without closing your open programs Sum of first and second natural number : 1+2=3
m
and Windows processes. Sum of first, second and third natural number
Log off : Switch to another user account on the = 1+2+3 =6
computer after closing all you open programs and Sum of first three natural number = 1+2+3+6=10
co
windows processes.
Input : n = 2
30. The left side is a comma - separate list of variables. Output : 4.
The right side is a comma separated list of Section- IV
expressions. To execute an assignment statement,
34. Components of a Computer : The computer
s.
first evaluate all the expressions on the right side
using thecurrent values of the variables, and then is the combination of hardware and software.
store them in the corresponding variables on the Hardware is the physical component of a
computer like motherboard, memory devices,
ok
left side.
monitor, keyboard etc., while software is the set
31. minimum (a,b) of programs or instructions. Both hardware and
-- input : s : a, b software together make the computer system to
-- output : result = a↓ b o function.
Algorithm minimum can be defined as Central Processing Unit : CPU is the major
1. minimum (a,b) component which interprets and executes software
ab
2. -- a, b instructions. It also control the operation of all
other components such as memory, input and
3. if a <b
output units.
4. result : = a Arithmetic and Logic Unit :
5. else
(i) The ALU is a part of the CPU where various
ur
6. result = b
computing functions are performed on data.
7. -- result = a↓ b.
(ii) The ALU performs arithmetic operations
32. 1. Compare (200,30) such as addition, subtraction, multiplication,
.s
Second scoords are using u : = u - 7+22 = u + 15 primary memory and secondary memory.
But one of the round u is divisor by 3 then The primary memory is used to temporarily
remainder is equal. Any one of the numbers store the programs and data when the
divisible by 3 sun remainder is 0 or 1 or 2 u is the instructions are ready to execute. The
need for zero. secondary memory is used to store the data
permanently.
324 Sura’s XI Std - Computer Science - Govt. Model Question Paper 2018
m
is, the content is available even after the the AND gate gives the output as C = ( A . B).
power supply is switched off. Hard disk, A
C
CD-ROM and DVD ROM are examples of B
co
secondary memory.
This circuit can be redrawn as the bubbles on the
(or)
(a) 456 Binary Number inputs, where the bubbles represent inversion.
We refer this as bubbled AND gate. Let us analyses
Quotient Remainder
s.
this logic circuit for all input possibilities.
456/2 228 0
228/2 114 0 If A = 0 and B = 0 C=(0.0) = 1.1 = 1
114/2 57 0 If A = 0 and B = 1 C=(0.1) = 1.0 = 0
ok
57/2 28 1 If A = 1 and B = 0 C=(1.0) = 0.1 = 0
28/2 14 0 If A = 1 and B = 1 C=(1.1) = 0.0 = 0
14/2 7 0
Here the truth table is
7/2 3 1
3/2 1
o1
Input Output
A B C
1/2 0 1
ab
0 0 1
Binary Number = (111001000) 2
Hexadecimal Number = (1C8) 16 0 1 0
(b) 855 1 0 0
Quotient Remainder
ur
1 1 0
855/2 427 1
You can see that, a bubbled AND gate produces the
427/2 213 1
same output as a NOR gate. So, You can replace
213/2 106 1
.s
(A + B) = A . B
13/2 6 1
6/2 3 0 Which establishes the De Morgan’s first theorem.
3/2 1 1
w
Sura’s XI Std - Computer Science - Govt. Model Question Paper 2018 325
m
1 0 1
click on the file you want to copy, then select
1 1 0 Copy.
(iv) Return to the Removable Disk window, right-
co
(or)
click within the window, then select Paste.
(a) Clock Speed :
METHOD 2 : Drag and Drop
(i) Every microprocessor has an internal clock
that regulates the speed at which it executes (i) Plug the USB flash drive directly into an
s.
instructions. available USB port.
(ii) The speed at which the microprocessor (ii) Allow the computer to recognize the drive,
executes instructions is called clock speed. then click Start → Computer.
ok
Clock speed is measured in MHz or in GHz. (iii) Navigate to the folders in your computer
containing files you want to transfer.
(b) Word Size :
(iv) Click and drag the files you want to the
(i) The number of bits that can be processed by
Removable Disk.
turn determines the architecture of the (iii) Right-click on the file you want to transfer
microprocessor. to your removable disk.
(c) Word MDR : (iv) Click Send To and select the Removable Disk
.s
(i) Memory Data Register is the register of a associated with the USB flash drive.
computer’s control unit that contains the METHOD 4 : Copy and Paste using keyboard
data to be stored in the computer storage (Eg.
w
(ii) It is also called Memory Buffer Register. (i) Plug the USB flash drive directly into an
available USB port.
w
326 Sura’s XI Std - Computer Science - Govt. Model Question Paper 2018
m
5 5x x 5k 5k
y = = 4 16 8×2 4 3+1 24
( −3( −
)(3−)(1)−1) 3 3
5 32 16 × 2 5 4+1 25
Alorithm Specification : To solove a problem,
co
first we must state the problem clearly and When the loop ends P = ai still true, but i = 5.
precisely. A problem is specified by the given input Therefore P = a5. In general when the loop ends,
and the disired output. to desing an algorithm for P = ab. Thus, we have verified that power ab
solving a problem we should know the properties satisfies its specification.
s.
of the given input and the properites of the 38. (i) In iteration, the loop body is repeatedly
desired output. The goal of the algorithm is to executed as long as the loop condition is
estabilshed the relation beltween the input and the true. Each time the loop body is executed,
ok
desired output in simple words, specification of an the variables are updated.
algorithm is the desired input-ouput relation. (ii) However, there is also a property of the
37. factorial (3) variables which remains unchanged by the
i = 1, f = 1;
=f=1×1
o execution of the loop body.
(iii) T his unchanging property is called the
=f=1×2
ab
loop invariant. Loop invariant is the key
=f=2×3
= f = 6. to construct and to reason about iterative
(or) algorithms.
Algorithm power (a,b) computes ab by multiplying
ur
---output : P = ab else
P, i:1,0 if (n%2! = 0) -- recursion step in case of odd
a × power (a, n -1)
w
While i ≠ b
else
-- loop invariant : P = ai
a × power (a, n/2) --- recursion step in case
P,i = P × a, i + 1
of even.
w
m
Section- I Codes:
(i) (ii) (iii) (iv)
(i) All questions are compulsory. (a) 4 1 3 2
(ii) Choose the most suitable answer from the given (b) 1 3 2 4
co
four alternative and write the option code and
(c) 3 1 4 2
the corresponding answer. (15 × 1 = 15)
(d) 4 3 1 2
1. Identify the output device ……………
7. Suppose u, v = 10, 5 before the assignment. What
(a) Keyboard (b) Memory
s.
are the values of u and v after the sequence of
(c) Monitor (d) Mouse
assignments?
2. Which refers to the number of bits processed by
a computer’s CPU? 1 u := v
ok
(a) Byte (b) Nibble 2 v := u
(c) Word length (d) Bit (a) u, v = 5 ,5 (b) u, v = 5 ,10
3. Which is the fastest memory? o (c) u, v = 10 ,5 (d) u, v = 10 ,10
(a) Hard disk (b) Main memory
8. Which of the following is not an invariant of the
(c) Cache memory (d) Blue-Ray disc assignment? m, n := m2+, n3+
ab
4. Pick the Odd one Out.
(a) m mod 2 (b) n mod 3
(a) UNIX (b) Linux
(c) 3 X m - 2 X n (d) 2 X m - 3 X n
(c) Android (d) Flowchart
9. Which one of the following is not correctly
ur
functions
explanation of (A).
(iii) Composition 3 relation between the
I/O (b) Both (A) and (R) are true and (R) is not the
(iv) Decomposition 4 algorithm consists correct explanation of (A).
of control flow (c) (A) is true, but (R) is false.
statements. (d) (A) is false, but (R) is true.
[327]