Programming Languages Test 1

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

In what language is most of UNIX written?

C

What language should be used in the scenario that all applications are used for the operation of the computer?

C

What language should be used in the scenario that some applications have a lot of floating-point arithmetic computations and require only arrays as the major data structure, but others are used to compute payrolls and also to generate reports?

C# or Ada

Provide one or more examples for Imperative Languages

C, Pascal, PL/1, COBOL, and FORTRAN

What language should be used in the scenario that all applications are used to compute payrolls and also to generate reports?

COBOL

What language should be used in the scenario that all applications have a lot of floating- point arithmetic computations and require only arrays as the major data structure?

FORTRAN

Which produces faster program execution, a compiler or a pure interpreter?

The compiler produces a faster program execution because the coding is already converted to machine language and just needs to be executed. The Run-time environment will slow down the execution process.

How can knowledge of programming language characteristics benefit the whole computing community?

They can help programmers efficiently write programs to solve problems in a particular application domain. They can transfer the characteristics to properly implement them in other languages.

How can the awareness of a wider variety of programming language features reduce the limitations that the control structures, data structures, and abstractions of a programming language can impose on a programmer?

a. By choosing a programming language with the best features to solve a particular problem. b. By simulating features from one language in those that do not have them. Example: the string and fixed decimal basic data types in PL/1 can also be simulated in C/C++

What language was the first to support the three fundamental features of object-oriented programming?

smalltalk

What are the three fundamental features of an object-oriented programming language?

Data abstraction, inheritance, and dynamic binding.

What does a linker do?

The linker that combines object files and their library functions create an executable file and adjusts the addresses.

What programming language has dominated business applications over the past 50 years?

COBOL

Provide a description of the functions of the linker and loader.

Compile, Link, Load. Today loader is a part of OS. Loaders allocate memory locations for program in virtual memory. It then loads the program executable file in memory and then initializes the resistors.

What are the three general methods of implementing a programming language?

Compiler implementation, Pure interpretation, and Hybrid implementation.

What is the difference between a language interpreter and a compiler?

Compiler translates source code to executable code, interpreter executes the executable code.

Provide one or more examples of Object-Oriented Programming Languages

C++, Eiffel, and Java

What programming language has dominated scientific computing over the past 50 years?

FORTRAN

What construct of a programming language provides process abstraction?

Functions in C++

What language should be used in the scenario that all applications are embedded in HTML documents and are interpreted by a browser that displays the documents?

JavaScript

Provide one or more examples for Functional Languages

LISP, Scheme, Meta Language, and Miranda

What are the three things that characterize a programming language?

Lexical Elements, Syntax, and dynamic semantics

Provide the major components of a compiler with a brief description of their functions?

Lexical analyzer (scanner) (reads source code character by character and puts into words then classifies them by token), Syntax analyzer (parser), Semantics routines, intermediate code generator, and code generator.

What language should be used in the scenario that all applications are embedded in HTML documents and are interpreted on the server before the document is sent to a requesting browser?

PHP

What language should be used in the scenario that all applications are common Gateway Interface (CGI) programs for the World Wide Web?

Perl

What are the most commonly used languages in the scientific and business domains?

Scientific: FORTRAN Business: COBOL

Provide the two types of semantics (each with a brief description) of a programming language?

Static specify rules of syntactic structures (number of arguments in a function should be the same as parameters) and dynamic semantic is about how syntactic structures are converted to machine language.

What are the major types of statements (with their meanings) of an imperative language?

1. Input Statements 2. Output Statements 3. Assignment Statements 4. Two-way selection structure (used to execute actions based on the result of the condition). 5. one-way selection (used to execute action if condition is true). 6. counter-controlled iteration structure (used to repeat execution of one or more statements a fixed number of times). 7. logically-controlled iteration (used to repeat execution of one or more statements as long as condition remains true). 8. multi-way-controlled selection structure (used to choose a course of action based on true value of two or more conditions).

Provide the characteristics of the following high-level programming language categories: imperative languages, functional language, logic programming languages, object oriented programming languages?

