UNIT 5 - Programming Languages

Embed Size (px)

Citation preview

  • 8/13/2019 UNIT 5 - Programming Languages

    1/11

  • 8/13/2019 UNIT 5 - Programming Languages

    2/11

    45

    50

    55

    60

    Neagu Iulia Veronica Unit 5 * Programming languagesr The code can be read and written by a prograrnmer. To run on a computerit must be converted into a machine readable form, a process calledassembly' The language is specific to a particular target machine or family ofmachines' Some assembler languages provide a macro-facility enabling thedevelopment of complex patterns of machine instructionsSecond generation programming languages, originally just called high levelprogramming languages were created to simplify the burden of programming by makingits expression more like the normal mode of expression for thoughts used by theprogrammers. They were introduced in the late 1950's, with FORTRAN reflecting theneeds of scientific programmers, ALGOL reflecting an attempt to produce an European /American standard view, and COBOL providing a "natural language" for developers of

    commercial soflware-The third generation languages emphasized:' Expression of an algorithm in a way that was independent of thecharacteristics of the machine on which the algorithm would run' The rise of strong typing (used to describe those situations whereprogramming languages specify one or more restrictions on howoperations involving values having different data tlpes can be intermixed)' Block structures (blocks which can be nested to any depth) and automatedmanagement of storage with a stackr Broad-spectrum applicability and greatly extended functionality"Generational" classification of these languages was abandoned after the thirdgeneration languages, with the natural successors to the third generation languages beingtermed object-oriented. c gave rise to C++ and later to c#, LISP to CLos, ADA to ADA95 and even COBOL to COBOL2002, and new languages like Java have emerged in that"generation" as well.But significantly different languages and systems were already being called fourthand fifth generation programming languages by language communities with specialinterests. The tnanner in which these generations have been put forward tends to differ incharacter from those of earlier generations, and they represent software points-of-viewleading away from the mainstream.

    65

    70

    75

  • 8/13/2019 UNIT 5 - Programming Languages

    3/11

    Neagu Iulia Veronica Unit 5 - Programming languagesLa) Give synonyms for the following words from the text:Specifications (1. 2); traits (1. 3); chained (r.21); embedded (1.27); query (1. 33); converred(1. a3);spectrum (1.64);' emerged (1.68);mainstream (1.74)b) llthat do the following abbreviations stand for?COBOL; FORTRAN; PHP, SQL; RDBMS; LISP; CLOS; PASCAL; BASIC;DYNAMO;II. Explain the following mathematical concepts in English:1. Hexadecimal figure2.Binary mathematics3. Floating point arithmetic4. Double precision arithmetic5. Boolean truth values

    III. Match the following programming languages with their dejinition:a) Ansver thefollowing questions:1. What is software - as compared to hardware?2. \\'hat kind of software do all computer users need in order to use their machines?3. What purposes do programming languages serve?4. What is a low-level language?5. What is the purpose of a compiler?b) Conplete the following sentences (you may use more than one word per blank space):l. New .. . . are released every time there is an improvement on the hardware side.2. ..... Are languages which are close to human language.3. ............ such as Excel 4.0 or Multiplan are some of the most widely-used .in the computer field.4. The translation of a program into machine code is carried out either via a .. ....... ... oran ....5. Before running a program, the user has to ensure that it is ............-free.IV. Mstch thefollowing programming languages with their deJinition:l. ActionScript;2. C#;3. C++; 4. Delphi; 5. Erlang; 6. FoxPro2; 7 . Iava;8. LabVIEW; 9.Lisp; 10. MATLAB; 11. PHP; 12. PEARL; 13. Unix shell; 14. Visual Basic; 15. XMLa. a text-based procedurally-oriented programming language and DBMS, originallypublished by Fox softwareb. a general-purpose scripting language; it is embedded into the HTML source documentand interpreted by a web server, which generates the web page document

  • 8/13/2019 UNIT 5 - Programming Languages

    4/11

    NeagululiaYeronica Unit 5 * Programming languagesc. a multi-paradigm programming language encompassing imperative, functional,generic, object-oriented and component-oriented programming disciplinesd. produced by Borland, it was formerly known as the Object Pascal Language; its mostpopular use is the development of desktop and enterprise database applications, but as ageneral purpose development tool it is capable of and used for most types of developmentprojectse. a programming language that derives much of its syntax from C and C++ but has asimpler object model and fewer low-level facilities; it is widely used from applicationsoftware to web applicationsf. a computer programming language designed for multitasking and real-timeprogramming; it supports both fixed-point and floating-point numeric values, characterand character string data as well as bit values; it also provides facilities for structures andmulti-dimensional arraysg. it is derived from BASIC and enables the rapid application development of graphicaluser interface applications, access to databases using Data Access Objects, Remote DataObjects or ActiveX controls and objectsh. a set of rules for encoding documents in machine-readable form; its design goalsemphasize simplicity, generality and usability over the Interneti. a scripting language developed by Adobe, used primarily for the development ofwebsites and software targeting the Adobe Flash Player platformj. short for Laboratory Virtual Instrumentation Engineering Workbench; it is also referredto as G and used for data acquisition, instrument control and industrial automationk. a command-line interyreter or shell that provides a traditional user interface for theUnix operating system and for Unix-like systemsl. designed by Ericsson to support distributed, fault-tolerant, soft-real-time, non-stopapplicationsm. one of the earliest programming languages; it pioneered many ideas in computerscience, including tree data structures, automatic storage management, dynamic typingand the self-hosting compiler; linked lists are one of this programming language's majordata structures and its source code is itself made up of listsn. a statically typed, free-form, multi-paradigm, compiled, general-purpose programminglanguage; this language began as enhancements to C, first adding classes, then virhralfunctions, operator overloading, multiple inheritance, templates, and exception handlingamong other featureso. it allows matrix manipulations, plotting of functions and data, implementation ofalgorithms, creation of user interfaces and interfacing with programs written in otherlanguages, including C, C++ and Fortran.V. Fill in the blanks of thefollowing text about Linux:

    ln 1992, a talented prografilmer named Linus Torvalds took a small educationalversion of UNIX called Minix rewriting and extending it. By mid 1993, Linux hadcompletely dropped its Minix roots and became quite a 1) ........... of UNIX. 2).... it rn.as adopted with great enthusiasm by other prograrnmers on the Internet, itbegan 3) .... like wildfire. It soon became the fastest growing version of Unix,mainly because it was 4) ....

  • 8/13/2019 UNIT 5 - Programming Languages

    5/11

    Neagu lulia Veronica Unit 5 - Programming languagesLinux ran primarily on x86 based PC's, and it actually ran pretty well even on aslow 386 with 4 Mb of RAM and a 40 Mb hard disk. Linus and his followers proudlydescribed Linux as a 5) ... (a programmer's system) because it relied heavily onfreely 6) .... which had been written by other 7) .... Its 8). ... wasthe X Window System, which was freely available from MIT. For its GUI it used acollection of freely available window managers and other GUI components, as well as theAthena and Openlook styles, which were also freely available. Because of its 9)...., some 10) ... . even began to sell versions of Motif for Linux. Most ofthe other programs which people actually used (the shells, the compilers, the utilitycommands, etc.) came from the GNU Project - a free software 11) ... . started byfuchard Stallman in the 1980's. Stallman was a talented prograrnmer, but he was also alittle 12) ..... He passionately believed that all software should be free and shouldcome with 13) ... . so that other programmers could extend it, and that computing

    professionals should only make money through 14) ... .. The ultimate goal of theGNU Project was to create a completely free {INIX-like operating system called GNU.VI. Translute the following txto excerpts into English:a) Java este un limbaj de programare de nivel inalt, dezvoltat de JavaSoft, companie incadrul firmei Sun Microsystems. Dintre caracteristicile principale ale limbajului amintim:o simplitate - Java este uqor de invdfat, caracteristicile complicate (supraincircareaoperatorilor, mogtenirea multipld, gabloane) intdlnite in alte limbaje deprogramare sunt eliminate.o robustete, elimina sursele frecvente de erori ce apar in programare prin eliminarea

    pointerilor, administrarea automatd a memoriei qi eliminarea fisurilor de memorieprintr-o procedurd de colectare a 'gunoiului' care rul.eazd in fundal. Un programJava care a trecut de compilare are proprietatea ca la execulie sd nu "cadisistemul".. complet orientat pe obiecte - elimind complet stilul de programare procedural; sebazeazd pe incapsulare, mogtenire, polimorfi srn. ufurinlS in ceea ce privegte programarea in refea. securitate, este cel mai sigur limbaj de programare disponibil in acest moment,asigurdnd mecanisme stricte de securitate a programelor concretizate prin:verificarea dinamici a codului pentru detectarea secvenlelor periculoase,impunerea unor reguli stricte pentru rularea programelor lansate pe calculatoareaflate la distanti etco este neutru din punct de vedere arhitecturale porlabilitate, cu alte cuvinte Java este un limbaj independent de platforma delucru, aceeagi aplicalie ruldnd, Iiri nicio modificare, pe sisteme diferite cum ar fiWindows, UNIX sau Macintosh, lucru care aduce economii substantiale firmelorcare dezvoltd aplicatii pentru Internet.Sloganul debazd, este: "Write once, run anywhere"In func{ie de modul de executie al programelor, limbajele de programare seimpart in doud categorii:

  • 8/13/2019 UNIT 5 - Programming Languages

    6/11

    Ncasu Iulia Veronica Unil 5 - Programming languageso interpretate: instruc{iunile sunt citite linie cu linie de un program numit interpretorgi traduse in instructiuni maginS; avantaj: simplitate; dezavantaj: vitezl deexecutie redusa;o compilate: codul sursd al programelor este transformat de compilator intr-un codce poate fi executat direct de procesor; avantaj: execufie rapida; dezavantaj: lipsaportabilitdlii, codul compilat intr-un format de nivel scdzut nu poate fi rulat decdt

    pe platforma pe care a fost compilat.Programele Java sunt atdt interpretate cdt gi compilate.Codul de octeli este diferit de codul maqinS. Codul maqind este reprezentat de o

    succesiune de 0 si 1; codurile de octe{i sunt seturi de instructiuni care seamdni cu codulscris in limbaj de asamblare. Codul magind este executat direct de cdtre procesor gi poatefi folosit numai pe platforma pe care a fost creat; codul de octe{i este interpretat demediul Java qi de aceea poate fi rulat pe orice platformd care foloseqte mediul de execufieJava.b) ,,Nivelul"unui limbaj este apreciat prin pozitia pelimbajul recunoscut de microprocesor (limbajprogramatorului (limba romdnd, limba englezd etc.).Un limbaj de nivel scazut este foarte apropiat de magin6, el manipuleazd cuelemente de nivel hardware, fizic, cum ar fi: registru, microprocesor, loca{ie de memorie,port de intrareiiegire etc.Un limbaj de nivel inalt sau foarte inalt manipuleazd cu concepte apropiate delimbajul natural, concepte de nivel logic, cum ar fi: coleclie de date, nume de operalie(sort, writeln, open), variabile, constante (asemindtoare ca infeles cu cele dinmatematicd).

    Cu ajutorul unui limbaj de nivel inalt programatorul se face mult mai uqor infelesde citre calculator . Uneori o singurd linie de program scrisd cu un astfel de lirnbaj poateechivala cu sute de linii de program scrise in limbaj maqind. Deci din punct de vedere alreducerii timpului de realizarc al unui program gi al siguran(ei in funcfionare (absenlaerorilor de programare) este de preferat un limbaj de nivel cdt mai ridicat (inalt sau foarteinalt). In schimb, pe mdsurd ce limbajul are un nivel mai ridicat execufia programuluiconceput cu ajutorul siu va fi mai lenti, dec6t a unui program ce realizeazd aceleagiopera{ii dar este scris in limbaj de asamblare.O altd diferen{d esen{iald intre cele doud tipuri de limbaje o reprezintdportabilitatea, adici posibilitatea transferdrii programelor pe un alt tip de magind dec6tcea pe care au fost construite. Din acest punct de vedere limbajul de asamblare esteneportabil deoarece el este specific microprocesorului. Programele realizate pe un tip demagind trebuie rescrise integral pentru noul tip de maginS, folosind un nou set deinstruc{iuni - care, de obicei, diferi foarte mult. Lucrurile stau altfel cu programeleconcepute cu ajutorul unui limbaj de nivel inalt, deoarece acestea sunt detagate demagind. Intre un astfel de program qi calculator se interpune compilatorul (sauinterpretorul) care rezolvi corect transformarea figierului-sursi in figier-executabil.Limbaje procedurale - neproceduraleCele doud tipuri de limbaje, procedurale gi neprocedurale, se diferenliazd prinnivelul de organizare (structurare) a unui program Lirnbajele neprocedurale suntconcepute pentru a g6ndi un program la nivel de instruc{iune, pe cdnd cele procedurale,obligd programatorul sd conceapd programe la nivel de bloc. Intr-un limbaj procedural

    care o ocupd pe scara constituiti demaqini) qi limbajul nafural al

  • 8/13/2019 UNIT 5 - Programming Languages

    7/11

  • 8/13/2019 UNIT 5 - Programming Languages

    8/11

    Neaeu lulia Veronica Unit 5 Programmiug lunguagesGRAMMAR SPOTLIGHT

    AdverbsAdverbs sre those parts of speech that modify or add to the meaning of verbs,adjectives, other adverbs, prepositional phrases, complete sentences or even nounsmodifying: o A verb: Kerry sung that song beautifullv.. An adjective: The problem wus extre@-d [fu. An adverb: Mary understood us verv well.. A prepositional phrase: Her watch wus completelv out of order.

    o A complete sentence: Strangelv enouglt, she left without saying a word.o A noun: The girl over there is my sister.Forms of adt erbs

    . Individual words: here, soon, then, when. Compound words:l. made up of two dffirent parts of speech: abroad, anywhere2. made ap of an adjective/noun * tlre suffm -ly: badly, hoarlya. udjectives ending in -e, retain e and then -ly is added: extreme- extremely; nice - nicely

    b. adjectives ending in -le drop -e and add -y in the udverb:capable - capably; gentle - gentlyc. adjectives ending in -l preceded by a vowel, retuin I and add -ly: final - jinally; usual - usuallyd. adjectives ending in -ll just add -y: fall - folly; dull - dullye, adjectives ending in -y chonge y to I and then add -11,; sssy-easily; hoppy - happilySometimes, the -ly adverbs have s different meaning from tlteir correspondingadjectives.c CLOSE - "quite", "near"; CLOSELY - descriptive asee.g.: He came g ryto getting 100%.This girl resembles her mother closelv.o DEEP - 'To, down" or "into" (it may be used either literally or figuratively);DEEPLY - "very greatly" (ased metaphorically of degree)e.g.: He went deep into the woods.She felt his betrayal d99pb.o FREE - "ruithoat payment"l FREELY - "in a free manner" or "l[/illingly","readily"e.g.: It cost me notling. It was tee.I feel that I can speak fuly. (without hiding anything; openly)o HARD - ux)ith great effirt/great force", "tvith great attention"l HARDLY -" alnt o st no/n ot/no n e./nev e r e tc. "r "p r o b a bl1, no t "

  • 8/13/2019 UNIT 5 - Programming Languages

    9/11

    Neasu Iulia Veronica Unit 5 - Programming languagese.g.: You huve worked very hsrd.

    IAe can hardh, walk.. HIGH - "et o great distance from ground--level, sea-Ievel etc."; HIGHLY -"very muchttr "utitlx approvalt'e.g.: The plane was flying hieh in the sky.He speaks very hishlv of you.o JUST - "exactly/precisely", "very recently"; JUSTLY - uin a fair or reasonablemenner"e.g,: Our friends have iust arrived.She was quite iUgllyblamedfor the accident.. LATE - "after the expected or usual time", 'far into the day or night"lLATELY - "recently"e.g.: He arrived late for the interview.

    Have you met them latelt?o RIGHT - "exactly", "immediately", "completely", "conectly"l RIGHTLI'-"accurately"e.g.: I waitedfor her 1lgfuhere.They riehtlv assumed that he was guilty.. SHARP - "punctually", "abruptly", "quickly"l SHARPLY - uin a sharpmannerttr " distinctly t'e.g.: l(e left the club at 11 o'clock sharu.Opinions are sharplv divided on this mstter.Tvpes of adverhs

    o Adverbs of mannerc Adverbs ofplace. Adverbs of time. Adverbs ofdegreeIruegular comDsrison of adverbswellbadly.fo,fa,

    betterworsefartherfurther

    bestworstfurtltestfarthest

    The position of adverbslVhen s sentence contains more than one kind of adverb, the usaal ordershould be:Manner Place time

  • 8/13/2019 UNIT 5 - Programming Languages

    10/11

    Neagu Iulia Veronica Unit 5 - Programming languagesEXERCISES

    I. Replace each adjective with an adverb:e.g.: boastful - boastfully1. The ballerina moved around very .. ... (graceful)2.David .... (easy) won the first race.3. I don't know . ... (exact) how much money he makes.4.I .. . . (honest) don't know what John told his sister.5. The singer of the band sang very .. .. (bad) during the concert.6. My friend Tom always speaks very .. ... (loud)7. You speak English very ... .. (good)8. These days I am so busy at work that I . . . ...... .. . (rare) have time to go out.9. Sometimes I like to spend the day just lying in bed . .. .. (lazy)10. The police officer made sure that she got home ..... (safe)II. Each sentence has an underlined word. Your task is to decide whether the word is anadverb or an adjective:1. Be careful The iron is very hot.2. A microwave can cook food fast.3. June sang very loudly.4. This bacon is lovely.5. Joe dresses very infonnallv.6. She's a very strange woman.J.I'm free tomorrow. Shall we meet at 5?8. Jane is very helpful if you have a problem with your computer.9. Sam walks very shakily, because he's getting old.l0.l get up early every morning.I 1. It is a fast car.12. He is a better swimmer than me.13. He reached deep into his pockets.14. He swims better than me.15. He works hard.16. We found the people friendly.17. He drove some of them mad.18. This made everyone late.19. We shall leave the room empty.20. He turned the comer well.III. For each sentence, choose the best word or phrase to complete the gap from thechoices below:l. Thanks for the weekend. We had .. .. a wonderful time.2.The weather at the beach on Saturday was .. .. gorgeous.3. Try that restaurant. The food is .... marvelous.

    10

  • 8/13/2019 UNIT 5 - Programming Languages

    11/11

    Neasu Iulia Veronica Unit 5 - Programming languages4. I was ... annoyed when he said that.5. He told me alan .... unbelievable story.6. You probably feel quite cold today but actually, fifteen degrees is ........... hot forEngland in October.7. What they told the police was .. .. untrue.8. Both sisters were . ... brilliant sfudents.9. That's a wonderful ring. It must have been . ... expensive.10. I need to sit by the fire. I'm freezingI L That cheap umbrella I bought was .. .. useless. It broke the frrst time I used it.12. You're talking .... rubbish Of course I don't believe youl. a) so2. a) such3. a) such4. a) much5. a) completely6. a) simply7. a) extremely8. a) relatively9. a) really10. a) rather1 1) a) veryl2) a) rather

    b) suchb) extremelyb) veryb) absolutelyb) extremelyb) prettyb) veryb) totallyb) absolutelyb) whollyb) tullyb) extreme

    c) veryc) absolutelyc) teniblyc) totallyc) nearlyc) completelyc) totallyc) almostc) simplyc) absolutelyc) utterlyc) quite

    d) absolutelyd) awtullyd) simplyd) extremelyd) veryd) absolutelyd)ratherd) whollyd) totallyd) veryd) extremelyd) absolute

    ll