Saturday, 24 March 2018

Basic Knowledge about Software

What is Computer ?
  → Computer is an electronic device that takes input, process it and gives output.

What is 0 and 1 ?
  → There is nothing like 0 and 1 in computer.There is no physical significance of 0 and 1
  → Any information can be encoded as a sequence of 0 and 1.

How 0 and 1 get stored in memory ?
What is Hardware ?
 → Hardware is a comprehensive term for all of the physical parts of a computer, as distinguished from the data it contains or operates on, and the software that provides instruction for the hardware to accomplish tasks
    Hardware is anything which is tangible.

What is a File ?
   File is a data bundle.


What is software ?
  Application Software
  System Software

Program and Process
    Set of instruction is called Program
    Active state of a program is called Process

Operating System
   It is a system software
   Examples are DOS, windows xp, windows vista, windows 7 windows 8, Solaris, Macintosh, Linux, ubuntu etc.
It provides interface between user and machine.
Acts as a manger of the computer system
It does process management, memory management, file management.

Execution of Program


Software develop in C language


Why C language is Important ?

Why C language is so important ?
  • Worth to know about C language
              - Oracle is written in C
              - Core libraries of android are written in C
              - MySQL is written in C
              - Almost every device driver is written in C
              - Major part of web browser is written in C
              - Unix operating system is developed in C
              - C is the world's most popular programming language
   
  • For Students  
              - C is important to build programming skills
              - C covers basic features of all programming language 
              - C campus recruitment process
              - C is most popular language for hardware dependent programming
             
  • History of C language
            It is Developer of BCPL
            Basic Combined Programming Language
            It is develop in 1966


Developer of B language
It is develop in 1969.Also developer of UNIX operating system 
He is also developed first master level chess called Belle in 1980.

Developer of C language in 1972.
At AT & T's Bell LABs, USA
Co-developer of UNIX operating system


Recursion

Recursive function is a function that calls itself. When a function calls another function and that second function calls the third function then this kind of a function is called nesting of functions.But a recursive is the function that calls itself repeatedly.

A simple example :
main ( )
{
printf (" this is an example of recursive function");
main( );
}
 when this program is executed.The line is printed repeatedly and indefinitely.We might have to abruptly terminate the execution.

/*Program to calculate Factorial of a number */
#include <stdio.h>
void calc_factorial (int);  //function prototype
void calc_factorial (int i)
{
int I, factorial_number = 1;
for (i = 1; I < = n; ++i)
   factorial_number *=I;
printf("The factorial of %d is %d\n", n, factorial_number);
}
int main(void)
{
int number = 0;
printf(" Enter a number\n");
scanf("%d",&number);
calc_factorial (number);
return 0;
}

Sample Program Output
  Enter a number
     3
   The factorial of 3 is 6

Friday, 23 March 2018

Function

A function is a self contained block of statement that perform a coherent task of some kind.
Function provides modularity to the software.

Function definition :
[data type] function name (argument list)
argument declaration;
{
local variable declaration;
statements;
[return expression]
}

Example :
mul(a,b)
int a,b;
{
int y;
y = a + b;
return y;
}
When the value of y which is the addition of the values of a and b.The last two statement i.e.,
y = a + b; can be combined as
return (y)
return (a + b)

Why Functions are used ?
  1. Many program require that a specific function is repeated many times instead of writing the function code as many timers as it is required we can write it as a single function and access the same function again as many times as it is required.
  2. We can avoid writing redundant program code  of some instructions again and again.
  3. Programs with using functions are compact and easy to understand.
  4.Testing and correcting errors is easy because errors are localized and corrected.
  5.We can understand the flow of program and its code easily since the readability in enhanced while using the functions.
  6. A single function written in a program can also be used in other programs also.

#include <stdio.h>
/* function body */
int add (int x, int y){
 int z;
z = x + y;
return (z);
}
main ( )
{
int i,j,k;
i = 10;
j = 20;
k = add(i,j);  /* function call */
printf ("The value of k is %d\n",k);
}
The value of k is 30

Scope Resolution Operator

Scope of the variable is the life time of the variable in the program.
A variable can either global or local scope.

Global Variable is a declared in the main body of the source code outside all functions while the local variable is the one declared within the body of function or block.

