0% found this document useful (0 votes)
54 views3 pages

C++ Lecture 2

This document discusses computer programs and programming languages. It defines a program as a set of instructions given to a computer and a programming language as the language used to write programs. There are two main types of programming languages: low-level languages like machine language and assembly language, which are close to computer hardware; and high-level languages like C++ and Java, which are closer to human languages. It defines source code as the program written in a high-level language and object code as the machine-readable version produced by a language translator. Language translators like compilers, interpreters, and assemblers are used to convert programs into object code that computers can execute.

Uploaded by

abdulreh507
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views3 pages

C++ Lecture 2

This document discusses computer programs and programming languages. It defines a program as a set of instructions given to a computer and a programming language as the language used to write programs. There are two main types of programming languages: low-level languages like machine language and assembly language, which are close to computer hardware; and high-level languages like C++ and Java, which are closer to human languages. It defines source code as the program written in a high-level language and object code as the machine-readable version produced by a language translator. Language translators like compilers, interpreters, and assemblers are used to convert programs into object code that computers can execute.

Uploaded by

abdulreh507
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Introduction to Computer Science (C++)

Q: What is program and programming language? Discuss two main


categories of programming languages.
Program:
A computer is a device that follows the instruction given to it. A well define set of
instructions given to the computer is called a computer program. A computer program is
written in a programming language, A person who develops program is called programmer.
Programming Language:
A set of words and symbols used to write programs is called programming language. The
programming languages are used to write computer programs, A programming language is
a means of communication between a user and computer.
Types of Programming Languages:
There are two types of computer programming languages
• Low Level Language
• High Level Language
Low Level Languages:
Low level languages are near to computer hardware and far from human languages. The
low-level languages are divided into the following two main categories:
• Machine Language
• Assembly Language:
Machine Language:
A type of language in which instructions are written in binary form is called machine
language. It is the only language that is directly understood by the computer r. It is the native
language of the computer.
A program written in machine language can be executed very fast by computer. The compute
does not need any translator to understand this language. The programs written in machine
language are machine dependent. Machine language is difficult to understand and learn. The
process of writing and modifying program in machine language takes a lot of time.
Assembly Language:
Assembly language is a low-level language. It is one step higher than machine language. In
assembly language machine instruction are replaced with English like words known as
mnemonics. It pronounced as Ne-Monics.

Instructor: M Altaf 1 Course: C++


High Level Language:
A type of language that is close to human languages is called high level language. The
instructions in these languages are similar to English language such as input and print etc.
These languages are easy to understand.
A set of rules for writing programs in a high-level language is known as syntax. Each
language has its own syntax, The instruction must be written according to the syntax of the
language, any error in the program is identified by the language translator. A program cannot
be converted into machine language if it contains any syntax error.
Some examples of high-level languages are as follows:
• C/C++
• JAVA
• PASCAL
• FOTRAN
• BASIC
• COBOL
Q: Define source code and object code.
Source Code:
A program written in a high-level language is called source code. Source code is also called
source program. Computer cannot understand the statements of high-level language. The
source code cannot be executed by computer directly. It is converted into object code and
then executed.
Object Code:
A program in machine language is called object code. It is also called object program or
machine code. Computer understands object code directly.
Q: Describe language translator. Discuss different types of language
processors.
Computer understands only machine language. A program written in high level or assembly
language cannot be run on a computer directly. It must be converted into machine language
before execution. Language processor or translator is a type of system software that converts
these programs into machine language. Every computer language has its own translators.
Types of Translators:
• Compiler
• Interpreter
• Assembler
Compiler:

A compiler is a program that converts the instruction of high-level language into machine
Instructor: M Altaf 2 Course: C++
language as a whole. A program written in high level language is called source program.
The complier converts the source program into machine code. The machine code is known
as object program. The object program can be executed may times.
The compiler checks each statement in the source program and generates machine
instructions. Compiler can translate the programs of only those languages for which it is
written. For example, C compiler can translate only those programs that are written in C
language.

Interpreter:
An interpreter is a program that translates one instruction of the program at a time. It
converts the instruction into machine language and executes, ` it then moves to the next
instruction of the program. It displays the error message if there is any error in the
instruction.
The advantage of interpreters over compiler is that an error is found immediately. The
programmer can correct the errors during program development.
The disadvantage of interpreter is that it is not very efficient, the interpreter does not produce
and object program. It converts the instructions into machine language each time it is
executed. BASIC language uses interpreter.

Assembler:
An assembler is a translating program that translates the instruction of assembly language
into machine language.

Instructor: M Altaf 3 Course: C++

You might also like