Shared Flashcard Set

Details

Software Engineering
All about Software Engineering
8
Computer Science
Professional
07/01/2017

Additional Computer Science Flashcards

 


 

Cards

Term

1-function overloading (redefined function with another parameters ) 

1.B-operators overloading declares the addition operator that can be used to add two Box objects and returns final Box object 

2- recursion (self-call to the same function )

3-pointers (a type of variable store memory address )

4-pass by value (remain the value of the variable as it is)

5-pass by reference (change the value of the variable)

6-char takes 1 bit int takes 4 double takes 8(note array calculation is type * number of element Ex:int array[5]=takes 4*5 from memory)

7-pointers (when you work with math and pointers any operation you do doesn't change memory address )

8-binary scope resolution operator is Class::

9-x++ means that if x = 10 next line x =11

but ++x means that x =11 in this line

10- every random function in all programming is actually not random it follows a certain algorithm or pattern so to make sure you are generating truly random numbers use the time that's all.

 

Definition

Virtual Functions

 

 A virtual function a member function which is declared within the base class and is re-defined (Override) by the derived class

 

Rules for Virtual Functions

  1. They Must be declared in public section of the class.
  2. Virtual functions cannot be static and also cannot be a friend function of another class.
  3. Virtual functions should be accessed using pointer or reference of the base class type to achieve run time polymorphism.
  4. The prototype of virtual functions should be same in the base as well as derived class.
  5. They are always defined in base class and overridden in derived class. It is not mandatory for derived class to override (or re-define the virtual function), in that case base class version of function is used.
  6. A class may have virtual destructor but it cannot have a virtual constructor

 

Term
class Base {
    public:
        int publicMember;
    protected:
        int protectedMember;
    private:
        int privateMember;
};
  • Everything that is aware of Base is also aware that Base contains publicMember.
  • Only the children (and their children) are aware that Base contains protectedMember.
  • No one but Base is aware of privateMember
Definition
Term

Design Pattern 

mocks object

Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production

Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what's programmed in for the test. Stubs may also record information about calls, such as an email gateway stub that remembers the messages it 'sent', or maybe only how many messages it 'sent'.

Mocks are what we are talking about here: objects pre-programmed with expectations which form a specification of the calls they are expected to receive

Definition

Design Pattern 

Active Record

Database access is repetitive

Adapter

the pieces does't fit (ex:call function with unknown parameter)

Decorator 

Add behaviors to specific object in run time 

Factory 

various implementations

Strategy

same goal Different implementations

Singleton

shared / limited resource 

 Gate way

mixed business & database logic 

Term

Design Pattern 

Active Record

Database access is repetitive

Adapter

the pieces does't fit (ex:call function with unknown parameter)

Decorator 

Add behaviors to specific object in run time 

Factory 

various implementations

Strategy

same goal Different implementations

Singleton

shared / limited resource 

 Gate way

mixed business & database logic 

Definition
Term

Data structure

1- there are 2 levels (user level, implementation level )

2- user level ex: int arr[10];

3-implementation ex:

 

 Data Types (arrays , stacks array, linked stack)

 

5-traverseStack(to print data dynamically without knowing entry type)

Definition

Stacks

1- stacks have accessing mechanism (initialise ,push,pop, stackEmpty, stackFull, sackSize, stackTop,stackClear,traverseStack)

2- difference between stack array linked stack(linked stack is dynamic stack(size is not defined|| to overcome size limitation))

3- linked stack (create node:node is object contain two parameters 1- element it self(entry) 2-pointer to next node  (next))

 

Term

Notes

1- linear function is edit in two value in parallel  

Definition
Term

Pure Virtual Function(Abstract Classes)

Sometimes implementation of all function cannot be provided in a base class because we don’t know the implementation. Such a class is called an abstract class

PS:If we do not override the pure virtual function in derived class, then derived class also becomes abstract class

EX:    virtual void show() = 0;

 

Definition

Function Template

 

Templates are the foundation of generic programming, which involves writing code in a way that is independent of any particular type.

EX:template <typename T>

T myMax(T x, T y)

{

   return (x > y)? x: y;

}

 

Term

Template specialization

 

template <class T>

void fun(T a)

{

   cout << "The main template fun(): "

        << a << endl;

}

 

template<>

void fun(int a)

{

    cout << "Specialized Template for int type: "

         << a << endl;

}

 

Definition
Supporting users have an ad free experience!