11th Computer Science Public Exam Question With Answer 20219-2024
11th Computer Science Public Exam Question With Answer 20219-2024
in
d al
ka
vi
al
.k
w
w
w
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]
(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
n
5. Which generation of computer used transistors? [J-2019]
(a) First (b) Second (c) Third (d) Fourth
l.i
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)
da
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]
ka
(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
(b) 234
vi
4. Which amongst this is not an octal number? [S-2020]
(a) 645 (c) 876 (d) 123
5. For 10102 the hexadecimal equivalent is: [M-2023]
al
(a) C (b) B (c) E (d) A
6. 2^40 is referred as [J-2023]
.k
(a) Boolean algebra (b) Gate (c) Fundamental gates (d) Derived gates
2. Which gate is called as the logical inverter? [M-2020]
w
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]
n
(a) Graphics User Interface (GUI) (b) Data Distribution
(c) Security Management (d) Real Time Processing
l.i
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]
da
(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
ka
(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.
3.
(b) F4
vi
The shortcut key used to rename a file in windows----- [AUG-2022, M-2024]
(a) F2 (c) F5 (d) F6
Which of the following key combination is used to permanently delete a file or folder without sending to recycle bin? [M-2023]
al
(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
.k
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
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’ (d) “1232”
n
(c) 1232
5. Assume a=5, b=6; what will be result of a&b? [M-2019]
l.i
(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) ^^
da
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]
ka
(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)
vi
1. How many categories of data types available in C++? [M-2022]
(a) 5 (b) 4 (c) 3 (d) 2
al
2. Which of the following operator returns the size of the data type? [J-2024]
(a) Size of ( ) (b) Int( ) (c) long ( ) (d) double ( )
.k
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]
(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?
n
(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]
l.i
(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
da
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]
ka
(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]
vi
(a) struct (b) structure (c) void (d) const
(CHapter-13) (Introduction to Object Oriented Programming Techniques)
al
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
.k
n
2. Which of the following derives a class student from the base class school [M-2019]
(a) School: student (b) class student : public school
l.i
(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
da
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]
ka
(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) vi
1. Which of the following deals with procedures, practices and values? [M-2020, M-2022]
(a) Piracy (b) programs (c) virus (d) computer ethics
al
2. Commercial programs made available to the public illegally are known as---- [M-2023]
(a) Freeware (b) warez (c) Free software (d) software
.k
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]
w
5
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]
❖ 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]
.in
❖ 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
al
❖ The Primary Memory is used to temporarily store ❖ The Secondary memory is used to store the data
the programs permanently.
d
❖ It is volatile in nature ❖ It is non-volatile in nature
❖ Ex : RAM ❖ Ex: Hard Disk, CD or DVD
ka
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.
vi
❖ Dot matrix printers and line printers are impact printers.
CHAPTER – 2 (PART – 1) Number Systems
al
1. Convert (46)10 into equivalent binary number. [AUG-2022]
2 46 LSB
2 23-0 (46)10 = (101110)2
.k
2 11-1
2 5-1
2 2-1
w
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
w
Weight 512 64 8 1
Positional 83 82 81 80
Notation
Given 1 3 2 4
number
(1265)8 = 512x1+64x3+8x2+1x4
= 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: 15 10+2010 [M-2023]
2 15 2 20 15 10 = 1111
2 7-1 2 10-0 20 10 = 10100
2 3-1 2 5-0 15 10+2010 = (100011)2
1- 1 2 2-1
1-0
6
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
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.
.in
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]
al
❖ 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.
d
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.
ka
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.
vi
❖ The users can also communicate with each other.
❖ Example : Windows, Linux and UNIX
2. What is a GUI? [J-2019, M-2023]
al
❖ 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.
.k
3. What are the security management features (levels) available in Operating System? [S-2020]
❖ (1) File access level (2) System level (3) Network level
w
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)
w
.in
❖ 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.
al
❖ 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]
d
❖ In iteration, the loop body is repeatedly executed as long as the loop condition is true. Each time the loop body
ka
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++ vi
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.
al
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.
.k
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]
w
Answer: p = 84
CHAPTER – 9 (PART – 2) Data Types, Variables and Expressions
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;
.in
while (i<=20)
{
cout << i<<”\t”;
al
i=i+2;
}
3. Write a while loop that displays numbers 5, 10, 15, …....50. [M-2019]
d
int i=5;
ka
while (i<=50)
{
cout << i<<’,’ ;
i=i+5;
}
vi
4. Write the syntax and example of if statement [M-2020]
al
Syntax:
if (expression)
true-block;
.k
statement-x;
Example :
w
#include <iostream>
using namespace std;
int main()
w
{
int age;
w
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
.in
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 :
al
Strlen(string)
Ex:
name= “Tamil”
d
strlen(name); [ length of the name = 5 ]
ka
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]
vi
❖ 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.
al
2. The constants, variables or expressions used in the function call are known as actual parameters
CHAPTER – 12 Arrays and Structures
.k
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.
w
❖ 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
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.
.in
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
al
the user's web browser while the user is browsing internet.
CHAPTER – 18 Tamil Computing
d
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]
ka
❖ 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.
vi
al
.k
w
w
w
11
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]
Optical mouse Laser mouse
❖ Uses Light source ❖ Uses Laser Light
❖ It has 2 or 3 buttons ❖ It has as many as 12 buttons.
.in
❖ 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.
al
❖ 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.
d
❖ 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]
ka
❖ 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
vi
Crystal Display) and LED (Light Emitting Diodes).
5. Differentiate – Cold and Warm booting. [J-2023]
Cold booting Warm booting
al
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.
.k
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
w
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.
w
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
.in
1-0 1-1
20 (10100)2 25 (11001)2
8 bit 00010100 8 bit 00011001
al
1
2010 0 0 0 1 0 1 0 0
d
2510 0 0 0 1 1 0 0 1
+ 0 0 1 0 1 1 0 1
ka
2010+2510 = 4510 = ( 00101101)2
4. Convert 34010 to its equivalent Binary, Octal and Hexadecimal [J-2019]
Step :1 Decimal to binary vi
2 340 (340)10 = (101010100)2
2 170-0 Step :2 (Binary to Octal)
2 85-0 (101010100)2 (?)8
al
2 42-1 101 010 100 (340)10 = (524)8
2 21-0 5 2 4
.k
2 10-1
2 5-0 Step : 3 (Binary to Hexadecimal)
2-1 (101010100) 2 (?)16
w
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)
w
.in
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.
al
6. PS/2 Port: To connect mouse and keyboard to PC.
7. SCSI Port: To connect the hard disk drives and network connectors.
d
4. Differentiate CD and DVD. [J-2019, M-2020, M-2024]
CD DVD
ka
❖ CD stands for Compact Disk ❖ DVD Stands for Digital Versatile/ video Disc.
❖ Polycarbonate plastic material ❖ Optical disc
❖ Capacity: CD-ROM is 700MB vi ❖ 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.
al
5. Explain the types of RAM (AUG-2022)
❖ There are two basic types of RAM 1.Dynamic RAM (DRAM) 2.Static RAM (SRAM)
.k
.in
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:
al
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.
d
Step 4: The name of the folder will change.
ka
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.
vi
4. In the dialog box, select the location where you want to save the file by using look in drop down list box.
al
5. Type the name of the file in the file name text box.
6. Click save button.
CHAPTER – 6 Specification and Abstraction
.k
❖ 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.
w
.in
2) - -m, n = ? , ?
3) m, n:=m+5, n-2
4) - -m, n = ? , ?
CHAPTER – 9 (PART – 1) Introduction to C++
al
1. Describe the differences between keywords and identifiers? (or) Write a short note on [M-2020]
keywords identifiers
d
❖ 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
ka
❖ 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.. vi ❖ 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.
al
❖ The main ( ) function in the C++ programs is the starting point.
❖ All the C++ programs begin their execution in main ().
.k
❖ The logical operators act upon the operands that are themselves called as logical expressions.
❖ C++ provides three logical operators.
w
.in
case constant 2:
statement(s);
break;
---
al
---
default:
statement(s);
d
}
Purpose of switch statement
ka
❖ 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.
vi
3. Write a c++ program to sum the numbers from 1 to 10 using ‘for’ loop. [M-2022]
#include <iostream> Output
al
using namespace std; The sum of 1 to 10 is 55
int main ()
{
.k
int I,sum=0;
for(i=1; i<=10;i++)
{
w
sum=sum+I;
}
w
17
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
6. Differentiate – break and continue statement [J-2023]
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.
Compound (Block) statement:
.in
❖ 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>
al
using namespace std;
int main()
d
{
int n=5;
ka
do
{
cout<<n<<”,”; vi
n--;
}
while(n>0); [OR] while(n>=1);
al
return 0;
}
.k
CHAPTER – 11 Functions
1. What is the difference between isuppr () and toupper () functions? [J-2019, M-2020, M-2024]
isuppr() toupper()
w
❖ This function is used to check the given character ❖ This function is used to convert the given
is uppercase. character into its uppercase.
w
.in
❖ A structure without a name/tag is called anonymous structure.
Example:
struct
al
{
long rollno;
int age;
d
float weight; } student;
❖ The student can be referred as reference name to the above structure and the elements can be accessed like
ka
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:
vi
struct student
al
{
int age;
float height, weight;
.k
struct dob
{
w
int date;
char month[4];
int year;
w
};
}s1;
w
19
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;
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;
.in
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?
al
using namespace std; Answer: product
class product 2. What are the data members are the class?
{ Answer: code, quantity, price
d
int code, quantity;
ka
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();
vi
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; }
al
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.
.k
❖ 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.
w
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 +,++,-
w
,—,+=,-=,*.<,>.
❖ It is also a type of polymorphism in which an operator is overloaded to give user defined meaning to it.
w
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.
20
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
protected:
char Grade[5];
public:
Marks();
.in
void Mentry();
void Mdisplay(); };
class Result:public Marks
{
al
float Total,Agg;
char remark[5];
d
result();
void Rcalculate(); void Rdisplay();
ka
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.
vi
❖ The process of translating the plain text data into random and mangled data.
❖ Used by militaries and governments to facilitate secret communication.
al
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]
.k
1.Honesty :
❖ Users should be truthful while using the internet.
2.Confidentiality:
w
❖ Users should not share any important information with unauthorized people.
3.Respect :
w
21
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.
.in
d al
ka
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):
vi
❖ 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.
al
❖ 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.
.k
❖ 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.
w
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.
w
3.Output Unit:
❖ An Output Unit is any hardware component that conveys information to users in an understandable form.
w
.in
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.
al
❖ For example, 134, 16 ‘Kavitha’, ‘C’ are data.
❖ This will not give any meaningful message.
Information:
d
❖ 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.
ka
❖ 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.
vi
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.
al
❖ Example: Monitor, Printer etc.
Output Devices:
.k
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.
w
❖ Monitors may either be Monochrome which display text or images in Black and White or can be color, which
display results in multiple colors.
w
❖ 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.
w
❖ 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.
23
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).
❖ 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]
.in
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
al
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
d
2 3-0 0.72x2= 1.44 =1
ka
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
vi 0 1
+ 1 0 0 1 0 1 1 1
al
11010102+1011012 = 100101112
b. Subtract 11010112 – 1110102
.k
0 10 10
1 1 0 1 0 1 1
1 1 1 0 1 0
w
- 0 1 1 0 0 0 1
11010112 - 1112 = 1100012
w
.in
2 5-0 1-0
2 2-1
1-0
al
21 (10101)2 5 (101)2
8 bit 00010101 8 bit 00000101
1’s 11101010
d
2’s 11101011
ka
- 21
1’s 1 1 1 0 1 0 1 0
1
2’s 1 1 1 0 1
vi
0 1 1
al
1 1 1 1
-2110 1 1 1 0 1 0 1 1
.k
510 0 0 0 0 0 1 0 1
+ 1 1 1 1 0 0 0 0
-2110+510 = -1610 = ( 11110000)2
w
2 12 2 15
2 6-0 2 7-1
2 3-0 3-1
w
1-1 1-1
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
25
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:
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”.
.in
❖ If both inputs are "false"/”0” then the output is "false” /”0”.
OR gate C = A OR B
OR Operation: C = A+B
al
Example: C = A+B
= 1+1
d
=1
Symbol & Truth table for AND Gate:
ka
vi
3.NOT Gate:
al
❖ 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.
.k
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.
.in
❖ 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]
al
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.
d
❖ 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.
ka
❖ 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:
vi
❖ 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.
al
❖ Unlike the main memory, PROMs retain their contents even when the computer is turned off.
❖ The PROM differs from ROM.
.k
❖ 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.
w
2.EPROM:
❖ Erasable Programmable Read Only Memory is a special type of memory which serves as a PROM, but the
w
❖ 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.
27
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.
❖ 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
.in
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.
al
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 :
d
❖ The Round Robin (RR) scheduling algorithm is designed especially for time sharing systems.
❖ Jobs (processes) are assigned and processor time in a circular method.
ka
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:
vi
❖ The given job (process) is assigned based on a Priority.
❖ The job which has higher priority is more important than other jobs.
al
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]
.k
❖ 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).
w
.in
❖ 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
al
(overlapped) in the Desktop.
2.Document Window:
❖ A document window is a section of the screen used to display the contents of a document.
d
CHAPTER – 6 Specification and Abstraction
ka
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.
vi
The specification of the algorithm is,
al
square_ root(n)
- - inputs: n is a real number, n ≥ 0.
- - outputs : y is a real number such that y2 = n.
.k
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
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.
.in
❖ 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.
d al
3.Logical Operators:
ka
❖ A logical operator is used to evaluate logical and relational expressions.
vi
❖ 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.
al
.k
w
w
w
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.
30
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.
❖ C++ has the following tokens: Keywords, Identifiers, Literals, Operators, Punctuators
Types of tokens:
1. Keywords:
.in
❖ 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
al
2. Identifiers:
❖ Identifiers are the user-defined names given to different parts of the C++ program viz. variables, functions,
arrays, classes etc.,Ex: Num ,
d
3. Literals (Constants):
❖ Literals are data items whose values do not change during the execution of a program.
ka
❖ Therefore Literals are called as Constants.
4.Operators:
❖ The symbols which are used to do some mathematical or logical operations are called as “Operators”.
vi
❖ The data items or values that the operators act upon are called as “Operands”.
5. Punctuators:
al
❖ 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)
.k
# include <iostream>
❖ Usually all C++ programs begin with include statements starting with a # (hash / pound).
❖
w
❖ 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
w
.in
}
Statement-x;
Working of for loop:
al
❖ 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
d
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
ka
3 to 5 is repeated.
❖ The workflow of for loop and flow chart are shown below.
Flow chart :
vi
al
.k
w
w
w
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;
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)
{
.in
True-block;
}
Else
al
{
False-block;
}
d
Statement-x
❖ In if-else statement, first the expression or condition is evaluated to either true of false.
ka
❖ 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>
vi
using namespace std;
int main()
al
{
int num, rem;
.k
if (rem==0)
cout<< "\n The given number"
<<num<< " is Even";
w
else
cout<< "\n The given number
"<<num<< " is Odd"; return 0;
w
}
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 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
multiple choices multiple choices.
❖ If-else statement checks for equality as well as for ❖ Switch checks only for equality.
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; . . . . {
33
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):
❖ 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.
.in
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-
al
controlled loop, the test-expression is evaluated before exit from the loop.
3. Update expression:
d
❖ 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.
ka
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.
vi
❖ 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.
al
8. Find the output of following program. [M-2022] Output
#include<iostream> Enter number 1:4
.k
{ Enter number 7: 34
cout<<"\n Enter Number"<<i+1<<"="; Enter number 8: 66
w
.in
{
int no;
cout<<"\nEnter a number to find its factorial: ";
al
cin >> no;
cout << "\nFactorial of Number " << no <<" = " << factorial(no);
d
return 0;
}
ka
int factorial(int m)
{
if (m > 1) vi
{
return m*factorial(m-1);
al
}
else
{
.k
return 1;
}
w
}
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++.
w
❖ They are: Local scope, Function scope, File scope and Class scope.
1.Local Scope:
❖ A local variable is defined within a block.
w
.in
{
int r=0,d;
while(num >0)
al
{
d=num%10;
r=r*10+d;
d
num=num/10;
ka
}
return(r);
}
int main()
{
vi
int x;
al
cout<<”\nEnter a number”;
cin>>x;
cout<<”\nReverse of the number is”<<reverse(x);
.k
return 0;
}
w
.in
for(j=0;j<n;j++)
{
cin>>B[i][j];
al
}
}
cout<<”The differences between the matrices”<<endl;
d
{
for(i=0;i<m;i++)
ka
{
for(j=0;j<n;j++)
cout<< (A[i][j]-B[i][j]<<”s/t”
}
vi
cout<<”/n”;
al
}
}
2. i) What is structure .What is its use? [M-2020]
.k
❖ 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.
w
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.
w
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.
37
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
2. Debug the following C++ program [M-2019]
#include<iostream> Error Coding Corrected Coding
#include<string> ---- using name space std;
Class Employee Class Employee class Employee
private private private :
char name[20]; Class staff : Public Employee class staff : public Employee
int code; void get ( ); void getdata();
public: cin >> exp ; cin >> ex;
void getdata(); void staff :: Display ( ) void staff :: display ()
void display(); staff s staff s;
}; S.getdata( ) s.getdata( )
Class staff:public Employee }; }
.in
{
int ex;
public:
al
void get();
void display();
};
d
void Employee::display();
cout<<"Name: "<<name;
ka
cout<<"Code: "<<code;
}
void Employee::getdata()
{
vi
cout<<"Name: ";
al
gets(name);
cout<<"Code: ";
cin>>code;
.k
}
void staff::getdata()
w
Employee::getdata();
cout<<"Experience:";
cin>>exp;
w
}
void staff::Display()
w
{
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;
} }
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
.in
❖ Less secure ❖ More secure
❖ It is top down approach ❖ It is bottom down approach
❖ All data items are global. ❖ Data abstraction is introduced.
al
❖ Emphasizes on algorithm. ❖ Emphasizes on data rather than algorithm.
❖ Overloading is not possible ❖ Overloading is possible
d
❖ 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
ka
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.
vi
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
al
inherit that class to sub class.
3. Easy Maintenance:
.k
❖ 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.
w
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?
w
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.
w
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.
39
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
public:
student(int r,int m)
.in
{
cout<<"Constructor "<<endl;
rno=r;
marks=m;
al
}
void printdet()
{
d
marks=marks+30;
ka
cout<<"Name: Bharathi"<<endl;
cout<<"Roll no : "<<rno<<"\n";
cout<<"Marks : "<<marks<<endl;
}
};
vi
int main()
al
{
student s(14,70);
s.printdet();
.k
}
2. Write the output for the following program [M-2019]
#include<iostream>
w
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;
}
40
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;
void getdata()
{
a=5;
.in
b=10;
sum = a+b;
}
al
} a1;
add a2;
int main()
d
{
add a3;
ka
a1.getdata();
a2.getdata();
a3.getdata();
cout<<a1.sum;
vi
cout<<a2.sum;
al
cout<<a3.sum; return 0; }
4. Debug the following program (S-2020) Correct Code
1. #include <stream> 1.# include <iostream>
.k
4. { 4.{
5. double width; 5.double width;
6. public:: 6.public:
w
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;
41
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;
}
.in
};
int main()
{
al
Trial a1, a2,a3;
a2.assign(45);
a1.assign(54);
d
cout<<"\nValue of first assignment:";
a2.display();
ka
cout<<"\nValue of second assignment:";
a1.display();
a3.test(a1, a2);
vi
cout<<"\nValue of first assignment after passing the values:";
a2.display();
al
cout<<"\nValue of second assignment after passing the values:";
a1.display();
return 0;
.k
CHAPTER – 15 Polymorphism
1. What are the rules for operator overloading? (OR) [M-2020, AUG-2022, J-2023, J-2024]
w
.in
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()
al
cout<<"\nSum Constructor :";
}
void input();
{
d
cout<<"\nEnter the values for a and b :";
cin>>a>>b;
ka
}
void addition()
{
s=a+b;
cout<<"\nThe sum of two numbers is :"<<s;
}
vi
void minus()
al
{
return a-b;
}
.k
+sum()
{
cout<<"\nSum Destructor:";
w
} };
class difference # public sum
{
w
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;
};
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:
.in
❖ 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:
al
❖ 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.
d
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.
ka
❖ 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.
vi
1.Private visibility mode:
al
❖ 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.
.k
w
w
❖ 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.
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
.in
{ 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.
al
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
d
void Mdisplay(); }; Commence Mentry();
class Result:public Marks Grade Mdisplay();
ka
{ Total Agg Rcalculate();
float Total,Agg; FinalGrade Rdisplay();
public:
char FinalGrade, Commence[20];
Result();
vi
void Rcalculate();
al
void Rdisplay();
};
4. Debug the following program. [M-2022] Correct Code:
.k
1. %include(iostream.h) 1.#include<iostream>
2. #include<conio.h> 2.#include<conio.h>
3. Class A() 3.using namespace std;
w
4. { 4.class A
5. public; 5.{
6. int a1,a2:a3; 6.public:
w
.in
4. {
5. public:
6. base()
7. {
al
8. cout<<"\nConstructor of base class...";
9. }
d
10. ~base()
11. {
ka
12. cout<<"\nDestructor of base class.... ";
13. }
14. };
15. class derived:public base
16. {
vi
17. public :
al
18. derived()
19. {
.k
23. {
24. cout << "\nDestructor of derived ...";
25. }
w
26. };
27. class derived1 :public derived
w
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()
46
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
27 Class derived1:: public derived class derived1:public derived
30 derived1(); derived1()
34 derived1(); ~derived1()
38. } };
39 int main(): int main()
.in
d al
ka
vi
al
.k
w
w
w
47
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 ( )
int count
Protected;
int width;
int height;
.in
PUBLIC;
Void setWwidth[int w]
{
width = w;
al
};
void setheight(int h)
d
{
height = h;
ka
}
}
Class rectangle:: Public Shape
{
Public
int getarea [ ]
vi
{
al
return (width * height);
};
.k
}
int MAIN()
{
w
rectangle rect:
rect. setwidth(5);
rect.setheight(7);
w
48
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
CHAPTER – 17 Computer Ethics and Cyber Security
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
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
.in
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
al
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.
d
PUBLIC COMPULSORY QUESTIONS WITH ANSWERS (MARCH-2019 TO JULY 2024]
ka
TWO MARKS (PUBLIC QUESTIONS) (q.no 24)
1. Write a while loop that displays numbers 2, 4, 6, 8…....20. [J-2024]
int i=2; vi
while (i<=20)
{
cout << i<<”\t”;
al
i=i+2;
}
.k
int main()
{
w
int i;
for(i=0;i<8;i++)
cout<<i<<endl;
w
return 0;
}
3. Convert the following if-else statement into conditional statement (J-2023)
if (marks > = 60) Answer: Grade = (marks > = 60)? A:B;
Grade = ‘A’;
else
Grade = ‘B’;
4. 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; }
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]]
8bits Binary value of a&b ➔ 0000 0001 ➔ 110
(ii) a^b
8bits Binary value of 65 ➔ 0100 0001 8bits Binary value of 15 ➔ 0000 1111
8bits Binary value of a^b ➔ 0100 1110 ➔ 7810
9. 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.
10. Write a while loop that displays numbers 5, 10, 15, .......50. (M-2019)
int i=5;
while (i<=50)
.in
{
cout << i<<’,’ ;
i+=5;
}
al
THREE MARKS (PUBLIC QUESTIONS) (q.no 33)
1. Write a C++ program to print multiplication table of a given number. [J-2024]
d
#include<iostream> Output :
using namespace std; Enter Number To Find Multiplication table 3
ka
int main() 3x1=3 3x2=6 3x3=9 3x4=12 3x5=15
{ 3x6=18 3x7=21 3x8=24 3x9=27 3x10=30
int num; vi
cout<<"Enter Number To Find Multiplication table ";
cin>>num;
for(int a=1;a < =10; a++)
al
{
cout<<num<<" * "<<a<<" = "<<num*a<<endl;
.k
}
return 0;
}
w
2. Write a C++ program to display number from 5 to 1 using do-while loop [M-2024]
#include<iostream>
w
int n=5;
do
{
cout<<n<<”,”;
n--;
}
while(n>0); [OR] while(n>=1);
return 0;
}
3. Convert the following into octal number into binary number. (J-2023)
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;
}
What is meant by computer ethics? (Aug-2022)
.in
5.
❖ 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.
al
❖ 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.
Write a c++ program to sum the numbers from 1 to 10 using ‘for’ loop. (M-2022)
d
6.
#include <iostream> Output
using namespace std; The sum of 1 to 10 is 55
ka
int main ()
{
int i,sum=0;
for(i=1; i<=10;i++)
vi
{
al
sum=sum+i;
}
cout<<"The sum of 1 to 10 is "<<sum;
.k
return 0;
}
w
char Name[20]; Base Class Personal Derived Class Marks and Result
public:
personal();
void pentry();
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
51
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]
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;
.in
int main() Output:
{ 1 3 5 7 9 11 13 15 …..75
int n;
for(int i=1;i<=75,i+=2)
al
cout<<i<< “\t”;
getch ( );
}
d
10. Read the following C++ code and answer the questions given below. (M-2019)
class student Questions:
ka
{ 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
vi
void add();
float calc();
}x1,x2;
al
.k
w
w
w
52
PREPARED BY..., B.MOHAMED YOUSUF M.C.A., B.Ed.., (PG ASST IN COMPUTER SCIENCE)
[[email protected]]