Sunteți pe pagina 1din 4

MCA SECOND SEMESTER OOPS VIVA QUESTION S AND ANSWERS

1. ENUMERATION:
USE: Reduces errors Makes it easy to change values in the future. user-defined type consisting of a set of named constant enum keyword is required to declare an enumeration.

2. FUNCTION OVERLOADING:
same name is given to different function

ADVANTAGE: save the memory space. develop more than one function with the same name

3.SCOPE
lifetime" of a name FILE SCOPE declared outside all blocks or classes can be accessed by any function or block within a single file

4.STORAGE CLASS:
define the scope (visability) and life time of variables AUTO STORAGE: 1. default storage class for local variables. 2. initializer is initialized every time it comes into existence. AMS ENGINEERING COLLEGE MCA STUDENTS SAL

STATIC STORAGE: 1. default storage class for global variables 2. A static variable in a block is initialized only one time.

Eg:
#include <stdio.h> int f(void) { static int x = 0; x++; return x; } int main(void) { int j; for (j = 0; j < 5; j++) { printf("Value of f(): %d\n", f()); } return 0; }

5.IMPLEMENTATION OF SIMPLE ADTS


ABSTRACT DATA TYPE

STACK:

last in, first out Stack is computer memory where all variables declared and initialized before runtime are stored

Queue: first-in first-out

6.CONSTRUCTOR
I. II. III. IV. V. initialize the variables same name as that of class. It is invoked automatically special member function whose task is to intialize the object of its class. Constructors are usually public because they are provided to create objects

AMS ENGINEERING COLLEGE MCA STUDENTS

SAL

DESTRUCTOR
deallocate memory to release any resources allocated by the object
class X { public: // Constructor for class X X(); // Destructor for class X ~X(); };

clean up and to free the resources The destructor has the same name as the class, but with a tilde (~) in front of it.

7.STATIC DATA MEMBERS:


Static means something maintaining state either forever or up to some point.

allocated as soon as the execution of program starts, regardless of their scope. They are de-allocated at the end of the program execution.

8.BIT FIELDS
store multiple logical values as a short series of bits

can only be declared inside a structure or a union 9.FUNCTION TEMPLATES operate with generic types allows us to create a function template whose functionality can be adapted to more
than one type or class without repeating the entire code for each type.

10.CLASS TEMPLATES:

requires two stacks one for integer data and o one for string data. used to generate template classes cannot declare an object of a class template SAL

AMS ENGINEERING COLLEGE MCA STUDENTS

11.SINGLE INHERITENCE:
When a derived class has only one base class its called a single inheritance .

12.MULTIPLE INHERITENCE:
can inherit behaviors and features from more than one superclass.

13.VIRTUAL FUNCTION:
function or method whose behaviour can be overridden within an inheriting class

by a function with the same signature


override the propertis of a function

virtual function is ended with null virtual function=o

14.EXCEPTION HANDLING:
used to change the normal flow of the code execution if a specified error (exceptional) condition occurs

AMS ENGINEERING COLLEGE MCA STUDENTS

SAL

S-ar putea să vă placă și