In 'C' the global version version of the variable of the variable can not be accessed from within the inner block.

In C++ , scope resolution operator (::) is used to access global variable.
Syntax:   ::global_variable_name;

#include<conio.h>
#include<iostream.h>
int a = 10;
void main( )
{
int a = 15;
clrscr( );
cout<<"\n\n\t Local a is -->"<<a<<"\tGlobal a is -->"<<::a;
a = 20;
cout<<"\n\n\t Local a is -->"<<a<<"\tGlobal a is -->"<<::a;
getch( );
}

OutPut:-
Local a is -->15     Global a is -->10
Local a is -->20     Global a is -->10

Output and Input Operator

cout <<"Welcome to the Computer Language";

This causes the string in quotation marks to be displayed on screen.

'cout' is a predefined object that represents standard output stream i.e. screen.

The operator '<<' is called as insertion or put to operator.It inserts the contents of the variable on its right to the object on its left.

Input Operator :

 cin >> no;
It is an input statement and causes the programs to wait for the user to type in a number.The number keyed in is placed in the variable 'no'.

'cin' is predefined object that represents standard input stream i.e. keyboard.

The operator '>>' is know as extraction or get from operator.
 
It extracts or takes the value from the keyboard and assigns it to the variable on its right.

Bitwise Operators

In order to manipulate the data at the bit level, the bitwise operators are provided in Java. These operators are used for testing the bits as well as shifting them to left or right etc.

These can be applied to integer types only.That is, they can not be used along with float or double value.


All these operator except one's complement operator are binary operators. These  perform the given bitwise operation on the operands.

Accordingly, the result is obtained.Shift operators shift the binary equivalent bits of the operand to respective left or right position.

Increment and Decrement Operators

Like C and C++ , Java is also having the increment and decrement operators' i.e. ++ and --. Both  of these are unary operators.The operator + + adds 1 to the operand and - - subtract 1 from the operand.

They can be written in following from:
 x++  or x--
 ++x  or --x

Both forms of the ++ increment the value of variable by one i.e. x++ or ++x will be equivalent to x = x+1. As well as , x - - is equivalent to x = x - 1.

When the increment or decrement operator is used before variable,it is called as pre-increment or post-increment operator.And when it is used after variable.it is called as post-increment or post-decrement operator.

The difference is simple.That is, when these pre-increment or pre-decrement operators are involved in the arithmetic expression .
For example,
 z = 14;
 y = z ++;

Here, the value of variable y will be 14 and z will be 15, because in the second expression, post increment operator is used. Value of variable z is assigned to y first and then it is incremented.If we change the second expression to,
y = ++z;

Now, both the values of y and z will be 15.Pre-increment operator does its job first the then uses the value in the expression.
 

Assignment Operators

Assignment operators are used to assign the value of an expression to the variable.The general assignment operator is '='. This is used to assign the value given to its right side to the variable written on left side.

Other assignment operators are also known as shorthand operators become they minimize our work of writing arithmetic expression.

Assignment operators are listed in table given below-

Logical Operators

There are only three logical operators which are related with the logical decision.These are listed in the following table-
First two operators are used to combine the conditions i.e. to form a compound conditional expression.Third operator is used to inverse the condition.
For example,
 x > y && k !=b12

This is termed as the logical expression.Whole expression also returns the Boolean value.That is, the above expression will return true when the both the conditions (x > y) and (k!=12) are true.If any one of these condition is false the expression will return false.

Consider another example,
m==99 || j <=10
This logical expression involves the logical OR operator.The expression will return true only when any one of the conditions (m==99 and j<=10) is true.If both condition are false, the whole expression will also expression will return false.

The third operator is know as logical NOT operator.This is the only unary logical operator and generally used to negate the condition.If we write this operator in front of any other relational or logical expression, the result of the expression will be inverted.That is, true will become false and false will become true.

For example,
x = 36 then
! (x > 40) will return true
! (x == 36) will return false
The following program will clear the idea of logical operators and expression.

Relational Operators

When we want to compare value of two variables for various means, relational operators are used. After comparing these values we may take several decision in the program.
Relational operators can be called as comparison operators. For example, we want to  find the largest of two integers, we can use '>' operators to perform comparison.
The expressions such as,
 val > 12 or cal < sal 
