0% found this document useful (0 votes)
38 views7 pages

GRADE - 9 - Introduction To Programming Languages

Uploaded by

mantrimegha1083
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
38 views7 pages

GRADE - 9 - Introduction To Programming Languages

Uploaded by

mantrimegha1083
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 7

Introduction to Programming Languages

Program: -

A computer program is a set of instructions arranged in a step by step


process based on some algorithm to perform a specific task.
Software: -

Software is a collection of programs and data files that are designed to


perform some operations.
Programming Language: -

Programming language is a language developed for writing programs for


a computer in a well-defined way and with a set of rules.
Types of Programming Language: -

Low Level Language:

Low level language is also called as machine level language where


instructions are written in binary code(using 1’s and 0’s). These
instructions will be executed directly.

Assembly Language:

In assembly language, programs are written using symbolic names called


mnemonics for performing operations. An assembler is a software which
converts assembly language program to machine language.

High Level Language:


High level languages use English like keywords, constructs for sequence
and use of variables and constants. Eg:-C, C++, Python.
Translators:-

The programs written in High Level Language (Source Code) are


converted into machine language (Object Code) using compiler or
interpreter for its execution. A compiler reads the whole source code
and translates it into a complete machine code to perform the required
task. An interpreter reads the source code and converts it into code line
by line.
Compiler Interpreter
Scans the entire program and Translates one statement at a
translates as a whole into time
machine language.
It takes time to analyze the source It takes less time to analyze the
code but the overall execution source code but the overall
time is comparatively faster. execution time is slower.
Debugging is comparatively hard Continues translating the program
as it displays all the errors until the first error is met in which
together. case it stops. Hence debugging is
easy.
Programming languages like C, Programming languages like
C++ uses compiler. BASIC, Ruby uses interpreter.

Programming Paradigm
Programming paradigm is an approach to programming and refers to the
style of writing programs. Computer program consists of 2 elements -
code and data. A program can be conceptually organized in two ways
that is around its code or around its data.
The two types of programming languages are: -
 Procedure Oriented Programming.
 Object Oriented Programming.
Procedure Oriented Programming:-(Organised around process)
Developing a program with process centric approach is called Procedure
Oriented Programming. It uses a list of instructions to tell the computer
what to do step by step. The problem is divided into small programs
called functions(procedures or subroutines). The primary focus stays on
the functions which will be used to accomplish the task. Procedures are
implemented on the data to perform the program hierarchy. A program
written in procedural language contain one or more procedures.
Example:- BASIC, Pascal, Fortran.
Limitations:-
The focus is on processing, the emphasis is on doing things.
 Procedural languages are difficult to relate with the real-world
objects.
 As the code gets larger, maintenance of the program becomes a
problem.
 Most functions share global data leaving data at risk of corruption.
 The module in a procedural language is dependent on each other so
that reusability is restricted.
 Procedural language code is not flexible to change. Since they are
interlinked the complete program should be changed if there is any
error.
Object Oriented Programming:-( Organised around data)
The object-oriented approach views a problem in terms of objects
involved rather than procedure for doing it. An object can be considered
as a partitioned area of computer memory that stores data and a set of
operations that can access that data.
Advantages: -
 Any real-world entity can be modelled using Object Oriented
Programming language.
 In Object Oriented Programming, the objects are built up in such a
that it can be used in other programs as well. So, it ensures
reusability.
 Programs written using OOP language are simpler to change when
the requirements for the application change.
 An object wraps the data and methods and ensures data security.
