CST223 Concepts of Program Language

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

What paradigm is Scheme

Functional

The first Object Oriented Language was ________________.

Simula

What programming language has the most consistent approach to OOP?

Smalltalk

On what is the Functional programming paradigm based?

The functional paradigm is based on the abstract notion of a function as studied in the lambda calculus.

What does "Referential transparency" mean for a function in a functional programming language?

The property whereby a function's value depends only on the values of its arguments (and nonlocal variables)

What is the difference between syntax and semantics of a programming language?

The syntax of a programming language is in many ways like the grammar of a natural language The semantics, or meaning, of a language is much more complex and difficult to describe precisely

Define "syntactic sugar."

The term syntactic sugar is used to refer to any mechanism that allows the programmer to replace a complex notation with a simpler, shorthand notation.

What are the 3 properties of an Imperative programming paradigm language?

The three properties that characterize imperative languages are the sequential execution of instructions, the use of variables representing memory locations, and the use of assignment to change the values of variables.

What does "finger typing" mean?

This excess work requirement, in turn, hampers programmer productivity

Moore's Law

Transistor capacity doubles every 18 months

Early dialects of Lisp were dynamically scoped, while Scheme and Common Lisp are statically scoped. True or False.

True

Are types in Scheme checked at compile time or runtime?

Types of values are not checked until necessary at runtime

What does modus tollens mean (not the Latin, but a meaningful English translation)?

a mode of reasoning from a hypothetical proposition according to which if the consequent be denied the antecedent is denied (as, if A is true, B is true; but B is false; therefore A is false)

What is a computer programming language?

a notation for communicating to a computer what we want it to do

In functional programming, functions are __________________________________.

a rule that associates to each x from some set X of values a unique yfrom a set Y of values.

What was a major design objective of the COBOL programming language?

a significant language because of its use in industry, and because of the large number of legacy applications

Describe the following Scheme functions: cdr

returns the tail of the list (minus the head)

Object-oriented programming languages satisfy three important needs in software design. Identify those needs.

reuse, modify program behavior with minimal changes, independence of different components

First programming language

ASM

Languages descended from algol

C, Java, C#

Give an example of a pure Object Oriented Programming Language.

Smalltalk is a pure object-oriented

Define Static Binding.

Static Binding (also called Early Binding):process of determining at compile time which implementation of a method to use by determining the object's actual class

By default C++ uses ____________ binding.

Statik binding

On what is the Logic programming paradigm based?

The logic paradigm is based on symbolic logic.

In pure functional programming, there are no _________ and no ____________.

loops, variables

What are 3 criteria that we can use to determine if a programming language is successful?

1. Achieves the goals of its designers 2. Attains widespread use in an application area 3. Serves as a model for other languages that are themselves successful

What are 3 characteristics of functional programming languages?

1. All procedures are functions and clearly distinguish incoming values ( parameters) from outgoing values (results). 2. In pure functional programming, there are no assignments. Once a variable is bound to a value, it behaves like a constant. 3. In pure functional programming, there are no loops. Instead, loops are replaced by recursive calls

What were 2 design goals for C++?

1. Support for good program development in the form of classes, inheritance, and strong type-checking 2. Efficient execution on the order of C or BCPL 3. Highly portable, easily implemented, and easily interfaced with other tools

What is the JVM? How does Java use it?

A Java virtual machine (JVM), an implementation of the Java Virtual Machine Specification, interprets compiled Java binary code (called bytecode) for a computer's processor (or "hardware platform") so that it can perform a Java program's instructions.

What does modus ponens mean (not the Latin, but a meaningful English translation)?

A valid form of argument in which the antecedent of a conditional proposition is affirmed, thereby entailing the affirmation of the consequent.

____ was the first programming language to have a formal specification.

ALGOL

What is meant by "applicative order evaluation"?

All subexpressions are evaluated first so that a corresponding expression tree is evaluated from leaves to root

Immutability

An element cannot be changed

What is Data abstraction? Give a couple examples.

Data abstractions simplify for human users the behavior and attributes of data, such as numbers, character strings, and search trees. Basic abstractions collect the most localized machine information. Structured abstractions collect intermediate information about the structure of a program

The basic data structure in Scheme is a _______________.

Basic data structure in Scheme is the list

What are some reasons why functional programming languages have not become mainstream?

Because of their semantics, such languages at first were interpreted rather than compiled, with a resulting substantial loss in execution speed.

Side effect

Changing data outside of scope

Programming language makers

Compilers or interpreters.

What is Control abstraction? Give a couple examples.

Control abstractions simplify properties of the transfer of control, that is, the modification of the execution path of a program based on the situation at hand. Examples of control abstractions are loops, conditional statements, and procedure calls

How does C++ implement dynamic binding?

Declaring a method as virtual is not sufficient to enable dynamic binding - Object must be either dynamically allocated or otherwise accessed through a reference

Define Dynamic Binding.

Dynamic Binding (also called Late Binding): the compiler doesn't decide the which method will be called. The determination is done at runtime.

Why are functional languages popular

Ease of concurrency

When the word efficiency is applied to a programming language, what is typically meant?

Efficiency: usually thought of as efficiency of the target code. Efficiency of execution. writability was less important than efficiency

Finger typing

Explicitly declared type

How did FORTRAN try to achieve efficiency?

FORTRAN was specifically designed to allow the programmer to generate compact code that executed quickly

is the following a Prolog Facts, Rules, or Queries. dinner(pizza).

Facts

is the following a Prolog Facts, Rules, or Queries. food(burger).

Facts

is the following a Prolog Facts, Rules, or Queries. food(pizza).

Facts

is the following a Prolog Facts, Rules, or Queries. food(sandwich).

