11th Comp - Sci EM MLM
11th Comp - Sci EM MLM
COMPUTER SCIENCE
Minimum Learning Materials
Prepared By,
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 2
5. Write the functions of control unit.
The control unit controls the flow of data between the CPU, memory and I/O
devices.
6. What is the function of memory?
Memory enables the computer to store the program. The memory unit is of two
types: 1. Primary memory 2. Secondary memory
7. Differentiate Input and output unit.
Input unit Output unit.
Input unit is used to feed any form of data An Output Unit is any hardware
to the computer. component that conveys information to
users in an understandable form.
8. Distinguish Primary and Secondary memory.
Primary Memory Secondary memory
The primary memory is used to store the The secondary memory is used to store
data temporarily. the data permanently.
Example: RAM Example: Hard disk, CD-ROM and DVD
Short Answers:
1. What are the characteristics of a computer?
Speed * Accuracy * Reliability
Diligence * Multi Processing * Memory
2. Write the applications of computer.
Computers are used to storing data, in the field of education, research, travel and
tourism, weather forecasting, social networking, e-commerce, booking airlines,
railway or movie tickets and even playing games.
3. What is an input device? Give two examples.
Input unit is used to feed any form of data to the computer, which can be stored
in the memory unit for further processing. Example: Keyboard, mouse, etc.
4. Name any three output devices.
Monitor: Monitor is used to display the information.
Printers: Printers are used to print the information on papers.
Plotter: Plotter is used to produce graphical output on papers.
5. Write short note on impact printer.
These printers print with striking of hammers or pins on ribbon.
Example: Dot Matrix printers and Line matrix printers.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 3
Explain in detail:
1. Explain the basic components of a computer with a neat diagram.
Input Unit: To feed any form of data to the computer. Example: Keyboard, mouse, etc.
Central Processing Unit: Three components,
The control unit controls the flow of data between the CPU, memory and I/O
devices.
The ALU performs arithmetic operations
Memory enables the computer to store the program.
Output Unit: Convey the information to users in an understandable form. Example:
Monitor, Printer etc.
Memory Unit: Two types:
The primary memory is used to store the data temporarily.
The secondary memory is used to store the data permanently.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 4
CHAPTER 2: Number Systems
Choose the correct answer:
1. Which refers to the number of bits processed by a computer‘s CPU?
A) Byte B) Nibble C) Word length D) Bit
2. How many bytes does 1 KiloByte contain?
A) 1000 B) 8 C) 4 D) 1024
3. Expansion for ASCII
A) American School Code for Information Interchange
B) American Standard Code for Information Interchange
C) All Standard Code for Information Interchange
D) American Society Code for Information Interchange
4. 2^50 is referred as
A) Kilo B) Tera C) Peta D) Zetta
5. How many characters can be handled in Binary Coded Decimal System?
A) 64 B) 255 C) 256 D) 128
6. For 11012 the equalent Hexadecimal equivalent is?
A) F B) E C) D D) B
7. What is the 1‘s complement of 00100110?
A) 00100110 B) 11011001 C) 11010001 D) 00101001
8. Which amongst this is not an Octal number?
A) 645 B) 234 C) 876 D) 123
Short Answers:
1. What is radix of a number system? Give example.
Radix or base is the count of number of digits in each number system.
Example : The decimal number system has ten distinct digits (0, 1, 2, 3, 4, 5, 6, 7,
8, 9) - Radix 10
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 5
2. Write note on binary number system.
There are only two digits in the Binary system, namely, 0 and 1.
The left most bit in the binary number is called as the Most Significant Bit
(MSB) and it has the largest positional weight.
The right most bit is the Least Significant Bit (LSB) and has the smallest
positional weight.
3. Convert (150)10 into Binary, then convert that Binary number to Octal.
Step 1: Convert (150)10 into Binary:
2 150
2 75 – 0
2 37 – 1
2 18 – 1
2 9 –0
2 4 –1
2 2 –0
1 –0
15010 = 100101102
Step 2: Convert 100101102 to Octal:
010 010 110
2 2 6
15010 = 2268
4. Add a) -2210+1510 b) 2010+2510
(a) -2210 + 1510
The Binary Equivalent of 2210 : 101102
8 – Bit Format: 00010110
1‘s Complement: 11101001
Add 1 Bit: ____ 1
2‘s Complement: 11101010
-22 = 1110 1010
15 = 0000 1111
-2210 + 1510 = 1111 1001
b) 2010+2510
The Binary Equivalent of 2010 = 10100
The Binary Equivalent of 2510 = 11001
2010 + 2510 = 101101
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 6
Explain in detail:
1. a) Write the procedure to convert fractional Decimal to Binary .
The steps involved in the method of repeated multiplication by 2:
Multiply the decimal fraction by 2 and note the integer part. The integer part
is either 0 or 1.
Discard the integer part of the previous product. Multiply the fractional part
of the previous product by 2. Repeat Step 1 until the same fraction repeats or
terminates (0).
The resulting integer part forms a sequence of 0s and 1s that become the
binary equivalent of decimal fraction.
The final answer is to be written from first integer part obtained.
2 98
2 49 – 0
2 24 – 1
2 12 – 0
2 6–0
2 3–0
1–1
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 7
2. Find 1‟s Complement and 2‟s Complement for the following Decimal number
a) -98 b) -135
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 8
Part - II - Boolean Algebra
Choose the correct answer:
1. Which is a basic electronic circuit which operates on one or more signals?
(A) Boolean algebra (B) Gate
(C) Fundamental gates (D) Derived gates
2. Which gate is called as the logical inverter?
(A) AND (B) OR ( C) NOT (D) XNOR
3. A + A = ?
(A) A (B) O (C ) 1 (D) A
4. NOR is a combination of ?
(A) NOT(OR) (B)NOT(AND) (C ) NOT(NOT) (D) NOT(NOR)
5. NAND is called as …… Gate
(A) Fundamental Gate (B) Derived Gate
(C ) Logical Gate (D) Universal gate
Short Answers:
1. Write the De Morgan‟s law.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 9
Explain in detail:
1. Explain the fundamental gates with expression and truth table.
There are three fundamental gates namely AND, OR and NOT.
AND gate:
The AND gate can have two or more input signals and produce an output signal.
The output will be 1 if and only if both inputs are 1; otherwise the output is 0.
The logical symbol of AND gate and Truth Table:
OR Gate
The OR gate gets its name from its behaviour like the logical inclusive "OR".
The output will be 1 if and only if one or both inputs are 1; otherwise, the output
is 0.
The logical symbol of OR gate and Truth Table:
NOT Gate
The NOT gate, called a logical inverter, has only one input. It reverses the logical
state.
The logical symbol of NOT gate and Truth Table:
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 10
2. Explain the Derived gates with expression and truth table.
NAND, NOR, XOR, XNOR are Derived Gates which are derived from the
fundamental gates.
NAND Gate:
The NAND gate operates an AND gate followed by a NOT gate.
The output is 0 if both the inputs are 1, otherwise the output is 1.
The logical symbol of NAND gate and Truth Table:
NOR Gate
The NOR gate circuit is an OR gate followed by an inverter.
The output is '1' if both the inputs are '0'. Otherwise the output is 0.
The logical symbol of NOR gate and Truth Table:
XOR Gate:
The XOR (exclusive - OR) gate acts in the same way as the logical "either/or."
The output is 1 if the inputs are different, but 0 if the inputs are the same.
The logical symbol of XOR gate and Truth Table:
XNOR gate.
The XNOR (exclusive – NOR) gate is a combination of XOR gate followed by an
inverter.
The output is 1 if the input are the same, otherwise the output is 0.
The logical symbol of XNOR gate and Truth Table:
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 11
CHAPTER 3: Computer Organisation
Choose the correct answer:
1. Which of the following is said to be the brain of a computer?
(a) Input devices (b) Output devices (c) Memory device (d) Microprocessor
2. Which of the following is not the part of a microprocessor unit?
(a) ALU (b) Control unit (c) Cache memory (d) register
3. How many bits constitute a word?
(a) 8 (b) 16 (c) 32 (d) determined by the processor used.
4. Which of the following device identifies the location when address is placed in the
memory address register?
(a) Locator (b) encoder (c) decoder (d) multiplexer
5. Which of the following is a CISC processor?
(a) Intel P6 (b) AMD K6 (c) Pentium III (d) Pentium IV
6. Which is the fastest memory?
(a) Hard disk (b) Main memory (c) Cache memory (d) Blue-Ray disc
7. How many memory locations are identified by a processor with 8 bits address bus at
a time?
(a) 28 (b) 1024 (c) 256 (d) 8000
8. What is the capacity of 12cm diameter DVD with single sided and single layer?
(a) 4.7 GB (b) 5.5 GB (c) 7.8GB (d) 2.2 GB
9. What is the smallest size of data represented in a CD?
(a) blocks (b) sectors (c) pits (d) tracks
10. Display devices are connected to the computer through.
(a) USB port (b) Ps/2 port (c) SCSI port (d) VGA connector
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 12
Short Answers:
1. Differentiate Computer Organisation from Computer Architecture.
Computer Organisation Computer Architecture
Computer Organisation deals with the Computer architecture deals with the
hardware components that are transparent engineering considerations involved in
to the programmer. designing a computer.
2. Classify the microprocessor based on the size of the data.
8-bit microprocessor * 16-bit microprocessor
32-bit microprocessor * 64-bit microprocessor
3. Write down the classifications of microprocessors based on the instruction set.
Reduced Instruction Set Computers (RISC)
Complex Instruction Set Computers (CISC)
Explain in detail:
1. Explain the characteristics of a microprocessor.
A Microprocessor‘s performance depends on the following characteristics:
Clock speed * Instruction set * Word size
Clock Speed
Every microprocessor has an internal clock that regulates the speed at which it
executes instructions.
Instruction Set
Basic set of machine level instructions that a microprocessor is designed to
execute is called as an instruction set.
Word Size
The number of bits that can be processed by a processor in a single instruction is
called its word size.
2. Arrange the memory devices in ascending order based on the access time.
Different memory devices are arranged according to the capacity, speed and cost.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 13
3. Explain the types of ROM.
Read Only Memory (ROM):
Read Only Memory refers to special memory in a computer.
ROM stores critical programs such as the program that boots the computer. Once
the data has been written onto a ROM chip, it cannot be modified or removed and
can only be read.
Programmable Read Only Memory (PROM):
Programmable read only memory is also a non-volatile memory on which data
can be written only once.
Erasable Programmable Read Only Memory (EPROM):
Erasable Programmable Read Only Memory is a special type of memory which
serves as a PROM, but the content can be erased using ultraviolet rays.
Electrically Erasable Programmable Read Only Memory (EEPROM):
Electrically Erasable Programmable Read Only Memory is a special type of
PROM that can be erased by exposing it to an electrical charge.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 14
CHAPTER 4: Theoretical concepts of Operating System
Choose the correct answer:
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) NFTS
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 15
5. What is multi-processing?
This is a one of the features of Operating System. It has two or more processors
for a single running process (job).
6. What are the different Operating Systems used in computer?
UNIX * Linux
Mac OS * MS-DOS
Microsoft Windows
Short Answers:
1. List out the key features of Operating system.
User Interface (UI)
Memory Management
Process management
Security Management
Fault Tolerance
File Management
Explain in detail:
1. Explain the process management algorithms in Operating System.
The following algorithms are mainly used to allocate the job (process) to the
processor. 1. FIFO 2. SJF 3. Round Robin 4. Based on Priority
FIFO (First In First Out) Scheduling:
This algorithm is based on queuing technique.
SJF (Shortest Job First) Scheduling:
This algorithm works based on the size of the job being executed by the CPU.
Round Robin Scheduling:
The Round Robin (RR) scheduling algorithm is designed especially for time
sharing systems. Jobs (processes) are assigned and processor time in a circular
method.
Based On Priority:
The given job (process) is assigned based on a Priority. The job which has higher
priority is more important than other jobs.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 16
CHAPTER 5: Working with Windows Operating System
Choose the correct answer:
1. From the options given below, choose the operations managed by the operating
system.
a. Memory b. Processes
c. Disks and 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. Windows 10 d. all of the above
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 rename a file in windows
a. F2 b.F4 c.F5 d. F6
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 18
Explain in detail:
1. Explain the versions of Windows Operating System.
Version Year Specific Feature
Windows 1.x 1985 Introduction of GUI in 16-bit Processor.
Windows 2.x 1987 Supports to minimize or maximize windows.
Windows 3.x 1992 Introduced the concept of multitasking.
Windows 95 1995 Introduced Start button, the taskbar, Windows
Explorer and Start menu.
Windows 98 1998 Plug and play feature was introduced.
Windows 2000 2000 Served as an Operating System for business desktop
and laptop systems.
Windows XP 2001 Introduced 64-bit Processor.
Windows 7 2009 Booting time was improved
Windows 8 2012 Served as common platform for mobile and computer.
Windows 10 2015 Start Button was added again, Multiple desktop.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 19
CHAPTER 6: Specification and Abstraction
Choose the correct answer:
1. Which of the following activities is algorithmic in nature?
(a) Assemble a bicycle (b) Describe a bicycle
(c) Label the parts of a bicycle (d) Explain how a bicycle works.
2. Which of the following activities is not algorithmic in nature?
(a) Multiply two numbers. (b) Draw a kolam.
(c) Walk in the park. (d) Swapping of two numbers.
3. Omitting details inessential to the task and representing only the essential features of
the task is known as
(a) specification (b) abstraction (c) composition (d) decomposition
4. Stating the input property and the input-output relation a problem is known
(a) specification (b) statement (c) algorithm (d) definition
5. Ensuring the input-output relation is
(a) the responsibility of the algorithm and the right of the user.
(b) the responsibility of the user and the right of the algorithm.
(c) the responsibility of the algorithm but not the right of the user.
(d) the responsibility of both the user and the algorithm
6. If i = 5 before the assignment i := i-1 after the assignment, the value of i is
(a) 5 (b) 4 (c) 3 (d) 2
7. If 0 < i before the assignment i := i-1 after the assignment, we can conclude that
(a) 0 < i (b) 0 ≤ i (c) i = 0 (d) 0 ≥i
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 20
CHAPTER 7: Composition and Decomposition
Choose the correct answer:
1. Suppose u, v = 10 ,5 before the assignment. What are the values of u and v after the
sequence of assignments?
1 u := v 2 v := u
(a) u, v = 5 ,5 (b) u, v = 5 ,10 (c) u, v = 10 ,5 (d) u, v = 10 ,10
2. Which of the following properties is true after the assignment (at line 3?
1 --i, j = 0, 0
2 i, j := i+1, j-1
3 -- ?
(a) i+j >0 (b) i+j < 0 (c) i+j =0 (d) i = j
3. If C1 is false and C2 is true, the compound statement
1 if C1
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
(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
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 21
Very Short Answers:
1. Distinguish between a condition and a statement.
CONDITION STATEMENT
Condition is the Checking process of either Processing the condition.
True / False.
A condition is contained in a diamond A statement is contained in a rectangular
shaped box with two outgoing arrows, box with a single outgoing arrow, which
labeled true and false. points to the box to be executed next.
EX: a>b EX: Print a (a-is a Biggest value)
2. Draw a flowchart for conditional statement.
Start
Stop
Short Answers:
1. What is case analysis?
Alternative statement analyses the problem into two cases. Case analysis
statement generalizes it to multiple cases.
Case analysis splits the problem into an exhaustive set of disjoint cases.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 22
CHAPTER 8: Iteration and recursion
Choose the correct answer:
1. A loop invariant need not be true
(a) at the start of the loop. (b) at the start of each iteration
(c) at the end of each iteration (d) at the start of the algorithm
2. We wish to cover a chessboard with dominoes, the number of black squares and the
number of white squares covered by 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
3. If m x a + n x b is an invariant for the assignment a, b : = a + 8, b + 7, the values of
m and n are
(a) m = 8, n = 7 (b) m = 7, n = -8 (c) m = 7, n = 8 (d) m = 8, n = -7
4. Which of the following is not an invariant of the assignment?
m, n := m+2, n+3
(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
0 n = 0
F (n) = 1 n = 1
F(n — 1) + F(n — 2) otherwise
1 if n = 0
n n -1
a = a x a otherwise
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 23
CHAPTER 9: Introduction to C++
Choose the correct answer:
1. Who developed C++?
(a) Charles Babbage (b) Bjarne Stroustrup (c) Bill Gates (d) Sundar Pichai
2. What was the original name given to C++?
(a) CPP (b) Advanced C (c) C with Classes (d) Class with C
3. Who coined C++?
(a) Rick Mascitti (b) Rick Bjarne (c) Bill Gates (d) Dennis Ritchie
4. The smallest individual unit in a program is:
(a) Program (b) Algorithm (c) Flowchart (d) Tokens
5. Which of the following operator is extraction operator in C++?
(a) >> (b) << (c) <> (d) ^^
6. Which of the following statements is not true?
(a) Keywords are the reserved words which convey specific meaning to the C++
compiler.
(b) Reserved words or keywords can be used as an identifier name.
(c) An integer constant must have at least one digit without a decimal point.
(d) Exponent form of real constants consist of two parts
7. Which of the following is a valid string literal?
(a) ‗A‘ (b) ‗Welcome‘ (c) 1232 (d) “1232”
8. A program written in high level language is called as
(a) Object code (b) Source code (c) Executable code (d) All the above
9. Assume a=5, b=6; what will be result of a&b?
(a) 4 (b) 5 (c) 1 (d) 0
10. Which of the following is called as compile time operators?
(a) sizeof (b) pointer (c) virtual (d) this
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 24
Short Answers:
1. Describe the differences between keywords and identifiers?
KEYWORDS IDENTIFIERS
Keywords are the reserved words Identifiers are the user-defined names
which convey specific meaning to the given to different parts of the C++
C++ compiler. program.
EX: int , void , break , do , if etc.. EX: name, mark, num etc..
2. Is C++ case sensitive? What is meant by the term “case sensitive”?
C++ is a case sensitive programming language.
C++ is case sensitive as it treats upper and lower-case characters differently.
3. Differentiate “=” and “==”.
= ==
= is a Assignment Operator. = = is a Equality Operator.
Assign a value of an Variable. To Indicate Two Operands are Equal.
Ex: a = 5 Ex: a= = b
4. What is the use of a header file?
iostream header file contains the definition of its member objects cin and cout.
If you fail to include iostream in your program, an error message will occur on
cin and cout; and we will not be able to get any input or send any output.
5. Why is main function special?
C++ program is a collection of functions. Every C++ program must have a main
function. The main( ) function is the starting point where all C++ programs begin
their execution.
Explain in detail
1. Write about Binary operators used in C++.
Binary Operators - Require two operands. C++ Operators are classified as:
Arithmetic Operators: Arithmetic operators to perform simple arithmetic
operations like addition, subtraction, multiplication, division etc.,
Operator Operation Example
+ Addition 10 + 5 = 15
- Subtraction 10 – 5 = 5
* Multiplication 10 * 5 = 50
/ Division 10 / 5 = 2 (Quotient of the division)
Modulus 10 % 3 = 1
%
(To find the reminder of a division) (Remainder of the division)
Relational Operators: Relational operators are used to determine the
relationship between its operands. When the relational operators are applied on
two operands, the result will be a Boolean value.
Operator Operation Example
> Greater than a>b
< Less than a<b
>= Greater than or equal to a >= b
<= Less than or equal to a <= b
== Equal to a == b
!= Not equal a != b
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 25
Logical operators : C++ provides three logical operators.
Operator Operation Description
&& AND The logical AND combines two different relational
expressions in to one. It returns 1 (True), if both expression
are true, otherwise it returns 0 (false).
|| OR The logical OR combines two different relational
expressions in to one. It returns 1 (True), if either one of the
expression is true. It returns 0 (false), if both the
expressions are false.
! NOT NOT works on a single expression / operand. It simply
negates or inverts the truth value. i.e., if an operand /
expression is 1 (true) then this operator returns 0 (false) and
vice versa
Assignment Operator: Assignment operator is used to assign a value to a
variable which is on the left hand side of an assignment statement. = (equal) is
commonly used as the assignment operator in all computer programming
languages. Ex: a = 5
2. What are the types of Errors?
Syntax Error:
Syntax is a set of grammatical rules to construct a program.
Syntax errors occur when grammatical rules of C++ are violated.
Example: cout << “Welcome to Programming in C++”
As per grammatical rules of C++, every executable statement should terminate
with a semicolon. But, this statement does not end with a semicolon.
Semantic Error:
A Program has not produced expected result even though the program is
grammatically correct.
It may be happened by wrong use of variable / operator / order of execution etc.
This means, program is grammatically correct, but it contains some logical error.
So, Semantic error is also called as “Logic Error.
Run-time error:
A run time error occurs during the execution of a program. It occurs because of
some illegal operation that takes place.
For example, if a program tries to open a file which does not exist, it results in a
run-time error.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 26
CHAPTER 9: Data Types, Variables and Expressions
Choose the correct answer:
1. How many categories of data types are available in C++?
(a) 5 (b) 4 (c) 3 (d) 2
2. Which of the following data types is not a fundamental type?
(a) signed (b) int (c) float (d) char
3. What will be the result of following statement?
char ch= ‗B‘;
cout << (int) ch;
(a) B (b) b (c) 65 (d) 66
4. Which of the character is used as suffix to indicate a floating point value?
(a) F (b) C (c) L (d) D
5. How many bytes of memory is allocated for the following variable declaration if you
are using Dev C++? short int x;
(a) 2 (b) 4 (c) 6 (d) 8
6. What is the output of the following snippet?
char ch = ‗A‘;
ch = ch + 1;
(a) B (b) A1 (c) F (d) 1A
7. Which of the following is not a data type modifier?
(a) signed (b) int (c) long (d) short
8. Which of the following operator returns the size of the data type?
(a) sizeof( ) (b) int ( ) (c) long ( ) (d) double ( )
9. Which operator is used to access reference of a variable?
(a) $ (b) # (c) & (d) !
10. This can be used as alternate to endl command:
(a) \t (b) \b (c) \0 (c) \n
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 28
CHAPTER 10: Flow of Control
Choose the correct answer:
1. What is the alternate name of null statement?
(A) No statement (B) Empty statement
(C) Void statement (D) Zero statement
2. In C++, the group of statements should be enclosed within:
(A) { } (B) [ ] (C) ( ) (D) < >
3. The set of statements that are executed again and again in iteration is called as:
(A) condition (B) loop (C) statement (D) body of loop
4. The multi way branch statement:
(A) if (B) if … else (C) switch (D) for
5. How many types of iteration statements?
(A) 2 (B) 3 (C) 4 (D) 5
6. How many times the following loop will execute?
for (int i=0; i<10; i++)
(A) 0 (B) 10 (C) 9 (D) 11
7. Which of the following is the exit control loop?
(A) for (B) while (C) do…while (D) if…else
8. Identify the odd one from the keywordsof jump statements:
(A) break (B) switch (C) goto (D) continue
9. Which of the following is called entry control loop?
(A) do-while (B) for (C) while (D) if-else
10. A loop that contains another loop inside its body:
(A) Nested loop (B) Inner loop (C) Inline loop (D) Nesting of loop
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 29
4. What will be the output of the following code:
int year;
cin >> year;
if (year % 100 == 0)
if ( year % 400 == 0)
cout << "Leap";
else
cout << "Not Leap year";
If the input given is (i) 2000 (ii) 2003 (iii) 2010?
Output:
(i) Leap (ii) Not Leap year (iii) Not Leap year
5. What is the output of the following code?
for (int i=2; i<=10 ; i+=2)
cout << i;
output: 2 4 6 8 10
Short Answers:
1. Convert the following if-else to a single conditional statement:
if (x >= 10)
a = m + 5;
else
a = m;
conditional statement: if (x >= 10)? a=m+5 : a=m; (or)
a = (x>=10)? m+5 : m;
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 30
2. Rewrite the following code so that it is functional:
v = 5;
do;
{
total += v;
cout << total;
while v <= 10
correct code:
int v = 5;
do
{
total += v;
cout << total;
v++;
} while (v <= 10);
3. Write the syntax and purpose of switch statement.
syntax of switch:
switch(expression)
{
case constant 1: statement(s); break;
case constant 2: statement(s); break;
.
.
default: statement(s);
}
purpose of switch statement:
The switch statement is a multi-way branch statement.
It provides an easy way to dispatch execution to different parts of code based on
the value of the expression.
The switch statement replaces multiple if-else sequence.
4. Write a short program to print following series: 1 4 7 10...... 40
#include<iostream>
using namespace std;
int main( )
{
for (int i=1; i<=40 ; i+=3)
cout << i<<‘ , ‘;
return 0;
}
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 31
Explain in detail:
1. What is an entry control loop? Explain any one of the entry controlled loop
with suitable example.
In an entry-controlled loop, first the test-expression is evaluated and if it is
nonzero, the body of the loop is executed otherwise the loop is terminated.
for loop :
The for loop is a entry- controlled loop and is the easiest looping statement which
allows code to be executed repeatedly.
It contains three different statements:
Initialization
condition or test-expression and
update expression(s))
The three statements are separated by semicolons.
The general syntax is:
for (initialization(s); test-expression; update expression(s))
{
Statement 1;
Statement 2;
………….
}
Statement-x;
Example: C++ program to display numbers from 0 to 9 using for loop
#include<iostream>
using namespace std;
int main( )
{
for (int i = 0; i<10 ; i++)
cout << i<<‘ ‘;
return 0;
}
Output: 0 1 2 3 4 5 6 7 8 9
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 32
CHAPTER 11: Functions
Choose the correct answer:
1. Which of the following header file defines the standard I/O predefined functions ?
A) stdio.h B) math.h C) string.h D) ctype.h
2. Which function is used to check whether a character is alphanumeric or not.
A) isalpha() B) isdigit() C) isalnum() D) islower()
3. Which function begins the program execution ?
A) isalpha() B) isdigit() C) main() D) islower()
4. Which of the following function is with a return value and without any argument ?
A) x=display(int, int) B) x=display()
C) y=display(float) D) display(int)
5. Which is return data type of the function prototype of add(int, int); ?
A) int B) float C) char D) double
6. Which of the following is the scope operator ?
A) > B) & C) % D) ::
Short Answers:
1. What is Built-in functions ?
C++ provides a rich collection of functions ready to be used for various tasks.
The tasks to be performed by each of these are already written, debugged and
compiled, their definitions alone are grouped and stored in files called header
files. Such ready-to-use sub programs are called pre-defined functions or built-
in functions.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 33
2. What is the difference between isupper() and toupper() functions ?
isuppr() toupper()
This function is used to check the given This function is used to convert the given
character is uppercase. character into its uppercase.
This function will return 1 if true This function will return the upper case
otherwise 0. equivalent of the given character.
3. Write about strcmp() function.
The strcmp() function takes two arguments: string1 and string2. It compares the
contents of string1 and string2 lexicographically.
The strcmp() function returns:
Positive value if the first differing character in string1 is greater than the
corresponding character in string2.
Negative value if the first differing character in string1 is less than the
corresponding character in string2.
0 if string1 and string2 are equal.
4. What is default arguments ? Give example.
In C++, one can assign default values to the formal parameters of a function
prototype. The Default arguments allow to omit some arguments when calling the
function.
When calling a function,
For any missing arguments, complier uses the values in default arguments
for the called function.
The default value is given in the form of variable initialization.
Example : void defaultvalue(int n1=10, n2=100);
Explain in detail:
1. Explain Call by value method with suitable example.
Call by value method copies the value of an actual parameter into the formal
parameter of the function.
In this case, changes made to formal parameter within the function will have no
effect on the actual parameter.
Example Program:
#include<iostream>
using namespace std;
void fun(int x)
{
x=20;
}
int main( )
{
int a=10;
fun(a);
cout<<a;
}
Output : 10
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 34
2. Explain scope of variable with example.
Scope refers to the accessibility of a variable. There are four types of scopes in
C++.
1. Local scope - Inside a block which is called local variables.
2. Function scope - Inside a function is called function variables.
3. File scope - Outside of all functions which is called global variables.
4. Class scope - Inside a class is called class variable or data members.
Local Scope:
A local variable is defined within a block. A block of code begins and ends with
curly braces { }.
A local variable cannot be accessed from outside the block of its declaration.
Function Scope:
The scope of variables declared within a function is extended to the function
block, and all sub-blocks therein.
The life time of a function scope variable, is the life time of the function block.
File Scope:
A variable declared above all blocks and functions (including main ( ) ) has the
scope of a file.
The life time of a file scope variable is the life time of a program.
The file scope variable is also called as global variable.
Example Program:
#include<iostream>
using namespace std;
int sum; File Scope
void add(int x, int y)
{
int z=30 Function Scope
sum=x+y+z;
}
int main()
{
int a=10;
{
int b=20; Local Scope
add(a,b);
}
cout<<sum;
}
Class Scope:
A class is a new way of creating and implementing a user defined data type.
Classes provide a method for packing together data of different types.
Data members are the data variables that represent the features or properties of a
class.
class student The class student contains mark1,
{ mark2 and total are data variables.
private : Its scope is within the class student
int mark1, mark2, total; only.
};
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 35
CHAPTER 12: Arrays and Structures
Choose the correct answer:
1. Which of the following is the collection of variables of the same type that an
referenced by a commonname ?
a) int b) float c) Array d) class
2. int age[]={6,90,20,18,2}; How many elements are there in this array?
a) 2 b) 5 c) 6 d) 4
3. cin>>n[3]; To which element does this statement accept the value?
a) 2 b) 3 c) 4 d) 5
4. By default, a string ends with which character?
a) \o b) \t c) \n d) \b
5. Structure definition is terminated by
(a) : (b) } (c) ; (d) ::
6. What will happen when the structure is declared?
(a) it will not allocate any memory (b) it will allocate the memory
(c) it will be declared and initialized (d) it will be only declared
7. A structure declaration is given below.
struct Time
{
int hours;
int minutes;
int seconds;
}t;
Using above declaration which of the following refers to seconds.
(a) Time.seconds (b) Time::seconds (c)seconds (d) t. seconds
8. Which of the following is a properly defined structure?
(a) struct {int num;} (b) struct sum {int num;}
(c) struct sum int sum; (d) struct sum {int num;};
9. A structure declaration is given below.
struct employee
{
int empno;
char ename[10];
}e[5];
Using above declaration which of the following statement is correct.
(a) cout<<e[0].empno<<e[0].ename; (b) cout<<e[0].empno<<ename;
(c) cout<<e[0]->empno<<e[0]->ename; (d) cout<<e.empno<<e.ename;
10. When accessing a structure member ,the identifier to the left of the dot operator is
the name of
(a) structure variable (b) structure tag
(c) structure member (d) structure function
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 36
Very Short Answers:
1. What is Traversal in an Array?
Accessing each element of an array at least once to perform any operation is
known as Traversal.
2. What is Strings?
A string is defined as a sequence of characters where each character may be a
letter, number or a symbol.
Each element occupies one byte of memory.
Every string is terminated by a null (‗\0‘, ASCII code 0) character
3. What is the syntax to declare two – dimensional array.
The declaration of a 2-D array is
data-type array_name[row-size][col-size];
data-type - any valid C++ data-type,
array_name - the name of the 2-D array,
row-size - the number of rows
col-size - the number of columns in the 2-D array.
4. Define structure .What is its use?
Structure is a user-defined which has the combination of data items with different
data types.
This allows to group of variables of mixed data types together into a single unit.
5. What is the error in the following structure definition.
struct employee{ inteno;charename[20];char dept;}
Employee e1,e2;
Spaces are missing at two places.
Structure name given wrongly.
Corrected Structure:
struct Employee
{
int eno;
char ename[20];
char dept;
} Employee e1,e2;
Short Answers
1. Define an Array ? What are the types?
An array is a collection of variables of the same type that are referenced by a
common name. An array is also a derived data type in C++.
There are different types of arrays used in C++. They are:
One-dimensional arrays
Two-dimensional arrays
Multi-dimensional arrays
2. Write note an Array of strings.
An array of strings is a two-dimensional character array.
The size of the first index (rows) denotes the number of strings and the size of the
second index (columns) denotes the maximum length of each string.
Declaration of 2D Array: char Name[6][10];
Initialization:
char Name[6][10] = {"Vijay", "Raji", "Suji", "Joshini", "Murugan", "Mani"};
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 37
3. How to access members of a structure?Give example.
Data members are accessed by dot(.) operator.
Syntax: objectname.datamember;
The syntax for that is using a dot (.) between the object name and the member
name.
For example, the elements of the structure Student can be accessed as follows:
balu.rollno
balu.age
4. What is called anonymous structure .Give an example.
A structure without a name/tag is called anonymous structure.
Ex: struct
{
long rollno;
int age;
float weight;
} student;
The student can be referred as reference name to the above structure and the
elements can be accessed like student.rollno, student.age and student.weight.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 38
CHAPTER 13: Introduction to Object Oriented Programming Techniques
Choose the correct answer:
1. The term is used to describe a programming approach based on classes and objects is
(A) OOP (B) POP (C) ADT (D) SOP
2. The paradigm which aims more at procedures.
(A) Object Oriented Programming (B) Procedural programming
(C) Modular programming (D) Structural programming
3. Which of the following is a user defined data type?
(A) class (B) float (C) int (D) object
4. The identifiable entity with some characteristics and behaviour is.
(A) class (B) object (C) structure (D) member
5. The mechanism by which the data and functions are bound together into a single unit
is known as
(A) Inheritance (B) Encapsulation (C) Polymorphism (D) Abstraction
6. Insulation of the data from direct access by the program is called as
(A) Data hiding (B) Encapsulation (C) Polymorphism (D) Abstraction
7. Which of the following concept encapsulate all the essential properties of the object
that are to be created?
(A) class (B) Encapsulation (C) Polymorphism (D) Abstraction
8. Which of the following is the most important advantage of inheritance?
(A) data hiding (B) code reusability
(C) code modification (D) accessibility
9. ―Write once and use it multiple time‖ can be achieved by
(A) redundancy (B) reusability (C) modification (D) composition
10. Which of the following supports the transitive nature of data?
(A) Inheritance (B) Encapsulation (C) Polymorphism (D) Abstraction
Explain in detail:
1. Write the differences between Object Oriented Programming and procedural
programming.
Object Oriented Programming Procedural programming
Emphasizes on data rather than algorithm Procedural programming aims more at
procedures.
It implements programs using classes Programs are organized in the form of
and objects. subroutines or sub programs.
Data and its associated operations are All data items are global.
grouped in to single unit
Programs are designed around the data Suitable for small sized software
being operated application.
Relationships can be created between Difficult to maintain and enhance the
similar, yet distinct data types program code as any change in data type
needs to be propagated to all subroutines
that use the same data type.
Example: C++, Java, VB.Net, Python Example: FORTRAN and COBOL.
etc.
2. What are the advantages of OOPs?
Advantages of OOP:
Re-usability: ―Write once and use it multiple times‖ you can achieve this by
using class.
Redundancy: Inheritance is the good feature for data redundancy. If you need a
same functionality in multiple class you can write a common class for the same
functionality and inherit that class to sub class.
Easy Maintenance: It is easy to maintain and modify existing code as new
objects can be created with small differences to existing ones.
Security: Using data hiding and abstraction only necessary data will be provided
thus maintains the security of data.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 40
3. Write a note on the basic concepts that supports OOPs?
The Object Oriented Programming has been developed to overcome the
drawbacks of procedural and modular programming.
It is widely accepted that object-oriented programming is the most important and
powerful way of creating software.
The Object-Oriented Programming approach mainly encourages:
Modularisation: where the program can be decomposed into modules.
Software re-use: where a program can be composed from existing and new
modules.
Main Features of Object Oriented Programming:
Encapsulation: The mechanism by which the data and functions are bound
together into a single unit is known as Encapsulation.
Data Abstraction: Abstraction refers to showing only the essential features
without revealing background details.
Modularity: Modularity is designing a system that is divided into a set of
functional units (named modules) that can be composed into a larger application.
Inheritance: Inheritance is the technique of building new classes (derived class)
from an existing Class (base class).
Polymorphism: Polymorphism is the ability of a message or function to be
displayed in more than one form.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 41
CHAPTER 14: Classes and objects
Choose the correct answer:
1. The variables declared inside the class are known as
(A) data (B) inline (C) method (D) attributes
2. Which of the following statements about member functions are True or False?
i) A member function can call another member function directly with using the dot
operator.
ii) Member function can access the private data of the class.
(A) i)True, ii)True (B) i)False, ii)True
(C) i)True, ii)False (D) i)False,ii)False
3. A member function can call another member function directly, without using the dot
operator called as
(A) sub function (B) sub member
(C) nesting of member function (D) sibling of member function
4. The member function defined within the class behave like ........ functions
(A) inline (B) Non inline (C) Outline (D) Data
5. Which of the following access specifier protects data from inadvertent
modifications?
(A) Private (B) Protected (C) Public (D) Global
6. class x
{
int y;
public:
x(int z){y=z;}
} x1[4];
int main()
{ x x2(10);
return 0;}
How many objects are created for the above program
(A) 10 (B) 14 (C) 5 (D) 2
7. State whether the following statements about the constructor are True or False.
i) constructors should be declared in the private section.
ii) constructors are invoked automatically when the objects are created.
(A) True, True (B) True, False (C) False, True (D) False, False
8. Which of the following constructor is executed for the following prototype ?
add display( add &); // add is a class name
(A) Default constructor (B) Parameterized constructor
(C) Copy constructor (D) Non Parameterized constructor
Explain in detail:
1. Mention the differences between constructor and destructor.
Constructor Destructor
The constructor is executed The destructor is executed automatically
automatically when the object is created. when the control reaches the end of
class scope to destroy the object.
The name of the constructor must be The Destructor has the same as that of
same as that of the class. the class prefixed by the Tilde symbol
(~).
The constructor function can be The Destructor function can‘t be
overloaded. overloaded.
A constructor can have parameter The Destructor cannot have parameter
(Arguments) list. (Arguments) list.
Constructor cannot be inherited. But a Destructor cannot be inherited.
derived class can call the base class
constructor.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 43
CHAPTER 15: Polymorphism
Choose the correct answer:
1. Which of the following refers to a function having more than one distinct meaning?
(A) Function Overloading (B) Member overloading
(C) Operator overloading (D) Operations overloading
2. Which of the following reduces the number of comparisons in a program ?
(A) Operator overloading (B) Operations overloading
(C) Function Overloading (D) Member overloading
3. void dispchar(char ch=‘$‘,int size=10)
{
for(int i=1;i<=size;i++)
cout<<ch;
}
How will you invoke the function dispchar() for the following input?
To print $ for 10 times
(A) dispchar(); (B) dispchar(ch,size);
(C) dispchar($,10); (D) dispchar(‗$‘,10 times);
4. Which of the following is not true with respect to function overloading?
(A) The overloaded functions must differ in their signature.
(B) The return type is also considered for overloading a function.
(C) The default arguments of overloaded functions are not considered for
Overloading.
(D) Destructor function cannot be overloaded.
5. Which of the following is invalid prototype for function overloading.
(A) Void fun (int x); (B) Void fun (int x);
Void fun (char ch) ; Void fun (int y);
(C) Void fun (double d); (D) Void fun (double d);
Void fun (char ch); Void fun (int y);
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 44
Short Answers:
1. What are the rules for function overloading?
The overloaded function must differ in the number of its arguments or data types.
The return types of overloaded functions are not considered for overloading same
data type.
The default arguments of overloaded functions are not considered as part of the
parameter list in function overloading.
2. What is operator overloading? Give some examples of operators which can be
overloaded.
The mechanism of giving special meaning to an operator is known as operator
overloading.
The term Operator overloading, refers to giving additional functionality to the
normal C++ operators like +,++,-,—,+=,-=,*.<,>.
3. Discuss the benefits of constructor overloading ?
Function overloading can be applied for constructors, as constructors are special
functions of classes.
A class can have more than one constructor with different signature.
Constructor overloading provides flexibility of creating multiple type of objects
for a class.
Explain in detail:
1. What are the rules for operator overloading?
Precedence and associatively of an operator cannot be changed.
No new operators can be created, only existing operators can be overloaded.
Cannot redefine the meaning of an operator‘s procedure. You cannot change how
integers are added. Only additional functions can be given to an operator
Overloaded operators cannot have default arguments.
When binary operators are overloaded, the left hand object must be an object of
the relevant class.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 45
CHAPTER 16: Inheritance
Choose the correct answer:
1. Which of the following is the process of creating new classes from an existing class
(a) Polymorphism (b) Inheritance (c) Encapsulation (d) super class
2. Which of the following derives a class student from the base class school
(a) school: student (b) class student : public school
(c) student : public school (d) class school : public student
3. The type of inheritance that reflects the transitive nature is
(A) Single Inheritance (B) Multiple Inheritance
(C) Multilevel Inheritance (D) Hybrid Inheritance
4. Which visibility mode should be used when you want the features of the base class
to be available to the derived class but not to the classes that are derived from the
derived class?
(A) Private (B) Public (C) Protected (D) All of these
5. Inheritance is a process of creating new class from
(A) Base class (B) abstract (C) derived class (D) Function
6. A class is derived from a class which is a derived class itself, then this is referred to as
(A) multiple inheritance (B) multilevel inheritance
(C) single inheritance (D) double inheritance
7. Which amongst the following is executed in the order of inheritance?
(A) Destructor (B) Member function (C) Constructor (D) Object
8. Which of the following is true with respect to inheritance?
(A) Private members of base class are inherited to the derived class with private
(B) Private members of base class are not inherited to the derived class with
private accessibility
(C) Public members of base class are inherited but not visible to the derived class
(D) Protected members of base class are inherited but not visible to the outsideclass
9. Based on the following class declaration answer the questions (from9.1 to 9.4 )
class vehicle protected:
{ int wheels; int load;
public: public:
void input_data(float,float); void read_data(float,float)
void output_data(); void write_data(); };
protected: class bus: private heavy_vehicle {
int passenger; char Ticket[20];
}; public:
class heavy_vehicle : protected void fetch_data(char);
vehicle { void display_data(); };
int diesel_petrol;
9.1. Which is the base class of the class heavy_vehicle?
(a) Bus (b) heavy_vehicle (c) vehicle (d) both (a) and (c)
9.2. The data member that can be accessed from the function displaydata()
(a) passenger (b) load (c) Ticket (d) All of these
9.3. The member function that can be accessed by an objects of bus Class is
(a) input_data(), output_data() (b) read_data() ,write_data()
(c) fetch_data(), display_data() (d) All of these
9.4. The member function that is inherited as public by Class Bus
(a) input_data(), output_data() (b) read_data(), write_data()
(c) fetch_data(), display_data() (d) none of these
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 46
Very Short Answers:
1. What is inheritance?
The mechanism of deriving new class from an existing class is called inheritance.
2. What is a base class?
A class that is used as the basis for creating a new class is called a superclass or
base class.
Short Answers:
1. What are the points to be noted while deriving a new class?
The following points should be observed for defining the derived class.
The keyword class has to be used.
The name of the derived class is to be given after the keyword class.
A single colon (:).
The type of derivation, namely private, public or protected.
The name of the base class, if more than one base class, then it can be given
separated by comma.
Explain in detail:
1. Explain the different types of inheritance.
Single Inheritance: When a derived class inherits only from one base class, it is
known as single inheritance.
Multiple Inheritance: When a derived class inherits from multiple base classes it is
known as multiple inheritance.
Hierarchical inheritance: When more than one derived classes are created from a
single base class , it is known as Hierarchical inheritance.
Multilevel Inheritance: The transitive nature of inheritance is reflected by this form
of inheritance. When a class is derived from a class which is a derived class – then it
is referred to as multilevel inheritance.
Hybrid inheritance: When there is a combination of more than one type of
inheritance, it is known as hybrid inheritance.
The following diagram represents the different types of inheritance
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 47
2. Explain the different visibility mode through pictorial representation.
Private visibility mode:
When a base class is inherited with private visibility mode the public and
protected members of the base class become „private‟ members of the derived
class.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 48
CHAPTER 17: Computer Ethics And Cyber Security
Choose the correct answer:
1. Which of the following deals with procedures, practices and values?
a. piracy b. programs c. virus d. computer ethics
2. Commercial programs made available to the public illegally are known as
a. freeware b. warez c. free software d. software
3. Which one of the following are self-repeating and do not require a computer
program to attach themselves?
a. viruses b. worms c. spyware d. Trojans
4. Which one of the following tracks a user visits a website?
a. spyware b. cookies c. worms d. Trojans
5. Which of the following is not a malicious program on computer systems?
a. worms d. Trojans c. spyware d. cookies
6. A computer network security that monitors and controls incoming and outgoing
traffic is
a. Cookies b.Virus c. Firewall d. worms
7. The process of converting cipher text to plain text is called
a. Encryption b. Decryption c. key d. proxy server
8. e-commerce means
a. electronic commerce b. electronic data exchange
c. electric data exchange d. electronic commercialization.
9. Distributing unwanted e-mail to others is called.
a. scam b. spam c. fraud d. spoofing
10. Legal recognition for transactions are carried out by
a. Electronic Data Interchange b. Electronic Data Exchange
c. Electronic Data Transfer d. Electrical Data Interchange
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 49
Short Answers:
1. What is the role of firewalls?
A firewall is a computer network security based system that monitors and
controls incoming and outgoing network traffic based on predefined security
rules.
A firewall commonly establishes a block between a trusted internal computer
network and entrusted computer outside the network.
2. Write about encryption and decryption.
Encryption and decryption are processes that ensure confidentiality that only
authorized persons can access the information.
Encryption is the process of translating the plain text data (plaintext) into random
and mangled data (called cipher-text).
Decryption is the reverse process of converting the cipher-text back to plaintext.
Encryption and decryption are done by cryptography.
3. What are the guidelines to be followed by any computer user?
Honesty: Users should be truthful while using the internet.
Confidentiality: Users should not share any important information with
unauthorized people.
Respect: Each user should respect the privacy of other users.
Professionalism: Each user should maintain professional conduct.
Obey The Law: Users should strictly obey the cyber law in computer usage.
Responsibility: Each user should take ownership and responsibility for their
actions.
4. What are ethical issues? Name some.
An Ethical issue is a problem or issue that requires a person or organization to
choose between alternatives that must be evaluated as right (ethical) or wrong
(unethical).
Some of the common ethical issues are listed below:
Cyber crime * Software Piracy * Unauthorized Access
Hacking * Use of computers to commit fraud
Sabotage in the form of viruses * Making false claims using computers
Explain in detail:
1. What are the various crimes happening using computer?
Crime Function
Cyber Terrorism Hacking, threats, and blackmailing towards a
business or a person.
Cyber stalking Harassing through online.
Malware Malicious programs that can perform a variety of functions
including stealing, encrypting or deleting sensitive data, altering
or hijacking core computing functions and monitoring user‘s
computer activity without their permission.
Harvesting A person or program collects login and password information
from a legitimate user to illegally gain access to others‘
account(s).
Spam Distribute unwanted e-mail to a large number ofinternet users.
Spoofing It is a malicious practice in which communication is send from
unknown
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 50
2. Write the different types of cyber attacks.
Virus: A virus is a small piece of computer code that can repeat itself and
spreads from one computer to another by attaching itself to another computer file.
Worms: Worms are self – repeating and do not require a computer program to
attach themselves.
Spyware: Spyware can be installed on the computer automatically when the
attachments are open, by clicking on links or by downloading infected software.
Ransomeware: Ransomware is a type of malicious program that demands
payment after launching a cyper-attack on a computer system.
Pharming : Pharming is a scamming practice in which malicious code is
installed on a personal computer or server, misdirecting users to fraudulent web
sites without their knowledge or permission.
Phishing: Phishing is a type of computer crime used to attack, steal user data,
including login name, password and credit card numbers.
Man In The Middle (MITM): Man-in-the-middle attack is an attack where the
attacker secretly relays and possibly alters the communication between two
parties who believe they are directly communicating with each other.
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 51
CHAPTER 18: Tamil Computing
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 52
Education Is The
Most Powerful Weapon
Which You Can Use
To Change The World.
ALL THE BEST!
J. Kavitha, B.Sc, B.Ed, M.C.A, M.Phil., Computer Instructor Gr-I, GHSS, S.S.KULAM - CBE 53