Principles of Object Oriented Programming: -
1) Abstraction: -
Abstraction refers to the act of representing the essential features of a
system hiding the implementation details to the user. This reduces the
complexity and increases the productivity. For example, in a switchboard
only the essential aspects to operate the switchboard is available to the
user hiding the internal circuitry, connections etc.
2) Encapsulation:
The wrapping of data and function that operate on the data into a single
unit(called class) is known as encapsulation. The only way to access the
data is provided by the functions. These functions are called member
functions or methods in java. Access restriction to class members and
methods is provided with the use of access specifiers.
The primary benefit of Encapsulation is
Data Hiding: -
The binding of data and the code that manipulates keeps them safe from
outside interference and misuse. Access to the data is controlled
through an interface.
3) Polymorphism: -
Polymorphism (from Greek meaning “Many Forms) is the concept that
supports the capability of an object of a class to behave differently in
response to a message or action. Polymorphism is the capability of an
interface to do different things based on the data of different type it
accepts and gives the desired output.
Polymorphism is implemented through function overloading and
overriding.
An example from real life : A student in a school is a son/daughter at
home, a player in the game, a customer in the shop,…..
4) Inheritance:-
It is the feature of programming language in which an object can acquire
the properties of another object. The class whose property is acquired is
called super class(Base class or main class or parent class). The class in
which the property of the base class is acquired is called derived
class(Extended class or sub class or child class).
Define class
A class is a template or blueprint used to create multiple instances called
objects that share the common characteristics and behaviour. The
characteristics of an object are represented by its data called attribute
and its behaviour is represented by its associated functions.
Define Object.
Objects are the basic runtime entities in an Object Oriented
Programming language. It represents an entity that can store data and
has its interface through functions. It is also called as an instance of a
class having its own unique identity.
Explain Ordinary Compilation.
The process of converting a source code(program written in high level
language) into the machine code is called compilation. The converted
machine code is dependent on the platform it is executing on. The
resultant machine code is called native executable code. The native
executable code is directly executed on the corresponding computer for
which it has been created.
Explain java compilation.
Programs written in java are compiled into a special type of intermediate
code called byte code using the java compiler, javac. Byte code still
needs an interpreter to execute them on any given platform. Java Virtual
Machine(JVM) is an abstract machine designed on the top of the existing
processors that helps to convert the byte code to the native executable
code and executes it. It generally starts compiling the entire byte code
at runtime using Just-in-time compiler. It hides the underlying Operating
System from java applications. JVM is written specifically for the specific
Operating System which can interpret any byte code for the given
platform.
Explain byte code.
Java byte code is a set of pseudo-machine language instructions that are
understood by the JVM and are independent of the underlying
hardware.
Java byte code is executable by JVM which reads each instruction of the
program one by one and translates it to the corresponding machine
language and executes it.

Explain the different features of java.


a) Simple
Java is easy to write and understand. It can be used to develop wide
variety of dynamic, completely secure and platform independent
applications.
b) Object Oriented
In Java, all elements are objects. Java supports the Object Oriented
Programming paradigm implementing abstraction, encapsulation,
inheritance and polymorphism. Class is the basic unit in java and objects
are entities following the prototype defined by the class.
c) Platform independent
The concept of Write Once Run Anywhere(WORA) makes it a powerful
language. Unlike other programming languages such as C & C++, it is not
compiled into platform specific machine, rather into platform
independent byte code. This byte code is distributed over the web and
interpreted by virtual machine(JVM) on whichever platform it is being
run.
d) Multithreaded
Multithreaded is the capability of machine to execute multiple
threads(process) concurrently within the same program. This feature
allows programmers to develop interactive applications.
e) Robust and Secure
Java applications are reliable in various ways. Java offers compile time
checking to detect early the cause of bugs as well as run time checking.
It eliminates the use of pointers which can cause memory corruption or
unwanted access of memory.
f) Java is distributed
Java supports network programming to communicate with remote
objects distributed over the network. It also provides libraries like
RMI(Remote Method Invocation) to develop network applications.
g) Garbage collection
Automatic garbage collection is another great feature of java with which
it prevents inadvertent corruption of memory. Java has new operator to
allocate memory for objects in the program, but it does not use any
operator for deleting memory of the object instead it is done
automatically with garbage collector.
List out any three attributes and behaviour of the following objects:-
Object Attributes Behaviour
Car Modelno drive()
colour applyBreak()
currentspeed changeGear()
slowDown()
Student Name Read()
Rollno play()
Address editData()
TV Model changeChannel()
Screensize increaseVolume()
display editSettings()

You might also like