Tsehaye Assagnment
Tsehaye Assagnment
Computer programming
tsehaye sahile 0116/19 regular computer science
1. What is a program?
Program is a common computer term that can be used as both a noun and a verb. A
program (noun) is executablesoftware that runs on a computer. It is similar to a script,
but is often much larger in size and does not require a scripting engine to run. Instead,
a program consists of compiled code that can run directly from the
computer'soperating system.
Examples of programs include Web browsers, word processors, e-mail clients, video
games, and system utilities. These programs are often called applications, which can
be used synonymously with "software programs." On Windows, programs typically
have an .EXE file extension, while Macintosh programs have an .APPextension.
When "program" is used as verb, it means to create a software program. For example,
programmers create programs by writing code that instructs the computer what to do.
The functions and commands written by the programmer are collectively referred to as
source code. When the code is finished, the source code file or files are compiled into
an executable program.
2. What is hardware?
11. A CPU understands instructions that are written only in what language?
Ø machine language
A computer's CPU can only understand instructions that are written in machine
language.
12. A program has to be copied into what type of memory each time the CPU
executes it?
Although a program can be stored on a secondary storage device such as a disk drive,
it has to be copied into main memory, or RAM, each time the CPU executes it.
13. When a CPU executes the instructions in a program, it is engaged in what
process?
Ø fetch-decode-execute cycle.
14. What is assembly language?
assembly language was created in the early days of computing2 as an alternative to
machine language. Instead of using binary num-bers for instructions, assembly
language uses short words that are known as mnemonics. For example, in assembly
language, the mnemonic add typically means to add numbers, mul typ-ically means to
multiply numbers, and mov typically means to move a value to a location in memory.
When a programmer uses assembly language to write a program, he or she can write
short mnemonics instead of binary numbers.
Assembly language programs cannot be executed by the CPU, however. The CPU
only understands machine language, so a special program known as an assembler is
used to translate an assembly language program to a machine language program.
15. What type of programming language allows you to create powerful and
complex programs without knowing how the CPU works?
Ø high-level languages
16. Each language has a set of rules that must be strictly followed when writing a
program. What is this set of rules called?
Ø The syntax rules
17. What do you call a program that translates a high-level language program
into a separate machine language program?
Ø Compilers and Interpreters
18. What do you call a program that both translates and executes the instructions
in a high-level language program?
Ø The Python language and python language use an interpreter to translate.
19. What type of mistake is usually caused by a misspelled key word, a missing
punctuation character, or the incorrect use of an operator?
Ø syntax error
20. What is an algorithm? Explain
Probably the best way to understand an algorithm is to think of it as a recipe. There
are many ways to bake cookies, but by following a recipe a baker knows to first
preheat the oven, then measure out the flour, add butter, chocolate chips, etc. until the
desired cookies are complete.
Using algorithms, a programmer or computer scientist can tell his machine to query
database A for last month’s sales figures, compare them to the prior month and the
same month last year, and then display it in a bar graph.
Mix multiple algorithms together and you have a working computer program.
As can be expected, there are numerous types of algorithms for virtually every kind of
mathematical problem there is to solve. There are:
l Numerical algorithms.
l Algebraic algorithms.
l Geometric algorithms.
l Operational algorithms.
l Theoretical algorithms. and Sequential algorithms.
There are also various algorithms named after the leading mathematicians who
invented them:
lShor’s algorithm.
lGirvan-Newman algorithm.
lSeveral Euclidian algorithms.
There are also those named after the specific problem they solve, such as:
lBidirectional search algorithm.
lK-way merge algorithm.
In the computing field, most algorithms tend to solve data management and analysis
problems.
Top Computing Algorithms
Sort
Arranging data in an efficient and useful manner. These include quick sort, merge
sort, counting sort and others;
Search
Finding key data in sorted data sets. The most common is the binary sort, but there are
also depth, breadth and first searches used by web applications;
Hashing
Similar to search but with an indexing and key ID component. Hashing provides
superior results because it assigns value to certain data;
Dynamic Programming
Converts larger, complex problems into series of smaller problems;
Exponential by Squaring (EbS)
Also known as binary exponentiation, EbS speeds up the calculation of large integers,
polynomials, square matrices and other complex problems;
String Matching and Parsing
Designed to find patterns in large data sets using predefined terms and restrictions;
21. What are flow charts? Explain
A flowchart is a diagram that describes a process or operation. It includes multiple
steps, which the process "flows" through from start to finish. Common uses for
flowcharts include developing business plans, defining troubleshooting steps, and
designing mathematical algorithms. Some flowcharts may only include a few steps,
while others can be highly complex, containing hundreds of possible outcomes.
Flowcharts typically use standard symbols to represent different stages or actions
within the chart. For example, each step is shown within a rectangle, while each
decision is displayed in a diamond. Arrows are placed between the different symbols
to show the direction the process is flowing. While flowcharts can be created with a
pen and paper, there are several software programs available that make designing
flowcharts especially easy. Common programs that can be used to create flowcharts
include SmartDraw and Visio for Windows and OmniGraffle for the Mac.