contains the relational operator. So, they can be termed as relational expression. The value of value relational expression can be either true or false. 
For example, if cal = 10 and sal = 15 then,
cal < sal is true 
while
sal > 20 is false

Java supports six different relational operators. These are listed and explained in the table below.

Observe the following relational expressions which returns boolean values 
          36 > 42 true
          52.14 < 45 false
          10 < 8 + 9 false
         -74 ! = 0 false

When the arithmetic expressions are used on either side of a relational operator, the arithmetic expression will be evaluated first and then the results are compared. In short, the arithmetic operators are having highest priority over relational operators.

Arithmetic Operators

These include all the operators which are used to perform basic arithmetic operations. These are listed.

Operator Meaning Example

According to number of operands required for an operator, they are classified as Unary (one operand), binary (two operands) and ternary (three operands) operators.
First five operators are binary operators as they required two operands. Last two operators are unary operators i.e they require only one operand to operate.
They are generally used to assign the sign for the constant.When all the operands in an arithmetic expression are integer then it is called as integer expression. They always return integer value.

For example : x = 10 and y = 3
  Then , x + y = 13
   x - y = 7
  x * y = 30
  x / y = 3 ( decimal part is truncated)
  x % y = 1 (remainder of the division)

When an arithmetic expression involves only real operands is called as real arithmetic.A real operand may assume values either in decimal or exponent notation.
When one of the operands is real and the other is integer, the operation is called as mixed-mode expression.If any one of the operands is floating point, then the operation will generate the floating point result.Thus,
  25 / 10.0 will generate result 2.5
  Whereas,
 25 / 10 will generate result 2

Operators

An operator is the symbol that takes one or more arguments and operates on them to produce a result.

The constants, variable or expression on which operator operates are called as operands. Java supports a rich set of operators which are used in a program, to manipulate the data and variables.

They are usually the part of  logical expression. Operators in Java are classified into number of categories:

   1. Arithmetic Operators
   2. Assignment Operators 
   3. Increment / Decrement Operators 
   4. Relational Operators
   5. Logical Operator
   6. Conditional Operators
   7. Special Operators

Thursday, 22 March 2018

Pseudo Codes for Basic Logic (Control) Structure

Pseudocode is a compact and informal high-level description of a computer programming algorithm.
  Pseudo-code typically omits details that are not essential for human understanding of the algorithm such as variable declaration, system-specific code and subroutines.
   The purpose of using pseodocode is that it is easier for humans to understand than conventional programming language code.

Sequence Logic
   Sequence logic is used for performing instruction one after another in sequence. The logic flow of pseudo code is from top to bottom.

Selection Logic
  1. If-else
         Selection logic also known as decision logic is used for making decision.It is also called as decision logic.
       It is used for selecting the proper path out of two or more alternative paths in program logic.Selection logic is depicted as an IF.....THEN.....ELSE or on IF.....THEN or a case structure.
    The IF......THEN......ELSE construct says that if condition is true then 
            do process-I else (if condition is not true) do process-II.

  If we simply want do decide if a process is to be performed or not the IF.....THEN structure is used this structure says that if condition is true then do process-I and if it is not true then skip over process-I.

Switch-case
    The case structure is multiple way selection logic structure.The CASE structure indicates that if the value of type is equal to type I execute process-I if it equal to type II executes process II if it equals to type 3 execute process 3 if so on.
                       Fig: Flowchart for 'CASE' selection structure

Iteration (or Looping) Logic

    The looping structures in C are-
                 While loop
                 For loop
                 Do -while loop
                 Repeat-until
  Iteration logic is used to produce loops in program logic when one or more instruction may be executed several times depending on some condition.
    In case Do-WHILE the looping will continue as long as the condition is true the looping steps when the condition is not true.
    Important : Do-while loop is useful when we want the statements within the loop must be executed at least once.
                        Fig: Flowchart for DO-WHILE iteration structure

In case of REPEAT.....UNTIL : The looping continues until the condition becomes true. That is the execution of the statement  within the loop is repeated as long as the condition is not true.

Use of "Go to" Statement

The goto statement is the most basic form of unconditional transfer of control.
  Although the keyword may either be in upper or lower case depending on the language, it is usually
