Professional Documents
Culture Documents
Q No Solution Marks
1. i. C
ii. The capability of a class to derive properties and characteristics from another class 1*10
is called Inheritance. =10
iii. A
iv. B
v. B
vi. C
vii. B
viii. B
ix. An Object is an instance of a Class
x. C
Objects
Signature of the Faculty
Page No
Objects are the basic unit of OOP. They are instances of class, which have data members
and uses various member functions to perform tasks.
Class
It is similar to structures in C language. Class can also be defined as user defined data type
but it also contains functions in it. So, class is basically a blueprint for object. It declare &
defines what data variables the object will have and what operations can be performed on
the class's object.
Abstraction
Abstraction refers to showing only the essential features of the application and hiding the
details. In C++, classes can provide methods to the outside world to access & use the data
variables, keeping the variables hidden from direct access, or classes can even declare
everything accessible to everyone, or maybe just to the classes inheriting it. This can be
done using access specifiers.
Encapsulation
It can also be said data binding. Encapsulation is all about binding the data variables and
functions together in class.
Inheritance
Inheritance is a way to reuse once written code again and again. The class which is inherited
is called the Base class & the class which inherits is called the Derived class. They are also
called parent and child class.
So when, a derived class inherits a base class, the derived class can use all the functions
which are defined in base class, hence making code reusable.
Polymorphism
It is a feature, which lets us create functions with same name but different arguments, which
will perform different actions. That means, functions with same name, but functioning in
different ways. Or, it also allows us to redefine a function to provide it with a completely
new definition. You will learn how to do this in details soon in coming lessons.
Type Keyword
Boolean bool
Character char
Integer int
Signature of the Faculty
Page No
Floating point float
Double floating point double
Valueless void
Wide character wchar_t
Basis Of
Sl.No C C++
Distinction
C++ is an object-oriented programming
C is a structural or language and supports Polymorphism,
4. A Nature Of procedural type of Abstract Data Types, Encapsulation, among
1
Language programming others. Even though C++ derives basic
language. syntax from C, it cannot be classified as a
structural or a procedural language.
C lays emphasis on
the steps or C++ emphasizes the objects and not the
Point Of
2 procedures that are steps or procedures. It has higher abstraction
Emphasis
followed to solve a level.
problem.
Compatibility C++ supports function overloading,
C does not support
3 With implying that one can have name of
function overloading.
Overloading functions with varying parameters.
C does not provide
String or Boolean C++ provides Boolean or String data types.
4 Data Types data types. It It supports both user-defined and built-in
supports primitive & data types.
built-in data types.
C does not support
Compatibility
Exception Handling
With C++ supports Exception Exception:Handling
5 directly. It can be
Exception can be done through try & catch block.
done through some
Handling
other functions.
Compatibility C does not support
C++ supports functions with default
6 With functions with
arrangements.
Functions default arrangements
The following phases are essential for the execution of C++ program
1. Create
2. Save
3. Compile
4. Execute
Scope resolution operator (::) in C++ programming language is used to define a function
5. A outside a class or when we want to use a global variable but also has a local variable with
/*C++ program to create student class, read and print N student's details
(Example of array of objects).*/
#include <iostream>
using namespace std;
#define MAX 10
class student
{
private:
5. B
char name[30];
Signature of the Faculty
Page No
int rollNo;
int total;
float perc;
public:
//member function to get student's details
void getDetails(void);
//member function to print student's details
void putDetails(void);
};