Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Notes to know programming best from begging

Rating
-
Sold
-
Pages
23
Uploaded on
02-10-2024
Written in
2024/2025

In now days programming is the best option to earn online and create own business and for that c++ is consider more safe and regularly updated language which even other country (japan,Korea) prefer to . From my notes you can learn from basic and it's a easy language for other programming notes contact:- . If want I can provide you notes in hindi to

Show more Read less
Institution
Course

Content preview

1. PROGRAMMING LANGUAGES The Fourth generation of the programming languages are
called 4GLs. These languages represent the class of
Programming languages are used to communicate instructions programming languages that are closest to the human
to the machines especially computers so that the programs can languages.
control the behavior of the hardware of the machines to get
desired results. Basically, the hardware of the computers
understands only the language of the hardware which is Paradigm Key Program Program Example
called machine language. Concepts Execution


1.1 Translator Imperative Command Sequence of Execution of Algol,
(instruction) commands commands Pascal, C,
Ada
The hardware is unable to understand program written in any
other programming language. Therefore, in order to make the Functional Function Collection of Evaluation Lisp,
hardware of a computer understand the instructions functions of functions Refal,
Planner,
contained in a program written in any other programming Scheme
language, a mechanism called ‘translator’ is required. This
translator converts the program written in programming Logic Predicate Logic Logic Prolog
languages other into the native machine language .Every formulas: proving of
axioms & a the theorem
programming language must have its own translator for the
theorem
programs written in it to be executed or run on the computer
hardware. The three types of translators used are Object- Object Collection of Exchange of Smalltalk
oriented classes of messages , Eiffel,
objects between the C++, Java
• Assembler
objects
• Compiler
• Interpreter Programming Paradigms
1.1.1 Assembler

Assembler is used for converting the code of low-level language
(assembly language) into machine level language. 2. STRUCTURED PROGRAMMING PARADIGM
1.1.2 Compiler and Interpreter
The structured programming paradigm is a sub discipline of
Compilers and interpreters are used to convert the code of procedural programming under the category of imperative
high-level language into machine language. The high level programming paradigm. Most of the present day procedural
program is known as source program and the corresponding programming languages include the features that encourage
machine language program is known as object program. structured programming. It was first proposed by two
Although both compilers and interpreters perform the same mathematicians Corrado Bohm and Guiseppe jacopini who
task but there is a difference in their working. proposed and demonstrated that a computer program may
contain just three structures namely decisions, sequences, and
A compiler searches all the errors of program and lists them. If
loops.
the program is error free then it converts the code of program
into machine code and then the program can be executed by Any program can be created by breaking large programs into
separate commands. An interpreter checks the errors of smaller modular routines and imposing these logical
program statement by statement. After checking one structures. This paradigm generally follows the top down
statement, it converts that statement into machine code and approach where the complex programming blocks are broken
then executes that statement. This process continues until the down into smaller blocks maintaining a well defined structure
last statement of program or an erroneous statement occurs. and organization of the overall program. It discourages the use
of global variables and instead encourages to use variables that
are local to each of the blocks. Some of the languages that
follow this paradigm are Pascal, C, C++, Java, Ada etc. in
1.2 Programming Paradigms
contrast to non-structured programming languages like BASIC,
COBOL, FORTRAN etc.
First generation of programming languages was called
machine languages and the symbols like ‘0’ and ‘1’ were used
The structured programming follows the principle of divide and
to write programs under this category of programming
conquer. A solution of a problem can be said to consist of a set
languages.
of tasks, on the same lines, a program can also be designed to
perform a set of tasks by dividing it into the task performing
The second generations of programming languages were
blocks.
called the assembly languages and mainly used mnemonics to
construct a program. Both of these generations of
2.1 Advantages of Structured Programming
programming languages were CPU dependent i.e., every type of
a CPU will have its own machine and assembly language.
i) Complexity can be reduced using the concepts of divide
and conquer.
The third generation of programming languages was called
high level languages as these programming languages were ii) Logical structures ensure clear flow of control.
independent of the CPU of the hardware being used and the
iii) Increase in productivity by allowing multiple programmers
instructions written in the programs were just like the
to work on different part of the project independently at
instructions given in natural languages. The third generation
the same time.
languages are known as 3GL languages.
iv) Modules can be re-used many times, thus it saves time,
reduces complexity, and increases reliability.


H.O. : B-5,Dev nagar ,opp. Kamal & company ,gopalpura ,Jaipur Tel : 0141-2708941 , Mob : 9887755436, 9413223636 Visit us at : www.fluxeducare.in

, v) Easier to update/fix the program by replacing individual At times, instead of dealing with individual objects, it is
modules rather than large amounts of code. convenient to talk collectively about a group of similar objects
where all the objects of this group will have the same set of
2.2 Disadvantages of Structured Programming
attributes and methods.
i) Lack of encapsulation.
In the object-oriented programming paradigm, this collection of
ii) Same code repetition. objects corresponding to a particular group is known as a
class. All programs under this paradigm contain a description
iii) Lack of information hiding. of the structure (attributes) and behavior (methods). In a
iv) Change of even a single data structure in a program program, various objects are created from these classes. The
necessitates changes at many places throughout it, and process of creation of an object from a class is called
hence, the changes become very difficult to track even in a ‘instantiation’ and the object created is known as an instance
reasonably sized program. of the class. Every object created will have s ‘state’ associated
with the description of the structure in the class from which it
v) Not much reusability of code. has been instantiated. The state of an object is defined by the
set of values assigned to its corresponding attributes of the
object.

3. OBJECT-ORIENTED PROGRAMMING PARADIGM
Therefore, we can say that a class is used to represent a set of
objects having same structure and behavior. A class is defined
Simula was the first programming language developed in the
to be a template or a prototype so that a collection of attributes
mid-1960s to support the object-oriented programming
and methods can be described within it and this definition can
paradigm followed by Smalltalk in the mid 1970s that is
be used for creating different objects within a program. It is
known to be the first ‘pure’ object-oriented language. Java,
this concept of encapsulating the data and methods within the
C++, Object Pascal, Visual Basic, C# etc are other OOP
objects that provides the programmer with flexibility within the
languages that came into existence later. The main motive of
OOP paradigm because an object can be extended or modified
the developers of programming languages over the years has
without making changes to its external interface or other
always been to create such programming languages that are
classes/objects in the program. Various classes may exhibit
close to human languages. The way we perceive and interact
features like inheritance and polymorphism of methods.
with the things in our day-to-day lives, the representation of
programming constructs should closely match the same.
Hence came into existence the concept of ‘objects’ and ‘object- 4. STRUCTURED Vs OBJECT ORIENTED PROGRAMMING
oriented programming paradigm’.
The OOP can be considered to be a type of structured
Every object has certain defining properties which distinguish programming which uses structured programming techniques
it not only from different types of other objects but from the for program, flow, but adds more structure for data to be
similar types of objects too. If we take an example of an object modeled. Basic differences between these two are:
like a ball pen, its defining property may be the color in which
it can write, length, shape, unique manufacturing code etc. 1) OOP is closer to the phenomena in real world due to the
Some of these properties not only distinguish the ball pen use of objects whereas structured programming is a bit
object form the tooth brush object but also distinguish away from the natural way of thinking of human beings.
individual ball pens objects. It must be understood clearly that
2) Structured programming is a subset of object-oriented
no two objects in the physical world, even of same type, are
programming. Therefore, OOP can help in developing
identical since no two objects can have the value of all its
much larger and complex programs than structured
defining properties same.
programming.
Likewise, every object has certain functions associated with it
3) Under structured programming, the focus of a program is
and all similar types of objects are supposed to support these.
on procedures or functions and the data is considered
Although, some of these functions can be the same as
separately whereas in OOP, data and methods both are in
associated with different types of objects. In case of a ball pen,
collective focus.
one of the functions associated with each type of ball pen
object, is to write and another associated function is the
4) In OOP, the basic units of manipulation are the objects
provision to hold it in hands conveniently. All the ball pen
whereas in case of structured programming, functions or
objects support both these functions. Incidentally, all the tooth
procedures are the basic units of manipulation.
brush objects also support the function of holding them in the
hands conveniently but, in addition, support other functions
5) The focus of a program is on manipulation of data in
like brushing the teeth too.
structured programming whereas the focus of OOP is on
both data (structures and states of objects) as well as on
This concept of objects borrowed from the real world has been
its manipulation (behavior of objects).
the basis of the object-oriented programming (OOP) paradigm
and this paradigm is a direct consequence of an effort to have
6) In OOP, data is hidden within the objects and its
a programming language closely matching the human
manipulation can be strictly controlled whereas in
behavior. This OOP paradigm is all about creating programs
structure programming the data in the form of variables is
dealing with objects where these objects interact with one
exposed to unintended manipulation too.
another to achieve the overall objectives of the program. Every
object in the program has certain defining properties called 7) The OOP promotes the reuse of classes and their parts of
attributes (instance variables) possessing supporting values for the code too. In addition, it also supports the inheritance
each of the attributes and some associated functions of state and behaviour. This features is missing in
(methods). As in the real world objects, no two objects in a structured programming.
program can have the same values of all the attributes.


H.O. : B-5,Dev nagar ,opp. Kamal & company ,gopalpura ,Jaipur Tel : 0141-2708941 , Mob : 9887755436, 9413223636 Visit us at : www.fluxeducare.in

, 8) The OOP supports polymorphism of operations. ignores the remainder of the information. There are different
levels of abstraction.
9) The concepts of OOP have got integrated with most of the
prominent object-oriented methodologies of software If we take example of a class ‘student’, the class may have
development in a better way and help in reducing the plenty of attributes like, name, roll number, father’s name,
development effort and time as compared with that of date of birth, class, year or semester, course, marks obtained,
structured methodologies based on structured address for correspondence etc. The list can be very long. But,
programming. when we use this ‘student’ class in some program, not many of
these attribute would be required to be used. Only those
5. OBJECT-ORIENTED PROGRAMMING CONCEPTS attributes which are of interest i.e. the attributes that are
required to define the state of the program at any point of time
The Object-Oriented Programming is based on principles and during the execution of the program shall be included in the
provides the developers of various object-oriented programming definition of the class and rest of these attributes shall never
languages with a variety of new concepts to be incorporated in be used and hence be not included in the program. Same is
those languages. Some of the commonly found important true for behavior depicted by the methods of the class
concepts in most of the OOP languages are as: ‘student’.

5.1 Objects 5.4 Information Hiding

Objects are the basic run time entities in an object-oriented Information or data hiding in an object is characterized by its
system. They may represent a person, a place, a bank account, knowledge of a design decision which it hides from all other
a table of data or any item that the program has to handle. objects. The interface of an object is chosen to reveal only the
They may also represent user-defined data such as vectors, desired data or working of the object. It is the process of hiding
time and lists. Programming problem is analyzed in term of all details of an object that do not contribute to its essential
objects and the nature of communication between them. characteristics; typically, the structure of an object as well as
Program objects should be chosen such that they match the implementation of its methods is hidden from other
closely with the real-world objects. Objects take up space in objects. There can be two types of information hiding:
the memory and have an associated address like a record in functional information hiding related to the hiding of
Pascal, or a structure in c. implementation details of methods (behavioral information of a
particular object) and data hiding (structural information of a
When a program is executed, the objects interact by sending particular object). C++ allows varying degree of visibility of
messages to one another. For example, if “customer” and objects like public, private and protected. So the mechanism of
“account” are to object in a program, then the customer object information hiding is said to provide a strictly controlled access
may send a message to the count object requesting for the to the information enclosed within the capsule.
bank balance. Each object contain data, and code to
manipulate data. Objects can interact without having to know 5.5 Encapsulation
details of each other’s data or code. It is a sufficient to know
the type of message accepted, and the type of response The wrapping up of data and function into a single unit (called
returned by the objects. class) is known as encapsulation. Data and encapsulation is
the most striking feature of a class. The data is not accessible
5.2 Classes to the outside world, and only those functions which are
wrapped in the class can access it.
Objects contain data and code to manipulate that data. The
entire set of data and code of an object can be made a user- Encapsulation as consisting of separating the external aspects
defined data type with the help of class. In fact, objects are of an object which are accessible to other objects, from the
variables of the type class. Once a class has been defined, we internal implementation details of the object, which are hidden
can create any number of objects belonging to that class. Each from other objects. It is also known as information hiding and
object is associated with the data of type class with which they it prevents clients from seeing the object’s inside view, where
are created. A class is thus a collection of objects similar types. the behavior of the abstraction is implemented. In reference to
classes and objects in OOP, encapsulation is the process of
A class is a collection of similar entities which have same enclosing within these classes and objects the attributes and
structure and exhibit same behavior. These are used to the methods. It is the programmers who specify what
describe something in the real world like places, organization, information in an object can be shared with other objects.
roles, things, occurrences etc. A class is said to describe the Information hiding cannot be treated as encapsulation, both
structure and behavior of these sets of similar entities called are related but altogether different aspects e.g. an array or a
objects. As opposed to actual objects, the class gives a general record structure also encloses the information but this
description of these objects like a template, blueprint or a information cannot be said to be hidden. It is true that the
pattern; and contains the definitions of all the attributes and encapsulation mechanism like classes and objects hide
methods which will become the part of each object created information but these also provide visibility of some of their
form the class. Only after a class has been defined, specific information through well defined interfaces.
instances of the class can be created and these instances as
objects of the class is called instantiation. 5.6 Polymorphism

5.3 Data Abstraction Polymorphism or the ability to appear in many forms, is one of
the vital primary characteristic concepts of OOP. ‘Poly’ means
Abstraction is a technique which allows the hiding or ‘many’ and ‘morph’ means ‘form’. In reference to OOP, it is an
elimination of the irrelevant; and focusing on the essential. ability of assigning different meanings to entities such as
Abstraction is defined as a view of a problem that extracts the variable, methods or objects so that these can be made to
essential information relevant to a particular purpose and exhibit more than one form. It provides the programmers with
the flexibility of processing any object differently depending


H.O. : B-5,Dev nagar ,opp. Kamal & company ,gopalpura ,Jaipur Tel : 0141-2708941 , Mob : 9887755436, 9413223636 Visit us at : www.fluxeducare.in

, upon their data types. Using this concept, a programmer can Types of Inheritance
redefine various methods of the classes derived from their base
classes. Objects of different types can receive the same i) Single level Inheritance
message and respond in different ways provided these objects
have the same method definition (i.e. interface). The calling A derived class with only one base class is called single
object, also sometimes known as the client, need not know inheritance.
what type of object it is calling, the only thing that it needs to
know or ensure is that the called object has a method of a ii) Multi level Inheritance
specific name with defined arguments. Polymorphism is more
often than not applied to derived classes, where the methods of A derived class with one base class and that base class is a
the parent class are replaced with those having different derived class of another is called multilevel inheritance.
behaviors.
iii) Multiple Inheritance
There are two types of polymorphism:
A derived class with multiple base class is called multiple
i) Static or compile-time polymorphism inheritance.

In static polymorphism, which form of the method (from among iv) Hierarchical inheritance
the various available forms) is to be called and executed is
Multiple derived classes with same base class is
decided during the time of compilation, the example being
called hierarchical inheritance.
‘Method Overloading’. In method overloading, same method
name having different parameters is used more than once in
v) Hybrid inheritance
the same class. Which method is to be called and executed
depends upon the parameters passes by the calling method
Combination of multiple and hierarchical inheritance is
and is decided during the compilation of the program.
called hybrid inheritance.
ii) Dynamic or run time polymorphism
5.8 Message Passing
The dynamic polymorphism is applied in the form of method
In object oriented languages, you can consider a running
overriding which means there can exist two or more methods
program under execution as a pool of objects where objects are
in a program which have the same signature (name; return
created for ‘interaction’ and later destroyed when their job is
type; type, number and order of arguments to be passed)
over. This interaction is based on ‘messages’ which are sent
having different implementations.
from one object to another asking the recipient object to apply
one of its own methods on itself and hence, forcing a change in
5.7 Inheritance
its state. The objects are made to communicate or interact with
each other with the help of a mechanism called message
Inheritance is the process by which objects of one class
passing. The methods of any object may communicate with
acquired the properties of objects of another classes.
each other by sending and receiving messages in order to
Inheritance is a mechanism by which the classes inherit the
change the state of the object. An Object may communicate
attributes and methods of some other class. Inheritance is a
with other objects by sending and receiving messages to and
way to reuse the code of some existing or already defined
from their methods in order to change either its own state or
classes. The classes, in this case, are said to have ‘a-kind-of’
the state of other objects taking part in this communication or
and ‘is-a’ relationship with the other classes. Using this
that of both. An object can both send and receive messages.
property of OOP, one class can extend other classes by
including additional methods or attributes. The original class
The messages are sent and received by passing various
is called the ‘super class’ of the extending class and the
variables among specific methods using the signatures of the
extended class is called the ‘subclass’ of the class that is being
methods. Every method has a well defined and structured
extended. The subclass is sometimes known with the name of
signature. The signature of a method is composed of:
‘derived’ class and the super class with the name of ‘base’
class. The derived or subclasses classes can further be used to
a) a type, associated with the variable whose value after
have their own derived subclasses. This kind of a relationship
execution of the method, would be returned to the object that
of classes through inheritance gives rise to an inheritance
would invoke the method;
hierarchy of the classes.
b) the types of a specific number of variables and the order
As a example, if you take ‘car’ as a super class; then you can
associated with these variables whose values would be passed
treat SUV, sedan, sports car as its subclasses. All or some of
to the method before execution of the method starts. All these
these subclass cars have some common attributes (structure)
variables have a well defined format and corresponding values
and methods (behaviour). But the structure and behaviour of
at any instant of time available for communication during the
these subclass cars is not restricted to those of the superclass
execution of the program.
‘car’. A subclass car can contain methods and attributes in
addition to those inherited from the superclass ‘car’ e.g. a
5.9 Dynamic Binding
sports car will generally have only two doors whereas a sedan
will have four. The subclasses can also contain methods that Binding refers to the linking of a procedure call to the code to
override the methods they have inherited to have unique be executed in response to the call. Dynamic binding means
implementation of these methods. Various categories of that the code associated with a given procedure call is not
inheritance which are often used in OOP are single level, multi- known until the time of the call at run time. It is associated
level, multiple inheritance etc. with polymorphism and inheritance. A function call associated
with a polymorphic reference depends on the dynamic type of
that reference.



H.O. : B-5,Dev nagar ,opp. Kamal & company ,gopalpura ,Jaipur Tel : 0141-2708941 , Mob : 9887755436, 9413223636 Visit us at : www.fluxeducare.in

Written for

Institution
Course

Document information

Uploaded on
October 2, 2024
Number of pages
23
Written in
2024/2025
Type
Class notes
Professor(s)
Pooja
Contains
Bca program

Subjects

$5.59
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
ranigangwani

Get to know the seller

Seller avatar
ranigangwani Ss jain subhodh
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions