Professional Documents
Culture Documents
Mid Term Revision Questions For I PU Computer Science (1) 20211115201048
Mid Term Revision Questions For I PU Computer Science (1) 20211115201048
Question 1
What is a computer?
Answer:
Computer is defined as an electronic machine used for storing, processing and
analysing data or information as per a set of instructions given to it by
humans.
Question 2.
What is computer hardware?
Answer:
The physical components of a computer are called the hardware.
Question 3.
Define program.
Answer:
A computer program is a sequence of logical actions or instructions.
Question 4.
Define software.
Answer:
A group of programs that are put into a computer to operate and control its
activities are called the “software”.
Question 5
Question 6
What are the registers?
Answer:
It is a temporary storage location of the CPU.
Question 7
Question 8
What is the contribution of Prof. John Napier in the field of computers?
Answer:
John Napier invented a calculating device which is a set of 9 marked rods
called “Napier
Question 9
Name the device invented by William Oughtrcd to do computations.
Answer:
The device invented by William Oughtred for computations is the “slide rule”.
Question 10.
Who is the inventor of Pascaline?
Answer:
A French philosopher Blaise Pascal invented “Pascaline” the first mechanical
calculator.
Question 11.
Who invented Jacquard loom?
Answer:
Joseph Mary Jacquard invented Jacquard loom.
Question 12.
Who is the father of the computer?
Answer:
Charles Babbage is known as the father of the computer.
Question 13.
Who invented the difference engine?
Answer:
Charles Babbage invented the difference engine.
Question 14.
Who is the first computer programmer?
Answer:
Lady Ada Lovelace was the first computer programmer.
Question 15.
Where was Herman Hollerith machine was used?
Answer:
Herman Hollerith machine was used in a faster way to process the US census
in a faster way in the year 1890.
Question 16.
What is the earlier name of IBM?
Answer:
Tabulating Machine Company.
Question 17.
Expand IBM.
Answer:
International Business Machine
Question 18.
Expand the term ENIAC.
Answer:
Electronic Numerical Integrator and Calculator.
Question 19.
Expand the term EDVAC.
Answer:
Electronic Discrete Variable Automatic Computer.
Question 20.
Who developed the stored program concept?
Answer:
John von Neumann developed the stored program concept.
Question 21.
Expand the term UNIVAC.
Answer:
UNIVersal Automatic Computer.
Question 22.
Expand the terms COBOL and FORTRAN.
Answer:
Common Business Oriented Language and Formula Translation.
Question 23.
What is a microprocessor?
Answer:
The CPU of a computer system in which thousands of integrated circuits are
built onto a single silicon chip is called a microprocessor.
Question 24.
Expand the term PDA.
Answer:
Personal Digital Assistants.
2 Mark
Question 1.
Mention the main characteristics of a computer.
Answer:
The main characteristics of a computer are speed, storage capacity, accuracy,
and diligence.
Question 2.
Question 3.
Write the names of any two First generation computers.
Answer:
ENIAC, EDSAC
Question 4.
What is the main difference between microcomputer and minicomputer?
Answer:
The main difference is microcomputers are single-user computers and mini-
computers are multi-user computers.
Question 5.
How mainframe computers are different from supercomputers?
Answer:
Mainframe computers are used in business process applications and
supercomputers are used in scientific applications and calculations.
Question 6.
Give the application of hybrid computers.
Answer:
Hybrid computers are used in Process control (industries) and Robotics.
Question 7.
How computers are useful in education? Mention any two uses.
Answer:
Using Computer Aided Learning (CAL) & Computer Based Training
Students can readily learn and get new skills at their own convenient
speed.
Students can get timely and high-quality training on demand.
Students can solve different kinds of problems quickly and efficiently, by
using computers.
Question 8.
Give the application of computers in industries.
Answer:
Question 9.
What are the advantages of computers in business?
Answer:
Question 10.
Explain the uses of computers in the entertainment and multimedia field.
Answer:
Question 11.
What are the uses of computers in the field of science and technology?
Answer:
A flight simulation can be used to train pilots and how to deal with
critical situations.
Computer-based weather forecasting collects accurate data from many
devices all around the world to predict more reliable weather forecasts.
Five Marks
Question 1.
Briefly explain the characteristics of a computer.
Answer:
1. Speed:
Computers are fast in doing calculations. The speed of the computer is
measured in terms of No. of million instructions per second (MIPS).
2. Storage Capacity:
Computers come with a very large amount of memory space. They can hold a
lot of data. Computers can extract a particular piece of information from a
large amount of available data within a very short time.
3. Diligence:
After doing work for some time, humans become tired but computers do not
become tired. They work continuously. In fact, Computers which control
telephone exchanges, are never shut down. This is called diligence.
4. Accuracy:
The results that the computers produce are accurately provided that the input
data and programs are reliable.
Question 2
1. Input Unit:
It is a device through which we enter the program and data into the computer.
The data is then stored and processed with the help of programs.
3. Control Unit:
This unit is considered to be the nervous system of the computer. It controls
all the arithmetic operations to be performed. It also coordinates the functions
of all the hardware units of the computer.
5. Memory Unit:
The function of this unit is to store the data and the set of instructions given
by the programmer. The computation results are also stored in the memory
and they may be used for subsequent computations or sent to the output unit.
6. Output Devices:
Output devices receive information from the CPU and present it to the user in
the desired form. Some common output devices are a visual display unit
(VDU), Printer, etc.
(NOTE: If one 5 marks question for all generation then time, component
used, 2 advantages and 2 disadvantages of each generation if enough)
Question 4.
Write a short note on the first generation of computers.
Answer:
1. The first computers used vacuum tubes for electronic circuitry and
magnetic drums for memory.
2. They were very expensive to operate and the power consumption was
high, generated a lot of heat, which was often the cause of
malfunctions.
3. First-generation computers were communicated through machine
language to perform operations, and they could only solve one problem
at a time.
4. Input was based on punched cards and paper tape, and output was
displayed on printouts.
5. UNIVAC and ENIAC computers are examples of first-generation
computing devices.
Advantages:
Disadvantages:
Question 5.
Advantages:
Smaller in size
Better speed
Low power consumption
No heat was generated.
Better storage capacity
More reliability
Compact Design
Faster than I Generation Computers.
Disadvantages:
Advantages:
Disadvantages:
Question 7.
Advantages
Question 9.
Explain the use of computers in the field of business.
Answer.
All business firms do certain business tasks on a daily basis like generating
customer bills, studying sales of various products at different locations, etc.,
using computers. There are many departments like sales, purchase, finance,
etc., is big business firms. These departments are involved in different business
tasks which are large in volume and huge storage space is required and
computers are used in such places.
1. Marketing:
Marketing applications provide information about the products, their
distribution, advertising and selling activities.
2. Stock Exchanges:
The stock market uses a computerized system that makes it possible for
stockbrokers and customers to do all their trading electronically. Brokers
connect to stock exchanges using the internet and do the buying and selling
of shares online. Money transfer is done electronically.
3. Banks:
Computerized banking saves time for the customer. Cheques are read by
MICR (Magnetic Ink Character Reader, a device used to allow the data on
cheques to be read by machines). Banks use computers to maintain their
customer‟s accounts and their transaction details. Customers can also use
internet banking to transfer money. Money can be withdrawn from any ATM‟s
any time.
4. Departmental Stores:
At departmental stores, cashiers enter sales data by waving a bar code
scanner. Bar codes are read by bar code readers that translate the bar code
symbols into digital forms. The price of a particular item is set with the store‟s
computer and appears on the computer and billing is done automatically. The
report of purchases, sales and stock are generated using computers. Security
cameras are used and continuous recording using DVR is widely used in
departmental stores and other locations to monitor home or business
operations to ensures security and safety.
5. E-Commerce:
E-commerce (electronic commerce) is the buying, selling, and exchanging of
products, services, and information via computer network/internet. It
promotes online buying and selling of goods and services. A buyer can buy
products using a computer connected to the internet sitting anywhere in the
world at any time of the day.
Question 10.
Write a note on the classification of computers in detail.
Or
Answer:
Based on operating principles, computers can be classified into 3 types. They
are,
1. Digital Computers
2. Analog computers
3. Hybrid computers
1. Digital computers:
They operate essentially by counting. All quantities are expressed as discrete
digits or numbers. Digital computers are useful for evaluating arithmetic
expressions and the manipulation of data. The majority of the computers used
in the world today are digital.
2. Analog Computers:
They operate by measuring rather than counting. The computer functions by
establishing similarities between two quantities that are usually expressed as
voltages or currents. Analog computers are powerful tools to solve differential
equations.
3. Hybrid Computers:
Computers which combine features of both analog and digital type are called
hybrid computers.
Computers are also classified in terms of speed, accuracy, word length and
storage capacity. Computers are also available in different sizes and with
different capabilities. Broadly, they may be categorised as microcomputers,
mini, mainframe, and supercomputers.
1. Micro Computers:
Computers using Microprocessors are called Microcomputers. This is the
smallest general-purpose processing system usually designed for use by a
single person at a time.
2. Mini Computers:
These are medium-sized computers that are costlier and powerful than a
microcomputer. An important distinction between a micro and a
minicomputer is that a mini-computer is usually designed to serve multiple
users simultaneously. This type of computers need less power and less cooling
arrangements. Up to 8 users can use the system simultaneously, running their
own individual programs.
3. Super Computers:
The supercomputer is the largest, fastest and most expensive mainframe
computer. It is normally used by large business organisations that require an
extraordinary amount of computing power. Their computing speed is 10 times
faster than any other type of computer. These computers are capable of
executing more than 10,000 million instructions per second and have storage
capacities of millions of bits per chip.
Normally, the supercomputer is used for solving or handling large scale
numerical problems in scientific and engineering fields. These include
applications in electronics, petroleum engineering, weather forecasting,
structural analysis, chemistry, medicine, and physics.
Input Output and Memory Devices
1 mark
Question 1.
What are input devices?
Answer:
The devices which are used to input data and programs in the computer, are
known as “Input Devices”.
Question 2.
List any two commonly used input devices.
Answer:
Keyboard and Mouse
Question 3.
What is the name of the standard keyboard?
Answer:
QWERTY is the name of the standard keyboard.
Question 4.
How many keys are there in a standard keyboard?
Answer:
There are 101 keys in a standard keyboard.
Question 5.
What are ergonomic keyboards?
Answer:
It is a special type of keyboard that allows typing without much strain and
bending at the wrists. It reduces the muscle and finger pain while typin
Question 6
Question 7.
Expand the term OCR.
Answer:
Optical Character Reader/Recognition.
Question 8.
Expand the term MICR.
Answer:
Magnetic Ink Character Reader/Recognition.
Question 9.
Expand the term BCR.
Answer:
Bar Code Reader/Recognition.
Question 10
What is a scanner?
Answer:
Scanner is an input device that converts the document image into digital form
so that it can be fed into the computer.
Question 11.
Define track and sector.
Answer:
Tracks are concentric circles, and sectors are pie-shaped blocks on a track.
Question 12.
What is a plotter device?
Answer:
Plotters are printers that are used to print graphical output on paper. They use
a single color or multicolor pens to draw pictures such as blueprints, graphs,
drawings, charts, maps, etc.
2 Marks
Question 13.
What are output devices? Name any two commonly used output devices.
Answer:
The devices that bring information OUT of a computer system are called
output devices.
Question 14.
What do you mean by soft copy and hard copy?
Answer:
A soft copy is an electronic copy of data viewed on a computer‟s display
screen or transmitted as an e-mail attachment.
Question 15.
Mention any two impact printers.
Answer:
Daisy wheel printer and dot matrix printer.
Question 16.
List any two non-impact printers.
Answer:
Ink-jet printer and Laser printer.
Question 17.
Give the different types of computer monitors.
Answer:
The different types of computer monitors are CRT(Cathode Ray Tube.)
monitors, LCD (Liquid Crystal Display/Diode.)monitors, TFT (Thin Film
Transistor.) monitors and LED (Light Emitting Diode) monitors.
Question 18.
Expand PROM.
Answer:
Programmable Read-Only Memory
Expand EPROM.
Answer:
Erasable Programmable Read-Only Memory.
Expand EEPROM.
Answer:
Electrically Erasable Programmable Read-Only Memory.
Question 19.
What is cache memory?
Answer:
It is a small, fast memory location that exists between the main memory and
the CPU.
Question 20.
How is data stored in the hard disk? Define track and sector
Answer:
Data is stored on the surface of a platter in sectors and tracks.
Tracks are concentric circles, and sectors are pie-shaped blocks on a track.
3 Mark
Question 21.
Write a note on a computer keyboard.
Answer:
The keyboard is a standard input device. It is used to input data and programs
to the computer. It has alphabets, numeric and symbol keys. It has special keys
including function keys, control keys, and arrow keys. Today most users use
the QWERTY style keyboards. Keyboards are connected to the computer
through cables or wireless. The ergonomic keyboard, virtual keyboard, and
compact keyboard are a few other special types of keyboards.
Question 22.
Write a note on a mouse.
Answer:
The mouse is an input device used to point to a particular place on the screen
and select it in order to perform one or more actions. It can be used to select
menu commands, size windows, start programs, etc. The most common kind
of mouse has left and right buttons on top. The left mouse button is normally
used to select the items on the screen. The different types of are mechanical
mouse, optomechanical mouse, and optical mouse.
Question 23.
Question 25.
Write a short note on MICR and where is it found?
Answer:
Magnetic Ink Character Reader enables special characters printed in magnetic
ink to be read and input rapidly to a computer. MICR is used extensively in
banking because magnetic-ink characters are difficult to forge and are
therefore ideal for marking and identifying cheques.
Question 26.
Write a note on BCR.
Answer:
Barcodes are a set of black lines of different thicknesses with spaces between
them representing numeric characters. Bar code readers are used to input data
from bar codes. Most products in departmental stores/ bookshops have bar
codes on them. Bar code readers work by shining a beam of light on the lines
that make up the bar code and detecting the amount of light that is reflected
back.
Question 27.
What are the differences between main or primary memory and secondary
memory?
Answer:
Primary Memory:
Secondary Memory:
2. Non-volatile memory:
The information stored in it is not lost even if the power supply goes off.
It‟s used for the permanent storage of information.
Question 29
Dynamic RAM:
DRAM uses a single capacitor and a transistor for each memory cell
DRAM requires to be refreshed periodically.
Question 30.
Compare the characteristics of impact printers and non-impact printers.
Answer:
DRAM is cheaper and slower and is used for the large main memory.
Question 31.
Explain different types of printers.
Answer:
1. Dot-matrix printer:
Dot-matrix printer is an impact printer that prints text and graphics on the
paper by using tiny dots to form the shapes. It uses a set of metal pins known
as print head to strike an inked printer ribbon and produce dots on the paper.
These combinations of dots give the desired shape on the paper. Generally,
they print with a speed of 50 to 500 characters per second as per the quality of
the printing is desired. The quality of the print is determined by the number of
pins used (varying from 9 to 24).
2. Line printers:
It is a high-speed printer capable of printing an entire line at one time. A fast
line printer can print as many as 3,000 lines per minute. The disadvantages of
line printers are that they cannot print graphics, the print quality is low, and
they are very noisy.
3. Inkjet printers:
Ink-jet printers are non-impact line printers. The ink is stored in disposable ink
cartridges, often a separate cartridge is used for each of the major colors. It
prints by spraying small, electrically charged droplets of ink from nozzles
through holes in a matrix at high speed onto paper. Ink-jet printers can print
in color and are noiseless and cheaper than a color laser printer. However,
they are slower and the print resolution is between 300 and -1200 dpi.
4. Laser printers:
The laser printer uses a laser to draw the image onto the printer‟s drum, which
carries an electric charge. The parts of the drum hold the electrical charge are
able to pick up the dry powder type of ink, also called toner, from within the
printer. This ink is then fused to the paper, using heat, as the paper rolls over
the drum. After the document is printed, the electrical charge is removed from
the drum and the excess toner is collected. Laser printers produce good
quality prints with resolutions ranging from 300 dpi to 1200 dpi.
5. Thermal printers:
A thermal printer is a printer which uses heated elements to print. Direct
thermal and thermal wax transfer are the two types of thermal printers. These
printers are relatively efficient and quiet, and they come in a number of sizes
and styles for different printing needs. A thermal printer has a print head
containing many small resistive heating pins that on contact, melt wax-based
ink onto ordinary paper or burn dots onto a specially coated paper.
Question 32.
Write a short note on RAM.
Answer:
RAM (random access memory) is a primary memory in a computer where the
operating system, application programs, and data currently in use are kept so
that they can be quickly accessed by the CPU. RAM is much faster to read
from and write to than the other kinds of storage in a computer. It is a volatile
memory which that means data can be stored ones as long as the computer is
on. There are different types of RAM.
1. Static RAM:
SRAM is one type of RAM and it is a volatile memory. In an SRAM, each bit
that stores data is made up of four or six transistors that make up a flip-flop.
There are additional transistors that are used to control read and write
accesses of storage cells. Each SRAM cell can be in three different states called
to read, write and standby. A cell is in the reading state when data has been
requested and it is in writing state when the data in the cell is modified. The
cell is in the standby state when it is idling.
2. Dynamic RAM:
DRAM is also a volatile memory that uses separate capacitors to store each bit.
Capacitors, when not charged, represent the value 0 of a bit and when
charged represent the value 1. Since the capacitors discharge with time, they
need to be refreshed periodically to maintain the values stored in them. Each
memory cell in a DRAM consists of a capacitor and a transistor and these cells
are arranged in a square array.
3. SDRAM Synchronous Dynamic Random Access Memory:
SDRAM is a type of main memory that synchronizes itself with the computer‟s
system clock. This type of memory synchronizes its input and output signals
with the incoming clock that is used in the system board. Its speed rating is
given in MHz to easily compare it to system board bus speeds.
By doing so, data transactions can continually take place with each successive
rising edge of the clock. The clock is used as the main determining factor for
memory data operation. The memory array is composed of two banks that can
be accessed independently.
4. EDO RAM:
EDO is short for Extended Data Out-and is a type of memory that was first
used with Pentium computers. EDO allows a CPU to access memory 10 to 15
percent faster than the compatible Fast Page memory.
5. DDR RAM:
DDR (Double Data Rate DRAM) is similar to SDRAM. The transfer of data for
DDR components can be performed at both edges of the clock signal. This
allows a double rate of transmission speed enabling the device to operate at
speeds twice that of typical SDRAM devices.
6. DDR2 RAM:
The main benefit is speed runs its bus at twice the speed of the memory cells
it contains. This enables faster bus speeds than older DDR memory. It also
consumes less power than DDR.
Question 33.
Explain a hard disk in detail.
Answer:
Hard disk is a secondary storage device. It is a disk pack consisting of several
metal platters coated with a magnetic material, rotating at high speed (7200
revolutions per second). Each surface has a read/write head mounted on an
arm. The heads can only move in one radial direction. Both sides of a platter
are used. Each surface is divided into concentric circles or tracks, typically 1000
tracks per platter.
Each track is divided into about 100 sectors, separated by gaps. To access data
in a specific location, the arm has to be positioned over the proper track, this
takes about 10-20 ms (1 ms = 1 millisecond = 0.001 s). The head waits until
the desired sector is under it; this takes about 6 ms. Once the sector is found,
the data can be read at a rate of 4 Mb/s.
Hard Disk Components:
A number of disks on which data is stored (the more disks, the greater the
drive‟s capacity).
Ahead to read and write data (The heads “fly” over the surface of a disk
supported by a few molecules of air)
Each disk is segmented radially into tracks. Tracks are about 300 millionths of
an inch apart. Each track is divided into sectors. A sector is the smallest
addressable unit on a direct access storage device.
A cylinder is made up of all the tracks that are at the same location of each
platter in the device.
The storage capacity of the hard disk ranging from several GigaBytes (250GB)
to several Terra Bytes (2 TB). There are internal hard disk and external hard
disks.
Question 34.
Write a note on Magnetic Tape.
Answer:
The Magnetic Tapes is the Type of Secondary Storage device and is used for
taking backup of data. They contain some magnetic fields and are used to
convert data into sequential form and load into the tape. They contain a
ribbon which is coated with the magnetic material only on one side. There is
ahead which accesses and reads the data which is recorded on the tape. While
accessing/reading data it is possible to move along to different locations
either forward. On backward to get the required information.
The only hitch is one cannot directly land on a location, but has to wind
forward on rewind as the case may be to get to the required data. Tape drives
are used for inserting and winding/new winding to tapes mag. Tapes are
prone to get damaged easily due to human errors. A very large amount of
data can be stored, in the tap.
Advantages:
Disadvantages:
The data may get corrupted if the tape is placed near a strong magnetic field.
Define an algorithm.
Answer:
An algorithm is a “step by step procedure to solve a given problem infinite
number of steps”.
Define coding.
Answer:
The process of translating the algorithmic solution or flowchart solution into a
set of instructions in a programming language is called as coding.
What is testing?
Answer:
It is the process of checking the program logic, by providing selected sample
data and observing the output for correctness.
a. go to statement
b. break or continue statement
c. multiple exit points.
3/5 Marks
2. Problem Analysis:
In problem analysis, we try to understand what are the inputs to be specified
and what are the required outputs.
4. Coding:
The process of writing program instructions for i.e., it is the process of
transforming algorithm/flowchart into a program code using programming
language instructions.
5. Debugging:
It is the process of detecting and correcting the errors in the program. This
stage is also referred to as verification.
6. Program Documentation:
It is a reference material that contains details about a program and functions
of different programs of software. Documentation helps other users to
understand the program and use it conveniently more effectively.
a. It must be simple.
b. Every step should perform a single task.
c. There should not be any confusion at any stage.
d. It must involve a finite number of instructions.
e. It should produce at least one output.
f. It must give a unique solution to the problem.
g. The algorithm must terminate and must not enter into infinity.
Disadvantages:
Disadvantages:
2. Semantic errors:
An error, which occurs due to the incorrect logic in a solution is called
semantic error. It also occurs due to the wrong use of grammar in the
program.
3. Runtime Errors:
occur at run-time. Such an error causes a program to end abruptly or even
cause system shut-down. Such errors are hard to detect and are known as
„Bugs‟.
4. Logical Error:
It may happen that a program contains no syntax or run-time errors but still, it
doesn‟t produce the correct output. It is because the developer has not
understood the problem statement properly. These errors are hard to detect
as well. It may need the algorithm to be modified in the design phase and
changing sources code.
1. Modularity: Module is a logically self contained unit that can be tested and executed
independently. Modularity is a technique adopted to divide a complex problem into a number of self
contained independent programming fragments or modules.
2. Abstraction: Abstraction is an act which represents the essential features of an entity without
including explanations or any background details about it.
3. Data Encapsulation: Wrapping of data and functions into a single unit is called data
encapsulation. The concept of insulating the data from direct access by the program is called data
hiding.
4. Inheritance: Inheritance is the process by which objects of one class acquires the properties of the
objects of another class. (Or) The process of deriving a new class from the existing class is called
inheritance.
5. Polymorphism: Polymorphism is the ability for a message to be processed in more than one
form. The process of making an operator to exhibit different behaviors in different instances is
known as operator overloading. Using a single function name to perform different types of tasks is
known as function overloading.
6. Dynamic Binding: Binding means linking of a procedure call to the code to be executed when it is
called. Dynamic binding means binding the procedure call during program run rime.
7. Message Passing: Passing message objects and invoking the function by the object by sending a
message is known as message passing.
INTRODUCTION TO C++
Binary Operators
Arithmetic Operator
Arithmetic operators are used to performing the basic arithmetic operations such as
arithmetic, subtraction, multiplication, division and modulo division (remainder after
division).
Operator Description Example( a=10, b=20)
+ Adds two operand a + b = 30
- Subtracts second operand from the first a - b = -10
* Multiply both operand a * b = 200
/ Divide numerator by denominators b/a=2
% Modulus operators and remainder of b%a=0
after an integer division
Relational Operator
Relational Operator is used to comparing two operands given in expressions.
They define the relationship that exists between two constants.
For example, we may compare the age of two persons or the price of two
items….these comparisons can be done with the help of relational operators.
The result in either TRUE(1) or FALSE(0).Some of the relational operators are:
Operator Description Example( a=10, b=20)
< Checks if the value of left operand is a < b returns false(0)
less than the value of right operand
<= Checks if the value of left operand is a <= b returns false(0)
less than or equal to the value of right
operand
> Checks if the value of left operand is a > b returns true(1)
greater than the value of right operand
>= Checks if the value of left operand is a >= b returns false(0)
greater than or equal to the value of
right operand
== Checks if the value of two operands is a = = b returns false(0)
equal or not
!= Checks if the value of two operands is a != b returns true(1)
equal or not
Logical Operators
Logical operators are used to testing more than one condition and make decisions.
Some of the logical operators are
Operator Meaning Description Example
&& Logical AND If both the operands are non- If a=10 and b=5
zero then condition becomes then, ((a==10) &&
true. (b>5)) returns
false.
|| Logical OR If any of the two operands is If a=10 and b=5
non- zero then condition then, ((a==10) ||
becomes true (b>5)) returns true.
! Logical NOT If a condition is true then the If a=10 then,
Logical NOT operator will make !(a==10) returns
false. false.
Bitwise Operators
A bitwise operator works on bits and performs bit by bit operation.
Bitwise operators are used in bit level programming
Operators Meaning of operators
& Bitwise AND
| Bitwise OR
^ Bitwise exclusive OR
~ Bitwise complement
The truth table for bitwise AND ( & ), Bitwise OR( | ), Bitwise XOR ( ^ ) are as follows:
A B A&B (Bitwise A|B (Bitwise A^B (Bitwise
AND) OR) NOT)
0 0 0 0 0
0 1 0 1 1
1 0 0 1 1
1 1 1 1 0
Assignment Operators
The most common assignment operator is =.
This operator assigns the value on the right side to the left side.
Example:
var = 5 //5 is assigned to var
a = b; //value of b is assigned to a
5 = b; // Error! 5 is a constant.
Conditional Operator:
A ternary operator pair ”? :” is available in C++ to construct conditional expressions
of the form: exp1? exp2: exp3, where exp1,exp2, and exp3 are expressions,
The operator “?:” works as follows: exp1 is evaluated first. If it is true, then the
expression exp 2 is evaluated and becomes the value of the expression. If exp1 is
false, exp3 is evaluated and its value becomes the value of the expression.
Example: a=10; b=5; x = (a>b) ?a:b;
Special Operator:
Operators Meaning of operators
Ssizeof() It is a unary operator which is used in
finding the size of the data type.
Example: sizeof(a)
Comma (,) Comma operators are used to linking
related expressions together. Example:
int a=10, b=5
. (dot) and -> (arrow) Member Operator used to reference
individual members of classes, structure
and unions.
Mathematical Function:
Some of the important mathematical functions in header file math.h are
Function Meaning
sqrt(x) Square Root of X
pow(x, y) x raised to the power y
sin(x) Sine of an angle x(measured in radians)
cos(x) Cosine of an angle x (measured in radians)
tan(x) Tangent of an angle x (measured in radians)
asin(x) Sin-1(x) where x (measured in radians)
acos(x) Cos-1(x) where x (measured in radians)
exp(x) Exponential function of x (ex)
log(x) Logarithm of x
log 10(x) Logarithm of number x to base 10
abs(x) Absolute value of integer number x
fabs(x) Absolute value of real number x
Character Function:
Some of the important mathematical functions in header file ctype.h are
Function Meaning
isalpha(c) It returns True if C is an uppercase letter and false if c is lowercase.
isdigit(c) It returns True if c is a digit (0 to 9) otherwise false
isalnum(c) It returns True if c is digit from 0 through 9 or an alphabetic
character
(either uppercase or lowercase) otherwise false
islower(c) It returns True if c is a lowercase letter otherwise False
isupper(c) It returns True if c is a uppercase letter otherwise False
toupper(c) It converts c to uppercase letter
tolower(c) It converts c to lowercase letter.
String Function:
Some of the important mathematical functions in header file string.h are
Function Meaning
strlen(s) It gives the no. of characters including spaces present in a
strings.
strcat(s1, s2) It concatenates the string s2 onto the end of the string s1. The
string s1 must have enough locations to hold s2.
strcpy(s1, s2) It copies character string s2 to string s1. The s1 must have
enough
storage locations to hold s2
strcmp((s1,s2)==0) It compares s1 and s2 and find out whether s1 equal s2, greater
strcmp((s1,s2)>0) than s2 or s1 less than s2.
strcmp((s1,s2)<0)
strcmpi((s1,s2)==0) It compares s1 and s2 ignoring case and find out whether s1
strcmpi((s1,s2)>0) equal
strcmpi((s1,s2)<0) s2, greater than s2 or s1 less than s2.
strrev(s) It converts a string into its reverse.
strupr(s) It converts a string s into upper case.
strlwr(s) It converts a string into lower case.
DATA TYPES
Define datatype.
A variable is an object or element and it is allowed change during the execution of the program.
Give the syntax of declaring and initialization of variable.
The syntax for declaring a variable is:
datatype variable_name;
The variable_name is an identifier. These variables are used to denote constants, arrays, function,
structures, classes and files.
The variables are named storage location whose values can be manipulated during program run.
Ex:
int a;
The simple data types/fundamental data types include int, char, float, double and void.
This includes number such as 1, 45 and -9 are integers. An integer is allocated 2 bytes (16 bits) of
memory space.
The possible operations include addition, subtraction, multiplication, division, remainder etc.
The char type:
It is character data type to store any character from the basic character set.
Characters are enclosed in single quotation marks (‘). ‘A’, ‘a’, ‘b’, ‘9’, ‘+’ etc. are character
constants.
When a variable of type char is declared, the compiler converts the character to its equivalent ASCII
code.
Number such as 1.8, 4.5, 12e-5 and -9.66 are all floating point numbers.
It can also be both positive and negative. The range of numbers we can store from -34e-38 to
3.4e38.
The double and float are very similar. The float type allows you to store single precision floating
point numbers, while the double keyword allows you to store double precision floating point numbers.
Its size is typically 8 bytes of memory space.
In other words both the set of values and set of operations are empty.
The bool type has logical value true or false. The identifier true has the value 1, and the identifier
false has the value 0.
The syntax for enum is as follows: enum [tag] { enum – list} ; //for definition for enumerated type
enumtaddeclarator; //for declaration of variable type tag
Example 1:
enum choice { very_bad, bad, satisfactory, good, very_good}; choice mychoice;
Example 2:
enum MyEnumType { ALPHA, BETA, GAMMA }; Here, ALPHA takes the value 0, BETA takes
the value of 1, GAMMA takes the value of 2.
Example 3:
enum footsize { small = 5, medium = 7, large = 10};
DATA TYPES
Define datatype.
A variable is an object or element and it is allowed change during the execution of the program.
Give the syntax of declaring and initialization of variable.
The syntax for declaring a variable is:
datatype variable_name;
The variable_name is an identifier. These variables are used to denote constants, arrays, function,
structures, classes and files.
The variables are named storage location whose values can be manipulated during program run.
Ex:
int a;
The simple data types/fundamental data types include int, char, float, double and void.
The int type:
This includes number such as 1, 45 and -9 are integers. An integer is allocated 2 bytes (16 bits) of
memory space.
The possible operations include addition, subtraction, multiplication, division, remainder etc.
The char type:
It is character data type to store any character from the basic character set.
Characters are enclosed in single quotation marks (‘). ‘A’, ‘a’, ‘b’, ‘9’, ‘+’ etc. are character
constants.
When a variable of type char is declared, the compiler converts the character to its equivalent ASCII
code.
This represents the number with fractional part i.e. real numbers.
Number such as 1.8, 4.5, 12e-5 and -9.66 are all floating point numbers.
It can also be both positive and negative. The range of numbers we can store from -34e-38 to
3.4e38.
The double and float are very similar. The float type allows you to store single precision floating
point numbers, while the double keyword allows you to store double precision floating point numbers.
In other words both the set of values and set of operations are empty.
The bool type has logical value true or false. The identifier true has the value 1, and the identifier
false has the value 0.
The syntax for enum is as follows: enum [tag] { enum – list} ; //for definition for enumerated type
enumtaddeclarator; //for declaration of variable type tag
Example 1:
enum choice { very_bad, bad, satisfactory, good, very_good}; choice mychoice;
Example 2:
enum MyEnumType { ALPHA, BETA, GAMMA }; Here, ALPHA takes the value 0, BETA takes
the value of 1, GAMMA takes the value of 2.
Example 3:
enum footsize { small = 5, medium = 7, large = 10};
Spreadsheets
Define an electronic spreadsheet.
Answer:
An Electronic spreadsheet is an application software and the spreadsheet is
divided into rows and columns to store items like student is marks, stocks,
income and expenses, debits and credits.
Define a workbook.
Answer:
A workbook is a set of electronic spreadsheets.
Define a cell.
Answer:
The intersection of a row and a column in a spreadsheet is called a cell.
Define a chart.
Answer:
A chart is a pictorial representation of some data.
Explain the steps used to change the row size and columns width in a
worksheet.
Answer:
Select cell, a format, a row height a height in numbers. Select cell, a format, a
column width a width in numbers.
5 Mark
Step 2:
Mouse is used to highlight the block of cells containing data, and then insert
chart is clicked on.
Step 3:
When the chart wizard comes up, column or bar graph and a subtype as
clustered or stacked type is chosen as per requirement.
Step 4:
If the user wants to switch what appears on the X and Y axis, right-clicking on
the bar graph, then on „Select Data,‟ and finally on „Switch Row/Column‟.
Step 5:
Labels and legends of the chart embedded if needed. User can click on the bar
graph, and then click the „Layout‟ tab. Here you can choose what layout you
prefer for the chart title, axis titles, and legend.