What is a computer?
A
digital* computer* is anelectronic* machine that can be programmed to carry out sequences of arithmetic or logicaloperations* automatically. Each operation is described by a specificinstruction* orstatement* to be performed. Modern digital electronic computers have a generic set of operations andinstructions,* and they have the capability to execute specific sets of them known asprograms.* Each program describes and implements analgorithm* to solve a specific problem (e.g. performing a calculation, storing and retrieving information from a database etc.). The programs enable computers to perform a wide range of tasks. (cf. Wikipedia: Computers)Related Wikipedia entries:
computer;⇒ arithmetic;⇒ program⇒Vocabulary:
computer science terms⇒
essential vocabulary⇒
sample sentences, vocabulary, and tests to practice⇒
Examples
Example of a simple algorithm described by a flowchart diagram:
![]()
– arithmetic operation: + (addition)
– instructions: i←1 (assignment); i←i+1 (addition and assignment); write i (I/O instruction) etc.
– conditional instruction: (if) i>n (jump to stop); note that jump is performed when the i>n comparison provides 'true' logical value (i.e. 'yes')A possible implementation of the above algorithm can be easily created using the JavaScript programming language as follows:
var n=10; var i=1; while(i<=n) { writeln(i); i=i+1; } writeln("_____________");This small JavaScript program can be executed using a simple JS interpreter available here. Because JavaScript is a high-level programming language which does not contain conditional or unconditional control statements (like 'jump' or 'goto'), we should use the 'while' loop statement instead. The while(i<=n) {...} loop statement repeats the sequence (or 'block') of statements between the {...} curly brackets until the (i<=n) comparison (called the 'condition' of the loop) provides 'true' logical value.
What does digital mean?
A
digital* computer is a universal electronic*data processing* equipment which uses fixed-length sequences of binarydigits* to represent elementary, primitive or basictypes of data* (e.g. whole numbers or integers, real numbers, logical or Boolean values, characters etc.). Therepresentation of data* imposes specific coding rules and internal format upon each of the primitive and complexdata typesdefined in a computer system.Related Wikipedia entries:
data processing;⇒
data;⇒ digital data;⇒ binary data;⇒
data type(s);⇒
data representation, including
signed numbers;⇒ binary coded decimals;⇒ real numbers;⇒ characters;⇒⇒⇒
Complex data types, e.g. strings, texts, long texts (cf. the "memo" field type, MS Access), arrays, database records etc., and various types of digital media (such as animations, digital images, sounds, videos etc.) also use binary encoding but the length and the number of the sequences of bits identifying elementary data units can be extremely diverse. For example, in a digital audio CD an elementary data unit can be 16 bits long (identifying the sound intensity at a given moment in one stereo channel), and the number of elementary data units depends on the actual length of the digitized sound. Another example is a digital image that is composed of a number of picture elements called pixels. A two-dimensional raster image contains a fixed number of rows and columns of pixels. Each pixel represents a certain color (or gray level) at a specific point of the image. According to the well-known RGB color model, a specific color can be represented by the red, green and blue primary colors mixed together (i.e. adding them to each other in different intensities). In image file formats like jpg, the pixels are represented in 24 bits where the intensity of each primary color is represented by 8 bits.
Examples
Let us see some examples of the coding rules and internal format of a few elementary data types.
(1) examples of the coding rules and internal format of 8-bit integers:⇒
- 0 → 0000|0000
- 23 → 0001|0111
- −12 ⇒ 256−12=244 → 1111|0100
(2) examples of the coding rules and internal format of real ("floating point") numbers:⇒
- 4.5=1.125*22 ⇒ +(1+0.125)*2127+2 → 0 10000001 0010...
- −2.25=−1.125*21 ⇒ −(1+0.125)*2127+1 → 1 10000000 0010...
- 0.75=1.5*2−1 ⇒ (1+0.5)*2127−1 → 0 01111110 1000...
- −3=−1.5*21 ⇒ −(1+0.5)*2127+1 → 1 10000000 1000...
(3) examples of the coding rules and internal format of logical values:
- true ⇒ 1 → 00000001
- false ⇒ 0 → 00000000
(4) examples of the coding rules and internal format of ASCII characters (represented by a sequence of 7 bits):⇒
- ' ' ("space") ⇒ 32 → 0010|0000
- '0' ⇒ 48 → 0011|0000
- 'A' ⇒ 65 → 0100|0001