Facts

is the following a Prolog Facts, Rules, or Queries. lunch(sandwich).

Facts

Why is algol important

First language with a grammar

First high level language

Fortran

Syntactic Sugar

Language shortcuts that compile to a different syntax.

Does Haskell support lazy evaluation?

Haskell is a lazy language,

Scheme is a dialect of what language?

Higher order functions and expressions whose values are functions are made even more useful in ML through a process known as currying

What does currying mean in functional programming?

Higher-order functions and expressions whose values are functions are made even more useful in ML through a process known as currying

What does "Programmer efficiency" mean?

How quickly and easily can a person read and write a program in a particular language?

Programming Language

Human interface to a computer

Give 2 examples that demonstrate modus tollens.

If P, then Q. Not Q. Therefore, not P.

Give 2 examples that demonstrate modus ponens.

If P, then Q. P. Therefore, Q, for all x, if x is a mammal then x has two or four legs

What is a "side effect" in a programming language?

In programming a side effect is when a procedure changes a variable from outside its scope.

What are 3 ways to represent arithmetic expressions?

Infix (A + B), Postfix (A B +), Prefix (+ A B)

Why are functional languages not popular

It's not taught first

is the following a Prolog Facts, Rules, or Queries. meal(X) :- food(X)

Rule

Data abstraction

Representing data in a meaningful way

What does LISP (for the programming language) stand for?

LISt Processing

In what programming paradigm does Scheme fit?

Lisp

Programming language translators can be divided into 2 categories. What are they? What are some difference between them?

Low-Level and High-level

Assembly

Machine code with mnonics.

Design objective of Cobol

Natural language

Using those criteria, can we say ALGOL was successful? Why?

Orthogonality was a major design goal of Algol68, and it remains the best example of a language where constructs can be combined in all meaningful ways. Algol60's designers incorporated block structure, structured control statements, a more structured array type, and recursion.

Identify 3 currently widely used programming languages that are descended from ALGOL.

Pascal, Modula2, Ada

What is considered to be the first true high-level programming language?

Plankalkül

Design objectives of C++

Portability, backwards-compatability

What kinf of programming language is Haskell

Purely functional.

is the following a Prolog Facts, Rules, or Queries. meal(X), lunch(X)

Queries

Functional languages don't use loops

Recursion instead

Syntax vs. semantics

Syntax is structure, semantics is meaning.

Smalltalk has both instance messages and class messaged? True or False

TRUE

In C++, what is the dreaded diamond? Why do we dread diamonds?

The "dreaded diamond" refers to a class structure in which a particular class appears more than once in a class's inheritance hierarchy

Criteria for determining success of a language

Widely used, achieved goals, had descendents.

Is Haskell fully curried

Yes

Describe the following Scheme functions: car

accesses the head of the list

Describe the following Scheme functions: cons

adds a new head to an existing list

Why have some functional programing languages become popular today?

advances in compilation techniques for functional languages, plus advances in interpreter technology in cases where compilation is unsuitable or unavailable, have made functional languages very attractive for general programming.

What were 2 design goals for Python?

allow Python to act as a bridge between systems languages such as C and shell or scripting languages such as Perl. Consequently, he set out to make Python's syntax simpler and cleaner than that of ABC and other scripting languages. He also planned to include a set of powerful built-in data types, such as strings, lists, tuples (a type of immutable list), and dictionaries

Does Scheme normally use applicative order evaluation or lazy evaluation?

applicative order -All subexpressions are evaluated first

What is Assembly Language?

assembly language was developed for the purpose of useing mnemonic symbols for the instruction codes and memory locations

Prolog implements a (depth-first or breadth-first) ____ search strategy.

depth-first

What is the general accepted method for defining programming language semantics?

description, possibly idealized, of a machine or processor for that language

What type of programming language is Haskell?

functional language

A major difference between imperative programming and functional programming is the concept of a _____________.

functional programs lend themselves very well to parallel execution, functional languages have ironically acquired an efficiency advantage over imperative languages in the present era of multicore hardware architectures

What is Moore's Law?

hardware speeds increase by a factor of 2 every 18 months

What makes ALGOL such an important programming language?

it was the first programming language which gave detailed attention to formal language definition

What makes Java not a pure object oriented language?

java is purely object-oriented, with one exception:- Scalar data types (primitive types) are not objects

In First-order predicate calculus, what is an axiom?

logical statements that are assumed to be true and from which other true statements can be proved

The first stored program was in what language?

machine language

How does assembly language differ from binary machine code?

mnemonic symbols represents an advance on binary machine codes

What does "lazy evaluation" mean?

no value is computed unless it is actually needed for the computation of a program.

Functional programming languages don't use loops. Instead, they use ___________.

recursion

Are Horn clauses a subset or a superset of first-order predicate calculus?

subset

If we say that a programming language support "writability," what do we mean?

the quality of a language that enables a programmer to use it to express a computation clearly, correctly, concisely, and quickly

What does language Regularity mean?

the quality or state of being regular

In First-order predicate calculus, what are inference rules?

ways of deriving or proving new statements from a given set of statements

Java was designed with an emphasis on ___________ and _____________.

write once, run anywhere

Is Haskell fully curried?

yes


Set pelajaran terkait

Environmental Biology ~ Chapter 2

View Set

AG-Chapter 12.4 Party Identification

View Set

Peptic Ulcer disease 114- exam 1

View Set

AP Classroom APUSH Unit 5 Progress Check

View Set

International Markets and Derivatives: Futures, Forwards, Swaps, and Options

View Set

Module 3 (Elizabethan Literature) - Week 5 (Queen Elizabeth)

View Set