Passing Package 2nd PUC - 2024 - FINAL
Passing Package 2nd PUC - 2024 - FINAL
4. Write the difference between procedural programming and object oriented programming. – 5 marks
OR
Mention any 5 advantages of object oriented programming over procedural programming.
5. What is an object?
An object is a collection of member data and associated member function
[ 5 marks questions ]
1. Explain class definition and class declaration with syntax and example.
A class definition is a process of naming data members and member functions of the class.
The general syntax for defining a class is as follows:
class user_defined_name
{
private:
member data
member functions
protected:
member data
member functions
public:
member data
member functions
};
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
class interest
{
private:
double p, t, r, si;
public:
void getdata( );
void compute( );
void putdata( );
};
void interest::getdata( )
{
cout<<"Enter principal amount, time and rate"<<endl;
cin>>p>>t>>r;
}
3. What are access specifier? Explain different access specifier with example.
Access specifiers define the scope of data . Access specifier help in controlling the access of data members.
There are three types of access specifier namely private, public and protected.
i) private : private access means a member data can only be accessed by the member function. Members
declared under private are accessible only within the class. If no access specifier is mentioned, then by default,
members are private.
Ex:
class Date
{
private:
int day;
int month;
……….
};
ii) public : public access means that members can be accessed by any function outside the class also.
Ex:
class Date
{
private:
int day;
int month;
public:
void inputdate();
void displaydate();
};
iii) protected: The members which are declared using protected can be accessed only by the member functions,
friends of the class and also member functions derived from this class. The members cannot be accessed from
outside. The protected access specifier is therefore similar to private specifier.
protected:
int day;
int month;
void rectangle::get_data()
{
cin>>length>>breadth;
}
void rectangle::put_data()
{
cout<<length<<breadth;
}
int data::avg()
{
int a;
a = (maths+science)/2;
return a; output:
} Enter roll no: 35
void data::putdata() Enter maths marks: 56
{ Enter Science marks: 78
cout<<”Average = “<<avg()<<endl; Average = 67
}
void main()
{
clrscr();
data stud[3];
for(int i =0; i<3;i++)
stud[i].getdata();
return 0;
}
1. What is meant by function overloading? Explain the need for function overloading.
Function overloading means two or more functions having same name, but differ in the number of arguments or
datatype of arguments. [ Note : Also refer Function overloading lab program ]
Need for function overloading (Advantages of function overloading):
The main factor in function overloading is a function’s argument list. If there are two functions having same
name and different types of arguments or different number of arguments, then function overloading is
invoked automatically by the compiler. Thus the code is executed faster.
It is easier to understand the flow of information and debug.
Code maintenance is easy
Easier interface between programs and real world objects.
Function overloading is also known as compile time polymorphism.
INHERITANCE [ 1 + 5 = 6 marks ]
Father
Base class
Son
Derived class
II Multiple inheritance:
If a class is derived from more than one base class, it is known as multiple inheritance
Prince
Derived class
Derived class-1
Father
Derived class-2
Son
Derived class-n
IV Hierarchical inheritance:
If a number of classes are derived from a single base class, it is called as hierarchical inheritance
Base class
Staff
V Hybrid inheritance:
Hybrid inheritance is combination of Hierarchical and multilevel inheritance.
Base class
Derived class
I Public inheritance:
This is the most used inheritance mode. In this
1) The public members of a base class become pubic members of the derived class.
2) The private members of a base class cannot be inherited to the derived class
3) The protected members of a base class stay protected in a derived class.
II private inheritance:
1) The public members of a base class become the private members of the derived class.
2) The private members of a base class cannot be inherited to the derived class
3) The protected members of a base class stay protected in a derived class.
i) Traversal: The process of accessing each data element once to perform some
operation is called traversing.
ii) Insertion: The process of adding a new element into the given collection of data
elements is called insertion.
iii) Deletion: The process of removing an existing data element from the given collection
of data elements is called deletion.
iv) Searching: The process of finding the location of a data element in the given
collection of data elements is called as searching.
v) Sorting: The process of arrangement of data elements in ascending or descending
order is called sorting.
vi) Merging: The process of combining the data elements of two structures to form a
single structure is called merging.
5) What is a queue? Explain the different types of queues with a neat diagram.
A queue is an ordered collection of items where an item is inserted at one end called
the rear and an existing item is removed at the other end, called the front. Insertion
and deletion is performed according to the First-in-First-out principle(FIFO).
Types of queues:
Queues can be of four types:
1) Simple queues
2) Circular queues
3) Priority queues
4) Double ended queue(Dequeue)
1) Simple queue: In simple queue, insertion occurs at the rear end of the list and
deletion occurs at the front end of the list.
Front Rear
A B C
0 1 2 3 4
Front = 1, Rear = 3
2) Circular queue: In circular queue, the last node is connected back to the first
node to make a circle.
3 2
4
1
5
0 Front=0
6 7
Rear=7
3) Priority queue:
A priority queue is a queue that contains items that have some preset priority. An
element can be inserted or removed from any position depending on some priority.
[ Note : Refer K-Map from Boolean algebra – 5 marks ] – Refer “ K-Map Solved “ PDF
Logic gates [ 1+ 3 = 4 marks ]
1. What is HTML?
HTML is a language which is used to create web pages
2. Expand HTML.
HTML stands for Hyper Text Markup Language.
<BODY>
-----------------------------
-----------------------------
</BODY>
</HTML>
Basic tags:
1) <html>: This element defines the whole html document.
2) <head>: This element is displayed in title bar of the browser
3) <title>: The title appears in the title bar on top of the browser’s window.
4) <body>: This elements defines the body of the HTML document.
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
</table>
</body>
</HTML>
2) <TEXTAREA> </TEXTAREA>: This tag allows for free form text entry.
Ex: <TEXTAREA ROWS=4 COLS=20>
3) <SELECT>: This tag displays a select control and is used along with <option>
i) List Box: Ex: <SELECT NAME=LIST>
<OPTION>GM</OPTION></SELECT>
ii) Drop Down Box: Ex: <SELECT NAME=DROPDOWN>
<OPTION>GM</OPTION></SELECT>
6. Write a note on XML / Give the features of XML/Mention the advantages of XML.
XML is an extended markup language used for creating documents containing structured information.
1) XML is used to describe data and focus on what data is, whereas HTML is used to display data and focus
on formation of data.
2) XML tags are not predefined, we create our own tags, whereas HTML tags are predefined
3) XML tags are case sensitive, whereas HTML tags are not case sensitive
4) XML is extensible whereas HTML is not extensible.
5) XML can be used to store data but not HTML.
*********