written as:
   goto label

 The effect of a goto statement is to cause the next statement to be executed to be the statement appearing at ( or immediately after ) the indicated label. A label is an explicit name or number assigned to a fixed position within the source code and which may be referenced by control flow statement appearing elsewhere in the source code.

     Goto statement have been considered harmful by many computer scientists, notably Dijkstra.

Importance of use of Indentation in Programming

Remember that indentation is useful for people, not the machine Correct use of identifiers, white space and documentation makes your program easier to understand for those humans reading it. Since you also will be reading your own program, you will want to be consistent and current with your documentation.

  Properties of good style
    1. Program that are easy to read and understand.
    2. Programs that communicate the algorithm used in a form easy to follow.
    3.Programs that are easy to modify and enhance to adapt to new and changing environments.( It is important to keep in mind that the programmer making the modifications may not be the initial author.)

Principles of good style
  1. Clarity and simplicity
         Avoid unnecessary complexity.When possible,use the straight forward method.Don't sacrifice clarity for cleverness.
  2. Use meaningful identifiers
         Choose names for constant, variables,functions,etc. , that accurately describe the purpose of the identifier.For instance, a, x, t are poor identifiers because they are meaningless whereas age, salary, and first_name are good choices.Constant should be all uppercase. Other identifiers should make use of the underscore"_" and uppercase letters to distinguish the words in an identifier (FirstName or first_name but not firstname).
   3. One statement per line
   4. Use proper indentation of control structures.
         Be consistent with indentation.There are several styles to choose from but whichever you choose, be consistent! Some example are given below.Note the placement of the curly braces and the code.

Variables

"A variables is a temporary container to store information , it is a named location in computer memory where varying data like numbers and characters can be stored and manipulated during the execution of the program".
A variable must be declared before it is used.It is a must because the compiler wants to be aware of it.

Types of Variables

Basically there are two types of variables , namely
 1. local Variable
 2. Global Variable

Local Variable 
  The local variable is created when the functions gets control and is destroyed when the control transfers back to the caller.

Global Variable
  Whereas the Global Variable is known and accessible throughout program.Global Variables are declared at the top of the module.

Declaration of Variable
  The declaration of a variable is simple in C++ language.It begins with the data type, followed by at least a space, followed by the name of a variable with a semicolon. Space is optional before the semicolon.

For Example

  int my_Age;
  int my_Salary;
  int_employee;

If different variable are using the same data type on the same line are also allowed,but care must be taken to separate two with a comma except the last one that would end with a semicolon.

Initialization of variables

   When the variables in the example above are declared, they have an undetermined value until they are assigned a value for the first time.But it is possible for a variable to have a specific value from the moment it is declared.This is called the initialization of the variable.
      type identifier = initial_value;
For example, to declare a variable of type int called x and initialize it to a value of zero from the same moment it is declared,we can write:
     int x = 0;

Comments in C++

