0% found this document useful (0 votes)
3 views5 pages

C Sort Question 1

C++ is an object-oriented programming language developed by Bjame Stroustrup in 1983, which includes key concepts such as classes, objects, inheritance, and polymorphism. The document outlines fundamental OOP principles, characteristics of C++, and various programming constructs like tokens, arrays, and access specifiers. It also compares C++ with Java and C, explaining concepts like pointers, type conversion, and inheritance types.

Uploaded by

yashgelot27
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views5 pages

C Sort Question 1

C++ is an object-oriented programming language developed by Bjame Stroustrup in 1983, which includes key concepts such as classes, objects, inheritance, and polymorphism. The document outlines fundamental OOP principles, characteristics of C++, and various programming constructs like tokens, arrays, and access specifiers. It also compares C++ with Java and C, explaining concepts like pointers, type conversion, and inheritance types.

Uploaded by

yashgelot27
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1. What is C++?

C++ is an object oriented programming language. It was developed by Bjame


Stroustrup in 1983 at the AT & T Bell Laboratories, Now Jersey, USA. It is
basically a super set of C, which provided low level features.

2. What are the basic concepts of OOP?


▪ Objects
▪ Classes
▪ Data Abstraction and Encapsulation
▪ Inheritance
▪ Polymorphism
▪ Dynamic Binding
▪ Message Passing

3. What is oops?
An object oriented program is a collection of discrete objects, which are self
contained collections of both data structures and functions that interact with
other objects.
4. What are the characteristic of C++ language?
It has the following characteristics :

▪ Reduces complexity while solving problems


▪ Correctness of results is ensured
▪ Affordable in terms of hardware and other resources
▪ Easier and cheaper for integrating existing software facilities and
libraries
▪ Portable i.e. can be used on different types of computers with little or no
change in the programs.

5. What are tokens?


The smallest individual units in a program are called tokens.

6. What are the types of tokens?


C++ has the following tokens are :

▪ Keywords
▪ Identifiers
▪ Constants (literals)
▪ Punctuators (Separators)
▪ Operators

7. What is an object?
An object is an instance of a class. It can be uniquely identified by its name and it
defines a state, which is represented by the values of its attributes at a particular point
in time.

8. What is class?
A class is a collection of objects. A class may be defined as a group of objects with
same operations and attributes. The class is a key word in C++ programming. The user
deals with classes instead of dealing with various individual objects.

9. What is the difference between private and public class?


The Private access means that only associated functions can only access the data.
The Public access means that data can be accessed by other objects of the program.
10. What is the difference between class and objects?
Classes and objects are separate but related concepts. Every object belongs to a class and
every class contains one or more related objects.
A Class is static. All of the attributes of a class are fixed before, during, and after the
execution of a program. The attributes of a class don’t change.

11. What is static class member?


A static data member has a property that all instances of the containing class share this
one data member.

12. What is an array?


An array is a collection of identical data objects which are stored in consecutive
memory locations under a common heading or a variable name. In other words, an
array is a group or a table of values referred to by the same variable name. The
individual values in an array are called elements. Array elements are also variables.

13. What is a character array?


The procedure for declaring character array is almost the same as for other data types
such as integer or floating point. One can declare the character array by means of
alphanumeric characters.

14. Define Encapsulation?


The wrapping up of data and functions into a single unit is known as data
encapsulation.
Encapsulation means combining data and related functions that use that data together
and providing it as a logical entity.

15. What are access specifiers?


Access specifiers determine the accessibility of a class member. In general, there are
three important access specifiers :

▪ Public
▪ Private
▪ Protected

16. What is inheritance?


The mechanism of deriving a new class (derived) from an old class (base class) is
called inheritance. It allows the extension and reuse of existing code without having to
rewrite the code from scratch. Inheritance is the process by which objects of one class
acquire properties of objects of another class.

17. What is polymorphism?


Polymorphism means one name, multiple forms. It allows us to have more than one
function with the same name in a [Link] allows us to have overloading of operators
so that an operation can exhibit different behaviours in different instances.

18. What is function overloading?


Function Overloading more than one method with the same name but different type of
parameters and/or number of parameters can be defined. Depending on the actual
number and/or static type of the parameters used, the compiler will resolve the call to
the correct method.

19. What are the types of polymorphism?


Polymorphism can be broadly classified as

