





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
question with answer in specified format for beginners student capsul for exam
Typology: Exams
1 / 29
This page cannot be seen from the preview
Don't miss anything!






















1. List out the characteristics of FOP.
7. Define Encapsulation. The wrapping up of data and functions into a single unit is known as encapsulation. The data is kept safe from external interference and misuse. 8. Define Data hiding? The isolation of data from direct access by the program is called as data hiding or information hiding. 9. Define Abstraction. It refers to the act of representing essential features without including the background details. 10. Define ADT? The classes which are using the concept of data abstraction is known as abstract data types (ADT). 11. Define data member and member function? The attributes which are holding the information is known as data members. The functions that operate on data member are sometimes called as member function. 12. Define Inheritance? Inheritance is the process by which objects of one class acquire the properties of objects of another class. The new derived class inherits the members of the base class and also adds its own. 13. Define Polymorphism? It allows a single name/operator to be associated with different operations depending on the type of data passed to it. An operation may exhibit different behaviors in different instances. 14. Define dynamic binding? Dynamic binding means that the code associated with the given procedure call is not known until the time of call at runtime. 15. What is message passing? It is the process of invoking an operation on an object. In response to a message, the corresponding function is executed in the object. 16. List down the benefits of OOP?
23. List the different types of parameter passing techniques. (i) Pass by value (ii) Pass by Address (iii) Pass by Reference 24. What is Dynamic memory allocation? Allocation of memory space for any data structure during the course of the program execution is called as Dynamic memory allocation. 25. How memory management is performed dynamically in C++? Two operators are available for dynamic memory management. (i) new – for dynamic memory allocation (ii) delete – for dynamic memory deallocation
1. Define class? A class is a way to bind data and its associated functions together. It allows the data to be hidden if necessary. 2. What are the parts of class specification? The class specification has two parts
in the class can access it. These functions provide the interface between the object’s data and the program This insulation of the data from direct access by the program is called data hiding.
It allows the programmer to build large programs with clarity, extensibility and ease of maintenance, incorporating the sprit and efficiency of C
15. What are the applications of C++? It is a versatile language for handling very large programs It is suitable for virtually any programming task including development of editors, compilers, databases, communication systems and any complex real life application systems It allows us to create hierarchy-related objects, so we can build special object-oriented libraries which can be used later by many programmers While C++ is able to map the real-world problem properly, the C part of C++ gives the language the ability to get close to the machine – level details C++ programs are easily maintainable and expandable 16. Why we need the preprocessor directive #include? This directive causes the preprocessor to add the content of the iostream file to the program. It contains declarations for the identifier cout and the operator <<. It should be included at the beginning of all programs that use i/o statements. 17. How does a main() function in C++ differ from main() in C? In C++, main() returns an integer type value to the operating system. Therefore , every main() in C++ should end with a return (0) statement. Otherwise a warning or an error occurs. Since main() returns an integer type value, return type for main() is explicitly specified as int. In C, it does not specify any return value for the main() function. So there is no need for explicitly use the return statement. 18. Describe major parts of a C++ program.
| Include File | | ——————————– | | Class Declaration | | ——————————-| | Member Function Definition | | ——————————-| | Main Function Program | |______________________| The class declarations are placed in a header file and the definitions of member functions go into another file. The main program that uses the class is placed in a third file which “ includes” the previous two files as well as any other files required. 19. Describe I/O operator.
Input Operator The statement cin>> num; is an input statement and causes the program to wait for the user to type in a number. The operator >> is known as extraction or get from operator. It takes the value from the keyboard and assigns it to the variable on its right. Output Operator The statement Cout<< “ the numbers”; uses the cout identifier that represents the standard output stream ( screen) in C++. The operator <
20. Describe tokens The smallest individual units in a program are known as tokens. C++ has the following tokens: 1. Keywords 2. Identifiers 3. Constants 4. Strings 5. Operators. 21. Classifications of Data Types. 1. User defined Type a. Structure b. Union c. Class d. Enumeration 2. Built in type a. integral type i. int ii. char b. void c. floating type i. float ii. double d. Derived type i. array ii. function iii. pointer iv. reference 22.Describe with example the uses of enumeration data type (i) It provides a way for attaching names to numbers. (ii) The enum keyword gives the list of words by assigning them values 0,1,2 and so on. The
25. What are the operators available in C++? Arithmetic operator Relational Operator Assignment Operator Logical Operator Increment/ decrement Operator Conditional operator Bitwise operator Special operator Scope resolution operator Pointer to member declaration Pointer to member operator Memory release operator Line feed operator Filed width operator 26.Explain about Type Casting Operator This is used for conversion of variables or expression explicitly Syntax: (type – name) expression or Type –name ( expression) Ex: avg= sum/ float(i); Alternatively, we can use typedef to create an identifier of the required type and use it in the functional notation typedef int * int_pt; p= int_pt(q); 27.What are the types of expression? Constant expression Integral expression Float expression Pointer Expression Relational Expression Logical expression Bitwise expression 28. What is meant by operator overloading? Overloading means assigning different meaning to an operation, depending on the context. That is it is used to assign multiple meanings to operators.
Ex: The operator * when applied to a pointer variable, gives the value pointed to by the pointer. But it is used for multiplying two numbers.
29. What are the types of control strucuture sequence selection iteration 30.What are the advantages of new operator It automatically computes the size of the data object. So there is no need to use sizeof operator It automatically returns the correct pointer type, so that here is no need to use a type cast. It is possible to initialize the object while creating the memory space Like any other operator, operator new and delete can be overloaded.
class.
1.What is meant by reusability Reusability is a feature which is supported in object-oriented programming. This allows the reuse of existing classes without redefinition. 2.Define Inheritance In object-oriented programming, inheritance is a way to form new classes (instances of which are called objects) using classes that have already been defined. The former, known as derived classes , take over (or inherit ) attributes and behavior of the latter, which are referred to as base classes. It is intended to help reuse of existing code with little or no modification. Inheritance is also called generalization , because the is-a relationships capture a hierarchal relationship between classes of objects 3.What are the applications of Inheritance There are many different aspects to inheritance. Different uses focus on different properties, such as the external behavior of objects, internal structure of the object, structure of the inheritance hierarchy, or software engineering properties of inheritance. (i)Specialization One common reason to use inheritance is to create specializations of existing classes or objects. This is often called subtyping when applied to classes. In specialization, the new class or object has data or behavior aspects that are not part of the inherited class. Another form of specialization occurs when an inherited class specifies that it has a
it is called hierarchical inheritance.
6. How to define derived classes? A derived class can be defined by specifying its relational ship with the base class in addition to its own details. The syntax is: class derived-class-name : visibility-mode base-class-name { …… ……. }; Here the visibility mode is optional and if present, may be either private or public. The default mode is private. When a base class is privately inherited by a derived class, public members of the base class become private members of the derived class and therefore the public members of the base class can only be accessed by the member functions of the derived class. When the base class is publicly inherited, public members of the base class become public members of the derived class and therefore they are accessible to the objects of the derived class. 7. What is inherited from the base class? In principle, a derived class inherits every member of a base class except: its constructor and its destructor its operator=() members its friends Although the constructors and destructors of the base class are not inherited themselves, its default constructor (i.e., its constructor with no parameters) and its destructor are always called when a new object of a derived class is created or destroyed. 8.Define virtual base class A base class that has been qualified as virtual in the inheritance definition. In multiple inheritance, a derived class can inherit the members of a base class via two or more inheritance paths. If the base class is not virtual, the derived class will inherit more than one copy of the members of the base class. 9. Define virtual function It is a function qualified by the virtual keyword. When a virtual function is called via a pointer, the class of the object pointed to determines which function definition will be used. Virtual functions implement polymorphism, whereby objects belonging to different classes can respond to the same message in different ways.
10. What is meant by pure virtual function A virtual function that is declared in a base class but not defined there. The responsibility for defining the function falls on the derived classes, each of which generally provides a different definitions. It is illegal to create instances of a class that declares a pure virtual function. So such a class is necessarily an abstract base class. 11. What is meant by subclass and superclass Subclass: a class which has link to a more general class Superclass: a class which has one or more members which are classes themselves. 12. Define abstract class Abstract class is one that is not used to create objects. An abstract class is designed only to act as a base class. It is a design concept in program development and provides a base upon which other classes may be built. 13.What are the forms of inheritance