Program comments are explanatory statement that you can include in the C++ code that you write and helps anyone reading it's source code. All programming languages allow for some form and comments.
C++ supports single-line comment (//) and multi-line comments (/*...............................*/). All characters available inside any comment are ignored by C++ compiler.
C++ comments start with /* and end with */.

For example :-
 /* This is a comment */
.* C++ comments can also
* span multiple lines
*/

A comment can also start with // , extending to the end of the line.For example:
#include <iostream.h>
main( )
{
cout << "Hello World";  // prints Hello World

return 0;
}
When the above code is compiled ,it will ignore  //prints Hello World and final executable will produce the following results;

Output:-
Hello World

Wednesday, 21 March 2018

What is database?

A database is integrated collection of related information along with the details so that it is available to the several user for the different application.
                                        This is a database

Table/Entity
  Table is the structure inside database that contains data organized in columns and rows.




Column/Field/Feature/Attributes
  The name of each column in a table is used to interpret its meaning and is called an attributes.
 

Row/Records/Tuple
  Each row in a table represents a record and is called tuple.

Example:-
     Rahul , 101 , Delhi , rahul@gmail.com
     Sona , 102 , Kolkata , sona@gmail.com
     Sumit , 103 , sumit@gmail.com , Ranchi
     Sam , sam@gmail.com , Noida , 104
                This is a database list of four person, now its create in table form

Database Management System (DBMS)
  DBMS is the software system that allows the access to the data in the database.


Relational Database Management System (RDBMS)
 RDBMS avoided the navigation model as in old DBMS and introduced Relational model. The relational model has relationship between tables using primary keys, foreign keys and indexes. thus the fetching and storing  of data become faster than the old Navigation model.RDBMS is useful to efficiently manage  vast amount of data and is used in large business application.
  Ex:- SQL Server , Oracle , MySQL , MariaDB , SQLite.

Structural Query Language (SQL)
  It is commonly used with all relational database for data definition and manipulation.

Feature of SQL :-
  It is a non procedural language.
  It is an English-like language.
  It can process a single record as well as set of records at a time.
  All SQL statement define what is to be done rather than how it is to be done.
  SQL has facilities for defining database views , security , transaction etc. 

C++ Tokens

The smallest individual units in a program is known as Tokens.
The C++ programs are written by using these tokens , white spaces and syntax of the language.
C++ has following Tokens 
  1. Keywords
  2. Identifiers
  3. Constants
  4. Strings
  5. Operators

Keyword :-
  Keyword are those words meaning whose meaning is known to the compiler or whose meaning is already defined by compiler.
 Keywords are also called as reserved words.Keywords should not be used in variable declaration.
 Following are some example of keywords
   auto , break , case , char , class , const , continue , default,..........................................

Identifiers :-
  Identifiers refers to the name of the variables , functions , arrays , classes created by the programmer.
  Rules of Naming identifiers:-
   1. Only alphabets , digits , and underscore are permitted.
   2. Variable name should not start with digit.
   3. Uppercase and lowercase letter are distinct.
   4. Keywords should not be used as name of the identifier.
   5. 'C' recognizes 32 characters in name of the identifiers but C++ has no limit on its length.

Constant :-
  Each primitive data type has their own constant value declaration also called as literals.

Primary Constant
  a. Integer Constant
  b. Real Constant 
  c. Character Constant

Secondary Constant
  a. Array
  b. Pointer
  c. Structure and unions
  d. Enum

Primary Constant
 Integer Constant :-
   1. Integer constant must have at least one digit.
   2. They must not have a decimal point.
   3. They can be positive or negative.
   4. If there is no any sign to integer it is assume to be positive.
   5. No comma or blank spaces are allowed within the integer constant.
          e.g.  426, +756 , -588 etc.

Real Constant :-
   1. These are generally called as floating point constant.They can be written two forms.That is , fractional form & exponential form.
  2. Real constant can be positive or negative.
  3. They must have decimal point.
  4. Default sign is positive.
  5. No comma or blank spaces are allowed in the real number.
       e.g. 22.45 , -85.23 , -11.20 , +3.211e-4 , 5.6e4 etc.

Character Constant :-
   1. The character constant is a single alphabet or a single digit or s single special symbol enclosed within the single quotation marks.
   2. Maximum length of a character is one character.

Tuesday, 20 March 2018

Advantages and Disadvantages of the Object Oriented Programming

Advantages of Object Oriented Programming 

  • Object oriented programming has several advantage to the programmer and user.
  •  Through inheritance redundant code is eliminated and existing class can be extended according to requirement.
  •  Data hiding can be achieved with the help of the data abstraction and encapsulation Data hiding helps the programmers to build secure programs.
  •  It is easy to partition the work in a project based on a objects.
  •  Object oriented system can be easily upgraded from small to large system.
  •  It provides message passing technique for communication between objects.
  •  It is helpful in reducing complexity of the programs.
  •  Object Oriented Programming supports re-usability of the code.
  •  Security is the first main advantage of OOP, the data and functions are combined together in the form of class.

Disadvantage of the Object Oriented Programming

  •  The message based communication between many objects in a complex system is difficult to implement.
  •  Large program size : Object Oriented program typically involve more lines of code than procedural program It require more memory to process at a great speed. So it runs slower than the traditional programming language.
  •  It works on object and everything of the real world is not possible to divide into new neat classes and sub-classes.
  •  There are problems that lend themselves well to functional programming style, logic programming style, or procedure based programming style and applying object oriented programming in those situation will not result in efficient programs.

Monday, 19 March 2018

Basic Concept in Object Oriented Programming

All object oriented programming languages provide mechanism that help you implement the object oriented model. It is therefore necessary to understand some of the concept extensively in object oriented programming.

Classes :-
 The entire set of data and code of an object can be made using a user defined data type called as class.
 It is one of the types of abstract data types.In sort, we can call the class is data type of object. Classes are user defined data types and they behave like the built in type of different programming languages.
 Once class has defined , we can create any number of objects of that.
 Class is the collection of similar type of objects.

Object :-
 Object is called as the instance of the class.It is the run time entity in an object oriented system.In short, we can call object as a variable of type class.
 After creation, objects take up space in computer memory and have associated address like 'record' in pascal and 'structure' in C.
 When the program is executed, object can establish the path of communication among them by passing messages in between.
 Each object is associated with data of type class with which they are created.A class is thus collection of objects of similar types.
 For example, Maharashtra , Gujarat , Bengal , Goa , Tamilnadu , are the member of class India.
 In object oriented programming language, objects are represented with data and methods(function) as shown in following figure.
                         Fig. a) Representation of an object


                    Fig. b) Example of representation of an object

