Introduction to Programming Languages

¡Supera tus tareas y exámenes ahora con Quizwiz!

State and explain the 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 behavior. The characteristics of an object are represented by its data called attribute and its behavior is represented by its associated functions.

Define 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.

State the advantages of Object Oriented Programming.

Any real-world entity can be modeled 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.

Explain Procedure Oriented Programming.

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.

What is a high level language?

High level languages use English like keywords, constructors for sequence and use of variables and constants. Ex: C, C++, Python

What is 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 into machine language.

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.

State the limitations of Procedure Oriented Programming.

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.

What is low level language?

Low level language is also called as machine level language where instructions are written in binary code ( using 1s and 0s). These instructions will be executed directly.

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.

Define Programming Language.

Programming language is a language developed for writing programs for a computer in a well-defined way with a set of rules.

What is a programming paradigm?

Programming paradigm is an approach to programming and refers to the style of writing programs. Computer program consists of two elements- code and data. A program can be conceptually organized in two ways that is around its code or around its data.

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.

Define software.

Software is a collection of programs and data files that are designed to perform some operations.

Explain Compiler.

The compiler scans the entire program and translates as a whole into machine language. It takes time to analyze the source code but the overall execution time is comparatively faster. Debugging is comparatively hard as it displays all the errors together. Programming languages like C, C++ uses compiler.

Explain interpreter.

The interpreter translates one statement at a time. It takes less time to analyze the source code but the overall execution time is slower. This continues translating the program until the first error in which case it stops. Hence debugging is easy. Programming languages like BASIC, Ruby uses interpreter.

What is Object Oriented Programming

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.

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.

What are 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.

What are the two different types of Programming languages?

The two types of programming languages are:- 1. Procedure oriented Programming 2. Object Oriented Programming

Explain the 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)Multi-threaded:- Multi-threaded 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.


Conjuntos de estudio relacionados

Chapter 3.1 Neurons: Origin of Behavior

View Set

Chapter 5 Physical and Cognitive Development

View Set

Property & Casualty Insurance Exam

View Set

Chapter 2: Basic Financial Statements

View Set

(6 )- Health Insurance Policy Provisions

View Set

ART 271 - Asian Art History - Quiz 4

View Set