0% found this document useful (0 votes)
5 views

Assignment 1

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Assignment 1

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Answer 1.

i. An assembler is a program that converts assembly language into machine code. It takes the basic
commands and operations from assembly code and converts them into binary code that can be
recognized by a specific type of processor. Assemblers are similar to compilers in that they produce
executable code.. It produces binary code in form of 0s and 1s. Examples are Java, C, C++ etc. compilers.
Examples of assemblers are GAS, GNU etc.

ii. A compiler is a special program that processes statements written in a particular programming
language and turns them into machine language or "code" that a computer's processor uses. Typically, a
programmer writes language statements in a language such as Pascal or C one line at a time using an
editor. The language processor that reads the complete source program written in high-level language
as a whole in one go and translates it into an equivalent program in machine language is called a
Compiler. Example: C, C++, C#, Java.

iii.Modular programming is a software design technique that emphasizes separating the functionality of
a program into independent, interchangeable modules, such that each contains everything necessary to
execute only one aspect of the desired functionality.

Modular programming (also referred to as modular architecture) is a general programming concept. It


involves separating a program's functions into independent pieces or building blocks, each containing all
the parts needed to execute a single aspect of the functionality.

2)

Answer 3.

a. A high-level language (HLL) is a programming language such as C, FORTRAN, or Pascal that enables a
programmer to write programs that are more or less independent of a particular type of computer. Such
languages are considered high-level because they are closer to human languages and further from
machine languages. It is a computer programming language that resembles natural language or
mathematical notation and is designed to reflect the requirements of a problem; examples include Ada,
BASIC, C, COBOL, FORTRAN, PascalSee also machine code.

b. The Programming Process:

1.Defining the problem.

2.Planning the solution.

3.Coding the program.

4 Testing the program.


5.Documenting the program.

Answer 4.

a.Translator is a computer program that translates program written in a given programming language
into a functionally equivalent program in a different language.

Depending on the translator, this may involve changing or simplifying the program flow without losing
the essence of the program, thereby producing a functionally equivalent program.

b.i.Assembler

An assembler translates assembly language into machine code.

Assembly language consists of Mnemonics for machine Op-codes, so assemblers perform a 1:1
translation from mnemonic to a direct instruction. For example, LDA #4 converts to 0001001000100100.

Conversely, one instruction in a high level language will translate to one or more instructions at machine
level.

b.ii. Compiler

Compiler is a computer program that translates code written in a high level language to a low level
language, object/machine code.

The most common reason for translating source code is to create an executable program (converting
from high level language into machine language).

b.iii.Interpreter

An interpreter program execute other programs directly, running through program code and executing
it line-by-line. As it analyses every line, an interpreter is slower than running compiled code but it can
take less time to interpret program code than to compile and then run it. This is very useful when
prototyping and testing code.
Interpreters are written for multiple platforms, this means code written once can be run immediately on
different systems without having to recompile for each. Examples of this include flash based web
programs that will run on your PC, Mac, games console and mobile phone.

c. Generations of languages:

1. The first generation languages, or 1GL, are low-level languages that are machine language.

2. The second-generation languages, or 2GL, are also low-level assembly languages. They are sometimes
used in kernels and hardware drives, but more commonly used for video editing and video games.

3. The third-generation languages, or 3GL, are high-level languages, such as C, C++, Java, JavaScript, and
Visual Basic.

4. The fourth-generation languages, or 4GL, are languages that consist of statements similar to
statements in a human language. Fourth generation languages are commonly used in database
programming and scripts examples include Perl, PHP, Python, Ruby, and SQL.

5. The fifth-generation languages, or 5GL, are programming languages that contain visual tools to help
develop a program. Examples of fifth generation languages include Mercury, OPS5, and Prolog.

You might also like