See the above example, the class 'Batsman' has been declared.It contains data members Name and Innings as well as methods average ( ) and strike_rate ( ).
 In order to create the object of type Batsman we have to use following notation.

Procedure and Object Oriented Programming Language

Procedure Oriented Programming Language:-

High level language such as COBOL , FORTRAN AND C is commonly known as procedure oriented programming.
In the procedure oriented approach, the problem is viewed as a sequence of things to be done such as reading , calculating and printing.
Procedure oriented programming basically consist of writing list of instruction for the computer to follow and organizing these instructions into groups known as functions.
Procedure oriented programming language are not helpful in solving these problems having large complexity.
Another serious drawback with the approach is that it does not work on real world problems very well.
In procedure programming language top down programming approach is used in program design.

Object Oriented Programming Language:-

Many drawbacks of procedure language are eliminated by object oriented language.
Object oriented language combine data and functions that operate on data into a single unit called as object. This helps to achieve data encapsulation and data hiding.
OOP allows decomposition of a problem into number of entities called as objects and then build data functions around these objects.
The data of an object can be accessed only by the functions associated with that objects.
OOP treats data as a critical element in the program development and does not allow it to flow freely around the system.
Object oriented program can be easily modified whenever necessary.

Difference Between Procedure and Object oriented Programming Language:-


Representation of Algorithm

There were various ways to represent an algorithm:-
   1. As a program
   2. As flowchart
   3. As pseud codes

Program
    A program is set of instruction that are arranged in a sequence that helps computer to solve complex problem.Moreover, the process of writing a program is called Programming.

Flowchart
  A flowchart is nothing but a graphical representation of an algorithm. 
    Flowchart is a representation, primarily through the use of symbols, of the sequence of activities in a system ( process , operation , function or activity ).
  Flowchart uses various graphical symbols. All symbols are connected among themselves to indicate the flow of information and processing.

Flowchart Symbols
  Flowchart symbols are used to represent an algorithm : 

  Terminal:-
       The oval represents any terminal point in a program and generally contains words such as START , END.

Input or Output:-
      The parallelogram represents the input (via keyboard) or Output ( to screen) function.

Process:-
   The rectangle represents the processing operations. For example a = x + y.

Algorithm

An algorithm ( pronounced AL-go-rith-um) is a procedure or formula for solving a problem.A computer can be viewed as an elaborate algorithm.In mathematics and computer science, an algorithm usually means a small procedure that solves a recurrent problem.
    A formula or set of steps for solving a particular problem. To be an algorithm, a set of rules must be unambiguous and have a clear stopping point.Algorithm can be expressed in any language from natural languages like English or French programming language like FORTRAN.
   We use algorithm every day.For example, a recipe for baking a cake in an algorithm.

Advantage of Generalized Algorithm
  It is a foundational element of logic and human reasoning. Generalization points the existence of a domain or set of element, as well as one more common characteristics shared by those elements.
    In the case of certain enumerably infinite sets, we can give explicit instructions for determining the n th member of the set, for arbitrary finite n.Such instruction are to be given quite explicitly, in a form in which they could be followed by a computing machine.

