Вы находитесь на странице: 1из 4

Properties of an algorithm

1. Finiteness - each algorithm should terminate after a finite number of steps, it should
be a reasonable number
2. Definiteness - each step of the algorithm must be precisely defined, the actions
carried must be rigorously and explicitly specified for each case
3. Input - quantities which are given to the algorithm before the algorithm begins
4. Outputs - quantities that are related to the inputs
5. Effectiveness - how effective the operation to be performed by the algorithm is. All
the steps should be followed in the correct manner and everything should be done
perfectly.

 A method should be identified to solve a problem. A certain procedure must be


followed and there are a certain number of steps that should be followed in a
particular order
 You must analyze the problem before implementing the solution

 Iteration is the process of repeating a series of instructions. It is used to repeat a


statement or a block of statements within an algorithm
o Iterations are explained by using the "from to loop" and the "while loop"

 A conditional statement performs various instructions depending on a Boolean test.


o The usage of if-then-else comes under this

 Pre-planning is the process of planning something in advance


o Pre purchasing a game or product from amazon of the apple store is known as
pre-planning.
o Food that needs to be pre-heated before cooked is also known as pre-planning.
 A GANTT chart is used to project a timeline of something

 Concurrent means something that happens at the same time as something else.
 In computer science concurrent processing means the execution of different
instructions simultaneously by multiple processors so as to achieve the best
performance.
 The many sub procedures are assigned to separate processing units to perform
simultaneously. Sequential processing is the execution of all sub-procedures one after
the other by a single processor

1. What are the fundamental operations of a computer?


 Add - Add is an operation in which load instruction for two or more numbers is sent
from the RAM to the CU. The CU loads these numbers in ALU and adds the contents
off memory location 1 to memory location 2.
 Compare - when you compare the process of comparing (>, =, <) the contents of two
different memory locations using operators
 Retrieve - The process of reading a memory location is called retrieving
 Store - The result of the add operation is written a new memory location, this
operation is called store.

WHAT IS A COMPOUND OPERATION?


1. Combining separate code to solve a problem.

What are compound operations of a computer and how do they differ from fundamental
operations?
What are the essential features of a computer language?

 Abstract thinking means reflecting on events, ideas, attributes and relationships in a


general manner that hides all unnecessary details of specific objects.
o Abstract art is an example of abstraction.
o Although RAM and CPU are considered as fundamental physical parts, it is
known that they are abstraction of gates and integrated circuits which contain
millions of transistors.

 Object oriented programming uses abstraction, and is based on the principle that all
everyday tasks can be considered as entities. These entities are either objects or
events.
 Object oriented programming uses programming objects that describe data
(properties) and behavior (methods) of real objects, and facilitates code reusability
and abstraction.

Java program excepts two inputs and prints the remainder and quotient.
 Finding the maximum value of four numbers is a fundamental operation performed by the
computer

WHAT ARE THE FUNDAMENTAL FEATURES


 A programming language is described as the combination of its SEMANTICS and syntax
 Semantics is the meaning of what we write using the programming language
 Syntax is the way the sentence is structured and if also focuses on the "grammar" in the
code
 Grammar defines the syntax, while the rules of statement construction are called SYNTAX
(int, class, import)
 Both these together form the structure of the code
A CPU contains 4 primary parts
1. Control Unit - the CU is responsible for the operation of the CPU. It controls the
retrieval of instructions from the primary memory as well as the sequence of their
execution
2. Arithmetic logic unit - the ALU performs all the arithmetic input/output operations.
3. Memory address register
4. Memory data register

RAM - RAM stores the executing program instructions as well as any data that is needed.
Instructions and data in the RAM are stored in unique memory locations and every such
location had an address as well as content.

Need for higher level languages


1. Machine language - is a low level language and is the only language that can directly
be understood by a computer. They are hard to write, and difficult to debug and
maintain. Machine language is made up of 0's and 1's. Machine language for different
processors are different.
2. Assembly language - Assembly language is a replacement for binary code. It is a set of
instructions and references to memory address locations with symbols called
mnemonics. An assembler converts assembly language into machine language.
3. High level programming language - A high level programming language is a
programming language that uses the elements of natural language, is easy to use,
facilitates abstraction by hiding significant areas of computing systems and makes the
program easier in every way.

What is the need for a translation process and why do we need it?
 We need translation to convert hard level programming language into machine
language. There are two ways: compilation and interpretation.

A Java compiler is a program that takes the text file work of a developer and
compiles it into a platform, independent Java file. Programmers typically write
language statements in a given programming language one line at a time using a code
editor or an integrated development environment (IDE). The resulting file contains
what are called the source statements. The programmer then runs a compiler for the
appropriate language, specifying the name of the file that contains the source
statements.
o Compilation is the process that takes a source file as an input, it then reads the
file and checks for syntactical and program errors. If no errors are found it
produces an output file which is in the machine language.
o In case of Java the output produced is known as byte code or intermediate code.
o C and C++ are examples of languages that are compiled directly to machine code.
An interpreter is a program that reads in as input a source program, along with data
for the program, and translates the source program instruction by instruction. For
example, the Java interpreter java translate a .class file into code that can be
executed natively on the underlying machine.
o Java script is an example of a language that is an example of a language that is
interpreted.

 Compilers are faster than interpreters because interpreters run every time the
program is run, whereas compilers run once in the beginning and produce machine
code for execution.

 Java combines interpretation and compilation


o Compilation in Java converts Java to virtual machine bytecode, output is .java or
.class file which contains VMB
o The JVM takes the VMB and interprets it to run it

 JVM is a engine that provides runtime environment to drive the Java Code or
applications. It converts Java bytecode into machines language. JVM is a part of
JRE(Java Run Environment). It stands for Java Virtual Machine
o In other programming languages, the compiler produces machine code for a
particular system. However, Java compiler produces code for a Virtual Machine
known as Java Virtual Machine.
o First, Java code is complied into bytecode. This bytecode gets interpreted on
different machines
o Between host system and Java source, Bytecode is an intermediary language.
o JVM is responsible for allocating memory space.

1. Variable - A variable is used to store a data element of a program. The stored value
can be changed during the program execution. A variable has a name and a type.
2. Constant - Constants represent things and quantities that do not change. They can be
seen as non-modifiable variables.
o A string literal ("ok") or a variable which is declared as final who's value cannot
be changed is a constant.
3. Operators - operators are used to manipulate operands. Operators are signs like +
and - and * and %.
4. Object - An object is compromised of data and actions. Actions refer to the
operations that can be performed by the Object.

Вам также может понравиться