Imperative Languages have the following major features: 1. variables are used to represent memory locations 2. assignment statements are used to store values in memory locations 3. use of iteration as major form of repetition 4. an algorithm is specified in great detail and the specific order of execution of the instructions/statements must be included. Functional (Applicative) Languages are characterized by the following: a. computation is mostly done by applying functions to arguments b. Variables (symbols) do not necessarily represent memory locations and can be bound to values (atoms or lists) by special forms or when a function is called. c. recursion is the primary means of repetition Logic Programming Languages are characterized by the following: a. use of logical statements (facts and rules) to describe a program b. Programming in logic is nonprocedural because there is no way to specify in a program exactly how a result can be computed. The rules are specified in no particular order. c. computation is performed by deriving new facts from existing ones using an inference mechanism (resolution) and the rules Object-Oriented Programming Languages have the following characteristics: a. Data abstraction and information hiding: A programmer may create a class and hide from its clients the implementation of that class (information hiding) and a client of a class need not know how a class is implemented in order to use its functionality. The description of class functionality is independent of its implementation. For example, the class stack (with the methods push and pop). b. Inheritance: The definition of one class (derived class) can be derived from that of another class (base class). For example, graduate student from student, . . . etc c. Dynamic binding of the methods to the messages (function calls): a function call is bound to a function at execution time.

What language should be used in the scenario that all applications are used for game playing with symbolic manipulations of data represented as linked lists

LISP

What programming language has dominated artificial intelligence over the past 50 years?

LISP

What are the advantages in implementing a language with a pure interpreter?

Portability meaning the program can be executed on any system provided it has the run-time environment. Debugging, the program will stop on the mistake and continue to next line once resolved.

What is the name of the category of programming languages whose structure is dictated by the von Neumann computer architecture?

Procedural Languages

Provide one or more examples for Logic Programming Languages

Prolog

Provide two special-purpose languages with their characteristics?

Report Program Generator RPG is a language developed by IBM for generating reports. Some of RPG's characteristics include: •input specification (files and data) •switch specification (Boolean) •calculation and process •output specification SIMULA is language for system description and simulation with the concept of a class. Some of SIMULA's characteristics include: •A system in this case is viewed as a collection of independent entities (objects) interacting with each other. •For example, for the soda machine system, the entities could be the soda machine, the can container, and the users. •Systems are simulated by examining the life cycles of the entities of the system.

What are the major characteristics of each of the following programming domains: scientific and business applications.

Scientific: i. Need of simple data structures like arrays and matrices. ii. Their problems often require large numbers of floating-point arithmetic computations. iii. Most common control structures are counting loops and selections. Business: i. Ability to generate elaborate reports. ii. Need for precise ways to describe and store character data like strings and decimal numbers. iii. Ability to specify decimal arithmetic operations.

What role does the symbol table play in a compiler?

Symbol table is a table that contains all identifiers of a program such as name, address, value, type, lifetime, and scope. Symbol and identifiers mean the same thing.

What are the lexical elements of a programming language?

The Lexical Elements: consist of the following: a. The character set: set of all characters allowed in the text of a program. b. The rules for grouping characters into words (lexems) (For example, the rules for constructing identifiers, integer constants, string constants, . . . etc) c. The use of reserved words and keywords d. the manner in which blanks and line termination characters are handled e. How comments are written

What are the six reasons for studying the concepts of programming languages?

a. To increase the capacity to express ideas and build appreciation for valuable language features and encourage programmers to use them. b. To improve the background for choosing appropriate languages to help programmers pick the most appropriate language for a new project. c. To increase the ability to learn new languages. It is easy to learn how concepts apply to a new language when you have a thorough understanding of them. d. To gain a better understanding of the significance of implementation. Proper understanding of features aid in the debugging of a certain language. e. To better utilize languages already known. A language can become widely accepted when the people picking the languages are familiar with their concepts.


Set pelajaran terkait

ACC 298-CH 7 (Fraud and Internal Controls)

View Set

Physics Chapter 3: Refraction of Light

View Set

112-6 PEDIATRIC SKIN CONDITIONS & COMMUNICABLE DISEASES

View Set