11 CS Guide 2023
11 CS Guide 2023
11 CS Guide 2023
11
2
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
3
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
Fingerprint Reader:
15. Define control unit or • It is used for computer security instead of using passwords.
Write the functions of control unit. • It is a biometric technique.
• It is a very safe and convenient.
• It controls the entire operation of a computer through signals. Track Ball:
• In Track ball user spins the ball in various directions to navigate the
16. What is the function of memory? screen movements.
Retinal Scanner:
Memory unit • It performs a retinal scan.
• It is used to store data and instructions. • It is a biometric technique .
• There are two types of memory, they are primary memory and Light Pen:
secondary memory • A light pen is a pointing device .
Primary memory • It is connected to a monitor.
• It is also called main memory. • The tip of the light pen contains a light-sensitive element
• It is volatile. • It detects the light from the screen enabling the computer to
• Temporary memory. identify the location of the pen on the screen.
Ex. RAM Optical Character Reader:
Secondary memory • It is used to detect characters printed or written on a paper.
• It is non volatile • The Scanned document can be edited using a word processor.
• Permanent memory. 19.DefineBar Code
• Ex. Hard Disk, CD-ROM • A Bar code is a pattern printed in lines of different thickness.
• The Bar code reader scans the information on the bar codes
17. Distinguish between Primary and secondary memory. transmits to the Computer for further processing.
20.Define QR Code Reader: QR (Quick response) Code:
Primary memory • The QR code is the 2D bar code which can be read by a camera .
• It is also called main memory. Define Voice Input Systems:
• It is volatile. • Microphone serves as a voice Input device.
• Temporary memory. • It captures the voice data and send it to the Computer.
Ex. RAM Define Digital Camera:
Secondary memory • It captures images / videos directly in the digital form.
• It is non volatile • It uses a CCD (Charge Coupled Device) electronic chip.
• Permanent memory. • It converts light rays into digital format.
• Ex. Hard Disk, CD-ROM Touch Screen:
• A touch screen is a display device that allows the user to
18.Explain Some Important Input Devices. interact with a computer by using the finger.
• Touch screens are used in computers, laptops, monitors, smart
Keyboard: phones, tablets, ATM etc..
• Keyboard is the most common input device.
• It is used to give data and instructions to computer by typing on 21.Explain Some Output Devices.
the keyboard.
• The keys for letters, numbers and special characters are known Monitor:
as a character keys • Monitor is the most commonly used output device to display the
• Function keys are used to perform different functions. information.
• Other keys are enter and editing keys, function keys, navigation • Pictures are formed with picture elements called PIXELS.
keys, numeric keypad and lock keys etc.. • It can be Monochrome or Colour
Mouse: • CRT (Cathode Ray Tube),
It is an input device LCD (Liquid Crystal Display) and
• Mouse is a pointing device . LED (Light Emitting Diodes) are the types of monitor.
• It can be used to select icons, menus, command buttons etc • Monitor works with the VGA (Video Graphics Array) card.
• Some mouse actions are i) move, ii)click, iii)double click, • VGA acts as an interface between the computer and monitor.
iv)right click, v)drag and drop. Plotter:
Scanner: • Plotter is used to produce graphical output on papers.
• It converts printed or written Information into a digital • It uses single color or multi color pens to draw pictures.
format(file) into computer’s memory.
4
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
5
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
6
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
7
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
8.Find 1’s and 2’s complement for (–135)10 12.Convert (150)10 into Binary, then convert that binary number
Ref. above answer into octal
9.We cannot find 1’s complement for (28) 10 .
Reason: Because 28 is a positive number. 2|150
This is for negative numbers only 2|75 0
10.Binary Add a) -2210 + 1510 2|32 1
2|16 0
-22 2|8 0
2|22 2|4 0
2|11 0 2|2 0
2|5 1 2|1 0
2|2 1
2|1 0 (150)10 = (1000 0010)2
1101011
111010
------------
0110001
-------------
8
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
9
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
Note:
• Fraction repeats, the product is the same as in the first step. Conversion of fractional Binary to Decimal
• Write the integer parts from top to bottom. 30.Conversion of fractional Binary to Decimal equivalent
• Hence (0.2) 10 =(0.00110011…) 2
Binary to Decimal Conversion
27.Convert (1 1 0 0 1)2 into its equivalent decimal number.
11001
1 X 25 + 1 X24 +0 X 23 + 0 X 22 + 1 X 20
16 + 8 + 0 + 0 + 1
25
(11001)2= (25)10
Conversion Table
Hex Oct Dec Binary
0 0 0 0 0 0 0 31.Convert the given Binary number (11.011) 2 into its decimal
equivalent Integer part (11) 2 = 3
1 1 1 0 0 0 1
2 2 2 0 0 1 0
3 3 3 0 0 1 1
4 4 4 0 1 0 0
5 5 5 0 1 0 1
6 6 6 0 1 1 0 3 + . (0x0.5 + 1 x 0.25 + 1 x 0.125)
7 7 7 0 1 1 1 3 + . 0 + 0.25 + 0.125
8 8 1 0 0 0 3 +.375
9 9 1 0 0 1 3 . 375
Octal to Decimal Conversion:
A 1 0 1 0
32.Convert (1265) 8 to equivalent Decimal number
B 1 0 1 1
Positional 8 3 82 81 80
C 1 1 0 0 Given
D 1 1 0 1 Weight 512 64 8 1
E 1 1 1 0 Number 1 2 6 5
F 1 1 1 1 (1265) 8 = 512 ×1 + 64×2 + 8×6 +1×5
Binary to Octal Conversion = 512 + 128 + 48 + 5
28.Convert (11010110)2 into octal equivalent number (1265) 8 = (693) 10
Step 1: Group the given number into 3 bits from right to left.
011 010 110 Hexadecimal to Decimal Conversion
Note: The left most groups have less than 3 bits, so 0 is added to its left 33.Convert (25F) 16 into its equivalent Decimal number.
to make a group of 3 bits. Weight 256 16 1
Step-2: Find Octal equivalent of each group Positional
011 010 110 Notation 16 2 16 1 16 0
3 2 6 Given number = (2 5 F)16
(11010110)2 = (326)8 (25F) 16 = 2×256 + 5×16 + 15×1
= 512 + 80 +15
Binary to Hexadecimal Conversion (25F) 16 = (607) 10
29.Convert (1111010110)2 into Hexadecimal number
Step 1:Group the given number into 4bits from right to left. Hexadecimal to Binary Conversion
0011 1101 0110
Note: 0’s are added to the left most group 34.Convert (8BC) 16 into equivalent Binary number
To make it a group of 4 bits
0011 1101 0110
3 D 6
(1111010110)2 = (3D6) 16
10
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
11
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
2.Define Logical Operation ( or )What are the basic logical operators NOT GATE
(fundamental operators)?
• AND(+) , OR (.) and NOT(-)
3.Define TRUTH TABLE 9.Explain the fundamental gates with expression and truth table.
• All the possible input along with all the possible output of given Ref.5,6,7
A Y = 𝐴̅
combination of truth values is known as Truth Table.
0 1
1 0 8.Consider the following equation
4.What is Gate? What are the fundamental gates? D = A + (𝐵̅. C) Write truth table and Find the
• Gate is a basic electronic circuit. output of D when inputs A=0,B=1,and C=0.
• It operates on one or more input signals to produce an output A B C 𝐵̅ (𝐵̅.C) D =A + (𝐵̅ .C )
signal. 0 0 0 1 0 0
• There are three fundamental gates namely AND, OR and NOT. 0 0 1 1 1 1
0 1 0 0 0 0
5.Explain about AND operator
0 1 1 0 0 0
• The AND operator has two or more input variables and one
output. 1 0 0 1 0 1
The output is TRUE when all the Inputs are TRUE. 1 0 1 1 1 1
Algebraic expression : Y=A . B 1 1 0 0 0 1
TRUTH TABLE 1 1 1 0 0 1
A B Y=A.B Result: D=0
0 0 0 9.What are derived gates?
0 1 0 • The gates which are derived from fundamental gates are called
1 0 0 derived Gate.
1 1 1 Ex. NAND ,NOR,XOR,XNOR etc…..
AND GATE
10.Why the NAND and NOR gates are called universal gate?
• NAND and NOR gates are called Universal gates, because the
fundamental logic gates can be realized through them
11.Explain NOR Operator with an example.
6.Explain about OR operator
• The NOR is the combination of NOT and OR
• The OR operator has two or more input variables and one output .
• NOR = inverting the output of an OR operator.
The output is TRUE if at least one input is TRUE.
Algebraic expression : Y= ̅̅̅̅̅̅̅̅
𝑨+𝑩
Algebraic expression : Y = A + B
TRUTH TABLE
TRUTH TABLE
A B A+B Y = ̅̅̅̅̅̅̅̅
𝐴+𝐵
A B Y=A+B
0 0 0 1
0 0 0
0 1 1 0
0 1 1
1 0 1 0
1 0 1
1 1 1 0
1 1 1
LOGIC CIRCUIT
OR GATE
12
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
TRUTH TABLE
12.Explain Bubbled AND Gate
A B 𝐴̅ 𝐵̅ Y = 𝐴̅ + 𝐵̅
0 0 1 1 1
0 1 1 0 1
1 0 0 1 1
1 1 0 0 0
NOR = BUBBLED AND
• They are identical. NAND = BUBBLED OR
So the circuits are interchangeable • They are identical.
TRUTH TABLE So the circuits are interchangeable.
A B ‘A ‘B Y=𝑨
̅ .𝑩
̅
0 0 1 1 1 Algebraic expression : ̅̅̅̅̅̅
𝑨. 𝑩 = 𝑨 ̅+𝑩 ̅
0 1 1 0 0 De Morgan's Second theorem – Proved.
1 0 0 1 0
16.De Morgan's Second theorem – Prove. Ref.14 & 15
1 1 0 0 0
17. How AND and OR can be realized using NAND and NOR gate. (Ref.
Algebraic expression : ̅̅̅̅̅̅̅̅̅
𝑨+𝑩 =𝑨 ̅ .𝑩
̅
11,12 & 14 , 15)
De Morgan's First theorem – Proved
13.Prove – De Morgan First theorem Ref. 11 & 12
18.Explain XOR Gate with Truth Table.
• It is called exclusive - OR gate
14.Explain NAND operator with Truth Table.(or)
• The output is TRUE if the inputs are different,
Write short note on NAND gate:
otherwise FALSE .
• The NAND is the combination of NOT and AND
• NAND = inverting the output of an AND operator
Algebraic expression :Y = ̅̅̅̅̅𝐴. 𝐵
TRUTH TABLE
A B A.B Y = ̅̅̅̅̅
𝐴. 𝐵
0 0 0 1
0 1 0 1
Algebraic expression : C = 𝑨
̅ .B + A . 𝑩
̅
1 0 0 1
TRUTH TABLE
1 1 1 0
A B 𝐴̅ 𝐵̅ 𝐴̅ . B A . 𝐵̅ 𝐴̅ . B + A . 𝐵̅
All inputs are TRUE , output is FALSE
0 0 1 1 0 0 0
LOGIC CIRCUIT
0 1 1 0 1 0 1
1 0 0 1 0 1 1
1 1 0 0 0 0 0
LOGIC SYMBOL ⊕ or "encircled plus" stands for the XOR
Therefore
C=A⊕B
Logic Symbol
13
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
Algebraic expression : C = 𝑨
̅ .B + A . 𝑩
̅ 23. Explain the theorems of Boolean Algebra
A B 𝐴̅ 𝐵̅ 𝐴̅ . B A . 𝐵̅ 𝐴̅ . B + A . 𝐵̅ C=A⊙B
0 0 1 1 0 0 0 1
0 1 1 0 1 0 1 0
1 0 0 1 0 1 1 0
1 1 0 0 0 0 0 1
20.Prove the following Absorption law by using Truth Table 24.Explain the Derived gates with expression and truth table.
A + (A . B) = A Ref. 9,11,14,15,& 16
14
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
1.Differentiate between computer architecture and Computer 5. What are the parameters which influence the characteristics of a
organization microprocessor? Or
Computer Architecture What are the Characteristics of Microprocessors.? Explain
• It deals with the engineering considerations. There are three important Characteristics of Microprocessors. They are,
• It is used in designing a computer. a) Clock speed
Computer Organization b) Instruction set
• It deals with the hardware components. c) Word size
• It is used for Programmer.
Clock speed
2.What is microprocessor? Define microprocessor. • Every microprocessor has an internal clock.
• The microprocessor is a programmable multipurpose silicon chip. • The speed of instruction execution in microprocessor is called the
• It is controlled by clock pulses. clock speed.
• It accepts input as a binary data and after processing, it • Clock speed is measured in MHz (Mega Hertz) or in GHz (Giga
provides the output data as per the instructions stored in the Hertz).
memory. Instruction set
• Instruction is a command used to perform an operation based on
data.
• Basic set of instructions to execute by microprocessor is called
an instruction set.
Types of operations
• Data transfer
• Arithmetic operations
3.What are the main units of Microprocessor(CPU)? Explain • Logical operations
Microprocessor is made up of 3 main units. They are, • Control flow
1. Arithmetic and Logic unit (ALU) • Input/output
2. Control unit Word size
3. Registers (Internal Memory) • The number of bits that can be processed by a processor in a
Arithmetic and Logic unit (ALU): single instruction is called its word size.
• The ALU performs arithmetic operations and logical •
instructions based on computer instructions 6.What is an Instruction?
• Send the result to internal memory. • Instruction is a command used to perform an operation based on
Control unit: data.
• To control the over all operations of the computer through
signals. 7. How to determine architecture of the microprocessor?
Registers (Internal Memory): • Total number of input and output pins determine the architecture of
• They are used to hold the instruction and data for the execution the microprocessor
of the processor.
8.What is the use of program counter? Or What is a Program
counter?
4.What is System Bus? • The Program Counter (PC) is a special register in the CPU which
• A bus is a collection of wires used for communication between the always keeps the address of the next instruction to be executed.
Microprocessor and other devices.
There are 3 types of buses, they are
1. Address bus
2. Data bus
3. Control bus
15
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
9.Explain how Data communication between CPU and memory. Or Random access,
How the read and write operations are performed by a processor? • Any byte of memory can be accessed directly without
Explain orderly manner from starting to end.
19.Differentiate between RAM and ROM
• The Central Processing Unit(CPU)has a Memory Data Register (MDR) 20.Write short note on Read Only Memory (ROM).
and a Memory Address Register (MAR). 21.Write short note on Random Access Memory (RAM).
• MDR keeps the data. RAM
• MAR keeps the address of data. • It is volatile memory
• The program counter(PC) is a special register in the CPU. It is • Operating System, Application Programs and the data in
current use are kept temporarily
used to keep the address of the next instruction.
• It allows both read and write
• The Data bus is connected with MDR. • Stores temporarily
• The address bus is connected with MAR. • When the power is turned off, whatever data stored in RAM is
• The word in the RAM has the same size as MDR. lost
• The read operation transfers the data from word(RAM) to MDR. • They are two types SRAM,DRAM
• The write operation transfers the data from MDR to Word(RAM) ROM
• It is non-volatile memory
• ROM stores critical programs during the manufacturing .
• It can only be read.
• Stores permanently
• It retains its contents even when the computer is turned off.
• They are PROM,EPROM,EEPROM
16
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
23 Differentiate between EEPROM and PROM . ref. above ans 32.Explain different types of Ports and Interfaces in computer.
Differentiate between EEPROM and EPROM . ref. above ans Serial Port: To connect the external devices like screen
Which source is used to erase the content of a EPROM.ref.aboveans Parallel Port: To connect the printers.
24.Define Cache Memory. USB Ports:
• It is a very high speed and expensive memory • To connect external devices like cameras, scanners, mobile
• It is closer to CPU. phones, external hard disks and printers to the computer.
• It is in between the CPU and the main memory. • It stands for Universal Serial Bus (USB)
25.Define Access Time. • USB 3.0, USB 3.1 ,USB 3.2 can transfer data up to 5GB/Sec.
• How quickly the memory can respond to a read / write request is VGA Connector: To connect a monitor, LCD projector.
called as Access Time. Audio Plugs: To connect sound speakers, microphone and headphones.
26.List some secondary storage Devices. PS/2 Port: To connect mouse and keyboard to PC.
1.Hard Disk 2.Compact Disc (CD) SCSI Port: To connect the hard disk drives and network connectors.
3.Digital Versatile Disc (DVD) 4.Flash Memory Devices. 5. Blu-Ray Disc
27.Write short note on Hard disk. 33.Define High Definition Multimedia Interface (HDMI) or What is
• Hard disk is a magnetic disk used to store data. HDMI?
• It has the stacked arrangement of disks accessed by a pair of • It is an audio/video interface .
heads for each of the disks. • It transfers the uncompressed video and audio data from a
• The hard disks come with a single or double sided disk. video controller, to computer monitor, LCD projector, digital
television etc.
28.Differentiate CD and DVD( ref. above answers) 32.Arrange the memory devices in ascending order based on the
Compact disk(CD) access time
• CD is made up of polycarbonate plastic material. 1.Cache Memory.
• A thin layer of aluminum or gold is applied to the surface. • It is a very high speed and expensive memory
• In CD, data is represented as "pits" encoded in a spiral track on top. • It is closer to CPU.
• The areas between pits are known as "lands". • It is in between the CPU and the main memory.
• A motor within the CD player rotates the disk. 2.Main Memory
• The capacity is 700MB RAM
Digital Versatile Disc (DVD) • It is volatile memory
• DVD is an optical disc • It allows both read and write
• DVDs are read with a laser. • Stores temporarily
• The disc can have one or two sides, and one or two layers per side; • When the power is turned off, whatever data stored in RAM is
• Single layer has 4.7 GB capacity, lost
• Double layer has 8.5 GB capacity. • They are two types SRAM,DRAM
• Double-layered sides are usually gold-coloured ROM
• Single-layered sides are usually silver-coloured, like a CD • It is non-volatile memory
30.How will you differentiate a flash memory and an EEPROM? • ROM stores critical programs during the manufacturing process
Flash memory itself i.e booting
• Flash memory is non-volatile. • can only be read.
• It can be electrically erased and reprogrammed. • Stores permanently
• It offers fast access times • They are PROM,EPROM,EEPROM
• They are either EEPROM or EPROM. 3.Secondary Storage Devices
Ex. Pen drives, Memory cards etc • They are non-volatile in nature.
EEPROM • Secondary storage devices are used to store data and programs
• It is a non-volatile memory. permanently
• It can be erased by an electrical charge. • They are also called as Backup storage
• It is slower in performance. They are Hard Disk,C , D,DVD,Flash memory ,Blue Ray Disk etc..
17
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
18
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
19
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
15.Define Fault Tolerance of computer. • The Distributed Operating System is used to access shared data
• OS have fault tolerance capabilities and retain the existing state and files in any machine around the world using internet /
of system. intranet
16.What is File Allocation Table (FAT)? • The user can handle the data from different locations.
• File Allocation Table (FAT) is a file management technique in OS. The advantages of distributed Operating System
• Any type of data in a computer is stored in the form of files • The resources available from one location to another location .
and directories/folders through File Allocation Table (FAT). • Many computer resources can be added easily in the network
• The FAT stores general information about files like filename, • Improves the interaction with the customers and clients.
type ,size, starting address and access mode. • Reduces the load on the host computer.
17.Explain File Management in OS.
• OS manages the files, folders and directory systems on a 23.Give some list of Prominent OS. Or
computer. What are the different Operating Systems used in computer?
• Any type of data in a computer is stored in the form of files • UNIX
and directories/folders through File Allocation Table (FAT). • Microsoft Windows
• The FAT stores general information about files like filename, • Linux
type (text or binary), size, starting address and access For mobile
mode. • iOS
• OS helps to create, edit, copy, allocate memory to the files. • Android
• There are few other file management techniques available like
1.Next Generation File System (NTFS)
2.ext2(Linux).
18.Write short note on Multi-Processing.
20
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
1.Operating system is a
A)Application Software B) Hardware C)System Software D)Component
2) Identify the usage of Operating Systems
A)Easy interaction between the human and computer
B)Controlling input & output Devices
C)Managing use of main memory
D)All the above
3) Which of the following is not a function of an Operating System?
A)Process Management B)Memory Management
C)Security management D)Complier Environment
4) Which of the following OS is a Commercially licensed Operating
system?
A)Windows B)UBUNTU C)FEDORA D)REDHAT
5) Which of the following Operating systems support Mobile Devices?
A)Windows 7 B)Linux C)BOSS D)iOS
6) File Management manages
A)Files B)Folders C)Directory systems D)All the Above
7) Interactive Operating System provides
A)Graphics User Interface (GUI) B)Data Distribution
C)Security Management D)Real Time Processing
8) An example for single task operating system is
a)Linux b)Windows c) MS-DOS d)Unix
9)The file management system used by linux is..
a)ext2 b)NTFS c)FAT d)NFT
21
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
22
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
23
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
25.How will you Rename a File? 28.Differentiate cut(Move) and copy options.
Using the FILE Menu copy Cut (move)
• Select the File or Folder . It leaves the files or text from It removes the files or text
• Click File→ Rename. source location and place them from source location and place
• Type in the new name. in the destination location them in the destination location
• Press Enter To copy, ctrl + c , Edit - To cut(move), ctrl + X,
Using the Right Mouse Button >copy Edit - >cut
• Select the file or folder . 29.How to Deleting Files and Folders in Windows 7?
• Right click - > Rename • Select the file or folder.
• Type in the new name. • Select Right- click -> Delete or
• Press Enter. • Click File → Delete or press Delete key from the keyboard.
Using the Left Mouse Button • The file will be deleted and moved to the Recycle bin.
• Select the File or Folder. 30.How to delete a file or folder permanently in windows ?
• Press F2 . • To permanently delete a file or folder (i.e. to avoid hold down the
• Type in the new name. SHIFT key, and press delete on the keyboard.
• Press Enter. 31.Write a note onRecycle bin?
• Recycle bin is a special folder to keep the files or folders
26.Explain the different methods of copy and cut(Move) Files and deleted by the user,
Folders. • The user cannot access the files or folders in the Recycle bin
Method I - COPY and PASTE without restoring it.
• Select the file or folder To restore file or folder from the Recycle Bin
• Click Edit → Copy or Ctrl + C or right click → Copy In recycle bin
• Move to new location and paste it using • Right click on a file or folder .
• Click Edit → Paste or Edit -> Paste or Ctrl + V Or Right click • Select Restore for one .
→ Paste • Restore all for multiple files or folders
• The file will be pasted in the new location. To delete
Method II-CUT and PASTE • select Empty the Recycle Bin.
• Select the file or folder 32.How to Creating Shortcuts on the Desktop
• Click Edit → Cut or Ctrl + X or right click → cut Select the file or folder
• Move to new location and paste it using • Right click on the file or folder.
• Click Edit → Paste or Edit -> Paste or Ctrl + V Or Right click • Select Send to->Desktop (create shortcut)
→ Paste • A shortcut for the file or folder will now appear on your desktop.
• The file will be pasted in the new location.
Method III – Drag and Drop 33.How to shutting down or logging off a computer n Windows.?
• Click and drag the selected file and/or folder . Close your all open programs.
• drop it where you want to copy the file and/or folder. Click start → log off or Start → Shutdown .
• Your file(s) or folder(s) will now appear in the new area. • Switch User: Switch to another user account on the computer
27.How to Copying Files and Folders to removable disk? without closing your open programs and Windows processes.
Method - I • Log Off: Switch to another user account.
• Select the file or folder • Lock: Lock the computer
• Click Edit → Copy or Ctrl + C or right click → Copy • Restart: Reboot the computer.
• Click Start→Computer. • Sleep: Puts the computer into a low-power mode that retains all
• Double-click on the Removable Disk drive . running programs and open Windows for a super-quick restart.
• In Removable Disk window, right-click -> Paste • Hibernate (found only on laptop computers): Puts the computer into a
Your file(s) or folder(s) will now appear in the new area. low-power mode after saving all running programs and open windows
METHOD II - Send To for a quick restart.
• Plug in the USB flash drive and open
• Right-click on the file you want to transfer to your removable 34.Differentiate between Hibernate and Sleep .
disk. ref. above answer
• Click Send To->Removable Disk
24
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
1.From the options given below, choose the operations managed by the
operating system.
a. Memory b. Processor c. I/O devices d. all of the above
2. Which is the default folder for many Windows Applications to save your
file?
a. My Document b. My Pictures
c. Documents and Settings d. My Computer
3. Under which of the following OS, the option Shift + Delete –
permanently deletes a file or folder?
a.Windows 7 b. Windows 8
c.Windows10 d. None of the OS
4. What is the meaning of "Hibernate" in Windows XP/Windows 7?
a. Restart the Computer in safe mode
b. Restart the Computer in hibernate mode
c. Shutdown the Computer terminating all the running applications
d. Shutdown the Computer without closing the running applications
5.The shortcut key used to remain a file in windows
a. F2 b.F4 c.F5 d.F6
25
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
26
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
27
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
28
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
13.Both conditional statement and iterative statement have a 17.Why is function an abstraction?
condition and a statement. How do they differ? • The process of providing only the essentials and hiding the details
is known as abstraction
Conditional statement Function is an abstraction of an algorithm,.
▪ A conditional statement is executed only if the condition is true • A function is like a sub algorithm.
otherwise, nothing is done • Construct each part (function)separately,
Iterative Statement and then integrate the parts to the complete algorithm.
▪ An Iteration statement is a set of statements that are 18.How do we refine a statement? OR
repeatedly executed until a condition is TRUE. Define Refinement.
14.What is case analysis? After decomposing a problem into smaller sub problems,
Write about Case analysis control flow with flowchart. • Each sub problem can be expanded into more detailed steps.
▪ Case analysis is a multiple branching statement, • Each step can be further expanded.
▪ Based on a condition, the control is transferred to one of the many • This is known as refinement.
possible points.
If C1,C2,C3 are conditions True 19.Consider the problem of testing whether a triangle is right-
S1,S2,S3 ,S4 are Statements angled, given its three sides a, b, c, where c is the longest side. The
C
case C1 S
triangle is right-angled, if c2 = a2 + b2
S1 1 1 Here a function square() is specified as
False
case C2 Square(y)
C S2
S2 --input : y
case C3 2 -- output : y2 (y*y)
S3 Flowchart for square()
else C S
S4 3 3 Input y
EN
• For each case, the problem is S4
solved independently. D Y*y
• If case condition is TRUE ,the
corresponding statement is
executed. Algorithm
• If none of case is TRUE then the default case S4 is executed. Right_angled(a,b,c)
The cases are exhaustive : At least one case is TRUE --input: c>=a,c>=b
The cases are disjoint : The case analysis always execute one case. --output: ifc2 = a2 + b2is true result = TRUE otherwise
15.Write an algorithm that compares two numbers and produce the result = FALSE
result as if ( square(c ) == square(a) + square(b) )
1.Compare (a,b) result: = TRUE it is right angle triangle
2.Case a<b else
3. Result= -1 result: = FALSE it is not a right angle triangle
4.Case a=b Flowchart
5. Result =0
6.Else – a>b start
7. Result = 1
16.Write about Iterative control flow with flowchart
• An Iteration statement is a set of statements that are Input a,b,c
repeatedly executed until a condition is TRUE.
The iterative statement is commonly known as a loop
If C is a condition and S is a statement, then
while C C2==a2+ T TRUE
S b2
This describes the following action: F
1. Test whether C is true or false.
FALSE En
2. If C is true, then do S and go back
to d
step 1; otherwise do nothing.
29
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
30
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
2 S1
3 else
4 if C2
5 S2
6 else
7 S3
Executes
(a) S1 (b) S2 (c) S3 (d) none
4. If C is false just before the loop, the control flows through
1 S1
2 while C
3 S2
4 S3
(a) S1 ; S3 (b) S1 ; S2 ; S3 (c)S1 ; S2 ; S2 ; S3 (d) S1 ; S2 ; S2 ; S2 ; S3
5. If C is true, S1 is executed in both the flowcharts, but S2 is
executed in
(a) (1) only (b) (2) only (c) both (1) and (2) (d) neither (1) nor (2)
6. How many times the loop is iterated?
i := 0
while i ≠ 5
i := i + 1
(a) 4 (b) 5 (c) 6 (d) 0
Answers:
1.a 2.c 3.b 4.a 5.a 6.b
31
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
32
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
11.King Vikramaditya has two magic swords. With one, he can cut off
19 heads of a dragon, but after that the dragon grows 13 heads. With CHOOSE THE CORRECT ANSWER
the other sword, he can cut off 7 heads, but 22 new heads grow. If
all heads are cut off, the dragon dies. If the dragon has originally 1.A loop invariant need not be true
1000 heads, can it ever die? (Hint:The number of heads mod 3 is (a) at the start of the loop. (b) at the start of each iteration (c) at the
invariant.) end of each iteration (d) at the start of the algorithm
2.We wish to cover a chessboard with dominoes, the number of
If the dragon has 1000 heads we start at 1000=1(mod 3) we cannot get to black squares and the number of white squares covered by
0 .so the dragon lives. dominoes, respectively, placing a domino can be modeled by
(a) b := b + 2 (b) w := w + 2 (c) b,w := b+1, w+1(d) b := w
12.Assume an 8 × 8 chessboard with the usual coloring. 3. If m x a + n x b is an invariant for the assignment a, b : = a + 8, b
"Recoloring" operation changes the color of all squares of a row or + 7, the values of m and n are
a column. You can recolor re-peatedly. The goal is to attain just one (a) m = 8, n = 7 (b) m = 7, n = -8 (c) m = 7, n = 8 (d) m = 8, n = -7
black square. Show that you cannot achieve the goal. (Hint: If a row 4. Which of the following is not an invariant of the assignment? m,
or column has n := m+2, n+3
b black squares, it changes by (|8 - b) - b|). (a) m mod 2(b) n mod 3 (c) 3 X m - 2 X n (d) 2 X m - 3 X n
5. If Fibonacci number is defined recursively as
White squares W = 32 to evaluate F(4), how many times F() is applied?
Black squares B = 32 (a) 3 (b) 4 (c) 8 (d) 9
6. Using this recursive definition
W+ B = 64 , W – B = 0 = 0 mod 4 how many multiplications are needed to calculate a10?
But the required state has 63 W 1 B (a) 11 (b) 10 (c) 9 d) 8
So W – B = 63 – 1 = 62 = 2 mod 4
Which is impossible. Answers:
1.d 2.a 3.b 4.d 5.b 6.9
13.Power can also be defined recursively as
Power (a,n)
--inputs : n integer
n
--output : a
If( n=0 ) --base case
1
else if(n is odd)
a x power (a,a n-1) -- recursion step
else (n is even)
a x power (a n/2 x a n/2) -- recursion step
33
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
34
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
35
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
36
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
Logical Operators
• Logical operators combine the results of one or more conditions. 42.Order of precedence of C++ Operators
• C++ provides three logical operators.
AND(&&), OR(||) are binary operators
NOT (!) is an unary operator
Assignment Operator
• It is used to assign a value to a variable.
• = is commonly used as the assignment operator.
• This operator copies the value at the right side to the left side
variable.
• It is also a binary operator.
Syntax : Variable = Value\ constant\ expression ;
Ex. a = 10;
37
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
47.Define Input operator or define Input statement . 50.What is the use of namespace std; or Define namespace std;
• The operator >> is called as “Stream extraction” or “get from” • It tells the compiler to use standard namespace.
operator. • Namespace collects identifiers used for class ,object and
• >> operator to get input. variables.
• It extracts the value through the keyboard and assigns it to the 51.What are the importance of main() function?
variable on its right. • Every C++ program must have a main function.
• The first operand is cin that identifies keyboard as the input • The main() function is the starting point where all C++ programs
device. begin their execution.
• The second operand must be a variable. • The executable statements should be inside the main() function.
Syntax : cin>>variable; ex. cin>>a;
cin>>var1>>var2>>var3; ex. cin>>a>>b; 52.How to creating and executing a C++ program
For yourself:
• To display the contents of the variable:
Syntax : cout<<variable; Ex. cout<<a;
• To display the Message only
Syntax : cout<<”Message”; Ex. cout<<”INDIA”;
• To display the Escape Sequence only
Syntax : cout<<”\escape seq.”; Ex. cout<<”\n”; 55.Explain how to work with Dev C++?
• To display the Message with Escape Sequence • Double click Dev C++ icon to open IDE
Syntax : cout<<”Message esc.seq.”; • To create a source file,
Ex. cout<<”INDIA\n”; • Select File → New → Source file or Press Ctrl + N.
• To display the result of expression • After save, Click Execute → Compile and Run or press F11 key.
cout<<a+b; • If your program is without any error, output will appear in output
• To display the constant or data. console.
cout<<7; or cout<< 2+3; 56.What are the types of Errors?
• To display Message escape ,sequence ,variable Some common types of errors are ,
cout<<”Message”<<’\n’<<variable; Syntax error
ex. cout<< “ The Result is..”<< ‘\t’ << c; • Syntax error occur when grammatical rules of C++ are violated.
• Ex. cout<<”INDIA” - it will throw an error because It does not end
with a semicolon.
38
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
39
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
61.Write about Fundamental data types. 3. What is the advantage of floating point numbers over integers?
• Predefined data types are Fundamental data types available with Ref. 61.
C++. • Because more fractions accommodated in double than in float type
• There are five fundamental data types in C++: char, int, float, 5. What is the use of void data type?Ref.61
double and void. 62.What are the Memory representation of Fundamental Data types
int data type: in C++?
• Integers are whole numbers without any fraction. • C++ compiler allocates specific memory space for each and every
• Integers can be positive or negative. data .
• It accepts and returns only integer numbers. • Every data is stored inside the computer memory in the form of
• .Ex. int a = 5; int x = -4 ; binary digits
int a= 4.5 (it will accept only 4)
Evaluate Yourself….
40
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
char type
Variables
65.Define variables.
• Variables are user-defined names.
• Variables are memory locations in which the values are stored.
• Variables are also identifiers.
• These are called as symbolic variable because these are named
location.
• They are R-value and L-value.
• R-value is data stored in a memory location
Floating point type • L-value is the memory address .
• The memory addresses are in the form of Hexadecimal values
• Ex. Let int a = 5; Here Variable name is a ;R value is 5 ; L value is
0x12b(for example)
41
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
Evaluate Yourself..
43
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
45
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
12.Explain conditional operator with an example. default: cout<<"\n , You have Failed..";
• The conditional operator(?:) (or) Ternary operator is an alternative } }
for ‘if else statement’. output
• It takes three operands. Enter your Mark 79
Syntax: Condition ? expression 2 : expression 3 You scored 79%
First division
Working of a program
* If x=76
* case 7 statement will execute directly and terminated by break;
• if the condition is true (Non-zero),
* If switch expression gets other then the case value default statement
• then the control is transferred to expression 2, otherwise, the
will execute
control passes to expression 3.
Example:
14.Differentiate between switch and if…else statement.
#include<iostream>
if…else switch
using namespace std;
Condition/ Expression decide Condition/Expression decide
int main()
whether if block or else block is which case to execute
{
execute.
int a,b,g;
cin>>a>>b; Uses multiple expression for Uses single expression for
g=(a>b)?a:b; multiple choices. multiple choices
cout<<g<<" IS GREATER"; logical expression checks only for expression
return 0; It evaluates integer ,char , It evaluate only char ,int and
} float, pointer or Boolean data enum data type
13.Explain switch statement with an example. (or) type
Write the syntax and purpose of switch statement. If expression is false, else If expression is false, default
• The switch statement is a multi-way branch statement. statement will be execute. statement will be execute.
• Based on a condition, the control is transferred to one of the many Difficult to edit Easy to Edit
possible points.
• It replaces else if statement. 15.Explain an Iteration or Loop statements ( or )
Syntax: Define Iteration Statements
switch (expression/variable) • It is also called Looping Statement.
{ • An Iteration statement is a set of statements that are
case 1 : action block 1; break; repeatedly executed until a condition is TRUE.
case 2 : action block 2; break; • It is also called control flow statements.
default : action block 3; • C++ supports three types of iteration statements.
} • They are, i) for ii) while iii) do…while
• When expression value matches against the case value, 16.Explain the Parts of a loop.
• that respective set of statements are executed. Every loop has four elements .They are
• Otherwise, the default statement is executed. • Initialization expression
Example: • Test expression
#include<iostream> • Update expression
using namespace std; • The body of the loop
int main() Initialization expression(s):
{ • The control variable(s) must be initialized before enters into
int p,x; loop.
cout<<"\n Enter your mark "; • It is executed only once in the beginning of the loop.
cin>>p; Test Expression:
cout<<" \nYou scored "<<p<<"%\n"; • If condition is TRUE, the loop-body will be execute otherwise the
x=p/10; loop is terminated.
switch( x ) Update expression:
{ • used to change the value of the control variable.
case 10: case 9: case 8: cout<<"\nDistinction" ; break; The body of the loop:
case 7: case 6 : cout<<"\nFirst division" ; break; • Set of statements forms a body of the loop that are executed
case 5:cout<<"\nSecond division" ; break; repetitively.
case 4: cout<<"\nThird division" ; break;
46
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
17.What are the difference between Entry controlled loop and Exit 22.Define infinite loop.
controlled loop?. • If condition is absent in a for loop is called infinite loop. Ex.
Entry controlled Exit controlled for(i=0; ; ++i) ( or ) for( ; ; )
Test-expression/condition is Test-expression/condition is
placed at the beginning of the placed at the end of the body of 23.Differentiate between empty and infinite loop . Ref above ans
body of the loop the loop 24.What is the output of the following code?
First the test-expression is First the body of the loop is int i;
evaluated. executed for(i=0;i<=5;i++);
The body of loop will be executed The body of loop will be executed { cout<< “ We are Indians”; }
only when condition is true at least one time • It is an empty loop
• The body of loop contains a null statement(;)
Ex.for , while do…while 25.Explain While loop with an example.
18.Explain for loop with an example • It is an Entry controlled loop.
• It is an Entry controlled loop. • The condition (Test –Expression) placed at the beginning of the
• Test-expression/condition is placed at the beginning of the body body of the loop.
of the loop Syntax:
• for loop contains initialization , test expression and update Initialization;
expression but these are optional. while ( Test expression )
Syntax: {
for(Initialization ; test-Expression ; update expression) Body of the loop;
{ Update expression;
Statements; }
} General working for loop
General working for loop 1.First the control variable is initialized
1.First the control variable is initialized 2. If the condition is false, the control exit from loop.
2.If the condition is false, the control exit from loop. 4. If the condition is true, the body of the loop is
4.If the condition is true, the body of the loop is executed,
executed, 5. Next the control is to update expression.
5. Next the control is to update expression. 6.After this, the control is again transferred to the condition.
6.After this, the control is again transferred to the condition. Example:
7.Next the steps 3 to 5 is repeated. #Include<iostream>
Example: using namespace std;
#Include<iostream> int main()
using namespace std; {
int main() int n=1;
) while(n<5)
{ {
for(int n=1;n<5;n++) cout <<n;
{ n++;
cout <<n }
} }
} Output: 1234
Output
1234 26.What is the following code?
19.Why always prefer prefix increment/decrement operator over int main()
postfix when to be used alone? {
• Because prefix operators are executed faster than postfix. int i=0;
20.Give an example of infinity loop and empty loop while(++i<100)
for( int i=0 ;; i++) - infinity loop return 0; }
for( ; ; ) - infinity loop • This is empty loop
21.What is an empty loop? • It does not contain any statement.
• Empty loop means a loop has no statement in its body is called an
empty loop.
Ex.for( int i=0 ; i<4 ; i++);
The body of loop contains a null statement(;)
47
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
27.What is the output of the following code? 29.Explain Nesting of Loop with an example.
int main() • A loop which contains another loop is called as a nested loop.
{ • The inner loop must be completely nested inside the body of the
int i=0; outer loop.
while(i<100) • An outer loop and inner loop cannot have the same control
cout <<I; variable, as it will lead to logical errors.
return 0; Syntax:
} Loop 1() for(int i = 1; i <= 3; i++)
• It is an infinity loop { {
• Because no update statement Loop 2() int j = 1;
{ while (j <= i)
28.Explain do..while loop with an example. block 2; {
• do.. while is an Exit controlled loop, } cout << “* “;
• The condition placed at the end of the body of loop. block 1; j++;
• The body of loop will be executed at least one time. } }
Syntax: cout << ‘\n’;
Initialization; }
do
{ working of the above program:
statement; The iterations of the nested loops are as follows;
update expression; For loop While loop
} while (condition); I=1 Is executed once(j<=1)
I=2 Is executed twice (j=1,2)
General working do..while loop I=3 Is executed thrice(j=1,2,3)
1.First the control variable is initialized. 30.Define jump statements
2.The body of the loop is executed, and update expression. It is used to transfer the control from one part of the program to
3.Then to condition. another with out condition. They are,
4 .If the condition is false, the control exit from loop. • goto statement
5. If the condition is true, the body of the loop is • break statement
executed, . • continue statement
Example 31.Explain goto statement with an example (or) explain
#Include<iostream> unconditional statement in C++.
using namespace std; • It is an unconditional statement.
int main() • It is used to transfer the control from one part of the program to
{ another with out condition.
Int n=1; Syntax:
do goto label; Syntax
{ cout <<n ………………. Label:
n++; ……………….. …..
}while(n <3); ………………. ……..
} Label: goto Label;
Return o;
} Here ,
• Label is an identifier.
• When goto label; is encountered, the control of program jumps
to label: and executes the code below it.
Example:
#Include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
if(a>b)
goto true;
48
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
49
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
51
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
52
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
18.Explain the Methods of calling functions. Note: m1 -> Actual parameter a -> Formal Parameter
What are the different ways of passing parameters in 21.Explain inline function with example
C++ functions? • An inline function inserts the function’s code directly into the
• The call statement communicates with the function calling program.
through arguments or parameters. • Insert the keyword inline in the function header
• There are two ways of passing parameters in C++ (Ex inline void swap (int a))
functions . • It is just a request to the compiler
1.Call by value 2. Call by reference. Sometimes the compiler will ignore the request
Advantages of inline functions:
19.Explain call by value in C++ with an example. • Inline functions execute faster but requires more
• The formal parameter creates new variables and stores the memory space.
value from actual parameter • Reduce the complexity of using STACKS.
• This method copies the values of actual parameters into the formal Ex.
parameters #include <iostream >
• Any change in the formal parameter is not reflected back to the using namespace std;
actual parameter. inline void swap (int a)
Ex. { a=8;
#include <iostream > cout << ‘\n’<< a;
using namespace std; }
void swap (int a) int main ( )
{ a=8; {
cout << ‘\n’<< a; int m1 = 10;
} cout <<m1 ;
int main ( ) swap (m1);
{ cout << ‘\n’<< m1;
int m1 = 10; }
cout <<m1 ;
53
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
54
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
4. Class scope
• A class is a new way of creating and implementing a
user defined data type.
• Access specifiers are , Private , protected and public.
class name
{
Private:
{ declaration; }
Protected:
{ declaration; }
Public:
{ declaration; }
};
55
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
56
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
58
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
59
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
60
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
61
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
62
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
18.Explain how the objects can be passed in pass by reference void square()
method. {
• object in formal parameter alias the object of actual parameter. n.prn();
• The formal object works directly on the actual object. x=2;
• Any changes made to the object inside the formal cout<< x * x;
parameter ,affect the actual object. }
#include <iostream> };
using namespace std;
class sample int main()
{ {
private: enclose e;
public: e.square();
void pass(sample &obj) }
{
-------- In the above program
} • The inner class nest is defined inside the outer class enclose.
}; • nest is accessed by enclose by creating an object of nest
int main()
{ Declaring an object of a class as a member to another class
sample s1,s2; • Whenever an object of a class is declared as a member of another
s2.pass(s1); class it is known as a container class.
return 0; • In the container-ship the object of one class is declared in another
} class.
19.What is nested class? #include<iostream>
• When one class become the member of another class then it is using namespace std;
called Nested class. class outer
20.What are the ways the classes can be nested? {
Classes can be nested in two ways. int data;
1. Defining a class within another class public:
2. Declaring an object of a class as a member to another class void get();
Defining a class with in another };
• When a class is declared with in another class, class inner
• The inner class is called as Nested class . {
• The outer class is known as Enclosing class. int value;
• Nested class can be defined in private as well as in the public outer ot;
section of the Enclosing class. public:
#include<iostream> voidgetdata();
using namespace std; };
class enclose Intmain()
{ {
private: Inner x;
int x; }
class nest In the above program
{ • Class outer and inner are defined separately.
private : • But both the classes are connected by the object 'ot' which is a
int y; member of class inner.
public: 21.What is Container class?
void prn() • Whenever an object of a class is declared as a member of another
{ class it is known as a container class.
y=3; 22.Write the example how will you dynamically initialize objects?
cout<<y; • When the initial values are provided during runtime is called
} dynamic initialization.
}; Example
nest n; #include<iostream>
public: using namespace std;
63
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
64
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
65
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
66
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
12.List out the operators that cannot be overload in C++ Rules or Restrictions on Operator Overloading
• scope operator (:: ) • Precedence and Associativity of an operator cannot be changed.
• sizeof • No new operators can be created,
• member selector ( . ) • Only existing operators can be overloaded.
• member pointer selector (* ) • Cannot redefine the meaning of an operator’s procedure.
• ternary operator ( ?: ) • Overloaded operators cannot have default arguments.
13.How to define operator overload in C++ • When binary operators are overloaded, the left hand object must be
• The definition of the overloaded operator is given using the keyword an object of the relevant class
'operator' followed by an operator symbol.
Syntax:
Inline:
ReturnType operator operatorSymbol(argument)
{
}
Ex. complex operator +( complex c2)
{
}
Outline:
ReturnType classname : : operator operatorSymbol(argument)
{
}
67
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
5. Hybrid inheritance
A combination of more than one type of
inheritance is known as hybrid inheritance.
It may be a combination of Multilevel and Multiple
or Hierarchical and Multilevel or Hierarchical,
68
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
• When classes are inherited the private members of the base class The following table contain the members defined inside each class
are not inherited they are only visible i.e continue to exist in before inheritance
derived classes, and cannot be accessed
9.Differentiate between private and public visibility modes.
Ref. above ans.
69
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
}
12.WriteSome Facts about the execution of constructor in Output:
inheritance. Constructor of base class...
• Base class constructors are executed first ,before the derived Constructor of derived ...
class constructors execution Constructor of derived1 ...
• Derived class can not inherit the base class constructor. Destructor of derived1 ...
• If there are multiple base classes ,then its start executing from the
Destructor of derived ...
left most base class
• In multilevel inheritance, the constructors will be executed in the
Destructor of base class....
order of inheritance
14.How the size of derived class object is calculated?
13.Find the output of the following program.
Size of derived class object =
#include<iostream>
using namespace std;
Size of all base class data members + size of all derived class data
class base
members.
{
15.What do you mean by overriding /Shadowing?
public:
• When a derived class member function has the same name as
base()
that of its base class member function ,
{
• The derived class member function shadows/hides the base
cout<<"\nConstructor of base class...";
}
class’s inherited function .
~base() • This situation is called function overriding /Shadowing .
{ • This can be resolved by giving the base class name followed by ::
cout<<"\nDestructor of base class.... "; and the member function name
} Ex. employee :: display();
};
Class derived : public base 16.Define“this” pointer
{ • this pointer used to refer the current objects members
public : • 'this' pointer is a constant pointer that holds the memory address
of the current object. .
derived()
{ • It identifies the currently calling object.
cout<< "\nConstructor of derived ...";
• It is useful when the argument variable name in the member
function and the data member name are same. Syntax: this->data
}
member name
~derived()
{ #include<iostream>
cout<< "\nDestructor of derived ..."; using namespace std;
} class T
}; {
class derived1 :public derived public:
int x;
{
void foo()
public : {
derived1() x = 6; // same as this->x = 6;
{ this->x = 5; // explicit use of this->
cout<< "\nConstructor of derived1 ..."; cout<<endl<<x<<" "<<this->x;
}
}
void foo(int x)
~derived1() {
{ this->x = x; // unqualified x refers to the parameter.'this->' required
cout<< "\nDestructor of derived1 ..."; for disambiguation
} cout<<endl<<x<<" "<<this->x;
}; }};
int main()
{
derived1 x;
return 0;
70
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
Constructor of publisher
Constructor of branch
17.Answer the following questions based on the given program. Constructor of author
#include<iostream> Destructor of author
#include<string.h> Destructor of branch
#include<stdio.h> Destructor of publisher
using namespace std; d. Name the base class(/es) and derived class (/es).
class publisher Base class: publisher, branchDerived class:author
{ e. Give number of bytes to be occupied by the object of the following
charpname[15]; class: (a) publisher (b) branch (c) author
charhoffice[15]; publisher:93 bytes branch:64 bytes author: 28 bytes
char address[25]; f. Write the names of data members accessible from the object of class
double turnover; author.
protected: Phone,no_of_emp, bphone,aut_code,aname,income
char phone[3][1O]; g. Write the names of all member functions accessible from the object of
void register(); class author.
public: getdata(),putdata(),give data(),have data(),disp data(), enter data();
publisher(); h. Write the names of all members accessible from member functions of
~publisher(); class author
void enter data(); getdata(),putdata(),give data(),have data(),disp data(), enter
voiddisp data(); data(),register()
}; Phone,no_of_emp, bphone,aut_code,aname,income
class branch 18.Consider the following c++ code and answer the questions
{ class Personal
charbcity[15]; {
charbaddress[25]; IntClass,Rno;
protected: char Section;
intno_of_emp; protected:
public: char Name[20];
charbphone[2][10]; public:
branch(); personal();
~branch(); voidpentry();
void have data(); voidPdisplay();
void give data();
};
};
ClassMarks:private Personal
{
class author: public branch, publisher
float M{5};
{ protected:
Intaut_code; char Grade[5];
Charaname[2O]; public:
float income; Marks();
public: void M entry();
author(); void M display();
~author(); };
voidgetdata(); classResult:public Marks
voidputdata();
{
};
floatTotal,Agg;
public:
charFinalGrade, Commence[20];
a.Which type of Inheritance is shown in the program?
Result();
Multiple inheritance void R calculate();
b.Specify the visibility mode of base classes. void R display();
public: }:
c. Give the sequence of Constructor/Destructor Invocation when object a. Which type of Inheritance is shown in the program?
of class author is created.
71
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
Multilevel Inheritance {
b. Specify the visibility mode of base classes. protected:
private , public int y;
c Give the sequence of Constructor/Destructor Invocation when object of public:
class Result is created. B(int x, int y)
Constructor
Personal() {
Marks() this->x = x;
Result() this->y = y;
Destructor }
Result() B()
Marks() {
Personal() cout<<endl<<" I am class B "<<endl;
d. Name the base class(/es) and derived class (/es). }
Base :Personal, Marks Derived : Marks , Result ~B()
e. Give number of bytes to be occupied by the object of the following {
class: cout<<endl<<" Bye ";
(a) Personal turbo 25bytes,devc++ 29bytes }
(b) Marks 25 bytes(c) Result 29bytes void show()
{
f. Write the names of data members accessible from the object of class cout<<"x = "<<x<<endl;
Result. cout<<"y = "<<y<<endl;
Name,Grade,total,Agg,FinalGrade.Commence }
g. Write the names of all member functions accessible from the object of };
class Result. int main()
R calculate(),R display(),M entry(),M display(),personal();void {
pentry(); voidPdisplay(); AobjA;
h. Write the names of all members accessible from member functionsof B objB(30, 20);
class Result. objB.show();
R calculate(),R display(),M entry(),M display(),personal();void return 0;
pentry(); voidPdisplay(); }
Output:
19.Write the output of the following program I am class A
#include<iostream> I am class B
using namespace std; X=30
class A Y=20
{ Bye
protected: Bye
int x; 20.Debug the following program
public:
void show() Output
{ -------------
cout<<"x = "<<x<<endl; 15
} 14
A() 13
{ Program :
cout<<endl<<" I am class A "<<endl; -------------
} %include(iostream.h)
~A() #include<conio.h>
{ Class A
cout<<endl<<" Bye "; {
} public;
}; int a1,a2:a3;
class B : public A Void getdata[]
{ {
a1=15;
72
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
a2=13;a3=13;
}
}
Class B:: public A()
{
PUBLIC
voidfunc()
{
int b1:b2:b3;
A::getdata[];
b1=a1;
b2=a2;
a3=a3;
cout<<b1<<’\t’<<b2<<’t\’<<b3;
}
void main()
{
clrscr()
B der;
der1:func();
getch();
}
To Know Yourself
Define Pointer variable
• A pointer is a variable that hold a memory address of other variable
• In Pointer ,the memory location of a variable can be directly
accessed.
• The address of ( & ) and the value at operator (*)are deals with
pointer.
To declare
Syntax :data type *Variable name;
Ex. Int *abc;- Here The variable abc can only
store addresses.
Initialization of pointer variable:
Int *abc , n;
n=10;
abc = &n;
• Pointer variable can store the address of other variables
• Pointer variable and assigning variable should have same data type.
---------------------------------------------------
For example
Int *abc ; float n;
n=10.5;
abc = &n;
Compiler shows an error because,
Pointer variable and assigning variable should have same data type
==============================================
73
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
74
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
75
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
2.Define e – Governance:
• Getting Government services through internet is known as e-Governance.
• One can get important announcements, government orders, and
government welfare schemes from the web portal of Govt.
• Ex.www.tn.gov.in\ta
3.Define e-Library
• E-Libraries are portal or website of collection of e-books.
• E-Library services provide thousands of Books as e-books mostly at free
of cost.
• Ex.www.chennailibrary.com
76
www.rmkmhsselango.blogspot.com 9677515019
ILANGOVAN ,RMKMHSS - 601206 9677515019
77
www.rmkmhsselango.blogspot.com 9677515019
11
COMPUTER SCIENCE
PRACTICAL
9677515019
www,rmkmhsselango.blogspot.com
Write a C++ program to input basic salary of an employee and calculate its Gross salary according to following:
Basic Salary <25000 : HRA = 20%, DA = 80%
Basic Salary >= 25000 : HRA = 25%, DA = 90%
Basic Salary >= 40000 : HRA = 30%, DA = 95%
AIM:
To input basic salary of an employee and calculate its Gross salary
CODING:
#include<iostream>
using namespace std;
int main()
{
float b,g,d,h;
cout<<"Enter Basic Salary of an Employee"; cin>>b;
if (b<25000)
{
d=b*80/100;
h=b*20/100;
}
else if (b>=25000 && b<40000)
{
d=b*90/100;
h=b*25/100;
}
else if (b>=40000)
{
d=b*95/100;
h=b*30/100;
}
g=b+d+h;
cout<<"\nBasic\t"<<b;
cout<<"\nDA\t"<<d; Output:
cout<<"\nHRA\t"<<h; Enter basic salary of an employee: 25000
cout<<"\nGross Salary\t"<<g; Basic 25000
} DA 22500
HRA 6250
Gross Salary : 53750
CS2 - PERCENTAGE
Write a C++ program to check percentage of a student and display the division (distinction, first, second, third
or fail) scored using switch case.
Percentage Division
>=80 Distinction
>=60 and <80 First division
>=50 and <60 Second Division
>=40 and <50 Third Division
<40 Fail
AIM: To check percentage of a student and display the division
CODING:
#include<iostream>
using namespace std;
int main()
{
int p,x;
cout<<"\n Enter Your Percentage "; cin>>p;
cout<<" \nYou Scored "<<p<<"%\n";
x=p/10;
switch( x )
{
case 10: case 9: case 8: cout<<"\nDistinction" ; break;
case 7: case 6 : cout<<"\nFirst division" ; break;
case 5:cout<<"\nSecond division" ; break; Output 1
case 4: cout<<"\nThird division" ; break; Enter your percentage 79
You scored 79%
default: cout<<"\nSorry , You have Failed.."; First division
Output 2
} Enter your percentage: 39
You scored 39%
} Sorry: You have failed
CS3 - PALINDROME
Write a C++ program to enter any number and check whether the number is palindrome
or not using while loop.
AIM: To enter any number and check whether the number is palindrome
CODING:
#include<iostream>
using namespace std;
int main()
{
int n,x,d,r =0;
cout<<"\n Enter a Positive Number";
cin>>n;
x = n;
while(n!=0)
Output 1
{ Enter a positive number: 1234
r=(r*10) + n%10; The Reverse number is: 4321
NOT A PALINDROME
n = n/10;
} Output 2
Enter a positive number: 1221
cout<<"\nThe Reverse Number is "<<r; The Reverse number is: 1221
if(x==r) PALINDROME
cout<<"\nPALINDROME";
else
cout<<"\n NOT A PALINDROME";
}
CS4 NUMBER CONVERSION
Using do while loop create the following menu based C++ program
1.Convert a Decimal to binary number
2.Convert a binary number to Decimal
3. Exit Depending on the choice accept the value and display the result .The program should continue till the user
select the third option
AIM:To Convert a Decimal to binary number and a binary number to Decimal in menu based using do..while loop
CODING:
#include<iostream>
#include<math.h> Output
using namespace std; 1.Decimal to Binary number
int main() 2.Binary to Decimal number
{ 3.Exit
int d=0,c,i; Enter your choice(1/2/3)1
long int b=0; Enter a Decimal Number: 23
do In decimal … 10111
{
cout<<"\n1.Decimal to Binary\n2.Binary to Decimal\n3.Exit"; 1.Decimal to Binary number
cout<<"\nEnter Your Choice (1 / 2 / 3)"; 10
cin>>c; 2.Binary to Decimal number
switch(c) 3.Exit
{ Enter your choice(1/2/3)2
case 1: cout<<"\nEnter a Decimal Number"; Enter a Binary Number: 11001
cin>>d; In binary … 25
i=0;
while(d!=0) 1.Decimal to Binary number
{ 2.Binary to Decimal number
b+=d%2*pow(10,i); 3.Exit
d/=2; Enter your choice(1/2/3) 3
i++;
}
cout<<"\n In Binary “<<b; break;
case 2: cout<<"\nEnter a Binary number";
cin>>b;
i=0;
while(b!=0)
{
d+=b%10*pow(2,i);
b/=10;
i++;
}
cout<<"\n\n Decimal"<<d; break;
case 3: break;
default: cout<<"\nEnter only 1 / 2 / 3:";
}
} while(c!=3);
}
CS5 - FIBONACCI PRIME SERIES
Write a C++ program using a user defined function to generate the Fibonacci series till n terms and print if
each term is prime or Composite.
AIM: To generate the Fibonacci series till n terms and print if each term is prime or Composite
CODING:
#include <iostream>
#include <stdlib.h>
using namespace std;
void prime (int a )
{
if ( a == 0 || a == 1 ) cout<< " \t NEITHER PRIME NOR COMPOSITE ";
else
{
for (int j = 2 ; j<a; j++)
{
if (a % j == 0) { cout<< "\t COMPOSITE" ;break ; }
}
if ( a == j ) cout<< "\t PRIME" ;
} Output
} ENTER THE NUMBER OF TERMS 10
void fib ( int n ) FIBONACCI SERIES
{ 0 NEITHER PRIME NOR COMPOSITE
int a = -1 , b = 1 ,c=0 ; 1 NEITHER PRIME NOR COMPOSITE
for ( int i = 1 ; i <= n ; i++) 1 NEITHER PRIME NOR COMPOSITE
{ 2 PRIME
cout<<”\n”; 3 PRIME
c=a+b; 5 PRIME
cout<<c; 8 COMPOSITE
prime(c); 13 PRIME
a = b; 21 COMPOSITE
b=c; 34 COMPOSITE
}
}
int main ()
{
int n ;
cout << " \n ENTER THE NUMBER OF TERMS " ; cin >> n ;
cout<< "\n FIBONACCI SERIES\n " ;
fib (n) ;
}
ABC PUBLISHERS
~~~~~~~~~~~~~~
INVOICE
~~~~~~~
==================================
Book Number : 1001
Title : C++Programming
Author Name : Balaguru
Price Per Book : 500
Total Amount : 1500
=================================
ABC PUBLISHERS
~~~~~~~~~~~~~~
INVOICE
~~~~~~~
==================================
Book Number : 1002
Title : CoreJava
Author Name : Xavier
Price Per Book : 250
Total Amount : 1250
==================================
CS9 - EMPLOYEE DETAILS USING CLASS
Create a C++ program to create a class employee containg the following members
AIM: To create a class employee contain the following members
Coding
#include<iostream>
using namespace std;
class emp{
public:
int eno;
char name[20], des[20];
void get(){
cout<<"Enter the employee number:";
cin>>eno;
cout<<"Enter the employee name:";25
cin>>name;
cout<<"Enter the designation:";
cin>>des;
}
};
class salary :public emp
{
float bp,hra, da,pf,np;
public:
void get1()
{
cout<<"Enter the basic pay:";
cin>>bp;
cout<<"Enter the HouseRent Allowance:";
cin>>hra;
cout<<"Enter the Dearness Allowance :";
cin>>da;
cout<<"Enter the Provident Fund:";
cin>>pf;
}
void calculate()
{
np=bp+hra+ da -pf;
}
void display()
{
cout<<eno<<"\t"<<name<<"\t"<<des<<"\t"<<bp<<"\t"<<hra<<"\t"<<da<<"\t"<<pf<<"\
t"<<np<<"\n";
}
};
int main(){
int i, n;26
char ch;
salary s[10];
cout<<"Enter the number of employee:";
cin>>n;
for (i =0; i < n; i++){
s[i].get();
s[i].get1();
s[i].calculate();
}
cout<<"\n\t\t\tEmployee Details\n";
cout<<"\ne_no \t e_name\t des \t bp \t hra \t da \t pf \t np \n";
for (i =0; i < n; i++){
s[i].display();
}
return 0;
}
Output
Enter the number of employee:2
Enter the employee number:1201
Enter the employee name:Ramkumar
Enter the designation:Engineer
Enter the basic pay:50000
Enter the House Rent Allowance:10000
Enter the Dearness Allowance :5000
Enter the Provident Fund:1000