CS Computer Science Passing Notes
CS Computer Science Passing Notes
Government Of Karnataka
Passing
Package
II PUC
Computer Science
2021-22
KABBUR PUBLICATIONS YouTube Channel, Contact 9738237960
For More Study Materials Subscribe to KABBUR PUBLICATIONS YouTube Channel
II PUC
COMPUTER SCIENCE(41)
PASSING PACKAGE
Prepared By:
CHAPTER 1:
Processor Socket : It includes the type of CPU socket used to insert the CPU. It is designed as per the
compatibility of the CPU on the motherboard. Example: PGA socket, LGA socket.
2. Explain any 2 types of motherboard.
XT Motherboard: XT stand for eXtend Technology. These are old model motherboard. In this
motherboard, we find old model processor socket LIF(Low Insertion Force) sockets, DIMM ram slots and
ISA slots, 12pin power connector and no ports.
AT Motherboard: AT Stand for Advanced Technology Motherboards. They have PGA(Pin Grid Array)
Socket, SDRAM slots, 20 pin power connector, PCI slots and ISA slots. Example: Pentium III Processors
Baby AT Motherboard: Baby AT Motherboards have the combination of XT and AT. They have slot
type processor sockets and PGA processor sockets, SDRAM slots and DDRRAM slots, PCI slots and ISA
slots, 12 pin power connector and 20 pin power connector and ports. Example: Pentium-III and Pentium-
IV
ATX Motherboard: ATX stand for Advanced Technology eXtended. Latest motherboard is called as
ATX motherboard. In this motherboard, we find MPGA processor sockets, DDRRAM slots, PCI slots,
AGP slots, SATA connectors, 20 pin and 24 pin ATX POWER CONNECTOR AND PORTS.
Example: Pentium-IV, Dual Core, Core 2 Duo, Quad Core,i3,i5, and i7 processors.
3. Explain any 2 different types of buses.
Address Bus – It carries address of the data in the memory which is to be read from/write into. Width of
the address bus determines the number of memory locations the computer can address.Example:36-bit
address bus can address 236=64GB of memory location
Data Bus - Provides a path to transfer data and instruction between CPU and memory. Width of data bus is
32-bit, 64-bit etc.
Control Bus-It carries control signals sent from CPU to different parts of the computer. It also used to
direct and monitor the actions of the other functional parts of the computer system.
4. Explain the different types of I/O ports (Any 2).
These ports are also called as communication ports.
The I/O ports connects the external devices to the motherboard.
Serial Port: Serial Port is also known as communication (COM) ports or RS232c ports. They are used for
connecting communication devices like mouse and modem. This port transfers data serially one bit at a
time. There are two varieties of COM ports, the 9-pin ports and 25- pin Ports.
Parallel port: Parallel ports are used to connect external I/O devices like printers or scanners. This port
facilitates the parallel transfer of data, usually one byte(8-bits) at a time.
USB –port: It is an advanced I/O port. Gives a single, standardized, easy-to-use way to connect a variety
of newer peripherals to a computer
IDE (Integrated Digital Electronics) port: IDE devices like CD-ROM drives or hard disk drives are
connected to the motherboard through the IDE port.
AGP (Accelerates Graphics Port) port: The AGP port is used to connect graphic card that provides
high-speed video performance, typically required in games and others multimedia applications.
5. Explain the function of UPS and its types.
An UPS is a power supply device that includes a battery to maintain power in the event of a power failure.
Typically, an UPS keeps a computer running for several minutes to few hours after a power failure.
Types of UPS
1. Online UPS: An online UPS avoids those momentary power lapses by continuously providing
power from its own inverter, even when the power line is functioning properly. Online UPS is
more costly than Standby UPS.
2. Standby UPS: A Standby UPS (or OFF-LINEUPS) Monitors the power line and switches to
battery power as soon as it detects a problem. The switch over to battery, however, can require
several milliseconds, during this time the computer is not receiving any power.
6. Explain Cache memory
The cache memory is a high speed memory available inside CPU to speed up access of data and
instructions stored in RAM memory.
Cache memory temporarily stores data that is used more often and makes it available to CPU at a fast rate.
Hence it is used to increase the speed of processing.
7. Explain any 2 components of the Motherboard.
1. Processor (CPU): The processor or CPU is the main component on the motherboard and is called as the
brain of the computer. It consists of ALU, CU registers.
2. BIOS Chip (Basic Input Output system): BIOS is a small chip on the motherboard that holds a set of
instructions to load the hardware settings required to active various devices like keyboards, monitors or
disk drives. The BIOS runs when the computer is switched ON. It performs a Power On Self-Test (POST),
that checks the presence of hardware devices and are functioning properly.
8. What is expansion slot? Mention any TWO types.
It is an opening on the motherboard into which expansion boards (peripheral cards) are inserted to improve
the functionality or capability of the computer. Example: After installing a sound card on the expansion
slot, sound capability of the computer can be improved or added. TYPES: ISA, PCI, AGP slot
ISA (Industry Standard Architecture) Slot- ISA slot is used to connect modem and input devices.
PCI (Peripheral Component Inter Connect) Slot- PCI slot is used to connect graphics accelerator cards,
sound cards, internal modem or SCSI cards, they are mush faster than ISA cards.
AGP (Advanced Graphic Port) Slot- It is used to connect graphics accelerator cards and 3D accelerator
cards. It enhances the visual experience for the user in multimedia applications and games.
III. FIVE MARKS QUESTIONS
1. What is port? Explain any four types of port.
Port is a connector or place used to connect input / output or peripheral devices to computer system
Types of port
Serial port- - It transmits 1 bit at a time, It needs single communicating wire to interface with the
computer
Parallel port- It transmits 8 bit at a time, It needs 8 communicating wire to interface with the
computer
USB – PORT-Universal serial bus port.
AGP Port Accelerated graphics port -Used to connect graphics card that provides high speed video
performance specially required in games and other multimedia application.
VGA PORT- Visual graphics adaptor port. -Used to connect monitor to computer’s video card.
2.What is bus? Explain different types of bus.
In computer architecture, bus is a communication path that transfers data and instructions between the
components inside a computer.
Types based on location
1. Internal: It connects different components on motherboard like processor, RAM etc. It is also called system
bus.
2. External: It serves as an interface for peripheral devices like HDD, CD-ROM etc. to connect with
processor. It is also called as expansion bus.
Types based on functionality
1. Control BUS: It is used by the processor to send control signals to different components and to maintain
co-ordination with TCU.
2. Data BUS: It provides the path to transfer data and instructions between CPU and memory.
3. Address BUS: It provides the transfer of physical address of the data and instructions in the main memory.
3. Define a)Bus b)Port c)Microprocessor d)Cache memory e)Disk controller
A Bus is a collection of wires that carries electrical signals from one component to another
Port is a socket used to connect external devices to the computer
Microprocessor is a single integrated circuit chip that function as computer CPU
Cache memory is a small, fast intermediate memory present in between CPU and RAM
Disk controller-is a circuit that enables the CPU to communicate with hard disk/floppy disk drives
4.Explain the types of power supply.
There are two types of power supply connected to a computer system . They are :
1. SMPS [ Switch Mode Power Supply ]
2. UPS [ Uninterruptable Power Supply ]
1. SMPS :
SMPS converts AC power from an electrical outlet to the DC power needed by system components.
SMPS is a metal box in the rear of the system that is attached to the computer chasis and to the system
board.
In a PC the SMPS converts 230 volts of AC to 5 to 12 volts of DC and the wattage is around 180 to 300
watts, 450 watts and 500 watts.
2. UPS :
An UPS is a power supply that includes a battery to maintain power in the event of a power failure or any
electrical problems like power line problems, power outages, under voltage or lightening.
UPS keeps a computer running for several minutes to few hours after a power failure, enabling us to save
data that is in RAM and then shut down the computer properly.
There are two types of UPS :
1. Offline UPS or Standby UPS:
In offline UPS the input current is directly connected to the device.
The UPS circuit always monitors the voltage level in the mains, and if there is a voltage drop or
mains failure, it switches on the inverter to give AC power to the device from the inverter until the
mains supply returns to normal.
2. Online UPS :
In online UPS the inverter is directly connected to the device and it is always on to give the
required current to the device.
Online UPS avoids momentary power lapses by continuously providing power from its own
inverter , even when the power
5. With a neat block diagram of a computer explain the basic units of computer.
A computer is designed using four basic units. They are:
1. Input Unit
2. Central Processing Unit(CPU)
Control Unit
Arithmetic and Logic Unit (ALU)
3. Memory Unit
4. Output Unit
Input Unit:
Computers need to receive data and instructions in order to solve a problem. The Input unit performs this
operation.
The Input Unit basically links the external world or environment to the computer system.
The input unit may consist of one or more input devices.
Central Processing Unit (CPU):
The function of the CPU is to interpret the instructions in the program and execute them one by one. It
consists of two major units.
1. Control Unit: It controls and directs the transfer of program instructions and data between various units.
2. Arithmetic and Logic Unit (ALU): Arithmetic and Logic Unit performs arithmetic and logical operations
and controls the speed of these operations
Memory Unit:
CHAPTER-2
BOOLEAN ALGEBRA
I. TWO MARKS QUESTIONS:
1. Prove that (X+Y)(X+Z) = X+YZ using algebraic
method.Proof:LHS = (X+Y)(X+Z)
= XX + XZ +XY + YZ
= X+XZ+XY+YZ (⸪X.X=X)
=X +XY+YZ (⸪X+XZ=X)
= X + YZ (⸪X+XY=X)
= RHS
X X X+X X X X.X
0 0 0 0 0 0
1 1 1 1 1 1
10. State and prove Involution law.
X
Ans: This law states that X=X
0 1 0
1 0 1
12. State and prove commutative law using truth table X. Y= Y.X
X Y X.Y Y.X
0 0 0 0
0 1 0 0
1 0 0 0
1 1 1 1
X+Y=Y+X
X Y X+Y Y+X
0 0 0 0
0 1 1 1
1 0 1 1
1 1 1 1
II KABBUR PUBLICATIONS
PUC COMPUTER SCIENCE (41) YouTube Channel, Contact 9738237960
Page 6
For More Study Materials Subscribe to KABBUR PUBLICATIONS YouTube Channel
b) . = +
The inverted product of two variables is equal to the sum of their individual
invertedvariables.
II KABBUR PUBLICATIONS
PUC COMPUTER SCIENCE (41) YouTube Channel, Contact 9738237960
Page 7
For More Study Materials Subscribe to KABBUR PUBLICATIONS YouTube Channel
4. Reduce F (A, B, C, D)= ∑ (0, 4, 6, 7, 8, 12, 14, 15) using Karnaugh map.
II KABBUR PUBLICATIONS
PUC COMPUTER SCIENCE (41) YouTube Channel, Contact 9738237960
Page 8
For More Study Materials Subscribe to KABBUR PUBLICATIONS YouTube Channel
7. Simplify the following Boolean expression using K-Map F (A, B, C, D) =∑ (0, 2,4, 5,6, 7, 8,
10,12,13,14,15)
II KABBUR PUBLICATIONS
PUC COMPUTER SCIENCE (41) YouTube Channel, Contact 9738237960
Page 9
For More Study Materials Subscribe to KABBUR PUBLICATIONS YouTube Channel
CHAPTER 3:
LOGIC GATES
I. ONE MARKS QUESTIONS:
1. Write the Logic symbols and Truth Tables for AND,OR,NOT, NAND ,NOR and XOR gates.
Ans:
II KABBUR PUBLICATIONS
PUC COMPUTER SCIENCE (41) YouTube Channel, Contact 9738237960
Page 10
For More Study Materials Subscribe to KABBUR PUBLICATIONS YouTube Channel
3. Explain NAND and NOR gate with Logic symbol and Truth Table.
NAND gate has two or more input signal but only one output signal.
The NAND gate is a complemented of AND gate.
The output of NAND gate will be 0 only when all inputs are 1 and output will be 0 if any input
represents a 0.
NAND is short form of NOT-AND.
II KABBUR PUBLICATIONS
PUC COMPUTER SCIENCE (41) YouTube Channel, Contact 9738237960
Page 11
For More Study Materials Subscribe to KABBUR PUBLICATIONS YouTube Channel
KARNATAKA RESIDENTIAL EDUCATIONAL INSTITUTIONS SOCIETY
NOR gate has two or more input signal but only one output signal.
The NOR gate is a complemented of OR gate.
The output of NOR gate will be 1 only when all inputs are 0 and output will be 0 if any input repre-
sents a 1.
NOR is short form of NOT-OR.
4.Explain XOR and XNOR gates with Logic symbol and Truth Table.
An exclusive-OR has two or more input signal but only one output signal.
Exclusive-OR gate is different form of OR gate.
Exclusive-OR gate produces output 1 for only when the input combinations are different.
The output is 0 if the input combinations are same.
XNOR gate
The XNOR gate is complement of XOR gate.
The output of XNOR is 1 only when the logic values of both X and Y is same i.e. either both are equal to 1 or both
are 0.
Its output is 0 when its inputs are different.
In Boolean algebra, ʘ sign stands for XNOR operation. Thus A XNOR B can be
written as A ʘ B
CHAPTER 4
DATA STRUCTURES
I. ONE MARK QUESTIONS:
1. What is Data structure?
Data Structure is the way of collecting and organizing the data in such a way that we can perform operation
on these data in an effective way.
2. What are primitive data structures?
Data structures that are directly operated upon the machine-level instructions are known as primitive data
structures.
3. Give any two examples for primitive data structures.
The integers, float, character data, pointers are primitive data structures.
4. What are non-primitive data structures?
The Data structures that are derived from the primitive data structures are called Non-primitive data struc-
ture.
5. Mention any two examples for non- primitive data structures?
Array, stack, queues, linked list, tree and graph are non- primitive data structures
6. What are lists?
Lists are linear collection of data items.
7. What is meant by linear data structures?
Linear Data structures are kind of data structure that has homogeneous elements.
8. What are non-linear data structures?
A Non-Linear Data structures is a data structure in which data item is connected to several other data items.
9. Define an array.
An array is an ordered collection of elements of same data type that share common name
10. Differentiate between one-dimensional and two-dimensional array.
In one-dimensional array we use only one subscript to identify an element where as in two dimensional ar-
rays we use two subscripts.
11. What do you mean by traversal operation?
The processing of accessing each element exactly once to perform some operation is called traversing.
12. Define searching.
The process of finding the location of a data element in the given collection of data elements is called as
searching.
13. Mention the types of searching in the array.
Linear Search and Binary Search.
14. Define sorting.
The process of arrangement of data elements in ascending or descending order is called sorting.
15. What is a stack?
A stack is an ordered collection of items in which an element may be inserted or deleted only at same end.
16. Name the data structure which is called LIFO.
A LIFO (Last In First Out) data structure is also called as stack.
17. What is LIFO list?
A stack data structure which follows LIFO (Last In First Out) list principle.
18. What are the operations that can be performed on stacks?
Stack( ), push(item), pop( ), peek( ), isEmpty( ), size( ) are the operations of stack.
19. Define the term PUSH and POP operation in stack.
The process of adding one element or item to the stack is represented by an operation called as the
PUSH operation.
The process of deleting one element or item from the stack is represented by an operation called as
the POP operation.
II PUC COMPUTER SCIENCE (41) Page 13
3.What do you mean by deletion? Write an algorithm for deleting an element from an array.
STEP 1: ELE = M[P]
STEP 2: FOR I = P TO N-1
STEP 3: M[I] = M[I+1]
[END OF STEP 3 FOR LOOP]
STEP 4: N= N – 1
[END IF]
7.What is Primitive data structure? Explain different operations on Primitive data structures.
The data structures which are directly operated on machine level instructions.
Ex :int, float, pointers etc…
Operations performed on primitive data structures are
1) create (2) destroy (3) select (4) update
create : This operation is used to create new data structure. Ex: int x;
destroy : This operation is used to remove unwanted data structures. Ex: Using delete operator/ destructor
function
select : This operation is used to extract required data from data structure Ex: cout<<x;
update : This operation is used to modify the contents of a data structure. Ex: x=x+2;
10.Define the following with respect to Binary Tree : a) Root node b) Leaf node c) Complete Tree
a) Root node :The very top node of a tree is called root node.
b) Leaf node : A node with no child nodes is called a leaf node.
c) Complete tree : Tree in which each leaf is at the same distance from the root.
i.e, all the nodes have maximum two sub trees.
CHAPTER-6:
OOP CONCEPTS
I.THREE MARKS QUESTIONS
1. Mention any three applications of OOP.
Object oriented databases.
CAD/CAM systems
Computer graphics and applications Or any three applications
2.Write a note on Polymorphism
Polymorphism is considered one of the important features of Object-Oriented Programming
The word “poly” means many and “morphs” means forms, So it means many forms
The ability of an operator and function to take multiple forms is known as Polymorphism
The different types of polymorphism are operator overloading and function overloading
3) Write any four high-level languages that fallow object oriented programming approach
Ans : 1) C++ 2) C# 3) java 4) Python
4) Explain Inheritance.
Inheritance is the process by which one object can acquire and use the properties of another object.
The existing class is known as base class or super class.
The new class is known as derived class or sub class.
The derived class shares some of the properties of the base class. Therefore a code from a base class
can be reused by a derived class.
The program is divided into objects The program is divided into functions.
Data in each object is controlled on its own Every function has different data, so there’s no control over it.
Inheritance is supported in three modes: public, private & protected Inheritance is not supported
Data can be hidden using Encapsulation No data hiding. Data is accessible globally
Overloading functions, constructors, and operators are done Overloading is not possible.
Classes or functions can be linked using the keyword “friend, only in C++. No friend function.
Used for solving big problems. Not suitable for solving big problems.
CHAPTER -7:
CLASSES AND OBJECTS
I.TWO MARKS QUESTIONS
1) Write the differences between class definition and class declaration ?
Class declaration Class defination
Class declaration includes informing the Class definition is basically the actual
compiler about properties of the variable implementation and memory location of
such as its name, type of value it holds and function and about memory for the
the initial value if any it takes. variable is allocated during the definition
of the variable.
Memory has not been allocated during the Memory has been allocated during the
declaration of a variable or function, class definition of a variable or function or class
The declaration could be done multiple Variable or function could be defined only
times either of a variable or of function. once.
2) Explain the different types of access specifiers ?
Ans: Access specifiers define how the members (attributes and methods) of a class can be accessed.
Every data member of a class is specified by three levels of access protection for hiding data and function
members internal to the class. Access specifier define the scope of the data
Three types of access specifiers:
1. 1 private
2. 2 public
3. 3 protected
Example:
class addition
{
private: int a, b, sum;
public:
void getdata( );
void display( );
};
1) What is class definition and declaration? Write its general syntax and example
A class definition is a process of naming a class and the data variables ,and interface operation of the
class.
The variables declared inside a class are known as data members.
The functions declared inside a class are known as member functions.
A class declaration specifies the representation of objects of the class and set of operations that can
be applied to such objects.
General syntax:
class user_defined_name
{
private:
Member_data;
Member_functions;
public:
Member_data;
Member_functions;
protected:
Member_data;
Member_functions;
};
Where,
Key word class is used to declare a class
User_Defined_Name is the name of the class.
Class body is enclosed in a pair of flower brackets. Class body contains the declaration of its members (data
and functions)
There are generally three types of members namely private, public and protected.
Example:
class Account
{
private:
int acc_no;
char name[25];
char acc_type[4];
int bal_amt;
public:
void getdata();
void display();
};
Private:
private access means a member data can only be accessed by the class member function
The data members or member functions declared private cannot be accessed from outside the class.
The objects of the class can access the private members only through the public member functions of
the class. This property is also called information hiding
By default data members in a class are private.
Example: private:
int x; float y;
public:
public access means that member can be accessed any function inside or outside the class
Example: public:
int width;
void getdata( );
protected:
The members which are declared using protected can be accessed only by the member functions,
friend of the class and also the member functions derived from this class.
The members cannot be accessed from outside the class
The protected access specifier is similar to private access specifiers.
Example: protected:
int x, y;
3) Explain member function inside the class definition with syntax and example
To define member function inside a class the function declaration within the class is replaced by
actual function definition inside the class
A function defined in a class is treated as inline function
Only small functions are defined inside class definition
Syntax:
return_type class_name(member function)
class rectangle
{
int length, breadth, area;
public:
void get_data( ) //function definition
{
cout<<” Enter the values for Length and Breadth”;
cin>>length>>breadth;
}
void compute( ) //function definition
{
area = length * breadth;
}
void display( ) //function definition
{
cout<<” The area of rectangle is”<<area;
}
};
4) What are the characteristics of member functions outside a class? Or Explain member function
outside the class definition with syntax and example
A function declared as a member of a class is known as member function
Member functions declared within a class must be defined separately outside the class To define
member function outside the class declaration, you must link the class name of the class with the
name of member function.
We can do this by preceding the function name with the class name followed by two colons (::)
The two colons (::) are called scope resolution operator.
Scope resolution operator (::) is used to define the member function outside the class.
The general form of a member function defined outside the class is:
return_type class_name : : member_function_name( arg1, arg2, ….argN)
{
function body;
}
Example:
class operation
{
private:
int a, b;
public:
int sum( );
int product( );
};
int operation : : sum( )
{
return (a+b);
}
int operation : : product( )
{
return (a * b);
}
class Student
{
private:
int rollno;
char name[20];
char gender;
int age;
public:
void get_data( );
void display( );
};
Student S1, S2, S3; //creation of objects
Here, creates object S1, S2, and S3 for the class Student.
When an object is created space is set aside for it in memory
In pass by reference, when an address of an object is passed to the function, the function di-
rectly works on the original object used in function call.
This means changes made to the object inside the function will reflect in the original object,
because the function is making changes in the original object itself.
Pass by reference is more efficient, since it requires only passing the address of the object and
not the entire object.
CHAPTER 8:
FUNCTION OVERLOADING
1. What is function overloading? What are the advantages of function overloading?
Function Overloading means two or more functions have the same name, but differ in the number of argu-
ments or data types of arguments.
Advantages of function overloading:
It is easier to understand the flow of information and debug.
Code Maintenance is easy.
Code is executed faster.
Better understanding of the relation between the program and real-world objects.
Eliminates the use of different function names.
2. Discuss overloaded functions with example.
The main factor in function overloading is a function’s argument list.
C++ can distinguish overloaded functions by the number and type of arguments.
If there are two functions having the same name and different types of arguments or different number
of arguments, then function overloading is invoked automatically by the compiler.
Function Overloading is also known as Compile time polymorphism.
Program to compute the volume of cone, cube and cylinder using overloaded functions.
#include<iostream.h>
#include<conio.h>
class funoverload
{
public:
int volume(int a) // Volume of Cube
{
return a*a*a;
}
double volume(double r, double h) // Volume of Cone
{
return (0.33*3.14*r*r*h);
}
double volume(double r, int h) // Volume of Cylinder
{
return (3.14*r*r*h);
}
double volume(double l, double b, double h) //Volume of Cuboid
{
return (l*b*h);
}
};
int main()
{
funoverload f1;
cout<<“Volume of the Cube: “<<f1.volume(10)<<endl;
cout<<“Volume of the Cone: “<<f1.volume(2.0,3.0)<<endl;
cout<<“Volume of the Cylinder: “<<f1.volume(2.0,3)endl;
cout<<“Volume of the Cuboid: “<<f1.volume(5.0,6.0,7.0)<<endl;
return 0;
II PUC COMPUTER SCIENCE (41) Page 27
3. What is the need for function overloading and write its restrictions.
It reduces the names of functions to be remembered (by using the same name for all the functions).
To work transparently and without any issues.
Restrictions:
Each function in a “set of overloaded functions” must have different arguments
4. What is an inline function? Write a simple program for it.
An Inline function is a special type of function whose body is inserted at the place where it is called,
instead of transferring the control to the function called.
The keyword inline is used to define inline function.
Program to find the cube of a number using inline function:
#include <iostream.h>
inline int square (int a)
{
return(a*a);
}
int main( )
{
int x, y;
x=square(5);
cout<<"Square of 5 = "<<x<<endl;
y=square(10);
cout<<"Square of 10 = "<<y<<endl;
return 0;
}
CHAPTER -9
CONSTRUCTOR AND DESTRUCTOR
I. Two marks questions:
1. What is a constructor? Give an example.
Constructor is a special member function which is used to initialize the member variable of an object
automatically.
Constructor is a special member function which is automatically called when an object is created.
Ex: class A
{
int p;
public:
A()
{
P=0;
}
};
When an existing parameterized constructor(a1) is passed as argument to the new object(a2) during
declaration, then also copy constructor is invoked.
Example: x a1(100,200); // parameterized constructor
Ex:
class num
{
private: int x;
public:
num( ) // constructor
{
cout<<”In constructor:”;
x=100;
}
void display( )
{
cout<<”Value of X=”<< x;
}
~num( ) //destructor
{
cout<<”In destructor:”;
}
};
void main()
{
num a;
a.display( );
}
Output :
In constructor:
Value of X=100
CHAPTER 10:
INHERITANCE
I. ONE MARK QUESTIONS AND ANSWERS :
1) What is inheritance?
Inheritance is the capability of one class to inherit properties from another class.
2) What is base class?
It is the class whose properties are inherited by another class.
3) What is derived class?
It is the class that inherits properties from base class or classes.
4) What is multiple inheritance?
If a class is derived from more than one base class, it is known as multiple inheritance.
5) Is inheritance possible in C?
No.
6) Write the syntax for defining derived class.
Syntax:
class derived_class_name : visibility_mode base_class_name
{
//Members of the derived class
};
Derived Class
Base Class
Public mode Private mode Protected mode
Private Not inherited Not inherited Not inherited
Public Public Private Protected
Protected Protected Private Protected
Multiple Inheritance:
If a class is derived from more than one base class, it is known as multiple inheritance.
Hierarchical Inheritance:
If a number of classes are derived from a single base class, it is called as hierarchical inheritance.
Hybrid Inheritance:
Hybrid Inheritance is combination of Hierarchical and Multilevel Inheritance.
CHAPTER 11:
POINTERS
I. One mark questions and answers:
1) Write the declaration syntax for a pointer. OR How to declare a pointer?
Syntax: data-type *variable_name;
Example: int *p;
2) How do you initialize a pointer variable?
int n=25;
int *p;
p=&n;
3) Define pointer.
A pointer is a variable that holds a memory address of another variable in memory.
4) What is the purpose of new operator in C++?
The new operator is used to allocate memory for objects during the run time.
5) Name the pointer operator(Indirection operator).
Asterisk (*)
6) What is static memory allocation?
In the static memory allocation, the amount of memory to be allocated is predicted and pre known.
7) What is the purpose of delete operator in C++?
The delete operator is used to de-allocate memory of objects during the run time.
8) Which operator is used as address operator?
Ampersand(&)
9) What is free store?
Free store is a pool of unallocated memory heap given to a program that is used by the program for
dynamic allocation during execution.
10) What are object pointers?
The Pointers pointing to objects are referred to as object pointers.
II. Two marks questions and answers:
1) Write any two operations cannot be performed on pointers.
Addition of two pointers.
Multiplication of two pointers.
Division of two pointers.
2) Name the operators used to allocate and de-allocate memory space dynamically.
new operator used for dynamic memory allocation.
delete operator used for dynamic memory de-allocation.
3) What are object pointers? Give its syntax.
The Pointers pointing to objects are referred to as object pointers.
Syntax: class_name *object-pointer;
Example : employee *eptr;
3) Write the difference between Static memory allocation and Dynamic memory allocation.
Static allocation of memory Dynamic allocation of memory
1. Memory is allocated before the execution of the 1. Memory is allocated during the execution of
program begins. the program.
2. No memory allocation or de-allocation actions are 2. Memory bindings are established and
performed during execution. destroyed during the execution.
3. Variables remain permanently allocated. 3. Allocated only when program unit is active.
4. Implemented using stacks and heaps. 4. Implemented using data segments.
5. More memory space required. 5. Less memory space required.
CHAPTER-12:
DATA FILE HANDLING
I. One Mark Questions
1. Which header file is required for file handling functions in C++?
Ans: fstream.h header file is required for file handling in C++.
2. What is stream?
Ans: Stream is a sequence of bytes which act as an interface between the programs and
the files.
3. Name the streams generally used for I/O.
Ans: Input stream and output stream
4. What are output streams?
Ans: The stream that receives data from the program is known as output stream.
5. What are input stream?
Ans: The stream that supplies data to the program is known as input stream.
6. What is the significance of fstream.h file?
Ans: It is used to implement input output facilities in C++ file.
7. Mention the use of filebuf.
Ans: It sets the file buffers to read and write.
8. What is fstreambase?
Ans: It is the base class for fstream, ifstream and ofstream classes.
9. Mention the methods of opening file within C++ program.
Ans: There are 2 methods used to open a file
1) Opening file using constructor
2) Opening file using open( ) member function
10. Write the member functions belonging to fstream class.
Ans: open( ) and close( )
11. What is ifstream class?
Ans: It provides input operations for file which is used to read from file.
12. What is ofstream class?
Ans: It provides output operations for file which is used to write on file
13. Write the member functions belonging to ofstream class.
Ans: put( ) and write( )
14. Write the member functions belonging to ifstream class
Ans: get( ) and read( )
15. Name the stream classes supported by C++ for file input.
Ans: ifstream class
16. Name the stream classes supported by C++ for output.
Ans: ofstream class
17. Mention the file modes.
Ans: in,out and app mode
18. What is ios::in?
Ans: ios::in opens file for reading only.
19. What is ios::out?
Ans: ios::out opens file for writing only.
20. Mention the types of file.
Ans: There are 2 types of file
a) Text file b) Binary file
21. What is text file?
II PUC COMPUTER SCIENCE (41) Page 40
5. Name the stream classes supported by C++ for file input and output.
Classes Meanings
ifstream It is a stream class to read from files. It provides input operations for file. It inherits
get( ),getline( ),read( ) ,seekg( ) and tellg( ) functions from istream class
ofstream It is a stream class to write on files. It provides output operations for file. It inherits
put( ),write( ), seekp( ) and tellp( ) functions from ostream class.
fstream It is stream class to both read and write from/to files. It provides support for simultaneous
input and output operations. It inherits all the functions from istream and ostream classes.
CHAPTER 13:
DATABASE CONCEPTS
I. ONE MARK QUESTIONS :
1. What is record?
A row in a table is called as record.
2. Define data mining.
Process of analyzing and picking information from large volume of data.
3. What is tuple?
Collection of related fields is known as tuple. ( OR ) Each row in a table is called as tuple.
4. What is an attribute?
Each column of a table is identified with distinct header called attribute. ( OR ) Named column(header) of a
table is called as attribute.
5. What is an entity?
An entity is an object OR a record contains a set of attributes.
6. What is data base?
A database is a collection of large amount of related data. In other words, it is collection of tables. OR
It is a collection of related data organized with a specific structure(table) stored on a suitable storage
device.
7. What is table?
A table is a collection of related data elements organized in terms of rows and columns.
8. What is key?
It is a column or columns which identifies each row or tuple. ( OR ) It is a set of one or more attributes
whose combined values are unique in all the rows of a table.
9. What is foreign key?
A foreign key is a key used to link two tables together. ( OR )
It is an attribute in one table which matches with the primary key attribute of another table.
10. Define primary key.
The key (attribute) which is used to uniquely identify each record in a table is called primary key.
OR Primary key is an attribute(field) in a table which is unique in each row(record) of a table.
11. What is domain?
It is defined as a set of allowed values for one or more attributes.
12. What is normalization?
Normalization is a step by step process of removing the different kinds of redundancy and anomaly one step
at a time from the database. ( OR ) It is the process of removing anomalies, data redundancy and data incon-
sistency from the database.
II. Two marks questions:
1. Define primary key and candidate key.
Primary key: The key(attribute) which is used to uniquely identify each record in a table is called as
primary key.
Candidate key: When more than one attribute serves as unique, then each attribute is called as candi-
date key.
2. What is data independence? Mention the types of data independence.
Data independence is an ability of a database to modify the schema definition at one level without affecting
in the other level.
Physical data independence
Logical data independence
Hierarchical data model: This data Model organizes the data in a tree like structure. All the nodes are
linked to each other with a definite hierarchy. This model represents the nodes as one-to-one and one-to-
many relationships.
Advantages:
This model is easy to design and simple.
The data access is quite predictable in the structure.
Process of retrieval and updates are optimized.
Network data model: This data model organizes the data in the form of graph. All the nodes are linked to
each other without any hierarchy. It is a powerful model, but database design is complicated. This model has
many-to-many relationships on data. It has one parent node and many child nodes known as dependants;
hence the data access is easier.
8. Mention any three advantages of random/direct file organization.
II PUC COMPUTER SCIENCE (41) Page 49
CHAPTER 14
SQL
1) SYNTAX AND EXAMPLE FOR CREATE COMMAND.
This command is used to create a new table
SYNTAX:
CREATE TABLE tablename(
column1 datatype,
column2 datatype,
column3 datatype,
....
);
EXAMPLE:
CREATE TABLE STUDENT
(
Regnum number(6),
Name varchar(25),
Combination char(5),
Dob date,
Fees number(4,2),
);
EXAMPLE:
Alter table student add (addressvarchar(30));
Alter table student modify (addressvarchar(35));
Alter table student delete (address);
SYNTAX:
DROP TABLE table_name;
EXAMPLE:
DROP TABLE Shippers;
EXAMPLE:
a) To delete all the records whose fees is less than 15,000.
DELETE FROM Student WHERE fees < 15000;
b) To delete all the records.
DELETE FROM Student;
EXAMPLE:
//to insert data only for selected columns
INSERT into Student (Regnum, Name, Combination) values (123, ‘John’, ‘ceba’);
EXAMPLES:
a) SELECT Regnum, fees FROM Student;
b) SELECT * FROM Student;
c) SELECT Regnum, Name FROM Student WHERE totalmarks> 500;
This command gives list of names and combination in sorted order of names (ascending
order).
SYNTAX OF GROUP BY:
SELECT col1, col2, … FROM tablename WHERE condition GROUP BY col1, col2, .. ;
EXAMPLE:
SELECT Name, Combination FROM Student GROUP BY Combination;
This command gives combination wise list of names and combination
COUNT (): This function returns the number of rows(records) in the table that satisfies the condition
specified in the WHERE condition. If the WHERE condition is not specified, then the query returns the total
number of rows present in the table.
Example:
a) To know the number of employees in a particular department, the query would be:
SELECT COUNT (*) FROM employee WHERE dept = 'Electronics';
b) To know the total number of employees in all the department, the query would take the form:
SELECT COUNT (*) FROM employee;
DISTINCT(): This function is used to select the distinct rows (without duplicates) present in
the table.
II PUC COMPUTER SCIENCE (41) Page 53
MAX(): This function is used to get the maximum value from a column.
Example:
To get the maximum salary drawn by an employee, the query would be:
SELECT MAX (salary) FROM employee;
MIN(): This function is used to get the minimum value from a column.
Example:
To get the minimum salary drawn by an employee, the query would be:
SELECT MIN (salary) FROM employee;
AVG(): This function is used to get the average value of a numeric column.
Example:
To get the average salary, the query would be
SELECT AVG (salary) FROM employee;
CHAPTER - 15
NETWORKING CONCEPTS
One mark Questions:
1) Define Network Or computer network.
Ans: A network is a connection of autonomous computers. ( OR )
A computer network is an interconnection of two or more computers that are able to exchange information.
2) Expand TCP/ IP.
Ans: Transmission Control Protocol / Internet Protocol.
3) Expand HTTP.
Ans: Hyper Text Transfer Protocol
4) Expand FTP.
Ans: File Transfer Protocol.
5) Expand GSM.
Ans: Global System for Mobile communication.
6) Expand CDMA.
Ans: Code Division Multiple Access.
7) Expand SMS.
Ans: Short Message Service.
8) What is a server?
Ans: A server is a computer that contains all information that can be shared by other computers. ( or )
A Server is a computer that facilitates the sharing of data, software, and hardware resources like
printers, modems etc on the network.
9) Define client.
Ans: Any computer connected to server.
10) Write any one application of network.
Ans: Chat, Video conferencing.
11) Define chatting.
Ans: Chatting is the process of communicating, interacting or exchanging “typed in messages” over
the internet.
12) What is WAN?
Ans: It is type of network which covers large geographical area. ( OR )
The network which spreads across the countries is known as WAN.
13) Write an example for antivirus.
Ans: Kaspersky, Quick Heal.
14) What is Topology?
Ans: Network Topology refers to the arrangement of computers and other devices in a network.
( OR )
The actual appearance or layout of networking is called as network topology.
Two Mark Questions:
1) Write any two differences between LAN and WAN.
LAN:
Circuit Switching:
Here a physical connection between sender and receiver is established in an unbroken path (dedicated path)
and then data is transmitted from the source to destination
E.g: In telephone system, a complete path (end to end) must exist before communication can take
place
Message Switching (Store and forward):
Here there is no dedicated path is established between the sender and receiver. But the sender appends a
“destination address” to the data.
Packet Switching:
Here data is broken into distinct, addressed, fixed size parts called as packets, that can be transferred sepa-
rately via different paths. Each packet contains the address of sender, address of destination, sequence num-
ber and some data. Finally, at the receiver end, packets are reordered by sequence number and the original
message is reconstructed.
1. Star Topology
In this type of topology, all the computers are connected to a single hub or a switch through a cable. This hub
is the central node and all others nodes are connected to the central node.
Advantages of a Star Topology
It is able to replicate.
It requires a host program as a carrier.
It is activated by external action.\
Its replication ability is limited to the system it entered.
Chat:
Exchange of typed in message by several people who are using the internet at the same time as you are.
In telephonic conversations, you say something, people hear it and respond, and you hear their responses on
the spot and can reply instantly.
Video Conferencing:
A two-way videophone conversation among multiple participations is called Video Conferencing.
Wi-fi:
Wi-Fi is short for Wireless Fidelity, which lets you connect to the internet without a direct line
from your PC to the ISP. For Wi-Fi to work, you need:
Voice mail:
It is a method of storing voice message electronically for later retrieval by the intended recipients.
CHAPTER 16
INTERNET AND OPEN SOURCE CONCEPTS
Internet Explorer
Netscape Navigator.
4. What is Web server?
Web Server is a WWW server that responds to the requests made by web browsers. Each website has a unique address
called URL (Uniform Resource Locator). ( or )
Web server is an internet host computer that may store thousands of websites. It responds to the requests made by the
web browsers.
5. Define Freeware
Freeware is a software which is available free of cost and which allows copying and further distribution, but not modi-
fication and whose source code is not available.
6. Expand WWW.
World Wide Web.
7.What is HTTP?
Hyper Text Transfer Protocol is a network protocol used to send the message from source to destination.
8.What is web browser?
It is a software that enables the user to navigate through the www, to view webpage and move from one website to an-
other website.
8.What is WWW?
It is a “set of protocols” that allow users to access any document on the internet through the naming system based on
URL.
Global participation.
Optimization of resources.
Improved market intelligence and strategic planning.
Buyer makes a buying decision, create the purchase order but does not print it.
Reduced time to complete business transaction, particularly from delivery to payment.
6. Define E-commerce. Write the various technologies and services used in E-commerce.
E-commerce is the trade of goods and services with the help of telecommunication and computers.
CHAPTER 17
WEB DESIGNING
One marks questions:
1. Dine HTML.
HTML (Hyper Text Markup Language) is a language, which makes it possible to present information on Internet.
2. Define DHTML.
It is a new HTML extension that will enable a webpage to react user input without sending request to the web server.
OR
Dynamic HTML is a collective term for a combination of Hypertext Markup Language (HTML) tags and options that
can make Web more animated and interactive than previous versions of HTML.
Dynamic HTML can allow Web documents to look and act like desktop applications or multimedia productions.
3. Define XML.
XML is a text-based markup language used for data interchange on the web.
OR
XML is an eXtended Markup Language for documents containing structured information. Structured information con-
tains both content and some indication of what role that content plays.
4. Use of HTML.
To create websites, such as Dreamweaver.
5. Define Web hosting
Web hosting is a service that allows organization and individuals to post a website or webpage on the internet.
OR
A registrant establishes a domain name, leases a block of server space and uploads their webpage.
6. Define Web Scripting
The process of creating and embedding scripts in a web page is known as web scripting.
7. Define Free Hosting
Some famous websites offer to host some WebPages for no cost is called as free hosting.
8. How to add background colour and image to HTML page
To add background image, we need to specify image in the <body >tag.
<body background=”image.gif”>
Shared Hosting:
VPS Hosting
Dedicated Hosting:
Cloud Hosting:
Step 4: Change Your DNS Address
After you have purchased your web hosting, you will get Name Servers (also known as Domain Name
Servers or DNS)
Step 5: Upload Your Website
You can now upload your website to your account by connecting to the server using either cPanel’s File Manager or
FTP Client (such as FileZilla) – after which your website will go live.
PART - B
II. Answer any FIVE questions. Each question carries two marks. 2 x 5 = 10
16) Expand the terms SDRAM and DDRAM.
17) Prove that X + XY = X.
18) Give the logic symbol and working of AND gate.
19) What is the need for function overloading?
20) Give any two advantages of parameterised constructor.
21) Give any two differences between static and dynamic memory allocation.
22) Differentiate between text file and binary file.
23) Define data and information.
24) What is web browser? Give an example.
25) Give the general structure of HTML program.
III. Answer any FIVE questions. Each question carries THREE marks. 3 x 5 = 15
26) What is cache memory? Explain its types.
27) Write truth table and standard symbol for NOR gate.
28) What is an array? Mention any two types of arrays.
29) Give any three advantages of inheritance.
30) Explain different operations performed on pointer.
31) Mention and explain any three modes of opening a file in C++.
32) Explain any three data types used in SQL.
33) What is LAN? Explain.
34) Mention any three services or technologies of e-commerce.
35) What is web hosting? Mention any two web hosting methods.
IV. Answer any SEVEN questions. Each question carries FIVE marks. 5 x 7 = 35
36) Reduce F(A,B,C,D)=∑(0,2,4,6,8,9,10,11,12,14) Using K – map.
37) Briefly explain different operations performed on linear data structure.
38) What is stack data structure? Write algorithms for PUSH and POP operations.
39) Explain memory representation of two-dimensional array using row-major
ordering.
40) Write any five applications of object-oriented programming.
41) Explain class definition with syntax and example.
42) Briefly explain characteristics of friend function.
43) Write the rules for constructor function.
44) What is inheritance? Explain hierarchical and hybrid inheritance.
45) Differentiate between manual and electronic data processing.
46) Mention any five advantages of DBMS.
47) Explain any five arithmetic operators used in SQL.
48) Mention DML commands in SQL. Explain any two commands.
49) Explain any five network devices.
*****