11th Computer Science Public Exam 2019 To 2024 Questions With Answer Key English Medium PDF Download
11th Computer Science Public Exam 2019 To 2024 Questions With Answer Key English Medium PDF Download
Com
et
i.N
la
sa
da
PREPARED BY.,
B. MOHAMED YOUSUF M.C.A., B.Ed.,
Pg asst in computer science
[[email protected]]
et
(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
i.N
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]
la
(a) 645 (b) 234 (c) 876 (d) 123
5. For 10102 the hexadecimal equivalent is: [M-2023]
(a) C sa (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?
da
(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 =?
Pa
(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
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
et
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]
i.N
(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]
la
(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 sa (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
da
(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
Pa
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)
w.
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]
ww
2
PREPARED BY… B.MOHAMED YOUSUF M.C.A.., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
(a) >> (b) << (c) <> (d) ^^
7. Which of the following is user defined data type? [M-2020]
(a) Char (b) class (c) float (d) int
i.N
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)
la
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]
sa
(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++;
da
} 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]
(b) if … else
Pa
et
(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
i.N
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]
la
(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]
sa
(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]
da
(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
Pa
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]
(a) Function Overloading (b) Member overloading (c) Operator (d) Operations
4
PREPARED BY… B.MOHAMED YOUSUF M.C.A.., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
(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
i.N
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)
la
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]
sa
(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]
da
(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
Pa
(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
ww
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
5
PREPARED BY… B.MOHAMED YOUSUF M.C.A.., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
❖ 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]
i.N
❖ 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
la
1. Convert (46)10 into equivalent binary number. [AUG-2022]
2 46 LSB
2 23-0 (46)10 = (101110)2
2 11-1
sa
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
da
Positional 83 82 81 80
Notation
Given 1 3 2 4
number
(1265)8 = 512x1+64x3+8x2+1x4
w.
= 512+192+16+4
(1265)8 = (724)10
4. Convert (44)10 into Binary number [M-2022]
2 44 LSB
ww
et
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
i.N
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]
3. la
❖ 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.
What are the security management features (levels) available in Operating System? [S-2020]
sa
❖ (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)
da
❖ 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.
7
PREPARED BY…, B.MOHAMED YOUSUF M.C.A., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
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.
i.N
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.
la
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.
sa
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.
da
❖ 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;
w.
8
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;
}
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;
}
et
3. Write a while loop that displays numbers 5, 10, 15, …....50. [M-2019]
int i=5;
while (i<=50)
i.N
{
cout << i<<’,’ ;
i=i+5;
}
4. Write the syntax and example of if statement [M-2020]
la
Syntax:
if (expression)
true-block;
sa
statement-x;
Example :
#include <iostream>
using namespace std;
da
int main()
{
int age;
cout<< “\n Enter your age: “;
cin>> age;
Pa
if(age>=18)
cout<< “\n You are eligible for voting ….”;
cout<< “This statement is always executed.”;
return 0;
}
w.
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.
9
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;
}
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:
et
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]
i.N
❖ 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.
la
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]
sa
❖ 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];
da
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.
ww
❖ 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
10
PREPARED BY…, B.MOHAMED YOUSUF M.C.A., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
CHAPTER – 16 Inheritance
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
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
et
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.
i.N
❖ This encoding scheme was registered in IANA (Internet Assigned Numbers Authority) unit of ICANN.
la
sa
da
Pa
w.
ww
11
PREPARED BY…, B.MOHAMED YOUSUF M.C.A., B.Ed., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
❖ 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.
i.N
❖ 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
la
When the system starts from initial state i.e. it is switched
on, we call it cold booting or Hard Booting.
When the system restarts or when Reset button is pressed,
we call it Warm Booting or Soft Booting.
The system does not start from initial state and so all
sa
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.
da
❖ 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]
ww
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
12
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
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
et
2510 0 0 0 1 1 0 0 1
+ 0 0 1 0 1 1 0 1
2010+2510 = 4510 = ( 00101101)2
i.N
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
la
2 42-1 101 010 100 (340)10 = (524)8
2 21-0 5 2 4
2 10-1
sa
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
da
5. A) State whether the following numbers are valid or not. If invalid write reason. [S-2020]
1) (796)8 - Not valid (octal base value 0 to 7)
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
Pa
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
w.
et
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.
i.N
❖ 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.
la
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.
sa
❖ 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
da
❖ 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.
ww
et
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.
i.N
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.
la
5. Type the name of the file in the file name text box.
6. Click save button.
CHAPTER – 6 Specification and Abstraction
sa
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.
da
❖ 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
w.
2. S1
3. case C2
4. S2
5. case C3
ww
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.
15
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
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
et
❖ 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
i.N
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.
la
❖ 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.
sa
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.
da
(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
w.
{
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)
{
case constant 1:
statement(s);
break;
case constant 2:
statement(s);
break;
---
---
default:
et
statement(s);
}
Purpose of switch statement
❖ The switch statement is a multi-way branch statement.
i.N
❖ 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; la
sa
for(i=1; i<=10;i++)
{
sum=sum+I;
}
da
#include<iostream>
using namespace std;
int main() Output:
{ 1 3 5 7 9 11 13 15 …..75
int n;
w.
for(int i=1;i<=75,i+=2)
cout<<i<< “\t”;
getch ( );
}
ww
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;}
17
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
{
int n=5;
do
i.N
{
cout<<n<<”,”;
n--;
}
while(n>0); [OR] while(n>=1);
la
return 0;
}
CHAPTER – 11 Functions
sa
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.
da
et
int age;
float weight; } student;
❖ The student can be referred as reference name to the above structure and the elements can be accessed like
i.N
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
la
{
int age;
float height, weight;
sa
struct dob
{
int date;
char month[4];
int year;
da
};
}s1;
CHAPTER – 13 Object Oriented Programming Techniques
1. Write a note on the features of procedural programming. [J-2023]
Pa
❖ 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.
w.
❖ 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()
19
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
{ Answer: code, quantity, price
int code, quantity;
float price; 3. What is the memory size of the objects p1,p2?
i.N
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; }
la
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.
sa
❖ 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 +,++,-
da
,—,+=,-=,*.<,>.
❖ 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 (?:)
Pa
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 (:)
w.
❖ 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]
ww
❖ 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.
20
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
result();
void Rcalculate(); void Rdisplay();
CHAPTER – 17 Computer Ethics and Cyber Security
i.N
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.
la
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 :
sa
❖ Users should be truthful while using the internet.
2.Confidentiality:
❖ Users should not share any important information with unauthorized people.
3.Respect :
da
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
w.
21
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
Input Unit
i.N
❖ 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.
la
❖ 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.
sa
❖ 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.
da
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:
Pa
❖ 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.
w.
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
ww
et
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.
i.N
❖ 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.
Output Devices:
1.Monitor: la
❖ Example: Monitor, Printer etc.
sa
❖ 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.
da
❖ 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.
Pa
❖ 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.
23
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
2 6-0 0.36x2 = 0.72 =0
2 3-0 0.72x2= 1.44 =1
1-1 0.44x2= 0.88 =0
i.N
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
la
11010102+1011012 = 100101112
b. Subtract 11010112 – 1110102
0 10 10
sa
1 1 0 1 0 1 1
1 1 1 0 1 0
- 0 1 1 0 0 0 1
11010112 - 1112 = 1100012
da
2 5-1
2 2-1
1-0
1
w.
1’s 1 1 0 1 0 0 0 1
1
2’s 1 1 0 1 0 0 1 0
(-46) 11010010
ww
et
1’s 11101010
2’s 11101011
i.N
- 21
1’s 1 1 1 0 1 0 1 0
1
2’s 1 1 1 0 1 0 1 1
la
1 1 1 1
-2110 1 1 1 0 1 0 1 1
510 0 0 0 0 0 1 0 1
sa
+ 1 1 1 1 0 0 0 0
-2110+510 = -1610 = ( 11110000)2
2 12 2 15
2 6-0 2 7-1
2 3-0 3-1
1-1 1-1
Pa
12 (1100)2 15 (1111)2
8 bit 00001100 8 bit 00001111
1’s 11110011
2’s 11110100
- 12 1 1
w.
1’s 1 1 1 1 0 0 1 1
1
2’s 1 1 1 1 0 1 0 0
ww
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
25
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
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
et
=1
Symbol & Truth table for AND Gate:
i.N
3.NOT Gate:
la
❖ 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.
sa
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:
da
Pa
b) Instruction Set:
❖ A command which is given to a computer to perform an operation on data is called an instruction.
❖ Basic set of machine level instructions that a microprocessor is designed to execute is called as an instruction set.
❖ This instruction set carries out the following types of operations:
1.Data transfer, 2.Arithmetic operations, 3.Logical operations, 4.Control flow , 5.Input/output
c) Word Size:
❖ The number of bits that can be processed by a processor in a single instruction is called its word size.
❖ Word size determines the amount of RAM that can be accessed by a microprocessor.
2. Arrange the memory devices in ascending order based on the access time. [M-2023]
26
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.
❖ 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
et
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.
i.N
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.
la
❖ 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.
sa
❖ 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
da
❖ 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.
w.
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.
27
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
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.
i.N
❖ 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.
4.
la
❖ Job B is assigned to the processor before job A.
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.
sa
❖ 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.
da
❖ 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.
ww
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.
28
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
❖ 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]
i.N
❖ 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,
la
square_ root(n)
- - inputs: n is a real number, n ≥ 0.
- - outputs : y is a real number such that y2 = n.
sa
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]
da
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
3 ≤ 4 True [OR] =f=1x2 =f=24
Pa
2 1x2=2 2+1=3
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.
w.
29
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.
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.
et
i.N
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.
la
sa
da
4.Bitwise Operators:
Pa
❖ 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.
w.
❖ 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.
❖ 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,
et
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.
i.N
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.
4.
la
❖ They are also called as “Separators”.
Explain use of header file with an example (Aug-2022)
sa
# 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.
da
❖ 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
Pa
❖ 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.
ww
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))
{
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.
et
❖ 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
i.N
3 to 5 is repeated.
❖ The workflow of for loop and flow chart are shown below.
Flow chart :
la
sa
da
Example : Output:
Pa
int I; value of I : 4
for(I = 0; i< 5; I ++ )
cout<< “value of I : “ <<i<<endl;
ww
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;
32
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.
syntax
if ( expression)
{
True-block;
}
Else
{
False-block;
et
}
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.
i.N
❖ 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;
la
cout<< "\n Enter a number: ";
sa
cin>>num;
rem = num % 2;
if (rem==0)
cout<< "\n The given number"
<<num<< " is Even";
da
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]
Pa
If-else Switch
❖ Expression inside if statement decide whether to ❖ Expression inside switch statement decide which
execute the if block or under else block. case to execute.
❖ An if-else statement uses multiple statements for ❖ Switch statement uses single expression for
w.
et
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:
i.N
❖ 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.
#include<iostream>
using namespace std; la
Find the output of following program. [M-2022] Output
Enter number 1:4
Enter number 2:5
sa
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
da
{ 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
Pa
❖ 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;
34
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);
}
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()
{
int no;
cout<<"\nEnter a number to find its factorial: ";
cin >> no;
cout << "\nFactorial of Number " << no <<" = " << factorial(no);
et
return 0;
}
int factorial(int m)
i.N
{
if (m > 1)
{
return m*factorial(m-1);
}
else
{
return 1; la
sa
}
}
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++.
da
❖ 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 { }.
Pa
❖ 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.
ww
❖ 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 :
35
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
❖ A class is a new way of creating and implementing a user defined data type
❖ Classes provide a method for packing together data of different types.
❖ Data members are the data variables that represent the features or properties of a class.
Class student The class student contains mark1,
{ mark2 and total are data variables.
Private: Its scope is within the class student
Int mark1,mark2, total; only.
};
4. Write a program to accept any integer number and reverse it. [J-2024] Output
#include <iostream> Enter a numbe r: 1234
using namespace std; Reverse of the number is: 321
int reverse(int num)
{
int r=0,d;
while(num >0)
{
d=num%10;
et
r=r*10+d;
num=num/10;
}
i.N
return(r);
}
int main()
{
int x;
la
cout<<”\nEnter a number”;
cin>>x;
cout<<”\nReverse of the number is”<<reverse(x);
sa
return 0;
}
5. Write the output of the following program. [M-2023] Output
#include<iostream> Monitor
using namespace std Speaker
da
❖ 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;
36
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
cin>>n;
cout<<”Enter the elements of A matrix”<<endl;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cin>>A[i][j];
}
}
cout<<”Enter the elements of B matrix”<<endl;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cin>>B[i][j];
}
}
et
cout<<”The differences between the matrices”<<endl;
{
for(i=0;i<m;i++)
{
i.N
for(j=0;j<n;j++)
cout<< (A[i][j]-B[i][j]<<”s/t”
}
cout<<”/n”;
la
}
}
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.
sa
❖ 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.
da
{
long rollno; int age; float weight;
};
iii) How to access members of a structure? Give example.
ww
❖ 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.
37
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
};
void Employee::display();
cout<<"Name: "<<name;
cout<<"Code: "<<code;
i.N
}
void Employee::getdata()
{
cout<<"Name: ";
la
gets(name);
cout<<"Code: ";
cin>>code;
}
sa
void staff::getdata()
Employee::getdata();
cout<<"Experience:";
cin>>exp;
da
}
void staff::Display()
{
Employee::display();
Pa
cout<<"Enter data"<<endl;
S.getdata()
cout<<"Display data"<<endl;
s.display(); return 0;
ww
};
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;
} }
38
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]
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
et
❖ 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]
i.N
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
3. Easy Maintenance:
la
inherit that class to sub class.
❖ It is easy to maintain and modify existing code as new objects can be created with small differences to existing ones.
sa
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?
da
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.
Pa
❖ 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:
w.
❖ 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)
ww
❖ 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
public:
student(int r,int m)
{
cout<<"Constructor "<<endl;
rno=r;
marks=m;
}
void printdet()
et
{
marks=marks+30;
cout<<"Name: Bharathi"<<endl;
i.N
cout<<"Roll no : "<<rno<<"\n";
cout<<"Marks : "<<marks<<endl;
}
};
int main()
la
{
student s(14,70);
s.printdet();
sa
cout<< "Back to Main";
return 0;
}
2. Write the output for the following program [M-2019]
da
#include<iostream>
using namespace std;
class nest;
{
int x1;
int square_num()
Pa
{
return x1*x1;
}
public:
void input_num() Output
{ Enter the number 2
w.
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;
}
40
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
int main()
{
add a3;
a1.getdata();
i.N
a2.getdata();
a3.getdata();
cout<<a1.sum;
cout<<a2.sum;
la
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;
sa
3. classes Box 3.class Box
4. { 4.{
5. double width; 5.double width;
6. public:: 6.public:
da
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)
w.
16. { 16. {
17. width=w; 17. width=w;
18. length=1; 18. }
19. } 19. int main()
ww
}
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);
et
a1.assign(54);
cout<<"\nValue of first assignment:";
a2.display();
cout<<"\nValue of second assignment:";
i.N
a1.display();
a3.test(a1, a2);
cout<<"\nValue of first assignment after passing the values:";
a2.display();
la
cout<<"\nValue of second assignment after passing the values:";
a1.display();
return 0;
CHAPTER – 15 Polymorphism
sa
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.
da
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)]
w.
❖ 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]
ww
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 :";
cout<<"\nAge :"<<obj.age;
42
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
{
cout<<"\nEnter the values for a and b :";
cin>>a>>b;
}
i.N
void addition()
{
s=a+b;
cout<<"\nThe sum of two numbers is :"<<s;
}
void minus()
la
{
return a-b;
}
+sum()
sa
{
cout<<"\nSum Destructor:";
} };
class difference # public sum
{
da
void sub()
{
input();
d=minuses();
cout<<"\nThe difference of two numbers are :"<<d;
}
w.
~difference()
{
cout<<"\nDifference Destructor:";
}
};
ww
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;
};
43
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:
❖ 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
et
inheritance or Hierarchical, Multilevel and Multiple inheritance.
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.
i.N
❖ 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:
la
❖ 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.
sa
da
inherited as protected members of the derived class and the public members of the base class will be inherited
as public members of the derived class.
44
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).
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.
et
void Mentry(); Data Members Member Functions
void Mdisplay(); }; Commence Mentry();
class Result:public Marks Grade Mdisplay();
{ Total Agg Rcalculate();
i.N
float Total,Agg; FinalGrade Rdisplay();
public:
char FinalGrade, Commence[20];
Result();
void Rcalculate();
la
void Rdisplay();
};
4. Debug the following program. [M-2022] Correct Code:
1. %include(iostream.h) 1.#include<iostream>
sa
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:
da
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:
45
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
10. ~base()
11. {
12. cout<<"\nDestructor of base class.... ";
i.N
13. }
14. };
15. class derived:public base
16. {
17. public :
la
18. derived()
19. {
20. cout << "\nConstructor of derived ...";
sa
21. }
22. ~derived()
23. {
24. cout << "\nDestructor of derived ...";
da
25. }
26. };
27. class derived1 :public derived
28. {
29. public :
Pa
30. derived1()
31. {
32. cout << "\nConstructor of derived1 ...";
33. }
34. ~derived1()
w.
35. {
36. cout << "\nDestructor of derived1 ...";
37. }
38. };
ww
46
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
i.N
la
sa
da
Pa
w.
ww
47
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
{
height = h;
}
i.N
}
Class rectangle:: Public Shape
{
Public
int getarea [ ]
{
la
return (width * height);
};
}
sa
int MAIN()
{
rectangle rect:
rect. setwidth(5);
rect.setheight(7);
da
7 Protected; protected:
10 PUBLIC; public:
11 Void setWwidth[int w] void setwidth(int w)
14 }; }
ww
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 }; }
48
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
numbers.
i.N
1. Write a while loop that displays numbers 2, 4, 6, 8…....20. [J-2024]
int i=2;
while (i<=20)
{
cout << i<<”\t”;
la
i=i+2;
}
2. Write the output of the following program. [M-2024]
sa
#include<iostram>
using namespace std; OUTPUT: 0 1 2 3 4 5 6 7 (Write vertical order)
int main()
{
da
int i;
for(i=0;i<8;i++)
cout<<i<<endl;
return 0;
}
Pa
int main ()
{
Double var1=87.25255;
cout<<(float)var1<<end1; cout<<(int)var1<<end1; }
5. 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.
6. What are importance of void data type? (M-2022)
1.To indicate the function does not return a value 2.To declare a generic pointer
7. 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
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
49
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
1.
#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
i.N
{ 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++)
{
la
cout<<num<<" * "<<a<<" = "<<num*a<<endl;
}
sa
return 0;
}
2. Write a C++ program to display number from 5 to 1 using do-while loop [M-2024]
#include<iostream>
da
do
{
cout<<n<<”,”;
n--;
}
w.
i) 6137
6 1 3 7 6127 = (110001011111)2
110 001 011 111
ii) 245
2 4 5 245 = (010100101)2
010 100 101
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 main() 1,2,3.4,6,7,8,9,10
{
50
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
int i;
for(i=1;i<=10;i++)
{
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.
et
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
i.N
int main ()
{
int i,sum=0;
for(i=1; i<=10;i++)
{
la
sum=sum+i;
}
cout<<"The sum of 1 to 10 is "<<sum;
sa
return 0;
}
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
da
personal();
void pentry();
void Pdisplay(); };
class Marks:private Personal
{ int M
w.
protected:
char Grade[5];
public:
Marks();
void Mentry();
ww
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
51
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
et
}
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()
i.N
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;
la
sa
da
Pa
w.
ww
52
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]