Avoiding Infinite Loops in Algorithm-by Counting
   A loop is a sequence of statement which is specified once but which may be carried out several times in succession.The code "inside" the loop is executed a specified number of times, or once for each of a collections of items, or until some condition is met.
           An infinite loop is a sequence of instructions in a computer program which loops endlessly, either due to the loop having no terminating condition, having one that can never by met or once that causes the loop to start over.
         To be an algorithm, set of rules must be unambiguous and have a clear stopping point.
  A loop counter value can be used to tell how many times a statement or block of statement is to be execute.

Avoiding Infinite Loops in Algorithm-by using a Sentinel Value
   The following sentinel value are used:-
     The break Statement in Loops :
         A break statement can be used to end a loop immediately.
         A break statement ends only the innermost loop or switch statement that contains the break statement.break statement make loops more difficult to understand.
  The continue statement in Loops:
      A continue statement 
               It ends current loop iteration and Begins the next one.

Fundamental of Object Oriented Programming

  • Our computer programs consists of two element i.e code and data. A program is conceptually organized around the data.
  • According to the way of flow of the data, there are two types of programming paradigms.The first way is called procedure oriented programming.In which everything is organized in functions by functions.
  • Flow of execution of the program is taken through the liner steps.The emphasis is given on the procedures rather than data.The data can be accessed anywhere in the functions.So there is no security for this data.
  • C is the best example of such procedure oriented programming. C language employed this programming approach successfully.
  •  
                                    Fig: Procedure Oriented Methodology

The second way is called object oriented programming.Basically,it is introduced to eliminate the flaws in the procedure oriented programming.
 
It is the best way to manage the increasing complexity in procedure orientation.Object Oriented programming organizes the program around the object i.e it treats the data as a critical element in the program development and does not allow it to flow freely around the system.
 
It ties this data more closely to the functions that operate on it and protects it from unintentional by other functions.
An object oriented programming can be characterized as 'data controlling access to code'. It has been given several organizational benefits.
                               Fig: object oriented Methodology

As shown in the above figure the data is centered element in the object, which can be only be accessed by all the functions defined in it. ( In java's terminology, function is called as method).

Object Oriented Programming is having following main features.

   Reduction in the complexity
      Program are divided into objects, which reduces the complexity of the program.

   Importance of data
      Emphasis is given on the data rather than procedure.

   Creation of new data structure
      Method that operate on the data of an object are tied together in a single data structure.

   Data Hiding
      The data used in different object is hidden from outside world.They can not be accessed outside functions.

   Characterization of the objects
      Data structures are designed such a way that they characterize the objects.

   Communication among objects
      Objects in a single program can communicate with each other through methods.

   Extensibility
      New data and methods can be easily added whenever necessary. So, usability of the program is extended.

Introduction and Needs of C++

Introduction:-
 
  • During 1970's and early 1980's had become a dominant programming language for programming. 'C' become very useful and successful programming tool.
  • 'C' was useful in solving complex structural programs.But when a program reaches to a certain size, 'C' was not a flexible to solve such a complexity.
  • To deal with such a complex programs,'Object Oriented Programming; concept was invented.
  • This method of programming reduces the complexity by introducing features like inheritance , encapsulation  abstraction , message passing and polymorphism.
  • Object Oriented Programming helpful in representing real life entities.It allows us to decompose a problem into number of entities called as objects.
  • 'C++ was the first object oriented programming language.It was invented by "Bjarne Stroustrup"

Its Need and Requirements:-

  •  Software engineers continuously looking for a new approach to software design and development which reduces complexity.
  •   Software evolution has a distinct phases or layers of growth.These layers build up one by one over last five decades.Each layer representing an improvement over the previous one.

Popular Posts

Categories

100 Python Programs for Beginner (49) AI (34) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (173) C (77) C# (12) C++ (82) Course (67) Coursera (226) Cybersecurity (24) data management (11) Data Science (128) Data Strucures (8) Deep Learning (20) Django (14) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flask (3) flutter (1) FPL (17) Google (34) Hadoop (3) HTML&CSS (47) IBM (25) IoT (1) IS (25) Java (93) Leet Code (4) Machine Learning (59) Meta (22) MICHIGAN (5) microsoft (4) Nvidia (3) Pandas (4) PHP (20) Projects (29) Python (929) Python Coding Challenge (351) Python Quiz (21) Python Tips (2) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (3) Software (17) SQL (42) UX Research (1) web application (8) Web development (2) web scraping (2)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses