






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
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
This study material provides a comprehensive introduction to programming, covering fundamental concepts such as algorithms, flowcharts, and programming methodologies. It explores different types of programming languages, including machine level, assembly level, and high-level languages. The document also delves into object-oriented programming concepts like abstraction, encapsulation, inheritance, and polymorphism, comparing them to procedural programming. It further explains static and dynamic binding, classes, and objects in programming.
Typology: Study notes
1 / 10
This page cannot be seen from the preview
Don't miss anything!
Programming is writing computer code to create a program, to solve a problem. Programs are created to implement algorithms. Algorithms can be represented as pseudocode or a flowchart, and programming is the translation of these into a computer program. To tell a computer to do something, a program must be written to tell it exactly what to do and how to do it. If an algorithm has been designed, the computer program will follow this algorithm, step-by- step, which will tell the computer exactly what it should do.
A programming language is an artificial language that a computer understands. The language is made up of series of statements that fit together to form instructions. These instructions tell a computer what to do.
A program is a set of instructions that a computer uses to perform a specific function. To use an analogy, a program is like a computer’s recipe. It contains a list of ingredients (called variables, which can represent numeric data, text, or images) and a list of directions (called statements) that tell the computer how to execute a specific task.
Sequential Algorithms:
Step4: Print c Step5: End
A flowchart is a diagrammatic representation which visually represents the flow of control through processing systems. By seeing a flowchart one can know the operations performed and the sequence of these operations in a system. A flow chart can be used for representing an algorithm diagrammatically. A flowchart will describe the operations and their sequence required to solve a given problem. A flowchart can be viewed as a blueprint of a design for solving a problem. When a problem is to be solved using a computer it is a good practice to draw a flowchart before writing a computer program. A flowchart is drawn according to defined set of rules which are as follows:
Example 6: Draw a flowchart to find the largest value of any three numbers.
Machine Level Language: It is a programming language that uses 0s and 1s. It is directly executable by hardware and it requires high precision programming. It is very difficult to debug. Assembly Level Language: It is a programming language that uses mnemonics. It is comparatively easy to understand and debug. The code is machine dependent (non-portable) and it is not directly executable on the hardware. The code requires a translator called assembler that can translate assembly level code to machine level code. High Level Language: It is an English like general purpose programming language that is hardware independent. It is not directly executable on the hardware. The code requires a translator called compiler or interpreter that can translate high level code to machine level code. High level languages can be classified as:
i) Abstraction Abstraction is a process of defining the essential concepts while ignoring the inessential details. The various types of Abstraction are: ■ Data Abstraction Programming languages define constructs to simplify the way information is presented to the programmer. ■ Functional Abstraction Programming languages have constructs that ‘gift wrap’ very complex and low level instructions into instructions that are much more readable. ■ Object Abstraction OOP languages take the concept even further and abstract programming constructs as objects. ii) Encapsulation All C++ programs are composed of the following two fundamental elements − ■ Program statements (code) − This is the part of a program that performs actions and they are called functions. ■ Program data − The data is the information of the program which gets affected by the program functions. Encapsulation is an Object Oriented Programming concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. Data encapsulation led to the important OOP concept of data hiding. iii) Inheritance Inheritance is based on the concept of code reusability. It saves time of program development. The mechanism of deriving a new derived class (subclass) from an old base class is known as inheritance. In other words the capability of a class to derive properties and characteristics from another class is called Inheritance. Inheritance is one of the most important feature of Object Oriented Programming. Sub Class: The class that inherits properties from another class is called Sub class or Derived Class. Super Class: The class whose properties are inherited by sub class is called Base Class or Super class. Types of Inheritance:
Event Occurrence Events that occur at compile time are "Static Binding". Events that occur at run time are "Dynamic Binding". Information All information needed to call a function is known at compile time. All information need to call a function come to know at run time. Advantage Efficiency. Flexibility. Time Fast execution Slow execution Alternate name Early Binding Late Binding Example Overloaded function call, overloaded operators. Virtual function in C++, overridden methods in Java.
Classes are similar to structures in C. They have fields corresponding to fields of a structure in C (similar to variables). They also have fields corresponding to functions in C (functions that can be applied to that structure). Some fields are accessible by everyone, some not (data hiding) and some fields shared by the entire class. Class can be viewed as a blueprint for creating instances of the same type called objects. For example: ‘Vehicle’ can be a class and ‘car’, ‘bus’, ‘bike’ can be objects of the ‘Vehicle’ class.
A class in C++ is a collection of objects. Variables created of a particular class are instances of that class known as objects. Variables have values for fields of the class. Class example: Student has name, id, gpa, etc. fields that store values has functions, changeGPA, addCredits, that can be applied to instances of that class Object examples: John Doe, Jane Doe each with their own values for the fields of the class
High-level computer programming language that implements objects and their associated procedures within the programming context to create software programs are known as Object Oriented Languages. They use an object-oriented programming technique that binds related data and functions into an object and encourages reuse of these objects within the same and other programs. These languages support all the features of OOPs such as abstraction, encapsulation, inheritance and polymorphism. They also support built-in objects. C#, Java, VB. Net are the examples of Object Oriented languages.