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

Unit3 - Languages With Exercises Modals

The document discusses computer languages and how computers process instructions. It explains that computers use binary and microassembly language to process commands in a step-by-step manner. It contrasts procedural languages, which execute instructions sequentially, with object-oriented languages, which allow data to have properties. The document concludes by showing short code samples of the "Hello World" program in different languages like BASIC, Pascal, C, Java, and PHP to illustrate how each language expresses the same task.

Uploaded by

Mari M
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)
47 views

Unit3 - Languages With Exercises Modals

The document discusses computer languages and how computers process instructions. It explains that computers use binary and microassembly language to process commands in a step-by-step manner. It contrasts procedural languages, which execute instructions sequentially, with object-oriented languages, which allow data to have properties. The document concludes by showing short code samples of the "Hello World" program in different languages like BASIC, Pascal, C, Java, and PHP to illustrate how each language expresses the same task.

Uploaded by

Mari M
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/ 10

UNIT 3 – Talk to Me

As was mentioned in the last unit, the computer uses high and low voltage along the
control lines/bus to tell the different parts of the computer what to do and what to
use. It uses what is called conventional machine language. We use binary (0’s
and 1’s) to express that language and microassembly to write it.

The computer processes commands and instructions in a step-by-step manner.


Looking at the microassembly language (often abbreviated as MAL), we see that
occurring:

0: mar := pc; rd;


1: pc := pc + 1; rd;
2: a := mbr; if n then 35;

Instruction 0 (remember, the computer starts counting at ZERO, not one) is


executed, then Instruction 1, then Instruction 2. A condition is checked in
Instruction 2. If it is true, then Instruction 35 is executed next; otherwise Instruction 3
(not shown) is executed. This continues until the computer is turned off (even if you
are not doing something, the CPU is always executing some type of instruction, even
if that instruction is “wait for the slow human to input something”).

Assembly, and early computer languages such as FORTRAN, COBOL, and BASIC,
were all procedural languages – do this, then do this, then do this, etc. The CPU still
does this.

In procedural languages, data are considered to be discrete. That is, the data item
has no other properties except for what it has been declared as, e.g. integer,
character, Boolean.

As the demand for more complex problems to be solved by the computer arose,
then object-oriented (OO) languages such as Java, Python, C++, Visual Basic,
.NET and Ruby were developed. In such languages, the data, which are called
objects, instances, or entities depending on the language, have other properties
that called attributes. These attributes (or descriptors) that are declared or
inherited.

Languages can also be distributed into two other groups – compiled and
interpreted.

With compiled languages, such as C, C++, COBOL, FORTRAN, and Pascal, the
program MUST be completely WITHOUT syntax error before it can be executed.
That means all variables must be declared in the program before they can be used.

While this is very time-consuming, the computer can run such programs very fast.
These languages are hardest on the programming, easiest on the machine.

With interpreted languages, such as BASIC, MATLAB, and PHP, a program can be
run WITH syntax error and WITHOUT the variables being declared because the
program is compiled as it is being executed. So, if a line is not used, it is not
compiled. If it has an error in it, the computer doesn’t see it.

18
UNIT 3 – Talk to Me

To give you an example, let’s say you were on the top floor of a six-story building
(see illustration below):

YOU Ukrainian
САША Ukrainian, Polish
ANDRZEJ Polish, German
HELGA German, French
FRANÇOIS French, English
JOHN English

You need to get a message to JOHN, the building chief, that


1) When everyone is gone
a. Shut all the windows
b. Turn off all the lights
c. Lock all the doors
2) To let you he has received the message

Unfortunately, you know only Ukrainian and JOHN knows only English. But your
friend САША knows Ukrainian and Polish, and he knows ANDRZEJ who knows
Polish and German, and so on.

In interpreted languages, you send the message down one line at a time to the CPU.
In compiled languages, you send the entire message down at once. The CPU
performs the command and goes to the next line. In a compiled program, the next
line is there. In an interpreted program, the CPU must wait for the next line to reach it
in machine.

Interestingly, this same idea in the basis for the Open Systems Interconnection
model (OSI model) - a conceptual model that characterizes and standardizes the
communication functions of telecommunication.

FACTOID: If you would like to see how computer languages developed, the
complexity of the development, and the major data structures of each, please go to:
http://www.digibarn.com/collections/posters/tongues/ComputerLanguagesChart-med.png

To look at how different languages handle the same task, let’s look at the iconic
“Hello World!” program that prints that phrase to the screen.

19
UNIT 3 – Talk to Me

BASIC (interpreted)

10 PRINT “Hello World!“

PASCAL (compiled)

Program HelloWorld(output);

begin
writeln('Hello, world!');
end.

C (compiled)

#include<stdio.h>

