11th Computer Science Public Exam Question With Answer 20219-2024 (1)
11th Computer Science Public Exam Question With Answer 20219-2024 (1)
11th Computer Science Public Exam Question With Answer 20219-2024 (1)
in
PREPARED BY.,
B. MOHAMED YOUSUF M.C.A., B.Ed.,
PG ASST IN COMPUTER SCIENCE
[[email protected]]
CHAPTER 1 TO 18 PUBLIC ONE WORD QUESTION WITH ANSWERS [MARCH-2019 TO JULY-2024]
(CHAPTER-1) (INTRODUCTION TO COMPUTERS)
1. Name the volatile memory--- [M-2023, J-2023]
(a) ROM (b) PROM (c) RAM (d) EPROM
2. Identify the output device [M-2020]
(a) Keyboard (b) Memory (c) Monitor (d) Mouse
3. Expand POST [S-2020, J-2024]
www.kalvikadal.in
(a) Post on self-test (b) Power on Software Test (c) Power on Self-Test (d) Power on Self Text
4. Which generation of computer used IC’s? [M-2022, M-2024]
(a) First (b) Second (c) Third (d) Fourth
5. Which generation of computer used transistors? [J-2019]
(a) First (b) Second (c) Third (d) Fourth
6. --- is the main component of second generation computers. [AUG-2022]
(a) Vacuum tubes (b) Transistors (c) IC (d) Microprocessors
(CHAPTER-2 PART-1) (NUMBER SYSTEMS)
1. Which refers to the number of bits processed by a computer’s CPU? [M-2024]
(a) Byte (b) Nibble (c) Word length (d) Bit
2. How many bytes does 1 Kilo Byte contain? [AUG-2022, J-2024]
(a) 1000 (b) 8 (c) 4 (d) 1024
3. For 11012 what is the Hexadecimal equivalent? [M-2022]
(a) F (b) E (c) D (d) B
4. Which amongst this is not an octal number? [S-2020]
(a) 645 (b) 234 (c) 876 (d) 123
5. For 10102 the hexadecimal equivalent is: [M-2023]
(a) C (b) B (c) E (d) A
6. 2^40 is referred as [J-2023]
(a) Kilo (b) Tera (c) Peta (d) Zetta
(CHAPTER-2 PART-2) (BOOLEAN ALGEBRA)
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? [M-2020]
(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
6. Which gate circuits is an OR gate followed by an inverted? [M-2019]
(a) NOR (b) XNOR (c) AND (d) OR
(CHAPTER-3) (COMPUTER ORGANIZATION)
1. Which of the following is not the part of a microprocessor unit? [M-2022, J-2024]
(a) ALU (b) Control unit (c) Cache memory (d) register
2. Which of the following is a CISC processor? [M-2024]
(a) Intel P6 (b) AMD K6 (c) Pentium III (d) Pentium IV
3. Which is the fastest memory? [AUG-2022]
(a) Hard disk (b) Main memory (c) Cache memory (d) Blue-Ray disc
4. What is the smallest size of data represented in a CD? [J-2023]
(a) Blocks (b) sectors (c) pits (d) tracks
5. Display devices are connected to the computer through. [M-2019, M-2023]
(a) USB port (b) Ps/2 port (c) SCSI port (d) VGA connector
6. Which is used to connect a monitor or any display device like LCD projector to a computer? [M-2019]
(a) SCSI port (b VGA connector (c) USB port (d) PS/2 port
7. Pick the RISC processor: [J-2019]
(a) Intel P6 (b) Intel 386&486 (c) Pentium II (d) Motorola 6800
1
PREPARED BY… B.MOHAMED YOUSUF M.C.A.., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
8. Which of the following is a very high speed and expensive memory? [S-2020]
(a) Cache (b) ROM (c) RAM (d) EPROM
(CHAPTER-4) (THEORETICAL CONCEPTS OF OPERATING SYSTEM)
1. Operating system is a---------[AUG-2022]
(a) Application Software (b) Hardware ` (c) System Software (d) Component
2. Which of the following Operating systems support Mobile Devices? [J-2019, S-2020]
(a) Windows 7 (b) Linux (c) BOSS (d) iOS
www.kalvikadal.in
3. File Management manages… [M-2023]
(a) Files (b) Folders (c) Directory systems (d) All the Above
4. Interactive Operating System provides-----[M-2024]
(a) Graphics User Interface (GUI) (b) Data Distribution
(c) Security Management (d) Real Time Processing
5. An example for single task operating system is [M-2022]
(a) Linux (b) Windows (c) MS-DOS (d) UNIX
6. The File management system used by Linux is [J-2024]
(a) ext2 (b) NTFS (c) FAT (d) NFTS
7. How many Level of securities is provided by operating system to the user? [M-2020, J-2023]
(a) 3 (b) 2 (c) 5 (d) 4
(CHAPTER-5) (WORKING WITH TYPICAL OPERATING SYSTEMS)
1. Which is the default folder for many Windows Applications to save your file? [M-2020, J-2024]
(a) My Document (b) My Pictures (c) Documents and Settings (d) My Computer
2. The shortcut key used to rename a file in windows-----[AUG-2022, M-2024]
(a) F2 (b) F4 (c) F5 (d) F6
3. Which of the following key combination is used to permanently delete a file or folder without sending to recycle bin? [M-2023]
(a) Shift and delete (b) Alt and delete (c) Tab and delete (d) Ctrl and delete
4. Which command is used to ‘paste’? [M-2022]
(a) Edit→ Paste (b) view → Paste (c) File → Paste (d) All the above
5. Which shortcut key is used to cut a file or folder? [J-2023]
(a) Ctrl+Alt+C (b) Ctrl+Alt+X (c) Ctrl+C (d) Ctrl+X
(CHAPTER-6) (SPECIFICATION AND ABSTRACTION)
1. Omitting details inessential to the task and representing only the essential features of the task is known as – [M-2024]
(a) Specification (b) abstraction (c) composition (d) decomposition
2. Stating the input property and the as : output relation a problem is known [M-2019, M-2023]
(a) Specification (b) statement (c) algorithm (d) definition
3. Ignoring or hiding unnecessary details and modelling an entity only by its essential properties is known as----[J-2019]
(a) Specification (b) Abstraction (c) Composition (d) Decomposition
4. Which is specified by the properties of the given input and the relation between the input and the desired output. [S-2020]
(a) Specification (b) Statement (c) algorithm (d) Definition
(CHAPTER-7) (COMPOSITION AND DECOMPOSITION)
1. If C1 is false and C2 is true, the compound statement if C1 S1 else if C25 S2 6 else 7 S3 executes—
(a) S1 (b) S2 (c) S3 (d) none [M-2019, M-2022]
2. How many times the loop is iterated? i := 0 while i ≠ 5 i := i + 1 [J-2019, M-2024, J-2024]
(a) 4 (b) 5 (c) 6 (d) 0
3. After the assignment what values will be stored in the variables m ,n ?1) m,n: =10,5 2) m,n: =m+3,n-2 3) m,n: = ? ?
(a) 3, 13 (b) 10, 13 (c) 13,3 (d) 10,5 [M-2020]
4. Which of the following notation is a mix of programming language like constraints and plain English?
(a) Flow chart (b) Pseudo-code (c) Algorithm (d) Structure [S-2020]
5. How many times the loop is iterated ---- M: =0 While (m<5) M:=m+1 [M-2020] (a) 10 (b) 4 (c) 5 (d) 6
(CHAPTER-8) (ITERATION AND RECURSION)
1. A loop invariant need not be true [M-2019]
(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. Using this recursive definition an = 1 if n = 0 axan-1 otherwise
How many multiplications are needed to calculate a10? [J-2023]
(a) 11 (b) 10 (c) 9 (d) 8
2
PREPARED BY… B.MOHAMED YOUSUF M.C.A.., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
3. The unchanging property of a variable in iteration is known as: [J-2019]
(a) Recursion (b) Loop invariant (c) Assignment (d) Condition
(CHAPTER-9 PART-1) (INTRODUCTION TO C++)
1. Who developed C++? [S-2020, M-2022]
(a) Charles Babbage (b) Bjarne Stroustrup (c) Bill Gates (d) Sundar Pichai
2. The smallest individual unit in a program is: [M-2020]
(a) Program (b) Algorithm (c) Flowchart (d) Tokens
www.kalvikadal.in
3. Which of the following operator is extraction operator of C++? [J-2019, AUG-2022, J-2023, J-2024]
(a) >> (b) << (c) <> (d) ^^
4. Which of the following is a valid string literal? [AUG-2022]
(a) ‘A’ (b) ‘Welcome’ (c) 1232 (d) “1232”
5. Assume a=5, b=6; what will be result of a&b? [M-2019]
(a) 4 (b) 5 (c) 1 (d) 0
6. Which of the following operator is received from operator of C++? [J-2019]
(a) >> (b) << (c) <> (d) ^^
7. Which of the following is user defined data type? [M-2020]
(a) Char (b) class (c) float (d) int
8. Which can be used as alternate to \n? [J-2019]
(a) \t (b) \a (c) end l (d) \o
9. In C++- - - -is used for pointer to a variable. [M-2024]
(a) - (b) + (c) ÷ (d) *
(CHAPTER-9 PART-2) (DATA TYPES, VARIABLES AND EXPRESSIONS)
1. How many categories of data types available in C++? [M-2022]
(a) 5 (b) 4 (c) 3 (d) 2
2. Which of the following operator returns the size of the data type? [J-2024]
(a) Size of ( ) (b) Int( ) (c) long ( ) (d) double ( )
3. This can be used as alternate to endl command: [M-2023]
(a) \t (b) \b (c) \0 (d) \n
4. #include<iostream> using namespace std; int main() { int i=1, sum=0; while(i<=10){ sum=sum+i; i++;
} cout<<sum; return 0;} The output of the following snippet is [M-2024]
(a) 55 (b) 54 (c) 51 (d) 50
(CHAPTER-10) (FLOW OF CONTROL)
1. The multi way branching statement: [AUG-2022]
(a) If (b) if … else (c) switch (d) for
2. How many times the following loop will execute? for (int i=0; i<10; i++) [M-2019]
(a) 0 (b) 10 (c) 9 (d) 11
3. Which of the following is the exit control loop? [AUG-2022, J-2024]
(a) For (b) while (c) do…while (d) if…else
4. Which of the following is called entry control loop? [M-2024]
(a) Do-while (b) for (c) while (d) if-else
5. #include<iostream> using namespace std int main() { int i, sum=5; for(i=1;i<=5;i++)
{ sum=sum+i} cout<<sum; return 0;} The output for the following snippet is: [M-2023]
(a) 20 (b) 10 (c) 25 (d) 15
6. Which of the following statement is used to terminate the execution of the loop------[M-2020]
(a)While (b) go to (c) break (d) continue
7. How many times the following loop will execute? for (int i=1; i<10; i++) [M-2022]
(a) 11 (b) 9 (c) 0 (d) 10
8. Which is not a jump statements in C++? [S-2020]
(a) Break (b) go to (c) Switch (d) continue
9. How many times the following loop will execute? for (int i=1; i<5; i++) [J-2023]
(a) 2 (b) 5 (c) 6 (d) 10
(CHAPTER-11) (FUNCTIONS)
1. Which of the following header file defines the standard I/O predefined functions? [S-2020]
(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. [M-2019, M-2020, J-2024]
(a) isalpha( ) (b) isdigit( ) (c) isalnum( ) (d) islower( )
3
PREPARED BY… B.MOHAMED YOUSUF M.C.A.., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
3. Which function begins the program execution? [J-2019, AUG-2022, M-2023]
(a) isalpha( ) (b) isdigit( ) (c) main( ) (d) islower( )
4. Which of the following is the scope operator? [M-2019, M-2024]
(a) > (b) & (c) % (d) ::
5. Int x=10; int main() { int x=100; cout<< ::x;} The output for above snippet is : [M-2022]
(a) 100 (b) x (c) ::x (d) 10
6. If two strings are equal, then strcmp() function returns which value? [J-2023]
www.kalvikadal.in
(a) 0 (b) -1 (c) +1 (d) =
(CHAPTER-12) (ARRAYS AND STRUCTURES)
1. Which of the following is the collection of variables of the same type that an referenced by a common name?
(a) int (b) float (c) Array (d) class [M-2022]
2. int age[ ]={6,90,20,18,2}; How many elements are there in this array? [J-2024]
(a) 2 (b) 5 (c) 6 (d) 4
3. int age[ ]={6,80,75,21,10}; How many elements are there in this array? [M-2020]
(a) 2 (b) 5 (c) 6 (d) 4
4. int age[ ]={6,90,12,18,2}; How many elements are there in this array? [AUG-2022]
(a) 2 (b) 5 (c) 6 (d) 4
5. cin>>n[4]; To which element does this statement accepts the value? [M-2019]
(a) 2 (b) 3 (c) 4 (d) 5
6. Array subscripts is always starts with which number? [J-2019]
(a) -1 (b) 2 (c) 0 (d) 3
7. Which keyword is used to create structure in C++? [J-2019, S-2020]
(a) struct (b) structure (c) void (d) const
(CHAPTER-13) (INTRODUCTION TO OBJECT ORIENTED PROGRAMMING TECHNIQUES)
1. The term is used to describe a programming approach based on classes and objects is – [M-2023]
(a) OOP (b) POP (c) ADT (d) SOP
2. Which of the following is a user defined data type? [M-2020]
(a) Class (b) float (c) Int. (d) Object
3. The identifiable entity with some characteristics and behavior is. [J-2023]
(a) Class (b) object (c) structure (d) member
4. The mechanism by which the data and functions are bound together into single unit is known as-----[M-2024]
(a) Inheritance (b) Encapsulation (c) Polymorphism (d) Abstraction
5. “Write once and use it multiple time” can be achieved by----[M-2022, J-2024]
(a) Redundancy (b) reusability (c) modification (d) composition
6. Which of the following supports the transitive nature of data? [S-2020]
(a) Inheritance (b) Encapsulation (c) Polymorphism (d) Abstraction
7. Which of the following is a technique of building new classes from an existing class? [J-2019]
(a) Inheritance (b) Abstraction (c) Encapsulation (d) Polymorphism
(CHAPTER-14) (CLASSES AND OBJECTS)
1. Which of the following constructor is executed for the following proto type? [M-2024]
Add display (add &); // add is a class name
(a) Default (b) Parameterized (c) Copy (d) Non-Parameterized
2. Class product { int code, quantity; float price; int main() { product p1,p2; return
0; How many bytes will be allocated with memory space of objects (p1)? [AUG-
2022]
(a) 4 bytes (b) 8 bytes (c) 12 bytes (d) 2 bytes
3. The functions that perform specific tasks in a class is called: [M-2022]
(a) Inline functions (b) Data members (c) Member functions (d) Online functions
4. How many number of destructors can a class in C++ contain? [S-2020]
(a) 4 (b) 3 (c) 2 (d) 1
5. How many access specifies declared inside class definition? [AUG-2022]
(a) 3 (b) 2 (c) 4 (d) 1
6. A constructor that accepts no parameter is called as: [J-2023]
(a) Parameterized (b) Copy (c) default (d) non- parameterized
(CHAPTER-15) (POLYMORPHISM)
1. Which of the following refers to a function having more than one distinct meaning? [J-2024]
4
PREPARED BY… B.MOHAMED YOUSUF M.C.A.., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
(a) Function Overloading (b) Member overloading (c) Operator (d) Operations
5
PREPARED BY… B.MOHAMED YOUSUF M.C.A.., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
2. Which of the following reduces the number of comparisons in a program? [J-2019]
(a) Operator overloading (b) Operations (c) Function Overloading (d) Member
3. Which of the following is not true with respect to function overloading? [M-2023]
(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
www.kalvikadal.in
(CHAPTER-16) (INHERITANCE)
1. Which of the following is the process of creating new classes from an existing class— [S-2020]
(a) Polymorphism (b) Inheritance (c) Encapsulation (d) super class
2. Which of the following derives a class student from the base class school [M-2019]
(a) School: student (b) class student : public school
(c) Student : public school (d) class school : public student
3. Inheritance is process of creating new class from --- [J-2024]
(a) Base class (b) abstract (c) derived class (d) Function
4. Which amongst the following is executed in the order of inheritance? [J-2019, M-2020, M-2023]
(a) Destructor (b) Member function (c) Constructor (d) Object
5. How many types are there in heritance? [AUG-2022]
(a) 5 (b) 4 (c) 3 (d) 2
6. Inheritance is the process of creating new class from: [J-2023]
(a) Base class (b) Abstract (c) Derived class (d) Function
(CHAPTER-17) (COMPUTER ETHICS AND CYBER SECURITY)
1. Which of the following deals with procedures, practices and values? [M-2020, M-2022]
(a) Piracy (b) programs (c) virus (d) computer ethics
2. Commercial programs made available to the public illegally are known as--- -[M-2023]
(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 [S-2020]
4. Which of the following is not a malicious program on computer systems? [J-2019]
(a) Worms (b) Trojans (c) spyware (d) cookies
5. A computer network security that monitors and controls incoming and outgoing traffic is--------[M-2019, J-2024]
(a) Cookies (b) virus (c) Firewall (d) worms
6. Distributing unwanted e-mail to others is called. [J-2023, M-2024]
(a) Scam (b) spam (c) fraud (d) spoofing
7. Legal recognition for transactions are carried out by [M-2024]
(a) Electronic Data Interchange (b) Electronic Data Exchange
(c) Electronic Data Transfer (d) Electrical Data Interchange
8. Which one of the following is Harass through online? [AUG-2022]
(a) Cyber terrorism (b) Scam (c) Cyber Stalking (d) Fraud
(CHAPTER-18) (TAMIL COMPUTING)
1. Which is not a search engine? [M-2022]
(a) Android (b) Bing (c) Yahoo (d) Google
2. Which of the following is the first Tamil Programming language? [S-2020, J-2023]
(a) Kamban (b) Azhagi (c) Tamil Open Office (d) Ezhil
3. Which one of the following is Harass through online? [AUG-2022]
(a) Cyber terrorism (b) Scam (c) Cyber stalking (d) Fraud
6
PREPARED BY… B.MOHAMED YOUSUF M.C.A.., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
CHAPTER 1 TO 18 TWO MARK PUBLIC QUESTION WITH ANSWERS [MARCH-2019 TO JULY-2024
CHAPTER – 1 INTRODUCTION TO COMPUTERS
1. What is a computer? [AUG-2022]
It is an electronic device that processes the input according to the set of instructions provided to it and gives the
desired output at a very fast rate.
2. What are the components of a CPU? [S-2020]
1. Control unit, 2.Arithmetic and logic unit (ALU), 3.Memory unit.
3. What is the function of an ALU? [M-2020, J-2024]
www.kalvikadal.in
The ALU is a part of the CPU where various computing functions are performed on data.
The ALU performs arithmetic operations such as addition, subtraction, multiplication, division and logical operations.
4. Write the functions of control unit. [M-2023]
The control unit controls the flow of data between the CPU, memory and I/O devices.
It also controls the entire operation of a computer.
5. Distinguish Primary and Secondary memory. [M-2024]
Primary memory Secondary memory
The Primary Memory is used to temporarily store The Secondary memory is used to store the data
the programs permanently.
It is volatile in nature It is non-volatile in nature
Ex : RAM Ex: Hard Disk, CD or DVD
6. Write short note on Impact printer [M-2019]
Impact printers print with striking of hammers or pins on ribbon.
These printers can print on multi-part by using mechanical pressure.
Dot matrix printers and line printers are impact printers.
CHAPTER – 2 (PART – 1) NUMBER SYSTEMS
1. Convert (46)10 into equivalent binary number. [AUG-2022]
2 46 LSB
2 23-0 (46)10 = (101110)2
2 11-1
2 5-1
2 2-1
1-0 MSB
2. List the encoding systems for characters in memory. [J-2023]
1. BCD – Binary Coded Decimal 2. EBCDIC – Extended Binary Coded Decimal Interchange Code
3. ASCII – American Standard Code for Information Interchange 4. Unicode
5. ISCII – Indian Standard Code for Information Interchange.
3. Convert (1324)8 into its equivalent decimal number. [M-2024]
Weight 512 64 8 1
Positional 8 3
8 2
81 80
Notation
Given 1 3 2 4
number
(1265) = 512x1+64x3+8x2+1x4
8
= 512+192+16+4
(1265)8 = (724)10
4. Convert (44)10 into Binary number [M-2022]
2 44 LSB
2 22-0 (46)10 = (101100)2
2 11-0
2 5-1
2 2-1
1-0 MSB
5. Write a short note on Hexadecimal number system [AUG-2022]
A hexadecimal number is represented using base 16. Hexadecimal or Hex numbers are used as a shorthand form
of binary sequence.
The first 10 symbols are the same as in the decimal system, 0 to 9 and the remaining 6 symbols are taken from the first 6
letters of the alphabet sequence, A to F, where A represents 10, B is 11, C is 12, D is 13, E is 14 and F is 15.
6. Perform binary addition for the following: 1510+2010 [M-2023]
2 15 2 20 1510 = 1111
2 7-1 2 10-0 2010 = 10100
2 3-1 2 5-0 1510+2010 = (100011)2
1- 1 2 2-1
1-0
7
PREPARED BY…, B.MOHAMED YOUSUF M.C.A., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
7. 11.0112 Binary to decimal equivalent [M-2020]
(11)2 = 3 21 20 . 2-1 2-2 2-3 =3+ .( 0x0.5+1x0.25+1x0.125 )
(0 + 0.25 +0.125)
1 1 . 0 1 1 (11.011)2 = (3.375)10
CHAPTER -2 (PART – 2) BOOLEAN ALGEBRA
1. What are derived gates? [J-2019]
The gates which are derived from the fundamental gates like, AND, OR, and NOT are called derived gates
Ex: NAND, NOR, XOR and XNOR are derived gates.
CHAPTER – 3 COMPUTER ORGANIZATION
www.kalvikadal.in
1. What is an instruction? [M-2019]
A command which is given to a computer to perform an operation on data is called an instruction.
2. What is a program counter? [M-2019, J-2023]
The Program Counter (PC) is a special register in the CPU which always keeps the address of the next
instruction to be executed.
3. What is HDMI? [S-2020, J-2024]
High-Definition Multimedia Interface is an audio/video interface transfers the uncompressed video and audio
data from a video controller, to a compatible computer monitor, LCD projector, digital television etc.
4. What is an instruction set? (AUG-2022)
Basic set of machine level instructions that a microprocessor is designed to execute is called as an instruction set.
CHAPTER – 4 THEORETICAL CONCEPTS OF OPERATING SYSTEM
1. What is the multi-user Operating system? [M-2019, M-2024]
It is used in computers and laptops that allow same data and applications to be accessed by multiple users at the same time.
The users can also communicate with each other.
Example : Windows, Linux and UNIX
2. What is a GUI? [J-2019, M-2023]
The GUI is a window based system with a pointing device to direct I/O, choose from menus, selections and a
keyboard to enter text.Its vibrant colours attract the user very easily.
3. What are the security management features (levels) available in Operating System? [S-2020]
(1) File access level (2) System level (3) Network level
4. Name some popular operating system used in personal computer and mobile devices. (M-2022)
1.Personal computer O.S – Windows, Linux, Unix 2.Mobile O.S – Android, Ios
5. Define software and mention its types (AUG-2022)
A software is set of instructions that perform specific task.
It interacts basically with the hardware to generate the desired output.
Software is classified into two types: 1) Application Software 2) System Software
CHAPTER – 5 WORKING WITH WINDOWS OPERATING SYSTEM
1. What is known as Multitasking? [J-2024]
Multiple applications can execute simultaneously in Windows, and this is known as “Multitasking”.
2. What are called standard icons? [M-2022, J-2023]
The icons which are available on desktop by default while installing Windows OS are called standard icons.
The standard icons available in all Windows OS are My Computer, Documents and Recycle Bin.
3. Differentiate Files and Folders. [AUG-2022]
Files Folders
A file is a collection of records Folder is a collection of files
The files store data of any kind. The folders store files and other sub folders
Each file has its own extension A folder does not have any extension.
Create a file:Start→All programs→Select applications→ok Create a folder:Right click→New→Folder→ok
CHAPTER – 6 SPECIFICATION AND ABSTRACTION
1. Define an algorithm. [M-2022, M-2024]
An algorithm is a step-by-step sequence of statements / instructions to solve a problem.
2. What is abstraction? (J-2023)
Ignoring or hiding unnecessary details and modelling an entity only by its essential properties is known as abstraction
3. What is difference between algorithm and a program? (AUG-2022)
Algorithm: An algorithm is a sequence of instructions to accomplish a task or solve a problem.
Program: A set of instructions that directs a computer’s hardware to perform a task.
CHAPTER – 7 COMPOSITION AND DECOMPOSITION
1. What is the difference between an algorithm and a program? [AUG-2022]
Algorithm Program
Algorithm is a step by step procedure to solve a It is a set of instructions to solve a problem by the
problem computer.
8
PREPARED BY…, B.MOHAMED YOUSUF M.C.A., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
An algorithm is a self-contained step-by-step set of A computer program is a sequence of instructions that
operations to be performed to solve a specific complete the rules of a specific programming language,
problem written to perform specific task with a computer.
Method / Procedure of a program Computer Coding / Program
No need to follow the grammar of a language Follow strictly the grammar of a programming language.
CHAPTER – 8 ITERATION AND RECURSION
1. What is an invariant? [J-2023]
An expression involving variables, which remains unchanged by an assignment to one of these variables, is
called an invariant of the assignment.
www.kalvikadal.in
An invariant is a condition that can be relied upon to be true during the execution of a program or during some portion of it.
2. Define a loop invariant. [M-2023]
An invariant the loop body is known as a loop invariant.
The property of the variables which remains unchanged by the execution of the loop body is called as loop invariant.
3. What is recursion? [M-2020]
Recursion is another algorithm design technique, closely related to iteration, but more powerful.
Using recursion, we solve a problem with a given input, by solving the same problem with a part of the input,
and constructing a solution to the original problem from the solution to the partial input.
4. What is iteration? [S-2020]
In iteration, the loop body is repeatedly executed as long as the loop condition is true. Each time the loop body
is executed, the variables are updated.
Iteration repeats the two steps of evaluating a condition and executing a statement, as long as the condition is true.
CHAPTER – 9 (PART – 1) INTRODUCTION TO C++
1. What is meant by a token? Name the token available in C++? [M-2023]
The smallest individual unit in a program is known as a “Token” or “Lexical unit.”
C++ has the following tokens: 1.Keywords, 2. Identifiers, 3.Constants, 4.Operators, 5.Punctuators.
2. What are keywords? Can keywords be used as identifiers? [J-2019]
Keywords are the reserved words which convey specific meaning to the C++ compiler.
No, Reserved words or keywords cannot be used as an identifier name.
3. Write about Input / Output operators in C++ [AUG-2022]
C++ provides the operator >> to get input. It extracts the value through the keyboard and assigns it to the
variable on its right; hence, it is called as “Stream extraction” or “get from” operator.
C++ provides << operator to perform output operation. The operator << is called the “Stream insertion” or “put to” operator.
4. Initially j is 20 and p is 4 then, What will be the value of p=p*++j? [M-2019]
Answer: p = 84
CHAPTER – 9 (PART – 2) DATA TYPES, VARIABLES AND EXPRESSIONS
1. Write a short note const keyword with an example. [M-2024]
Const is the keyword used to declare a constant.
Const are data items whose values do not change during the execution of the program.
It is known as Access modifier.
Example: int num = 100;
Const int num = 100;
2. What is the use of setw () format manipulator? [J-2024]
setw manipulator sets the width of the field assigned for the output.
The field width determines the minimum number of characters to be written in output.
Syntax: setw (number of characters)
3. Write the output for the following:[M-2023] Output
#include<iostream> 87.2525
using namespace std; 87
int main () { Double var1=87.25255; cout<<(float)var1<<end1; cout<<(int)var1<<end1; }
4. What is mean by type conversion? [S-2020]
The process of converting one fundamental data type into another is called as “Type Conversion”.
C++ provides two types of conversions. 1.Implicit type conversion 2.Explicit type conversion.
CHAPTER – 10 FLOW OF CONTROL
1. What is a null statement and compound statement? [M-2022 3M]
Null statement :
The “null or empty statement” is a statement containing only a semicolon (;)
Null statements are commonly used as placeholders in iteration statements or as statements on which to place
labels at the end of compound statements or functions.
Ex: ; // it is a null statement
9
PREPARED BY…, B.MOHAMED YOUSUF M.C.A., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
Compound statement :
C++ allows a group of statements enclosed by pair of braces {}.
This group of statements is called as a compound statement or a block.
The general format:
{
statement1;
statement2;
statement3;
www.kalvikadal.in
}
2. Write a while loop that displays numbers 2, 4, 6, 8........20. [J-2024]
int i=2;
while (i<=20)
{
cout << i<<”\t”;
i=i+2;
}
3. Write a while loop that displays numbers 5, 10, 15,.........50. [M-2019]
int i=5;
while (i<=50)
{
cout << i<<’,’ ;
i=i+5;
}
4. Write the syntax and example of if statement [M-2020]
Syntax:
if (expression)
true-block;
statement-x;
Example :
#include <iostream>
using namespace std;
int main()
{
int age;
cout<< “\n Enter your age: “;
cin>> age;
if(age>=18)
cout<< “\n You are eligible for voting ….”;
cout<< “This statement is always executed.”;
return 0;
}
5. What are the important control flow statement [J-2019]
Program statements that cause such jumps are called as “Control flow”.
The basics of control structures such as “Selection”, “Iteration” and “Jump” statement.
6. for (int m=1;m<=9,M+=2) cout<<m; [S-2020]
1)How many times the loop will be executed? 8 times 2) Write the output of the above snippet. 1 to 10
7. Convert the following if..else statement into conditional statement. [J-2023]
if (marks > = 60) Ans: Grade = (marks>=60)?A:B;
Grade = 'A';
else
Grade = 'B';
8. Write a note on break and continue statement in C++? [M-2020]
Break:
A break statement is a jump statement which terminates the execution of loop and the control is transferred to
resume normal execution after the body of the loop.
Continue:
The continue statement works quite similar to the break statement.
Instead of terminating the loop (break statement), continue statement forces the loop to continue or execute the
next iteration.
10
PREPARED BY…, B.MOHAMED YOUSUF M.C.A., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
9. Write the output of the following program. [M-2024] OUTPUT: 0 1 2 3 4 5 6 7 (Write vertical order)
#include<iostram>
using namespace std;
int main()
{
int i; for(i=0;i<8;i+
+) cout<<i<<endl;
return 0;
}
www.kalvikadal.in
CHAPTER – 11 FUNCTIONS
1. Write about strlen () function. [S-2020, J-2023, J-2024]
The strlen () takes a null terminated byte string source as its argument and returns its length.
The length does not include the null (\0) character.
General form :
Strlen(string)
Ex:
name= “Tamil”
strlen(name); [ length of the name = 5 ]
2. What are importance of void data type? [M-2019, M-2020, M-2022, M-2024]
To indicate the function does not return a value
To declare a generic pointer
3. What is Parameter and list its types? [J-2019]
Arguments or parameters are the means to pass values from the calling function to the called function
1. The variables used in the function definition as parameters are known as formal parameters.
2. The constants, variables or expressions used in the function call are known as actual parameters
CHAPTER – 12 ARRAYS AND STRUCTURES
1. What is the syntax to declare two – dimensional array. [M-2019, M-2022, J-2024]
The declaration of a 2-D array is : data-type array_name[row-size][col-size];
2. How many elements are there in the following array declaration and also write its memory allocation.
Char ch[15]; [J-2019]
Array declaration is: char array_name[size] Example: char your name[15];
15th element in the array.
CHAPTER – 13 OBJECT ORIENTED PROGRAMMING TECHNIQUES
1. What is polymorphism? [J-2019, M-2020, M-2023]
Polymorphism is the ability of a message or function to be displayed in more than one form.
2. Write the disadvantages of OOP. [M-2019]
Size: Object Oriented Programs are much larger than other programs.
Effort: Object Oriented Programs require a lot of work to create.
Speed: Object Oriented Programs are slower than other programs, because of their size.
3. What is a class in C++? [S-2020, J-2023]
1. Class is a user defined data type. 2. Class represents a group of similar objects.
CHAPTER – 14 CLASSES AND OBJECTS
1. What are called members? [M-2019]
Class comprises of members. Members are classified as Data Members and Member functions.
Data members are the data variables that represent the features or properties of a class.
Member functions are the functions that perform specific tasks in a class.
2. Write down the importance of destructor. [J-2019]
The purpose of the destructor is to free the resources that the object may have acquired during its lifetime.
A destructor function removes the memory of an object which was allocated by the constructor at the time
of creating a object.
CHAPTER – 15 POLYMORPHISM
1. What is function overloading? [M-2022]
The ability of the function to process the message or data in more than one form is called as function overloading.
2. List the operators that cannot be overloaded. [J-2019, J-2024]
1. Scope operator (::) 2.Sizeof 3.Member selector (.)
4. Member pointer selector (*) 5.Ternary operator (?:)
3. What is polymorphism? [M-2019, M-2020]
The word polymorphism means many forms (poly – many, morph – shapes)
Polymorphism is the ability of a message or function to be displayed in more than one form
CHAPTER – 16 INHERITANCE
11
PREPARED BY…, B.MOHAMED YOUSUF M.C.A., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
1. What is inheritance? [M-2023]
The mechanism of deriving new class from an existing class in called in heritance.
The technique of building new classes from an existing Class.
2. Why derived class is called power packed class? [M-2022]
The derived class inherits all the properties of the base class.
The derived class is a power packed class, as it can add additional attributes and methods and thus enhance its functionality.
CHAPTER – 17 COMPUTER ETHICS AND CYBER SECURITY
1. What is harvesting? [M-2019, AUG-2022]
A person or program collects login and password information from a legitimate user to illegally gain access to
www.kalvikadal.in
others’ account(s) is called harvesting.
2. What are Warez? [J-2023, M-2024]
Commercial programs that are made available to the public illegally are often called warez.
3. What is a Cookie? [S-2020]
A cookie is a small piece of data sent from a website and stored on the user's computer memory (Hard drive) by
the user's web browser while the user is browsing internet.
CHAPTER – 18 TAMIL COMPUTING
1. List of the search engines supporting Tamil. [M-2020, M-2024] 1.Google 2.Bing 3.Yahoo
2. What TSCII? [M-2020, M-2022]
TSCII (Tamil Script Code for Information Interchange) is the first coding system to handle our Tamil language.
This encoding scheme was registered in IANA (Internet Assigned Numbers Authority) unit of ICANN.
12
PREPARED BY…, B.MOHAMED YOUSUF M.C.A., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
CHAPTER 1 TO 18 THREE MARK PUBLIC QUESTION WITH ANSWERS [MARCH-2019 TO JULY-2024]
CHAPTER – 1 INTRODUCTION TO COMPUTERS
1. What are the characteristics of a computer? [M-2023]
1. Speed, 2.Accuracy, 3.Reliability, 4.Diligence, 5.Multi Processing, 6.Memory.
1. Speed : Computers can work very fast
2. Accuracy : The degree of accuracy of computer is very high.
3. Memory : Computers have the ability to store and retrieve data
2. Differentiate optical and Laser mouse. [M-2019]
www.kalvikadal.in
Optical mouse Laser mouse
Uses Light source Uses Laser Light
It has 2 or 3 buttons It has as many as 12 buttons.
Less sensitive Highly sensitive
Less sensitive towards surface Highly sensitive and able to work on any hard surface.
3. Write the characteristics of sixth generation. [M-2022]
Sixth Generation, computers could be defined as the era of intelligent computers, based on Artificial Neural Networks.
One of the most dramatic changes in the sixth generation will be the explosive growth of Wide Area Networking.
Natural Language Processing (NLP) is a component of Artificial Intelligence.
It provides the ability to develop the computer program to understand human language.
4. Write the significant features of monitor. (OR) Characteristics of monitor [M-2024]
Monitor is the most commonly used output device to display the information.
Pictures on a monitor are formed with picture elements called PIXELS.
There are many types of monitors available such as CRT (Cathode Ray Tube), LCD
(Liquid Crystal Display) and LED (Light Emitting Diodes).
5. Differentiate – Cold and Warm booting. [J-2023]
Cold booting Warm booting
When the system starts from initial state i.e. it is switched When the system restarts or when Reset button is pressed,
on, we call it cold booting or Hard Booting. we call it Warm Booting or Soft Booting.
The system does not start from initial state and so all
diagnostic tests need not be carried out in this case.
When the user presses the Power button, the instructions are The system does not start from initial state and so all
read from the ROM to initiate the booting process. diagnostic tests need not be carried out in this case. There
are chances of data loss and system damage as the data
might not have been stored properly.
CHAPTER – 2 (PART – 1) NUMBER SYSTEMS
1. What is radix of a number system? Give example. [AUG-2022]
Each number system is uniquely identified by its base value or radix.
Radix or base is the count of number of digits in each number system.
Radix or base is the general idea behind positional numbering system.
Example: 1.Binary –Radix 2 (1010)2 2.Octal – Radix 8 (457)8
3.Decimal- Radix 10 (314)10 4.hexa-Decimal – Radix 16 (25F)16
2. Write note on binary number system. [J-2023]
There are only TWO DIGITS in the Binary system, namely, 0 and 1.
The numbers in the binary system are represented to the base 2 and the positional multipliers are the powers of 2.
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. Add a) -2210+1510 [J-2024]
2 22 2 15
2 11-0 2 7-1
2 5-1 2 3-1
2 2-1 1-1
1-0
22 (10110)2 15 (1111)2
8 bit 00010110 8 bit 00001111
1’s 11101001
2’s 11101010
-22 1
1’s 1 1 1 0 1 0 0 1
1
2’s 1 1 1 0 1 0 1 0
13
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
1 1 1
-2210 1 1 1 0 1 0 1 0
1510 0 0 0 0 1 1 1 1
+ 1 1 1 1 1 0 0 1
2310+1210 = -710 = ( 11111001)2
b) 2010+2510 [J-2024]
2 20 2 25
2 10-0 2 12-1
www.kalvikadal.in
2 5-0 2 6-0
2 2-1 2 3-0
1-0 1-1
20 (10100)2 25 (11001)2
8 bit 00010100 8 bit 00011001
1
2010 0 0 0 1 0 1 0 0
2510 0 0 0 1 1 0 0 1
+ 0 0 1 0 1 1 0 1
2010+2510 = 4510 = ( 00101101)2
4. Convert 34010 to its equivalent Binary, Octal and Hexadecimal [J-2019]
Step :1 Decimal to binary
2 340 (340)10 = (101010100)2
2 170-0 Step :2 (Binary to Octal)
2 85-0 (101010100)2 (?)8
2 42-1 101 010 100 (340)10 = (524)8
2 21-0 5 2 4
2 10-1
2 5-0 Step : 3 (Binary to Hexadecimal)
2-1 (101010100)2 (?)16
1-0 0001 0101 0100 (340)10 = (154)16
1 5 4
5. A) State whether the following numbers are valid or not. If invalid write reason. [S-2020]
1) (796) - Not valid (octal base value 0 to 7)
8
2) (7GE)
16 - Valid ( Hexadecimal base value 0 to 9 & A to F) 3)(1110)2 - Valid ( Binary base value 0,1)
B) Write the number system for the following numbers.
1) (926)10 - Decimal number system 2) (ABC)16 - Hexadecimal number system 3) (450)8 – Octal number system
6. Convert the following into octal number into binary number. [J-2023]
i) 6137 ii) 245 iii) 472
6 1 3 7 2 4 5 4 7 2
110 001 011 111 010 100 101 100 111 010
6127 = (110001011111)2 245 = (010100101)2 472 = (100111010)2
CHAPTER – 2 (PART – 2) BOOLEAN ALGEBRA
1. Write the truth table of fundamental gates. [M-2020]
AND gate OR gate NOT gate
Input Output Input Output A A
A B A.B A B A+B 0 1
0 0 0 0 0 0 1 0
0 1 0 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1
2. Give the truth table of XOR gate. [M-2019, M-2024]
Input Output
A B C
0 0 0
0 1 1
1 0 1
1 1 0
3. Write the De Morgan’s law. [J-2024]
1) A+B = A. B 2) A.B = A+B
CHAPTER – 3 COMPUTER ORGANIZATION
14
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
1. Classify the microprocessor based on the size of the data. [M-2022, J-2024]
8-bit microprocessor 16-bit microprocessor 32-bit microprocessor and 64- bit.
2. Write down the classifications of microprocessors based on the instruction set. [M-2023]
There are two types of microprocessors based on their instruction sets.
1) Reduced Instruction Set Computers (RISC) :
Example: Pentium IV, Intel P6, AMD K6 and K7.
2) Complex Instruction Set Computers (CISC) :
Example: Intel 386 & 486, Pentium, Pentium II and III, and Motorola 68000.
3. Write down the interfaces and ports available in a computer. [S-2020]
www.kalvikadal.in
1. Serial Port: To connect the external devices, found in old computers.
2. Parallel Port: To connect the printers, found in old computers.
3. USB Ports: To connect external devices like cameras, scanners, mobile phones, external hard disks and printers to the computer.
4. VGA Connector: To connect a monitor or any display device like LCD projector.
5. Audio Plugs: To connect sound speakers, microphone and headphones.
6. PS/2 Port: To connect mouse and keyboard to PC.
7. SCSI Port: To connect the hard disk drives and network connectors.
4. Differentiate CD and DVD. [J-2019, M-2020, M-2024]
CD DVD
CD stands for Compact Disk DVD Stands for Digital Versatile/ video Disc.
Polycarbonate plastic material Optical disc
Capacity: CD-ROM is 700MB Capacity: 4.7 GB
Single-layered sides are usually silver-coloured. Double-layered sides are usually gold-coloured.
CD data is represented as tiny indentations DVD-ROM can be visually determined by
known as “pits” nothing the number of data sides of the disc.
5. Explain the types of RAM (AUG-2022)
There are two basic types of RAM 1.Dynamic RAM (DRAM) 2.Static RAM (SRAM)
Dynamic RAM being a common type needs to be refreshed frequently.
Static RAM needs to be refreshed less often, which makes it faster.
CHAPTER – 4 THEORETICAL CONCEPTS OF OPERATING SYSTEM
1. What are the advantages and disadvantages of Time-sharing features? [M-2023]
Advantage Disadvantage
Provides the advantages of quick response Problem of reliability
For each task a fixed time is allocated. Unreliability during data transmission
Avoids duplication of software It consumes more resource
Reduces CPU idle time Problem of data communication
2. List out the key features of Operating system [J-2023]
1.User Interface (UI) 2.Memory Management 3.Process management
4. Security Management 5. Fault Tolerance 6.File Management
3. Write a note following process management system (a) FIFO (b) SJF [S-2020]
FIFO (First In First Out) Scheduling: This algorithm is based on queuing technique.
Assume that a student is standing in a queue (Row) to get grade sheet from his/her teacher.
The other student who stands first in the queue gets his/her grade sheet first and leaves from the queue (Row).
Followed by the next student in the queue gets it corrected and so on.
This is the basic logic of the FIFO algorithm.
SJF (Shortest Job First)Scheduling:
This algorithm works based on the size of the job being executed by the CPU.
Consider two jobs A and B.
1) A = 6 kilo bytes 2) B = 9 kilo bytes . First the job “A” will be assigned and then job “B” gets its turn.
CHAPTER – 5 WORKING WITH WINDOWS OPERATING SYSTEM
1. What are the functions of Windows Operating System? [AUG-2022]
1. Access applications on the computer (Ex: Word processing, Games, Spread sheets, Calculators]
2. Load any new program on the computer. 3. Manage hardware such as printers, scanners, mouse, digital cameras etc.,
4. File management activities [Ex: Creating, Modifying, Saving, Deleting files and folders]
5. Change computer settings. [Colour scheme, Screen savers of our monitor etc]
2. Write a note on Recycle bin. [M-2020, J-2023]
Recycle bin is a special folder to keep the files or folders deleted by the user.
Which means we still have an opportunity to recover them.
The user cannot access the files or folders available in the Recycle bin without restoring it
Restore option is used to restore file or folder from the Recycle bin.
15
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
3. Write a note on the elements of a window. [J-2024]
The title bar will display the name of the application and the name of the document opened.
The menu bar is seen under the title bar. Menus in the menu bar can be accessed by pressing Alt key and the
letter that appears underlined in the menu title.
The workspace is the area in the document window to enter or type the text of your document.
The scroll bars are used to scroll the workspace horizontally or vertically.
The corners and borders of the window helps to drag and resize the windows.
4. Write the two ways to create a new folder. [M-2023]
Method I:
www.kalvikadal.in
Step 1: Open Computer Icon.
Step 2: Open any drive where you want to create a new folder.
Step 3: Click on File → New → Folder.
Step 4: A new folder is created with the default name “New folder”.
Step 5: Type in the folder name and press Enter key.
Method II:
Step 1: In the Desktop, right click → New → Folder.
Step 2: A Folder appears with the default name “New folder”.
Step 3: Type the name you want and press Enter Key.
Step 4: The name of the folder will change.
5. Write the procedure to create a file in word pad [AUG-2022]
1. Click Start → All Programs → Accessories → Wordpad or Run → type Wordpad, click
OK. Word pad window will be opened as folder.
2. Type the contents in the workspace and save the file using File → Save or Ctrl + S.
3. Save As dialog box will be opened.
4. In the dialog box, select the location where you want to save the file by using look in drop down list box.
5. Type the name of the file in the file name text box.
6. Click save button.
CHAPTER – 6 SPECIFICATION AND ABSTRACTION
1. How is state represented in algorithms? [M-2024]
State of a process is abstracted by a set of variables in the algorithm.
The state at any point of execution is simply the values of the variables at that point.
As the value of the variables are changed, the state changes.
2. What is decomposition [M-2020]
Decomposition breaks down a problem into smaller sub problems and combine their solutions to solve the original problem.
CHAPTER – 7 COMPOSITION AND DECOMPOSITION
1. What is case analysis? [M-2022]
Case analysis statement generalizes it to multiple cases.
Case analysis splits the problem into an exhaustive set of disjoint cases.
For each case, the problem is solved independently.
Example:
If C1, C2 and C3 are conditions, and S1,S2,S3 and S4 are statements, a 4-case analysis statement has the form.
1. case C1
2. S1
3. case C2
4. S2
5. case C3
6. S3
7. else
8. S4
2. What is a flow chart? Write the disadvantages of flow chart [S-2020]
Flowchart:
A flowchart is a collection of boxes containing statements and conditions which are connected by
arrows showing the order in which the boxes are to be executed.
Disadvantages:
Flowcharts are less compact than representation of algorithms in programming language or pseudo code.
They obscure the basic hierarchical structure of the algorithms.
Alternative statements and loops are disciplined control flow structures.
Flowcharts do not restrict us to disciplined control flow structures.
3. Define flow chart, pseudo code and a programming language [J-2019]
Flow chart:A flowchart is a collection of boxes containing statements and conditions which are connected by
arrows showing the order in which the boxes are to be executed.
16
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
Pseudo-code:
Pseudo code is a mix of programming-language-like constructs and plain English.
This notation is not formal nor exact.
It uses the same building blocks as programs, such as variables and control flow.
Programming language:
A programming language is a notation for expressing algorithms so that a computer can execute the algorithm.
An algorithm expressed in a programming language is called a program.
C, C++ and Python are examples of programming languages.
CHAPTER – 8 ITERATION AND RECURSION
www.kalvikadal.in
1. What are the values of variable m and n after in assignment in line (1) and line (3)? [M-2019]
1) m,n:=4,10 Ans: 1) m =4 , n = 10 3) m =9 , n = 8
2) - -m, n = ? , ?
3) m, n:=m+5, n-2
4) - -m, n = ? , ?
CHAPTER – 9 (PART – 1) INTRODUCTION TO C++
1. Describe the differences between keywords and identifiers? (or) Write a short note on [M-2020]
keywords identifiers
Keywords are the reserved words which convey Identifiers are the user-defined names given to
specific meaning to the C++ compiler. different parts of the C++ program
Keywords are the essential elements to construct These are the fundamental building blocks of a
C++ programs program
EX: int , void , break , do , if etc.. EX: name, age,class-11B,etc
2. Why is main function special? [J-2024]
C++ program is a collection of functions.
Every C++ program must have a main function.
The main ( ) function in the C++ programs is the starting point.
All the C++ programs begin their execution in main ().
Therefore, the executable statements should be inside the main ( ) function.
3. Write a note on logical operators in C++ (S-2020) (AUG-2022)
A logical operator is used to evaluate logical and relational expressions.
The logical operators act upon the operands that are themselves called as logical expressions.
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
4. What are keywords? Can keywords be used as identifiers? [M-2022]
Keywords are the reserved words which convey specific meaning to the C++ compiler.
No, Reserved words or keywords cannot be used as an identifier name.
CHAPTER – 9 (PART – 2) DATA TYPES, VARIABLES AND EXPRESSIONS
1. Types of conversion? Write short note on implicit type conversion [M-2019]
(Two types) 1. Implicit type conversion 2.Explicit type conversion.
Implicit type conversion:
An Implicit type conversion is a conversion performed by the compiler automatically.
So, implicit conversion is also called as “Automatic conversion”.
CHAPTER – 10 FLOW OF CONTROL
1. Write a C++ program to print multiplication table of a given number. [AUG-2022, J-2024]
#include<iostream> Output:
using namespace std; Enter Number To Find Multiplication table 3
int main() 3x1=3 3x2=6 3x3=9 3x4=12 3x5=15
{ 3x6=18 3x7=21 3x8=24 3x9=27 3x10=30
int num;
cout<<"Enter Number To Find Multiplication table ";
cin>>num;
for(int a=1;a < =10; a++)
17
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
{
cout<<num<<" * "<<a<<" = "<<num*a<<endl;
}
return 0;
}
2. Write the syntax and purpose of switch statement. [M-2019, M-2022, J-2024]
Syntax:
switch(expression)
{
www.kalvikadal.in
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.
3. Write a c++ program to sum the numbers from 1 to 10 using ‘for’ loop. [M-2022]
#include <iostream> Output
using namespace std; The sum of 1 to 10 is 55
int main ()
{
int I,sum=0;
for(i=1; i<=10;i++)
{
sum=sum+I;
}
cout<<”The sum of 1 to 10 is “<<sum;
return 0;
}
4. Write a short program to print following series: 1 3 5 7…75 [J-2019]
#include<iostream>
using namespace std;
int main() Output:
{ 1 3 5 7 9 11 13 15 …..75
int n;
for(int i=1;i<=75,i+=2)
cout<<i<< “\t”;
getch ( );
}
5. Write a C++ program to display numbers from 1 to 10. Except 5 using ‘for’ and ‘continue’ Statement. [M-2023]
#include<iostream>
using namespace std; Output:
int main() 1,2,3.4,6,7,8,9,10
{
int i;
for(i=1;i<=10;i++)
{
if(i==5)
{
continue;
}
cout<<i<<”\n”;
}
return 0;}
Differentiate – break and continue statement [J-2023]
18
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
6. Break Continue
Break is used to terminate the execution of the loop. Continue is not used to terminate the execution of loop.
It breaks the iteration. It skips the iteration.
When this statement is executed, control will come out When this statement is executed, it will not come out
from the loop and executes the statement immediate of the loop but moves/jumps to the next iteration of
after loop. loop.
Break is used with loops as well as switch case. Continue is only used in loops, it is not used in switch case.
7. What is null statement and compound statement? [M-2022]
Null statement: The "null or empty statement" is a statement containing only a semicolon.
www.kalvikadal.in
Compound (Block) statement:
C++ allows a group of statements enclosed by pair of braces {}.
This group of statements is called as a compound statement or a block.
8. Write a C++ program to display number from 5 to 1 using do-while loop [M-2024]
#include<iostream>
using namespace std;
int main()
{
int n=5;
do
{
cout<<n<<”,”;
n--;
}
while(n>0); [OR] while(n>=1);
return 0;
}
CHAPTER – 11 FUNCTIONS
1. What is the difference between isuppr () and toupper () functions? [J-2019, M-2020, M-2024]
isuppr() toupper()
This function is used to check the given character This function is used to convert the given
is uppercase. character into its uppercase.
General form: isupper(char c); General form: toupper(char c);
Ex: int n=isupper(‘A’); Ex: char c = toupper(‘k’); -- K
2. Write about strcmp () function. [M-2020, M-2023]
The strcmp () function takes two arguments: string1 and string2.
It compares the contents of string1 and string2 lexicographically.
The strcmp() function returns a:
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(= = ).
3. Write short note on pow () function in C++. [J-2024]
The pow () function returns base raised to the power of exponent.
If any argument passed to pow () is long double, the return type is promoted to long double.
If not, the return type is double.
The pow() function takes two arguments:
1. base – the base value 2.exponent – exponent of the base.
4. Write note on User-Defined functions [M-2022]
C++ also provides the facility to create new functions for specific task as per user requirement.
The name of the task and data required (arguments) are decided by the user and hence they are known as User-
defined functions.
5. Write a note on local scope [AUG-2022]
A local variable is defined within a block. A block of code begins and ends with curly braces { }.
The scope of a local variable is the block in which it is defined.
A local variable cannot be accessed from outside the block of its declaration.
A local variable is created upon entry into its block and destroyed upon exit.
CHAPTER – 12 ARRAYS AND STRUCTURES
1. Define an Array? What are the types? [M-2020, M-2024]
An array is a collection of variables of the same type that are referenced by a common name.
Types: 1. One-dimensional 2. Two-dimensional 3. Multi-dimensional arrays
19
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
2. With note an Array of strings. [AUG-2022]
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.
Usually, array of strings are declared in such a way to accommodate the null character at the end of each string.
Declaration of 2D Array: Char Name[6][10];
3. How to access members of a structure? Give example. [M-2020, J-2024]
Once the objects of structure type are declared, their members can be accessed directly.
Syntax: Object name . Member
www.kalvikadal.in
The syntax for that is using a dot (.) between the object name and the member name.
Example: student.rollno, student.age and student.weight .
4. What is called anonymous structure .Give an example? [J-2023]
A structure without a name/tag is called anonymous structure.
Example:
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.
5. What is called nested structure? Give example. [M-2019]
The structure declared within another structure is called as nested structure.
Example:
struct student
{
int age;
float height, weight;
struct dob
{
int date;
char month[4];
int year;
};
}s1;
CHAPTER – 13 OBJECT ORIENTED PROGRAMMING TECHNIQUES
1. Write a note on the features of procedural programming. [J-2023]
Programs are organized in the form of subroutines or sub programs. All data items are global.
Suitable for small sized software application.
Difficult to maintain and enhance the program code as any change in data type needs to be propagated to all
subroutines that use the same data type.
This is time consuming. Example: FORTRAN and COBOL.
2. List some of the features of modular programming. [J-2019, S-2020]
Emphasis on algorithm rather than data
Programs are divided into individual modules
Each modules are independent of each other and have their own local data
Modules can work with its own data as well as with the data passed to it.
Example: Pascal and C
3. Define Encapsulation [M-2019]
The mechanism by which the data and functions are bound together into a single unit is known as
Encapsulation. It implements abstraction.
CHAPTER – 14 CLASSES AND OBJECTS
1. What are the ways to define member function of a class? Give example. [J-2019]
The member functions of a class can be defined in two ways. 1.Inside 2.Outside class definition
Inside the class definition:
When a member function is defined inside a class, it behaves like inline functions. These are called Inline
member functions.
Outside the class definition:
When Member function defined outside the class just like normal function definition then it is be called as
outline member function or non-inline member function. Ex: void add :: display()
20
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
2. Write a short notes on class access specifies of C++. [M-2023]
Private Members: Cannot be accessed from outside the class.
Public Members: Accessible from anywhere outside the class but within a program.
Protected Members: Similar to a private member but it provides one additional benefit that they can be
accessed in child classes.
3. Read the following snippet answer the questions given below. [J-2019]
class student i) identify the member of the class?
{ Ans: m , n, add() , calc ()
int m,n;
www.kalvikadal.in
public void add(); ii) What is size of the objects x1,x2 in memory?
Float calc(); Ans: x1=8 bytes, x2=8 bytes
} x1,x2;
4. Read the following C++ code and answer the questions given below. [M-2020]
#include<iomanip> QUESTIONS
#include<iostream> 1.What is the name of the class in the above program?
using namespace std; Answer: product
class product 2. What are the data members are the class?
{ Answer: code, quantity, price
int code, quantity;
float price; 3. What is the memory size of the objects
p1,p2? public: Answer: Memory allocation for object p1 12
void assigndata(); Memory allocation for object p2 12
void print();
int main() { product p1,p2; cout<<”\n Memory allocation for object p1”<<sizeof(p1);
cout<<”\n Memory allocation for object p2”<<sizeof(p2); return 0; }
CHAPTER – 15 POLYMORPHISM
1. What are the rules for function overloading? [S-2020]
The overloaded function must differ in the number of its arguments or data types.
The return type of over loaded 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 over loading.
2. What is operator overloading? Give some example of operators which can not be overloaded. [J-2019]
Operator over loading:
The term operator overloading, refers to giving additional functionality to the normal C++ operators like +,++,-
,—,+=,-=,*.<,>.
It is also a type of polymorphism in which an operator is overloaded to give user defined meaning to it.
Example:
1.Scope operator (::) 2.Sizeof 3.Member selector (.) 4.Member pointer selector (✳) 5.Ternary operator (?:)
CHAPTER – 16 INHERITANCE
1. What are the points to be noted while deriving a new class? [M-2019, M-2024]
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 (the visibility mode), namely private, public or protected.
The names of the base classes (parent class).
2. What do you mean by overriding? [J-2023]
When a derived class member function has the same name as that of its base class member function, the
derived class member function shadows/hides the base class’s inherited function.
This situation is called function overriding and this can be resolved by giving the base class name followed by
:: and the member function name.
3. Write about three visibility mode [M-2020]
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.
When a base class is inherited with protected visibility mode the protected and public members of the base
class become ‘protected’ members of the derived class
When a base class is inherited with public visibility mode, the protected members of the base class will be
inherited as protected members of the derived class.
4. Consider the following c ++ code and answer the questions [S-2020]
class Personal 1 Which type of Inheritance is shown in the program?
{ Multilevel inheritance
int admno,rno; 2 Specify the visibility mode of base classes.
21
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
Marks – Public visibility mode Personal- Private visibility mode.
protected: 3.Name the base class(/es) and derived class (/es).
char Name[20]; Base Class Personal Derived Class Marks and Result
public:
personal();
void pentry();
void Pdisplay(); };
class Marks:private Personal
{ int M
www.kalvikadal.in
protected:
char Grade[5];
public:
Marks();
void Mentry();
void Mdisplay(); };
class Result:public Marks
{
float Total,Agg;
char remark[5];
result();
void Rcalculate(); void Rdisplay();
CHAPTER – 17 COMPUTER ETHICS AND CYBER SECURITY
1. Write about encryption and decryption. [M-2023]
Encryption:
Processes that ensure confidentiality that only authorized persons can access the information.
The process of translating the plain text data into random and mangled data.
Used by militaries and governments to facilitate secret communication.
Decryption: Reverse process of converting the cipher-text back to plaintext.
2. What are the guidelines to be followed by any computer user? [S-2020]
1.Honesty :
Users should be truthful while using the internet.
2. Confidentiality:
Users should not share any important information with unauthorized people.
3.Respect :
Each user should respect the privacy of other users.
4. Professionalism:
Each user should maintain professional conduct.
5.Obey The Law:
Users should strictly obey the cyber law in computer usage.
6. Responsibility:
Each user should take ownership and responsibility for their actions.
3. What are ethical issues? Name some. [M-2022]
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:
1. Cyber-crime 2) Software Piracy 3) Unauthorized Access 4) Hacking 5) Use of computers to commit fraud
6) Sabotage in the form of viruses 7) Making false claims using computers.
4. What is meant by computer ethics? [AUG-2022]
Computer ethics deals with the procedures, values and practices that govern the process of consuming
computer technology and its related disciplines without damaging or violating the moral values and beliefs of
any individual, organization or entity.
It is a set of moral principles that rule the behaviour of individuals who use computers.
An individual gains knowledge to follow the right behaviour, using morals that are also known as ethics.
CHAPTER – 18 TAMIL COMPUTING
1. Write a short note on Tamil virtual Academy. [M-2023]
With the objectives of spreading Tamil to the entire world through internet, Tamil Virtual University was
established by the Govt. of Tamilnadu.
This organization functions with the name of “Tamil Virtual Academy”.
It offers different courses in Tamil language, Culture, heritage etc.,
22
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
CHAPTER 1 TO 18 FIVE-MARK PUBLIC QUESTION WITH ANSWERS [MARCH-2019 TO JULY-2024
CHAPTER – 1 INTRODUCTION TO COMPUTERS
1. Explain the basic components of a computer with a neat diagram. [M-2019, J-2023, M-2024]
The computer is the combination of hardware and software.
Hardware is the physical component of a computer like motherboard, memory devices, monitor, keyboard etc.,
Software is the set of programs or instructions.
Both hardware and software together make the computer system to function.
Every task given to a computer follows an Input- Process- Output Cycle (IPO cycle).
It needs certain input, processes that input and produces the desired output.
www.kalvikadal.in
Input Unit
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.
Central Processing Unit (CPU):
CPU is the major component which interprets and executes software instructions.
It also controls the operation of all other components such as memory, input and output units.
The CPU has three components which are Control unit, Arithmetic and logic unit (ALU) and Memory unit.
1. Arithmetic and Logic Unit:
The ALU is a part of the CPU where various computing functions are performed on data.
The ALU performs arithmetic operations such as addition, subtraction, multiplication, division and logical operations.
The logical operations of ALU promote the decision-making ability of a computer.
2.Control Unit:
The control unit controls the flow of data between the CPU, memory and I/O devices.
It also controls the entire operation of a computer.
3.Output Unit:
An Output Unit is any hardware component that conveys information to users in an understandable form.
Example: Monitor, Printer etc.
4.Memory Unit:
The Memory Unit is of two types which are primary memory and secondary memory.
The primary memory is used to temporarily store the programs and data.
The secondary memory is used to store the data permanently.
The Primary Memory is volatile, the Random Access Memory (RAM) is an example of a main memory.
The Secondary memory is non-volatile, hard disk, CDROM and DVD ROM are examples of secondary memory.
2. Discuss the various generations of computers. [J-2019, AUG-2022, M-2020, M-2023, J-2024]
Generation Main Component Merits/Demerits
& Period used
First Vacuum tubes Big in size
Generation Consumed more power
1940-1956 Malfunction due to overheat
Machine Language was used
Second Transistors Smaller compared to First Generation
Generation Generated Less Heat
1956-1964 Consumed less power compared to first generation
Punched cards were used
First operating system was developed – Batch Processing and
Multiprogramming Operating System
Assembly language was used.
Third Integrated Computers were smaller,
Generation Circuits (IC) faster and more reliable
1964-1971 Consumed less power
High Level Languages were used
Fourth Microprocessor Smaller and Faster
Generation Very Large Scale Microcomputer series such as IBM and APPLE were developed
23
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
1971-1980 Portable Computers were introduced.
Integrated Circuits (VLSI)
Fifth Ultra Large Scale • Parallel Processing • Super conductors
Generation Integration(ULSI) • Computers size was drastically reduced.
1980 • Can recognise Images and Graphics
– till date • Introduction of Artificial Intelligence and Expert Systems
• Able to solve high complex problems including decision making
• Logical reasoning
Sixth Parallel and Distributed computing
Generation Computers have become smarter, faster and smaller
www.kalvikadal.in
In future Development of robotics
Natural Language Processing
Development of Voice Recognition Software
3. Explain Data and information [M-2022]
Data:
Data is defined as an un- processed collection of raw facts, suitable for communication, interpretation or processing.
For example, 134, 16 ‘Kavitha’, ‘C’ are data.
This will not give any meaningful message.
Information:
Information is a collection of facts from which conclusions may be drawn.
In simple words we can say that data is the raw facts that is processed to give meaningful, ordered or structured information.
For example Kavitha is 16 years old.
This information is about Kavitha and conveys some meaning.
This conversion of data into information is called data processing.
4. What is an output unit? Explain any three output unit. [M-2024]
Output Unit:
An Output Unit is any hardware component that conveys information to users in an understandable form.
Example: Monitor, Printer etc.
Output Devices:
1. Monitor:
Monitor is the most commonly used output device to display the information. It looks like a TV.
Pictures on a monitor are formed with picture elements called PIXELS.
Monitors may either be Monochrome which display text or images in Black and White or can be color, which
display results in multiple colors.
There are many types of monitors available such as CRT (Cathode Ray Tube), LCD (Liquid Crystal Display)
and LED (Light Emitting Diodes).
The monitor works with the VGA (Video Graphics Array) card.
The video graphics card helps the keyboard to communicate with the screen.
It acts as an interface between the computer and display monitor.
2.Plotter:
Plotter is an output device that is used to produce graphical output on papers.
It uses single color or multi color pens to draw pictures.
3.Printers:
Printers are used to print the information on papers.
Printers are divided into two main categories: 1. Impact Printers 2.Non Impact printers
Impact Printers:
These printers print with striking of hammers or pins on ribbon.
These printers can print on multi-part (using carbon papers) by using mechanical pressure.
For example, Dot Matrix printers and Line matrix printers are impact printers.
Non-Impact Printers:
These printers do not use striking mechanism for printing.
They use electrostatic or laser technology.
Quality and speed of these printers are better than Impact printers.
For example, Laser printers and Inkjet printers are non-impact printers.
4.Speakers:
Speakers produce voice output (audio) .
Using speaker along with speech synthesise software, the computer can provide voice output.
This has become very common in places like airlines, schools, banks, railway stations, etc.
5.Multimedia Projectors:
Multimedia projectors are used to produce computer output on a big screen.
These are used to display presentations in meeting halls or in classrooms.
24
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
CHAPTER – 2 (PART – 1) NUMBER SYSTEMS
1. a) Write the procedure to convert fractional Decimal to Binary [M-2023]
The method of repeated multiplication by 2 has to be used to convert such kind of decimal fractions.
The steps involved in the method of repeated multiplication by 2:
Step 1: Multiply the decimal fraction by 2 and note the integer part.
o The integer part is either 0 or 1.
Step 2: Discard the integer part of the previous product.
o Multiply the fractional part of the previous product by 2.
o Repeat Step 1 until the same fraction repeats or terminates (0).
www.kalvikadal.in
Step 3: The resulting integer part forms a sequence of 0s and 1s that become the binary equivalent of decimal fraction.
Step 4: The final answer is to be written from first integer part obtained till the last integer part obtained.
b) Convert (98.46)10 to binary: [S-2020, M-2023]
I. Integer Part: II. Fractional Part: Integer
2 98 98 = (1100010)2 0.46x2= 0.92 =0
2 49-0 0.92x2= 1.84 =1 (46)10 = (.0110010)2
2 24-1 0.84x2= 1.68 =1
2 12-0 0.68x2= 1.36 =1 (98.46)10 = (1100010.0111010….)2
2 6-0 0.36x2 = 0.72 =0
2 3-0 0.72x2= 1.44 =1
1-1 0.44x2= 0.88 =0
2. a) Add 11010102 + 1011012 [S-2020, J-2023, J-2024]
1 1 1
1 1 0 1 0 1 0
1 0 1 1 0 1
+ 1 0 0 1 0 1 1 1
11010102+1011012 = 100101112
b. Subtract 11010112 – 1110102
0 10 10
1 1 0 1 0 1 1
1 1 1 0 1 0
- 0 1 1 0 0 0 1
11010112 - 1112 = 1100012
3. Find the 2’s complement of (- 46)10 2) Convert (145)8 to binary [S-2020]
1. (-46)
2 46 (46) 101110
2 23-0 8 bit 00101110
2 11-1 1’s compliment 11010001
2 5-1
2 2-1
1-0
1
1’s 1 1 0 1 0 0 0 1
1
2’s 1 1 0 1 0 0 1 0
(-46) 11010010
2) Convert (145)8 to binary
(145)8 (?)2
1 4 5
www.kalvikadal.in
i] - 2110 +510 = (?)2
2 21 2 5
2 10-1 2 2-1
2 5-0 1-0
2 2-1
1-0
21 (10101)2 5 (101)2
8 bit 00010101 8 bit 00000101
1’s 11101010
2’s 11101011
- 21
1’s 1 1 1 0 1 0 1 0
1
2’s 1 1 1 0 1 0 1 1
1 1 1 1
-2110 1 1 1 0 1 0 1 1
510 0 0 0 0 0 1 0 1
+ 1 1 1 1 0 0 0 0
-2110+510 = -1610 = ( 11110000)2
12 (1100)2 15 (1111)2
8 bit 00001100 8 bit 00001111
1’s 11110011
2’s 11110100
- 12 1 1
1’s 1 1 1 1 0 0 1 1
1
2’s 1 1 1 1 0 1 0 0
1 1 1 1 1 1
-1210 1 1 1 1 0 1 0 0
1510 0 0 0 0 1 1 1 1
+ 1 0 0 0 0 0 0 1 1
-1210+1510 = 310 = ( 10000011)2
CHAPTER -2 (PART - 2) BOOLEAN ALGEBRA
1. Explain the fundamental gates with expression and truth table. [J-2024]
A gate is a basic electronic circuit which operates on one or more signals to produce an output signal.
There are three fundamental gates namely AND, OR and NOT.
1.AND Gate:
The AND gate can have two or more input signals and produce an output signal.
The output is "true" only when both inputs are "true", otherwise, the output is "false".
The output of the AND gate is represented by C, where A and B are two Boolean variables
A variable can take either of the values '0' or
'1'. AND gate C = AND B
26
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
AND Operation: C = A.B or C = AB
Example: C = A.B
= 0.0
=0
Symbol & Truth table for AND Gate:
www.kalvikadal.in
2. OR Gate:
The OR gate gets its name from its behaviour like the logical inclusive "OR".
The output is "true"”/1” if either or both of the inputs are "true"/”1”.
If both inputs are "false"/”0” then the output is "false” /”0”.
OR gate C = A OR B
OR Operation: C = A+B
Example: C = A+B
= 1+1
=1
Symbol & Truth table for AND Gate:
3. NOT Gate:
The NOT gate, called a logical inverter, has only one input.
It reverses the logical state.
In other words the output C is always the complement of the input.
NOT gate C = NOT A
NOT Operation: C = A
Example: if A is 0, C = 0 =1 ; On the other hand, if A is 1, C= 1 = 0
Symbol & Truth table for AND Gate:
27
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
Cache Memory :
The cache memory is a very high speed and expensive memory, which is used to speed up the memory
retrieval process.
Due to its higher cost, the CPU comes with a smaller size of cache memory compared with the size of the main memory.
Random-Access Memory (RAM):
The main memory is otherwise called as Random Access Memory.
It is the place in a computer where the Operating System, Application Programs and the data in current use are
kept temporarily so that they can be accessed by the computer’s processor.
The smallest unit of information that can be stored in the memory is called as a bit.
www.kalvikadal.in
RAM is a volatile memory
Hard Disk :
Hard disk is a magnetic disk on which you can store data.
The hard disk has the stacked arrangement of disks accessed by a pair of heads for each of the disks.
The hard disks come with a single or double sided disk.
3. Explain the types of ROM. [M-2022, M-2024, J-2024]
Read only memory(ROM)
Read only memory refers to special memory in a computer with pre-recorded data at manufacturing time
which cannot be modified.
The stored programs that start the computer and perform diagnostics are available in ROMs.
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.
ROM retains its contents even when the computer is turned off.
So, ROM is called as a non-volatile memory.
1. PROM:
Programmable read only memory is also a non-volatile memory on which data can be written only once.
Once a program has been written onto a PROM, it remains there forever.
Unlike the main memory, PROMs retain their contents even when the computer is turned off.
The PROM differs from ROM.
PROM is manufactured as a blank memory, whereas a ROM is programmed during the manufacturing process itself.
PROM programmer or a PROM burner is used to write data to a PROM chip.
The process of programming a PROM is called burning the PROM.
2. 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.
EPROM retains its contents until it is exposed to ultraviolet light.
The ultraviolet light clears its contents, making it possible to reprogram the memory.
An EPROM differs from a PROM, PROM can be written only once and cannot be erased.
EPROMs are used widely in personal computers because they enable the manufacturer to change the contents
of the PROM to replace with updated versions or erase the contents before the computer is delivered.
3. EEPROM:
Electrically Erasable Programmable Read Only Memory can be erased by exposing it to an electrical charge.
Like other types of PROM, EEPROM retains its contents even when the power is turned off.
Comparing with all other types of ROM, EEPROM is slower in performance.
CHAPTER – 4 THEORETICAL CONCEPTS OF OPERATING SYSTEM
1. Explain the concept of a Distributed Operating System along with its advantages. [M-2019, M-2024]
The Distributed Operating System is used to access shared data and files that reside in any machine around the world using
internet / intranet.
The user can handle the data from different locations.
The users can access as if it is available on their own computer.
Advantages :
A user at one location can make use of all the resources available at another location over the network.
Many computer resources can be added easily in the network
Improves the interaction with the customers and clients.
Reduces the load on the host computer.
2. List out the points to be noted while creating a user interface for an Operating system. [M-2019, J-2024]
The user interface should enable the user to retain this expertise for a longer time.
The user interface should also satisfy the customer based on their needs.
The user interface should save user’s precious time.
The ultimate aim of any product is to satisfy the customer.
The User Interface is also to satisfy the customer.
The user interface should reduce number of errors committed by the user.
28
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
3. Explain the process management algorithms in Operating System. [M-2020, M-2023]
Process management is function that includes creating and deleting processes (program) and providing
mechanisms for processes to communicate and synchronize with each other.
A system task, such as sending output to a printer or screen, can also be called as a Process.
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
1.FIFO (First In First Out)Scheduling:
This algorithm is based on queuing technique.
Technically, the process that enters the queue first is executed first by the CPU, followed by the next and so on.
www.kalvikadal.in
The processes are executed in the order of the queue (row).
Example:
Assume that a student is standing in a queue (Row) to get grade sheet from his/her teacher, according to the
order of the queue that is first in first out.
2. SJF (Shortest Job First)Scheduling:
This algorithm works based on the size of the job being executed by the CPU.
Example: Consider two jobs A and B. 1) A = 6 kilo bytes 2) B = 9 kilo bytes
First the job “A” will be assigned and then job “B” gets its turn.
3.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.
Example: Take three jobs A, B, C.
First the job A is assigned to CPU then job B and job C and then again A, B and C and so on.
4.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.
Example: Take two jobs A and B. Let the priority of A be 5 and priority B be 7.
Job B is assigned to the processor before job A.
4. List out the uses of operating system [M-2020, J-2023]
The main use of Operating System is to ensure that a computer can be used to extract what the user wants it do.
Easy interaction between the users and computers.
Starting computer operation automatically when power is turned on (Booting).
Controlling Input and Output Devices
Manage the utilisation of main memory.
Providing security to user programs.
CHAPTER – 5 WORKING WITH WINDOWS OPERATING SYSTEM
1. Explain the versions of Windows Operating System. [M-2022, J-2024]
Versions Year Specific features
Windows 1.x 1985 Introduction of GUI in 16 - bit. processor
Mouse was introduced as an input device.
Windows 2.x 1987 Supports to minimize or maximize windows.
Control panel feature was introduced with various system settings and customising options.
Windows 3.x 1992 Introduced the concept of multitasking.
Supported 256 colours which brought a more modern, colourful look to the interface.
Windows NT 1993 Designed to act as servers in network.
Windows 95 1995 Introduced Start button, the taskbar, Windows Explorer and Start menu.
Introduced 32 - bit processor and focused more on multitasking.
Windows 98 1998 Integration of the Web browser (Internet Explorer) with the Operating System.
DOS gaming began to disappear as Windows based games improved.
Plug and play feature was introduced.
Windows Me 2000 It introduced automated system diagnostics and recovery tools.
Windows 2000 Served as an Operating System for business desktop and laptop systems.
2000 Four versions of Windows 2000 were released: Professional (for business desktop
and laptop systems), Server (both a Web server and an office server), Advanced
Server (for line-of-business applications) and Data Centre Server (for high-traffic
computer networks).
Windows XP 2001 Introduced 64-bit Processor.
Improved Windows appearance with themes and offered a stable version.
Windows Vista 2006 Updated the look and feel of Windows.
Windows 7 2009 Booting time was improved,
Introduced new user interfaces like Aero Peek, pinning programs to taskbar,
handwriting recognition etc. and Internet Explorer 8
Windows 8 2012 Windows 8 is faster than previous versions of Windows.
29
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
Start button was removed.
Windows 8 takes better advantage of multi-core processing, solid state drives
(SSD), touch screens and other alternate input methods.
Served as common platform for mobile and computer.
Windows 10 2015 Start Button was added again.
Multiple desktop.
Central Notification Center for App notification and quick actions.
Cortana voice activated personal assistant.
2. Explain the parts of Windows in windows operating System. [S-2022]
www.kalvikadal.in
1. Application Window:
It is an area on a computer screen with defined boundaries, and within which information is displayed. Such
windows can be resized, maximised, minimised, placed side by side, overlap, and so on.
An Application Window contains an open application i.e. current application such as Word or Paint.
When two or more windows are opened, only one of them is active and the rest are inactive.
The Application Window of Open Office Writer and the appearance of the Multiple Windows opened
(overlapped) in the Desktop.
2. Document Window:
A document window is a section of the screen used to display the contents of a document.
CHAPTER – 6 SPECIFICATION AND ABSTRACTION
1. Write the specification of an algorithm for computing the square root of a number [M-2022]
Let us name the algorithm square_ root
It takes the number as the input. Let us the name the input n. n should not be negative.
It produces the square root of n as the output. Let us name the output y.
Then n should be the square of y.
The specification of the algorithm
is, square_ root(n)
- - inputs: n is a real number, n ≥ 0.
- - outputs : y is a real number such that y2 = n.
CHAPTER – 7 COMPOSITION AND DECOMPOSITION
1. Trace the step-by-step execution of the algorithm for factorial (4).
Factorial (n) -- inputs : n is an integer , n ≥ 0 -- outputs : f = n! f, i := 1 ,1
while I ≤ n f, I := f × I, i+1 [M-2019]
Algorithm trace:
Iteration f=f * i i=i+1 Condition while i ≤ n Factorial(4)
0 1 1 1 ≤ 4 True i=1, f=1; =f=2x3
1 1x1=1 1+1=2 2 ≤ 4 True = f=1x1 =f=6x4
2 1x2=2 2+1=3 3 ≤ 4 True [OR] =f=1x2 =f=24
3 2x3=6 3+1=4 4 ≤ 4 True
4 6x4=24 4+1=5 5 ≤ 4 True
2. Explain case analysis with an example [AUG-2022]
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.
For each case, the problem is solved independently.
If C1, C2, and C3 are conditions, and S1, S2, S3 and S4 are statements, a 4-case analysis statement has the
form, case C1 S1 case C2 S2 case C3 S3 else S4
The conditions C1, C2, and C3 are evaluated in turn.
For the first condition that evaluates to true, the corresponding statement is executed, and the case analysis statement ends.
If none of the conditions evaluates to true, then the default case S4 is executed.
The cases are exhaustive: at least one of the cases is true.
If all conditions are false, the default case is true.
The cases are disjoint: only one of the cases is true.
Though it is possible for more than one condition to be true, the case analysis always executes only one
case, the first one that is true.
If the three conditions are disjoint, then the four cases are (1) C1, (2) C2, (3) C3, (4) (not C1) and (not C2) and (not C3).
CHAPTER – 9 (PART – 1) INTRODUCTION TO C++
1. Write about Binary operators used in C++. [M-2023]
Binary Operators - Require two operands
C++ Operators are classified as: (1) Arithmetic Operators (2) Relational Operators (3) Logical Operators
(4) Bitwise Operators (5) Assignment Operators (6) Conditional Operator
30
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
1. Arithmetic Operators:
Arithmetic operators to perform simple arithmetic operations like addition, subtraction, multiplication, division etc.,
Support both unary and binary operators.
www.kalvikadal.in
2. 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 i.e 1 or 0 to
represents True or False respectively.
3. Logical Operators:
A logical operator is used to evaluate logical and relational expressions.
The logical operators act upon the operands that are themselves called as logical expressions.
AND,OR both are binary operators and NOT is a unary operators.
4. Bitwise Operators:
Bitwise operators work on each bit of data and perform bit-by-bit operation.
3 kinds of 1.Logical bitwise 2.Bitwise shift 3.One’s complement
5. Assignment Operator:
= (equal) is the assignment operator is used to assign a value on the right hand side to a variable on the left hand side.
It is also a binary operator.
Operator Name of Operator Example
+= Addition Assignment a = 10; c = a += 5; c = 15
- = Subtraction Assignment a = 10; c = a -= 5; c=5
*= Multiplication Assignment a = 10; c = a *= 5; c = 50
/= Division Assignment a = 10; c = a /= 5; c = 2
%= Modulus Assignment a = 10; c = a %= 5; c = 0
6. Conditional Operator:
?: is a conditional Operator which is also known as Ternary operator
This operator is used as an alternate to if … else control statement.
2. What are the types of Errors? [J-2019, M-2020, M-2022]
1. Syntax Error:
Syntax is a set of grammatical rules to construct a program.
Every programming language has unique rules for constructing the source code.
Syntax errors occur when grammatical rules of C++ are violated.
Example: if you type as follows, C++ will throw an error.
cout << “Welcome to Programming in C++”
2. 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.
31
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
This means, program is grammatically correct, but it contains some logical error.
So, Semantic error is also called as “Logic Error”.
3.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.
3. What are tokens in C++? Explain types of tokens with example [S-2020]
Tokens:
The smallest individual unit in a program is known as a Token or a Lexical unit.
www.kalvikadal.in
C++ has the following tokens: Keywords, Identifiers, Literals, Operators, Punctuators
Types of tokens:
1. Keywords:
Keywords are the reserved words which convey specific meaning to the C++ compiler.
They are the essential elements to construct C++ programs.
Ex: True, False, If, Else etc
2. Identifiers:
Identifiers are the user-defined names given to different parts of the C++ program viz. variables, functions,
arrays, classes etc.,Ex: Num ,
3. Literals (Constants):
Literals are data items whose values do not change during the execution of a program.
Therefore Literals are called as Constants.
4.Operators:
The symbols which are used to do some mathematical or logical operations are called as “Operators”.
The data items or values that the operators act upon are called as “Operands”.
5. Punctuators:
Punctuators are symbols, which are used as delimiters, while constructing a C++ program.
They are also called as “Separators”.
4. Explain use of header file with an example (Aug-2022)
# include <iostream>
Usually all C++ programs begin with include statements starting with a # (hash / pound).
The symbol # is a directive for the pre-processor.
That means, these statements are processed before the compilation process begins.
#include <iostream> statement tells the compiler’s pre-processor to include the header file “iostream” in the program.
The header file iostream should included in every C++ program to implement input / output functionalities.
In simple words, 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.
CHAPTER – 10 FLOW OF CONTROL
1. Explain control statement with suitable example. [J-2023]
Control statements are statements that alter the sequence of flow of instructions.
In a program, statements may be executed sequentially, selectively or iteratively.
Every programming languages
Provides statements to support sequence, selection (branching) and iteration.
If the Statements are executed sequentially, the flow is called as sequential flow.
1. Sequential statement:
The sequential statement are the statements, that are executed one after another only once from top to bottom.
These statements do not alter the flow of execution.
These statements are called as sequential flow statements.
They are always end with a semicolon (;).
2. Selection statement:
The selection statement means the statement (s) are executed depends upon a condition.
If a condition is true, a true block (a set of statements) is executed otherwise a false block is executed.
This statement is also called decision statement or selection statement.
Example : 1.if 2.elseif 3.nested if 4.Else if ladder 5.Switch case
3.Iteration Statement:
Iteration Statement (looping) is use to execute a set of statements repeatedly until a condition is satisfied.
If a condition evaluates to true, the set of statements (true block) is executed again and again.
This is also known as looping statement or iteration statement.
As soon as the condition becomes false, the repetition stops.
This is also known as looping statement or iteration statement.
The set of statements that are executed again and again is called the body of the loop.
The condition on which the execution or exit from the loop is called exit-condition or test-condition.
Example: 1.while 2.do-while 3. For
32
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
2. What is an entry control loop? Explain any one of the entry controlled loop with suitable example.
Entry control loop: (for loop) [J-2019, M-2020, S-2020, J-2024]
The for loop is a entry- controlled loop.
It 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))
separated by semicolons.
Syntax :
for (initialization(s); test-expression; update expression(s))
{
www.kalvikadal.in
Statement 1;
Statement 2
………….
}
Statement-x;
Working of for loop:
The initialization part is used to initialize variables or declare variable which are executed only once, then the
control passes to test-expression.
After evaluation of test-expression, if the result is false, the control transferred to statement-x. If the result is
true, the body of the for loop is executed, next the control is transferred to update expression.
After evaluation of update expression part, the control is transferred to the test-expression part. Next the steps
3 to 5 is repeated.
The workflow of for loop and flow chart are shown below.
Flow chart :
Example : Output:
#include <iostream> value of I : 0
using namespace std; value of I : 1
int main () value of I : 2
{ value of I : 3
int I; value of I : 4
for(I = 0; i< 5; I ++ )
cout<< “value of I : “ <<i<<endl;
return 0;
}
3. Write a program to find sum of the series. S = 1 + x + x2 +......+ xn [S-2020]
#include <iostream> Output
using namespace std; Enter N value 4
int main() Enter x value...2
{ SUM =31
int sum=1,x,i,t,n; cout<<”\
nEnter N value”; cin>>x;
cout<<”Enter x value…”;
cin>>n;
t=x;
for(i=1;i<=n; i++)
{
sum= sum+sum+t;
33
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
t=t*x;
}
cout<<”SUM=”<<sum;
}
4. Explain if else statement with example [Aug-2022]
If else:
If else execute a set of statement is a condition evaluates to true.
What if there is another course of action to be followed if the condition evaluates to false.
There is another form of if that allows for this kind of either or condition by providing an else clause.
www.kalvikadal.in
syntax
if ( expression)
{
True-block;
}
Else
{
False-block;
}
Statement-x
In if-else statement, first the expression or condition is evaluated to either true of false.
If the result is true, then the statements inside true-block is executed and false-block is skipped.
If the result is false, then the statement inside the false-block is executed i.e., the true-block is skipped.
Example:
#include<iostream>
using namespace std;
int main()
{
int num, rem;
cout<< "\n Enter a number: ";
cin>>num;
rem = num % 2;
if (rem==0)
cout<< "\n The given number"
<<num<< " is Even";
else
cout<< "\n The given number
"<<num<< " is Odd"; return 0;
}
5. What are the key differences between if… else and switch statements in C++? [M-2020, M-2024]
If-else Switch
Expression inside if statement decide whether Expression inside switch statement decide
to execute the if block or under else block. which case to execute.
An if-else statement uses multiple statements for Switch statement uses single expression
multiple choices for multiple choices.
If-else statement checks for equality as well as Switch checks only for equality.
for logical expression.
The if statement evaluates integer, character, Switch statement evaluates only character or a
pointer or floating-point type or Boolean type. integer data type.
If the condition is false the else block statements If the condition is false then the default statements
will be executed are executed.
6. Explain multi way branch statement (Switch) with a suitable example [M-2022]
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.
Syntax: Example:
switch(expression) #include<iostream>
{ using namespace std;
case constant 1: int main()
statement(s); { int num;
break; cout << “\n Enter week day number: “;
case constant 2: cin >> num;
statement(s); switch (num)
break; . . . . {
34
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
default: case 1 : cout << “\n Sunday”; break;
statement(s); case 2 : cout << “\n Monday”; break;
} case 3 : cout << “\n Tuesday”; break;
default: cout << “\n Wrong input….”; break; } }
7. Explain parts of a loop [M-2022]
Parts of a loop:
Every loop has four elements that are used for different purposes.
These elements are Initialization expression, Test expression, Update expression, The body of the loop
5. Initialization expression(s):
www.kalvikadal.in
The control variable(s) must be initialized before the control enters into loop.
The initialization of the control variable takes place under the initialization expressions.
The initialization expression is executed only once in the beginning of the loop.
2. Test Expression:
The test expression is an expression or condition whose value decides whether the loop-body will be execute or not.
If the expression evaluates to true (i.e., 1), the body of the loop gets executed, otherwise the loop is terminated.
In an entry-controlled loop, the test-expression is evaluated before the entering into a loop whereas in an exit-
controlled loop, the test-expression is evaluated before exit from the loop.
3. Update expression:
It is used to change the value of the loop variable.
This statement is executed at the end of the loop after the body of the loop is executed.
4. The body of the loop:
A statement or set of statements forms a body of the loop that are executed repetitively.
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.
In an exit-controlled loop, the body of the loop is executed first then the test-expression is evaluated.
If the test-expression is true the body of the loop is repeated otherwise loop is terminated.
8. Find the output of following program. [M-2022] Output
#include<iostream> Enter number 1:4
using namespace std; Enter number 2:5
int main() Enter number 3:13
{ Enter number 4:15
int num[10], even=0, odd=0; Enter number 5:18
for(int i=0; i<10; i++) Enter number 6: 23
{ Enter number 7: 34
cout<<"\n Enter Number"<<i+1<<"="; Enter number 8: 66
cin>>num[i]; Enter number 9: 77
if(num[i]%2==0) Enter number 10: 80
++even; There are 5 Even numbers
Else There are 5 Odd numbers
++odd;
}
cout<<"\n There are"<<even<<"Even Numbers";
cout<<"\n There are"<<odd<<"Odd Numbers";
}
CHAPTER – 11 FUNCTIONS
1. Explain Call by value method with suitable example. [M-2019, M-2020, S-2020, AUG-2022, M-2023]
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: Output
#include<iostream> Enter the Value for A : 5
using namespace std; The Value inside display function (a * a) : 25
void display(int x) The Value inside main function: 5
{
x=x*x;
cout<<"\n\nThe Value inside display function (x*x):"<<x;
}
int main()
{
int a;
cout<<”\nExample : Function call by value:”;
cout<<"\n\nEnter the Value for A :";
cin>>a;
35
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
display(a);
cout<<"\n\nThe Value inside main function "<<a;
return(0);
}
36
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
2. What is Recursion? Write a program to find GCD using recursion. [M-2020]
A function that calls itself is known as recursive function.
And, this technique is known as recursion.
Example Program: Output
#include <iostream> Enter a number to find its factorial: 5
using namespace std; Factorial of Number 5 = 120
int factorial(int); // Function prototype //
int main()
{
www.kalvikadal.in
int no;
cout<<"\nEnter a number to find its factorial: ";
cin >> no;
cout << "\nFactorial of Number " << no <<" = " << factorial(no);
return 0;
}
int factorial(int m)
{
if (m > 1)
{
return m*factorial(m-1);
}
else
{
return 1;
}
}
3. Explain scope of variable with example. [M-2020]
Scope refers to the accessibility of a variable. There are four types of scopes in C++.
They are: Local scope, Function scope, File scope and Class scope.
1.Local Scope:
A local variable is defined within a block.
A block of code begins and ends with curly braces { }.
The scope of a local variable is the block in which it is defined.
A local variable cannot be accessed from outside the block of its declaration.
A local variable is created upon entry into its block and destroyed upon exit.
2.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.
The scope of formal parameters is function scope.
3.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:
#include<iostream>
using namespace std;
void main ( )
{
Int b=20; b- function scope
If(a>b)
{
int t; t - Local variable
a=b;
b=t;
}
}
4.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.
37
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
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.
};
4. Write a program to accept any integer number and reverse it. [J-2024] Output
#include <iostream> Enter a number: 1234
using namespace std; Reverse of the number is: 321
int reverse(int num)
www.kalvikadal.in
{
int r=0,d;
while(num >0)
{
d=num%10;
r=r*10+d;
num=num/10;
}
return(r);
}
int main()
{
int x;
cout<<”\nEnter a number”;
cin>>x;
cout<<”\nReverse of the number is”<<reverse(x);
return 0;
}
5. Write the output of the following program. [M-2023] Output
#include<iostream> Monitor
using namespace std Speaker
int main () Printer
{ Scanner
Char dev[5][10]=”{“Monitor”,”Speaker”, “Printer”,”Scanner”,”Keyboard”}; Keyboard (or)
for(int i=0; i<5; i++) Error (or)
cout<<dev[i]<<”\n”; Relevant error message
}
6. Write a short note bon pow () in C++. [J-2023 (II)]
The pow() function returns base raised to the power of an exponent.
If any argument passed to pow() is long double, the return type is promoted to long double.
If not, the return type is double.
The pow() function takes two arguments: 1.base - the base value 2.exponent - exponent of the base
What is parameter and List its types (J-2023 (I))
Parameter:
Parameters are the means to pass values from the calling function to the called
function. Types: 1.Farmal parameters 2.Actual parameters
Formal parameters:
The variables used in the function definition as parameters are known as formal parameters.
Actual parameters:
The constants, variables or expressions used in the function call are known as actual parameters.
CHAPTER – 12 ARRAYS AND STRUCTURES
1. Write a C++ program to find the difference between two matrixes. [J-2019]
#include<iostream>
using namespace std;
int main()
{
int i,j,A[10][10],B[10][10],m,n;
cout<<”Enter number of rows”<<endl;
cin>>m;
cout<<”Enter number of columns”<<endl;
cin>>n;
cout<<”Enter the elements of A matrix”<<endl; for(i=0;i<m;i+
+)
38
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
{
for(j=0;j<n;j++)
{
cin>>A[i][j];
}
}
cout<<”Enter the elements of B matrix”<<endl; for(i=0;i<m;i+
+)
{
www.kalvikadal.in
for(j=0;j<n;j++)
{
cin>>B[i][j];
}
}
cout<<”The differences between the matrices”<<endl;
{
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
cout<< (A[i][j]-B[i][j]<<”s/t”
}
cout<<”/n”;
}
}
2. i) What is structure .What is its use? [M-2020]
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.
Use:
The structure provides a facility to store different data types as a part of the same logical element in one
memory chunk adjacent to each other.
ii) Write the syntax and an example for
structure. Syntax:
struct structure_name
{
type member_name1; type member_name2;
}
reference_name;
Example:
struct Student
{
long rollno; int age; float weight;
};
iii) How to access members of a structure? Give example.
Once the two objects of student structure type are declared, their members can be accessed directly.
The syntax for that is using a dot (.) between the object name and the member name.
Syntax is: Object name . Member
For example:
struct Student
{
longrollno; int age;
float weight;
}
balu, frank;
The elements of the structure Student can be accessed as follows:
balu.rollno balu.age balu.weight frank.rollno rank.age frank.weight.
www.kalvikadal.in
{
int ex;
public:
void get();
void display();
};
void Employee::display();
cout<<"Name: "<<name;
cout<<"Code: "<<code;
}
void Employee::getdata()
{
cout<<"Name: ";
gets(name);
cout<<"Code: ";
cin>>code;
}
void staff::getdata()
Employee::getdata();
cout<<"Experience:";
cin>>exp;
}
void staff::Display()
{
Employee::display();
cout<<"Experience :"<<ex<<" years"<<end
}
void main()
{
staff s
cout<<"Enter data"<<endl;
S.getdata()
cout<<"Display data"<<endl;
s.display(); return 0;
};
3. Debug the following C++ program (J-2023) Correct code
%include (iostream) #include <iostream>
using namespace std using namespace std;
int main [ ] int main()
{ {
int n,num, digit, rev =0 int n,num, digit, rev =0;
cout<<"Enter a positive number: "; cout<<"Enter a positive number: ";
cin>>num; cin>>num;
n =num: n =num;
while (num) while (num)
{ {
digit=num%10 digit=num%10;
rev=(rev *10)+ digit; rev=(rev *10)+ digit;
num=num/10 num=num/10;
} }
40
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
cout<<" The reverse of the number is: "<< rev <<endl; cout<<" The reverse of the number is: "<< rev <<endl;
if (n == rev) if (n == rev)
cout<<" The number is a palindrome"; cout<<" The number is a palindrome";
else: else
cout<<" The number is not a palindrome"; cout<<" The number is not a palindrome";
return 0; return 0;
}} }
CHAPTER – 13 OBJECT ORIENTED PROGRAMMING TECHNIQUES
1. Write the differences between Object Oriented Programming and procedural programming. [J-2019]
www.kalvikadal.in
Procedural Programming. Object Oriented Programming
It deals with algorithms It deals with data
Programs are divided into functions Programs are divided into objects
Less secure More secure
It is top down approach It is bottom down approach
All data items are global. Data abstraction is introduced.
Emphasizes on algorithm. Emphasizes on data rather than algorithm.
Overloading is not possible Overloading is possible
Implement programs in the form of sub programs. Implement programs using classes and objects.
Ex: C,VB,COBOL, FORTRAN Ex: C++, JAVA, VB.NET,PYTHON
2. What are the advantages of OOPS? [M-2020, S-2020, M-2022, J-2024]
1. Re-usability:
“Write once and use it multiple times” you can achieve this by using class.
2. 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.
3. Easy Maintenance:
It is easy to maintain and modify existing code as new objects can be created with small differences to existing ones.
4. Security:
Using data hiding and abstraction only necessary data will be provided thus maintains the security of data.
3. Write a note on the basic concepts that supports OOPs? (OR) [M-2019, M-2020, S-2020, J-2023]
What are the main features of OOPS?
1.Encapsulation:
The mechanism by which the data and functions are bound together into a single unit is known as Encapsulation.
Encapsulation is about binding the data variables and functions together in class. It can also be called data binding.
2.Data Abstraction:
Abstraction refers to showing only the essential features without revealing background details.
Classes use the concept of abstraction to define a list of abstract attributes and function which operate on these attributes.
They encapsulate all the essential properties of the object that are to be created.
The attributes are called data members because they hold information.
The functions that operate on these data are called methods or member function.
3. 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.
4. Inheritance:
Inheritance is the technique of building new classes (derived class) from an existing Class (base class)
The most important advantage of inheritance is code reusability.
5. Polymorphism:
Polymorphism is the ability of a message or function to be displayed in more than one form.
CHAPTER – 14 CLASSES AND OBJECTS
1. Mention the differences between constructor and destructor. [M-2023]
Constructor Destructor
The name of the constructor must be same as that The destructor has the same name as that class
of the class. prefixed by the tilde character ‘~’.
No return type can be specified for constructor. It has no return type
A constructor can have parameter list. The destructor cannot have arguments.
The constructor function can be overloaded. Destructors cannot be overloaded.
They cannot be inherited but a derived class can They cannot be inherited
call the base class constructor.
The compiler generates a constructor, in the In the absence of user defined destructor, it is
absence of a user defined constructor. generated by the compiler.
41
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
The constructor is executed automatically when The destructor is executed automatically when the control
the object is created. reaches the end of class scope to destroy the object.
Allocated memory space for the object Destroy the object
2. Write the output of the following. [M-2024] Output:
#include<iostream> Constructor
using namespace std; Name: Bharathi
class student Roll no:14
{ Marks : 100
int rno, marks; Back to Main
www.kalvikadal.in
public:
student(int r,int m)
{
cout<<"Constructor "<<endl;
rno=r;
marks=m;
}
void printdet()
{
marks=marks+30;
cout<<"Name: Bharathi"<<endl;
cout<<"Roll no : "<<rno<<"\n";
cout<<"Marks : "<<marks<<endl;
}
};
int main()
{
student s(14,70);
s.printdet();
cout<< "Back to Main";
return 0;
}
2. Write the output for the following program [M-2019]
#include<iostream>
using namespace std;
class nest;
{
int x1;
int square_num()
{
return x1*x1;
}
public:
void input_num() Output
{ Enter the number 2
cout<<”\n Enter the number”; The square of 2 is 4
cin>>x1; The cube of 2 is 8
}
int cube_num()
{
return x1*x1*x1;
}
void disp_num()
{
int sq=square_num()
int cu= cube_num()
cout<<”\n The square of “<<x1<<”is”<<sq;
cout<<”\n The cube of “<<x1<<”is”<<cu;
}
};
int main()
{
nest n1;
n1.input_num();
n1.disp_num();
return 0;
}
42
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
3. Write the output of the following. [J-2019]
# include <iostream> Output
# include <conio> 151515
using namespace std
class add
{
int a,b;
public:
int sum;
www.kalvikadal.in
void getdata()
{ a=
5;
b=10;
sum = a+b;
}
} a1;
add a2;
int main()
{
add a3;
a1.getdata();
a2.getdata();
a3.getdata();
cout<<a1.sum;
cout<<a2.sum;
cout<<a3.sum; return 0; }
4. Debug the following program (S-2020) Correct Code
1. #include <stream> 1.# include <iostream>
2. using namespace std: 2.using namespace std;
3. classes Box 3.class Box
4. { 4.{
5. double width; 5.double width;
6. public:: 6.public:
7. double length; 7. double length;
8. int printWidth() 8.void printWidth( )
9. { 9. {
10. cout<<"\nThe width of the box is :"<<<width; 10. cout<<”\n The width of the box is...”<<width;
11. cout<<"\nThe length of the box is :"<<iength; 11. cout<<”\n The length of the box is...”<<length;
12. } 12. }
13. void setWidth(double w,l); 13. void setWidth( double w );
14. } 14. };
15. void Box?:setWidth(double w,double 15. void Box :: setWidth(double w)
16. { 16. {
17. width=w; 17. width=w;
18. length=1; 18. }
19. } 19. int main()
20. int MAIN() 20. {
21. { 21. Box b;
22. Box obj; 22. b.setWidth(67.0,20.0);
23. b.setWidth(67.0,20.0); 23.b.printWidth();
24. b.print Width(); 24. return 0;
25. exit 0; 25. }
}
5. Write the output for the following C++ program. [S-2020]
#include<iostream>
using namespace std;
class Trial
int x;
public:
void assign(int y)
{
x=y;
43
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
}
void test(Trial obj1,Trial obj2) Output
{ Value of Object1 10
obj1.x=10; Value of Object2 20
obj2.x=20; Value of first assignment 54
cout<<"\nValue of Object1 :"<<obj1.x; Value of second assignment
45
cout<<"\nValue of Object2 :"<<obj2.x; Value of first assignment after passing the values 64
} Value of second assignment after passing the values 65
void display()
{
cout<<x;
}
};
int main()
{
Trial a1, a2,a3;
a2.assign(45);
a1.assign(54);
cout<<"\nValue of first assignment:";
a2.display();
cout<<"\nValue of second assignment:";
a1.display();
a3.test(a1, a2);
cout<<"\nValue of first assignment after passing the values:";
a2.display();
cout<<"\nValue of second assignment after passing the values:";
a1.display();
return 0;
CHAPTER – 15 POLYMORPHISM
1. What are the rules for operator overloading? (OR) [M-2020, AUG-2022, J-2023, J-2024]
Restrictions on Operator Overloading
1. Precedence and Associate activity of an operator cannot be changed.
2. No new operators can be created, only existing operators can be overloaded.
3. 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
4. Overloaded operators cannot have default arguments.
5. When binary operators are overloaded, the left hand object must be an object of the relevant class
2. What is function overloading? What are the rules for function overloading? [M-2024]
Function overloading:
The ability of the function to process the message or data in more than one form is called as function overloading.
Rules for function overloading: [J-2023(B)]
The overloaded function must differ in the number of its arguments or data types
The return type 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.
3. Write the output of the following program. [M-2020]
Assume the values for age as 23, height as 161.5 and weight as
45. #include <iostream> Output
using namespace std; Enter the age: 23
struct Student Enter the height: 161.5
int age; Enter the weight: 45
float height, weight; Your details:
}obj; Age : 23
int main() Height : 161.5 Weight : 45
{
cout<<"\nEnter the age :";
cin>>obj.age; cout<<"\
nEnter the height:";
cin>>obj.height; cout<<"\
nEnter the weight:";
cout<<"\nYour details :";
44
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
cout<<"\nAge :"<<obj.age;
cin>>obj.weight; cout<<"\nHeight :"<<obj.height; cout<<"\
tWeight :"<<obj.weight; salai
return 0;
}
4. Debug the following program (M-2020)
?include<iostream> Line No Error Program Correct Program
using namespace std 1 ?include<iostream> #include<iostream>
class sum 2 using namespace std using namespace std;
www.kalvikadal.in
{ 7 protected: public:
int a,s; 8 publicly: public:
protected: 14 void input(); void input()
int b, 28 +sum() ~sum()
publicly: 32 class difference # public sum class difference : public sum
void sum() 34 int d1; int d;
{ 44 d=minuses(); d=minus();
a=b=s=0; 52 int main[] int main()
cout<<"\nSum Constructor :";
}
void input();
{
cout<<"\nEnter the values for a and b :";
cin>>a>>b;
}
void addition()
{
s=a+b;
cout<<"\nThe sum of two numbers is :"<<s;
}
void minus()
{
return a-b;
}
+sum()
{
cout<<"\nSum Destructor:";
} };
class difference # public sum
{
int d1; public:
difference()
{
d=0;
cout<<"\nDifference Constructor:";
}
void sub()
{
input();
d=minuses();
cout<<"\nThe difference of two numbers are :"<<d;
}
~difference()
{
cout<<"\nDifference Destructor:";
}
};
int main[]
{
difference obj;
int ch=0;
cout<<"\n1. Add :\n\n2.Difference:";
cout<<"\n\nEnter your choice:";
cin>>ch;
switch(ch);
{
case '1':
obj.input();
obj.addition();
break;
case '2':
obj.sub();
break
}
return 0;
45
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
};
CHAPTER – 16 INHERITANCE
1. Explain the different types of inheritance. [J-2019, AUG-2022, M-2024]
There are different types of inheritance viz., Single Inheritance, Multiple
inheritance, Multilevel inheritance, hybrid inheritance and hierarchical inheritance.
1. Single Inheritance :
When a derived class inherits only from one base class, it is known as single inheritance.
2. Multiple Inheritance:
www.kalvikadal.in
When a derived class inherits from multiple base classes it is known as multiple inheritance
3. Hierarchical inheritance:
When more than one derived classes are created from a single base class, it is known as Hierarchical
inheritance.
4. 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.
5. Hybrid inheritance:
When there is a combination of more than one type of inheritance, it is known as hybrid inheritance.
Hence, it may be a combination of Multilevel and Multiple inheritance or Hierarchical and Multilevel
inheritance or Hierarchical, Multilevel and Multiple inheritance.
46
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
2. Explain the different visibility mode through pictorial representation. [M-2020, S-2020, J-2023]
An important feature of Inheritance is to know which member of the base class will be acquired by the derived class.
This is done by using visibility modes.
The accessibility of base class by the derived class is controlled by visibility modes.
The three visibility modes are private, protected and public.
The default visibility mode is private.
1.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.
www.kalvikadal.in
2. Protected visibility mode:
When a base class is inherited with protected visibility mode the protected and public members of the base
class become ‘protected members ‘ of the derived class.
47
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
3. Consider the following c ++ code and answer the questions [S-2020 3M]
class Personal 3.1 Which type of Inheritance is shown in the program?
{ Multilevel inheritance
int Class,Rno; 3.2 Specify the visibility mode of base classes.
char Section; Public - Result class ; Private – Mark class
protected: 3.3 Give the sequence of Constructor/Destructor Invocation when object of class Result is created.
char Name[20]; Constructor Personal (), Marks (), and Result ().
public: Destructor Result (), Marks (), and Personal ().
personal(); 3.4 Name the base class(/es) and derived class (/es).
www.kalvikadal.in
void pentry(); Base Class Personal Derived Class Marks and Result
void Pdisplay(); }; 3.5 Give number of bytes to be occupied by the object of the following class:
class Marks:private Personal (a) personal : 32 (or) 25 bytes ; (b) Marks : 60 [or) 25 bytes; (c) Result : 92 [or) 29 bytes
{ float M{5}; 3.6 Write the names of data members accessible from the object of class Result.
protected: Total, Agg, Grade, Final, Commence
char Grade[5]; 3.7 Write the names of all member functions accessible from the object of class Result.
public: Mentry(); Mdisplay(); Rcalculate(); Rdisplay();
Marks(); 3.8 Write the names of all members accessible from member functions of class Result.
void Mentry(); Data Members Member Functions
void Mdisplay(); }; Commence Mentry();
class Result:public Marks Grade Mdisplay();
{ Total Agg Rcalculate();
float Total,Agg; FinalGrade Rdisplay();
public:
char FinalGrade, Commence[20];
Result();
void Rcalculate();
void Rdisplay();
};
4. Debug the following program. [M-2022] Correct Code:
1. %include(iostream.h) 1.#include<iostream>
2. #include<conio.h> 2.#include<conio.h>
3. Class A() 3.using namespace std;
4. { 4.class A
5. public; 5.{
6. int a1,a2:a3; 6.public:
7. void getdata[ ] 7.int a1,a2,a3;
8. { 8.void getdata()
9. a1=15; 9.{
10. a2=13; a3=13; 10. a1=15; a2=13; a3=13;
11. } 11.}
12. } 12.};
13. class B:: public A() 13.class B:public A
14. { 14.{
15. PUBLIC 15.public:
16. voidfunc() 16.void func()
17. { 17.{
18. int b1:b2:b3; 18.int b1,b2,b3;
19. A::getdata[]; 19. A::getdata();
20. b1=a1; 20. b1=a1;
21. b2=a2; 21. b2=a2;
22. a3=a3; 22. b3=a3;
23. cout<<b1<<’\t’<<b2<<’t\’<<b3; 23. cout<<b1<<’\t’<<b2<<’t\’<<b3;
24. } 24. }
25. void main() 25. };
26. { 26. Int main()
27. B der; 27. {
28. der1:func(); 28. B der;
29. } 29. der.func();
30. }
L.n Given code Correct Code
1. %include(iostream.h) #include<iostream.h>
3. Class A( ) Class A
5. public; public:
6. int a1,a2:a3; int a1,a2,a3;
7. Void getdata[ ] void getdata( )
10. a2=13; a3=13; a2=14; a3=13; (In order to get the given output)
12. } };
13. Class B:: public A() class B:: public A
15. PUBLIC public:
48
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
16. voidfunc() void func()
18. int b1:b2:b3; int b1,b2,b3;
19. A::getdata[]; A::getdata( );
22. a3=a3; b3=a3;
23. cout<<b1<<’\t’<<b2<<’t\’<<b3; cout<<b1<<’\n’<<b2<<’\n’<<b3;
24 } };
28 der1:func(); der:func();
5. Debug the following C++ program. [M-2023]
1. #include<iostream>
www.kalvikadal.in
2. using namespace std;
3. class base
4. {
5. public:
6. base()
7. {
8. cout<<"\nConstructor of base class...";
9. }
10. ~base()
11. {
12. cout<<"\nDestructor of base class.....";
13. }
14. };
15. class derived:public base
16. {
17. public :
18. derived()
19. {
20. cout << "\nConstructor of derived....";
21. }
22. ~derived()
23. {
24. cout << "\nDestructor of derived....";
25. }
26. };
27. class derived1 :public derived
28. {
29. public :
30. derived1()
31. {
32. cout << "\nConstructor of derived1....";
33. }
34. ~derived1()
35. {
36. cout << "\nDestructor of derived1....";
37. }
38. };
39. int main()
40. {
41. derived1 x;
42. return 0;
43. }
L.n Given code Correct Code
1. $include<iostream> #include<iostream.h>
3. class base () class base
5. Public public:
10 !base ~base()
13 }; }
14 } };
15 Class derived:: public base class derived:public base
17 public public:
22 !derived() ~derived()
27 Class derived1:: public derived class derived1:public derived
49
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
30 derived1(); derived1()
34 derived1(); ~derived1()
38. } };
39 int main(): int main()
www.kalvikadal.in
50
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
6. Debug the following C++ program [M-2024]
Output:
Total area: 35
Program:
%include <iostream>
using namespace std:
CLASS Shape
{
Private ( )
www.kalvikadal.in
int count
Protected;
int width;
int height;
PUBLIC;
Void setWwidth[int w]
{
width = w;
};
void setheight(int h)
{
height = h;
}
}
Class rectangle:: Public Shape
{
Public
int getarea [ ]
{
return (width * height);
};
}
int MAIN()
{
rectangle rect:
rect. setwidth(5);
rect.setheight(7);
cout<< "Total area; "<<rect.getarea() <<endl;
return 0;
};
L.n Given code Correct Code
1 %include <iostream> #include<iostream>
2 using namespace std: using namespace std;
3 CLASS Shape class Shape
5 Private ( ) private:
6 int count int count;
7 Protected; protected:
10 PUBLIC; public:
11 Void setWwidth[int w] void setwidth(int w)
14 }; }
19 } };
20 Class rectangle:: Public Shape class rectangle : public Shape
22 Public public:
23 int getarea [ ] int getarea()
26 }; }
27 } };
28 int MAIN() int main()
30 rectangle rect: rectangle rect;
31 rect. setwidth(5); rect.setwidth(5);
33 cout<< "Total area; "<<rect.getarea() <<endl; cout<< "Total area: "<<rect.getarea() <<endl;
35 }; }
CHAPTER – 17 COMPUTER ETHICS AND CYBER SECURITY
51
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
3. Write the different types of cyber-attacks. [J-2019,M-2023]
Cyber Attack Function
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.
One of the most common virus is Trojan.
A Trojan virus is a program that appears to perform one function but actually performs malicious activity when
executed.
Worms Worms are self- repeating and do not require a computer program to attach themselves.
Worms continually look for vulnerabilities and report back to the author of the worm when weaknesses are
www.kalvikadal.in
discovered.
Spyware Spyware can be installed on the computer automatically when the attachments are open, by clicking on links or by
downloading infected software.
Ransom ware Ransom ware is a type of malicious program that demands payment after launching a cyber-attack on a computer
system.
This type of malware has become increasingly popular among criminals and costs the organizations millions each
year.
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.
52
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
8. If a = 65 , b= 15 then find (M-2020)
a=65, b=15
(i) a&b
8bits Binary value of 65 0100 0001 8bits Binary value of 15 0000 1111
ii) 245
2 4 5 245 = (010100101)2
010 100 101
53
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
iii) 472
4 7 2 472 = (100111010)2
100 111 010
4. Write a C++ program to display numbers from 1 to 10. Except 5 using ‘for’ and ‘continue’ Statement. (M-2023)
#include<iostream>
using namespace std; Output:
int i;
for(i=1;i<=10;i++)
{
www.kalvikadal.in
if(i==5)
{
continue;
}
cout<<i<<"\n";
}
return 0;
}
5. What is meant by computer ethics? (Aug-2022)
Computer ethics deals with the procedures, values and practices that govern the process of consuming
computer technology and its related disciplines without damaging or violating the moral values and beliefs of
any individual, organization or entity.
It is a set of moral principles that rule the behaviour of individuals who use computers.
An individual gains knowledge to follow the right behaviour, using morals that are also known as ethics.
6. Write a c++ program to sum the numbers from 1 to 10 using ‘for’ loop. (M-2022)
#include <iostream> Output
using namespace std; The sum of 1 to 10 is
55 int main ()
{
int i,sum=0;
for(i=1; i<=10;i++)
{
sum=sum+i;
}
cout<<"The sum of 1 to 10 is "<<sum;
return 0;
}
54
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
7. Consider the following c ++ code and answer the questions S-2020
class Personal 1 Which type of Inheritance is shown in the program?
{ Multilevel inheritance
int admno,rno; 2 Specify the visibility mode of base classes.
Marks – Public visibility mode Personal- Private visibility mode.
protected: 3.Name the base class(/es) and derived class (/es).
char Name[20]; Base Class Personal Derived Class Marks and Result
public:
personal();
void pentry();
www.kalvikadal.in
void Pdisplay(); };
class Marks:private Personal
{ int M
protected:
char Grade[5];
public:
Marks();
void Mentry();
void Mdisplay(); };
class Result:public Marks
{
float Total,Agg;
char remark[5];
result();
void Rcalculate(); void Rdisplay();
8. Read the following C++ code and answer the questions given below. (M-2020)
#include<iomanip> QUESTIONS
#include<iostream> 1.What is the name of the class in the above program?
using namespace std; Answer: product
class product 2. What are the data members are the class?
{ Answer: code, quantity, price
int code, quantity;
float price; 3. What is the memory size of the objects p1,p2?
public: Answer: Memory allocation for object p1 12
void assigndata(); Memory allocation for object p2
12 void print();
int main()
{
product p1,p2;
cout<<”\n Memory allocation for object p1”<<sizeof(p1);
cout<<”\n Memory allocation for object p2”<<sizeof(p2);
return 0;
}
9. Write a short program to print following series: 1 3 5 7…75 (J-2019)
#include<iostream>
using namespace std;
int main() Output:
{ 1 3 5 7 9 11 13 15 …..75
int n;
for(int i=1;i<=75,i+=2)
cout<<i<< “\t”;
getch ( );
}
10. Read the following C++ code and answer the questions given below. (M-2019)
class student Questions:
{ 1) Identify the member of the class : m,n, add(), calc()
int m,n;
public: 2) What is size of the objects x1,x2 in memory? x1 =8 bytes x2 = 8 bytes
void add();
float calc();
}x1,x2;
55
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]