▪ Compile time polymorphism


▪ Run time polymorphism

20. What is the difference between an identifier and a keyword?


Identifier :

▪ These are the fundamental building blocks of a program and are used to give
names to variables, functions, arrays, objects, classes etc.

Keyword :

▪ These words are reserved to do specific tasks and must not be used as normal
identifier names.

21. What is meant by type conversion?


The process in which one pre defined type of expressions is converted into another type is
called conversion.
[Link] is difference between C++ and Java?
▪ C++ has pointers Java does not
▪ Java is the platform independent as it works on any type of operating
systems
▪ Java has no pointers where c ++ has pointers
▪ Java has garbage collection C++ does not.

23. What is the difference between c &c++?


▪ c++ ia an object oriented programing but c is a procedure oriented
programing.
▪ c is super set of c++.
▪ c can’t suport inheritance,function overloading, method overloading etc.
but c++ can do this.
▪ In c program the main function could not return a value but in the c++
the main function shuld return a value.

24. What is a pointer?


▪ A pointer is a variable which holds a memory address within.
▪ Each variable is located at a particular position in the memory which is
known as Address.
▪ The address can be stored in a pointer.
▪ A program accesses the value in the address stored in the pointer by
using indirection operator.

25. What are the types of conversion?


There are two types of conversion are :

▪ Implicit (Automatic) Conversion


▪ Explicit Conversion

26. What is the difference between implicit and explicit conversion?


When data types are mixed in an expression, the conversion is performed
automatically. This process of automatic conversion is called implicit conversion.

Explicit Expressions are user defined expressions. C++ provides type casting facility.
The expression can be converted into a specific type.
27. What is pointer operator?
A pointer operator can be represented by a combination of * (asterisk) with a
variable.
28. What is copy constructor?
Copy constructor is a constructor function with the same name as the class and used to
make deep copy of objects.

29. What is default constructor?


A default constructor is a constructor that either has no parameters, or if it has
parameters, all the parameters have default values.

30. What is string?


String is a series of characters. The string is enclosed within double quotes. A
string is used to write or store messages.
″HELLO″
31. What is multiple inheritance?
A class can inherit properties from more than one class which is known as
multiple inheritance.
32. What is conditional operator( ?:)?
The conditional operator evaluates an expression returning a value if that
expression is true and a different one if the expression is evaluated as false.
33. What is recursive function?
A function which calls itself directly or indirectly again and again is known as
the recursive function. Recursive functions are very useful while constructing
the data structures like linked lists, double linked lists and trees. There is a
distinct difference between normal and recursive functions.
34. What is friend function?
The function declaration should be preceded by the keyword [Link] function
definitions does not use either the keyword or the scope operator ::. The functions that
are declared with the keyword friend as friend [Link], a friend function is an
ordinary function or a member of another class.

35. What is a call by reference?


A function call mechanism that passes arguments to a function by passing the addresses
of the arguments.

36. What is the call by value?


A function call mechanism that passes arguments to a function by passing a copy of the
value of the arguments.

37. What is inheritance?


The mechanism of deriving a new class from an old one is called inheritance. The old
class is referred to as the base class and the new one is called the derived class or the
sub class.

38. What are the types of inheritance?


▪ Single inheritance
▪ Multiple inheritance
▪ Multi level inheritance
▪ Hierarchical inheritance
▪ Hybrid inheritance

39. What is method overriding?


Method overriding is a mechanism in which the sub class method overrides the base
class method. If the same function name is present in both the base class and the sub
class then the sub class method overrides the base class method.

40. What is inline function?


Inline function is defined as a function definition such that each call to the function is in
effect, replaced by the statements that define the function. It is expanded in line when it
is invoked.
41. What is the difference between local and global variable?
Local variables Identifiers declared as label, const, type, variables and
functions in a block are said to belong to a particular block or function and
these identifiers arc known as the local parameters or variables. Local variables
are defined inside a function block or a compound statement.

Global variables are variables defined outside the main function block. These
variables are referred by the same data type and by the same name through
out the program in both the calling portion of a program and in the function
block. Whenever some of the variables are treated as constants in both the
main and the function block, it is advisable to use global variables.
42. What do you mean by pure virtual functions?
A pure virtual member function is a member function that the base class forces
derived classes to provide. Any class containing any pure virtual function
cannot be used to create object of its own type.

You might also like