main()
{
printf("Hello World!");

JAVA (compiled)

public class HelloWorld {


public static void main(String[] args) {
System.out.println("Hello, World");
}
}

PHP (interpreted)

<?php
echo "Hello World!";
?>

As you can see, each language expresses the same command in different ways with
some similarities. How does this relate to the CPU, which must run the program? As
was mentioned earlier, regardless of the type of language (compiled or interpreted),
the CPU can only run it in machine language. None of these are machine language.
They must be translated, interpreted, and compiled into machine language like the
illustration above.

20
UNIT 3 – Talk to Me

VOCABULARY
TECHNICAL NON-TECHNICAL
attribute - якість; властивість; символ; атрибут; basis – базис, основа \
характерна риса основание, фундамент
/качество; свойство; символ; атрибут; характерная
черта
Boolean - логічне, булеве значення /логическое, complex –
булевое значение складний/сложный
compile (v) – скласти/ компилировать condition -
умова/условие
conventional machine language - звичайна машинна entire – цілий/весь,
мова/ обычный машинный язык
data structure - структура даних/ структура данных function – функція/
функция
declare (v) – декларувати/ объявлять iconic – іконічний /
иконический
discrete – дискретний/ дискретный in demand – мати попит
\ быть востребованным,
пользоваться спросом
entity - компонент, об'єкт /компонент, объект illustration – ілюстрація/
иллюстрация
execute (v) – виконати/ выполнять task – завдання/ задача
inherit (v) – успадкувати/ унаследовать time-consuming –
трудомісткий/
трудоемкий
instance - реалізація /реализация
integer - ціле число /целое число
interpret (v) – тлумачити/ интерпретировать
microassembly language (MAL) - мікроскладальна
мова; мова асемблера / язык ассемблера
object - об'єкт/ объект
object-oriented - об'єктно-орієнтований/ объектно-
ориентированный
procedural – процедурний/ процедурный
property – властивість/ свойство
syntax – синтаксис/ синтаксис
translate (v) - перекладати, перетворювати/
переводить, преобразовывать
variable – змінна/ переменная

21
UNIT 3 – Talk to Me

ACTIVITIES:
1) Look at the “Hello World!” program illustrations above. Which do you think
would be easiest for you to write and why?

2) Pick a computer language you would like to program in and describe that
language to include: Is it procedural or object-oriented? Is it compiled or
interpreted? What are the major data structures of the language? Why
do you want to learn it?

3) What computer language(s) do you know, what do you use them for, and
why did you learn them?

4) Research what computer languages are in demand now and how you plan to
learn them (or at least one of them).

Vocabulary exercises

Exercise 1. Match the word / phrase with its definition


1) attribute a) likely to change, or showing change or difference as
a characteristic; a letter or symbol that represents any of a set
of values
2) compile b) the rules that state how, and in which order, words and symbols
must be used in a particular computer language
3) conventional c) an object or objects that belong to someone
4) declare d) relating to the usual or official way in which something is done
5) entity e) to decide what the intended meaning of something is
6) execute f) a whole number and not a fraction
7) inherit g) a particular situation, event, or fact, especially an example of
something that happens generally
8) instance h) to receive money, a house, etc. from someone after they have
died
9) integer i) to do or perform something, especially in a planned way
10) interpret j) something that exists apart from other things, having its own
independent existence
11) procedural k) to announce something clearly, firmly, publicly, or officially
12) property l) traditional and ordinary
13) syntax m) to change the language in which a computer program is written
into instructions that a computer can use
14) variable n) a quality or characteristic that someone or something has

22
UNIT 3 – Talk to Me

Exercise 2. Fill in the blanks with the words / phrases from the Unit.

condition time-consuming translate iconic function entire task

1) You'll lose marks if you _____________ from one language into another
too literally.
2) Working ____________________ here are primitive.
3) Producing a computer program is a very __________________________ job.
4) John Lennon gained _______________ status following his death.
5) I'm not quite sure what my _______________ is within the company.
6) He spent the _______________ afternoon playing a computer game.
7) We usually ask freshmen to perform a few simple tasks just to test their level of
the English language.

Exercise 3. What does the abbreviation/acronym stand for?

1) OO
2) PHP
3) OSI

Exercise 4. Use these prompts while preparing to present your answer


to the class.

1. The following presentation / essay takes a look at both sides of the argument.
2. Needless to say, …
3. Furthermore,
4. In addition, …
5. What is more, …
6. On top of that, …
7. In general, …
8. By and large, …
9. … any questions?

23
UNIT 3 – Talk to Me

Supplementary activities

Grammar

Exercise 5. Focus on the Modal Verbs. Read the text of the lesson one
more time and underline the Modals (Homework).

Exercise 6. Look at the table below and identify the underlined


sentences (in the text of the lesson) with the grammar tense/form
they are in. If you do not find a proper sentence, think of your own.

Functions of Modal Verbs and Synonyms Expressions

Use Present / Future Past


1. Ability - We can speak English. - We could/were able to speak
English when we were 10
(repeated action – ability in the
- I am able to ride a bike. past).
- I was able to swim when I was
seven.

2. Possibility - She can pass the exam. (90% - He could have been killed in the
certain) accident. (Luckily, he wasn’t
- They could still be at university. killed.)
(50% certain; it’s possible they
are still at university.)
- The students may be studying
in the reading room. (perhaps;
50% certain; it’s possible that - She may have seen Ann
they are studying.) yesterday.
- We might need some more (Perhaps she saw Ann.)
water. (40% certain; perhaps we
need some more water.)
- It is likely that she will phone - She might have forgotten.
tonight. (Perhaps she has forgotten.)
- She is likely to phone tonight.
- It was likely that she had
phoned the day before.
- She was likely to have phoned
the day before.

24
UNIT 3 – Talk to Me

3. Probability - He will be in the office soon. ________


(100% certain; prediction)

- She should get the credit - They should have sent the
easily. (90% certain; future parcel by now. (They have
only; she’ll get easily.) probably sent it by now.)
- He ought to be at the - He ought to have arrived half
college by now. (90 % certain; an hour ago. (He has probably
he will probably be home.) arrived.)

4. Logical - They must be having a - They must have been working.


assumption lesson. (90% certain – (positive; I’m sure they were
positive; I’m sure they’re working.)
(supposition)
working.)
- He can’t be over 50. - He can’t have failed the exam.
(negative; I’m sure he isn’t (negative; I’m sure he didn’t fail
over 50.) the exam.)
- She couldn’t be at home - She couldn’t have been at
(negative; I don’t think she’s at home yesterday. (negative; I don’t
home.) think she was at home yesterday.)

5. Permission - He can/can’t take a phone. - They weren’t allowed


(giving or refusing permission; to/couldn’t apply for the position.
informal) - She was allowed to cross the
- Could we use your border (NOT: could)
dictionary? (more polite;
asking for permission)
- You may use the Internet.
(formal; giving permission)
- Might I come in, please?
(more formal; asking
permission)
- I’m afraid you can’t/mustn’t
use the phone here. (informal;
refusing permission)
- Students may not leave the
room with their exam paper.
(formal; refusing permission –
written notice)

25
UNIT 3 – Talk to Me

6. Necessity/ - I must find a new job. - I had to find a new job. (I was
absence of (I say so.) obliged to.)
- She has to wear the uniform. - Since her car was being
necessity
(necessity coming from repaired, she had to go to Kyiv by
outside the speaker) bus.
- We’ve got to leave now.
(informal)
- The classroom needs - We had to go to work yesterday.
repairing. OR The classroom
needs to be repaired. (It’s - The classroom needed
necessary) repairing. OR The classroom
- They don’t have to/don’t needed to be repaired. (it was
need/needn’t take notes if necessary)
they don’t want to. (it isn’t
necessary – absence of - They didn’t have to take notes.
necessity) (it wasn’t necessary – absence of
- I ought to get my hair cut. necessity)
(it’s necessary) - They didn’t have to/didn’t need
to come early. (It wasn’t
necessary for them to come early
and they didn’t.)
- She needn’t have come on
Saturday. (It wasn’t necessary for
her to come on Saturday but she
did.)

7. Advice - You should eat less fast - I should have handed that
food. (general advice; I advise assignment in on time. (but I
you) didn’t)
- We ought to be ready to
obtain new skills. (most people - She ought to have gone to bed
believe this, I advise you) earlier. (but she didn’t)
- You had better come on
time. (it’s a good idea; advice - The project would have been
on a specific situation) cleaner if we had used some
- Shall I take this course? cardboard. (but we didn’t)
(asking for advice)

8. Criticism - He could at least offer his - He could have at least offered


help. his help that day.
- You should try harder. - You should have tried harder.
(but you didn’t)
- They ought to show more - They ought to have shown more
respect. respect last night. (it was the good
idea to do but they didn’t do it)

26
UNIT 3 – Talk to Me

9. Obligation - I must care about it. (I’m - I had to care about it last night.
obliged to; I say so.)
- I have to care about it. (I’m - I had to care about it last night.
obliged to; the boss says so.)
- They ought to care about - They ought to have cared about
their pets. (It’s the right thing to their pets. (It was the right thing to
do but they don’t always do it.) do but they didn’t do it.)

10. Requests - Can I borrow your pencil?


(informal)
- Could I borrow your pencil?
(formal)
- May I use your phone,
please? (formal) ______
- Might I come in? (very
formal)
- Will you help me tonight?
(vey friendly)
- Would you mind passing this
paper? (polite)
11. Offers - Can I/ we help you?
(informal)
- Shall I / we do anything for
them? (informal) ______
- Would you like me to do it
for you?
12. Suggestion - Shall we talk about this? _______
- I/We can start now if you like. _______
- We could go if you want.
- I could have done that.

13. Prohibition - You can’t use mobile phones - They couldn’t use mobile
here. (you aren’t allowed to) phones there. (they weren’t
allowed)
- You mustn’t use mobile ________
phones here. (it’s forbidden)
- You may not use mobile ________
phones here. (formal)
14. Duty - Everybody must obey the - All the people had to obey the
rules. rules.
- Everyone ought to save - She ought to have saved the
natural resources. (It’s the natural resources. (It was the right
right thing to do but they do thing to do but she didn’t do it.)
not always do it.)

27

You might also like