exam

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

special words issues

(while, class, for) most statements with these special words always terminate in the same way, which makes it difficult to determine which state is being ended (end if, end) better at this ADA FORTRAN 95. Using more reserve words can improve readabilty

type checking

* is simply testing for type errors in a program, either by the compiler or during program execution. very important for reliability because run-time type checking is expensive, compile-time checking is more desirable; the earlier the errors are detected the less expensive to repair it. * We need to make sure the types of the operands (or arguments) of an operation are compatible Operations are compatible.

How can user-defined operator overloading harm the readability of a program?

By using the same operator for multiple uses (+) adding number or concatenated strings is helpful reducing the number of unique symbol but can detract readability and Type Checking is an important because the earlier errors in program are detected, the less expensive it is to make the required repairs.

types of programming languages (4)

Imperative (c, c++, java) Functional (Lisp) logic Object Oriented

What are the arguments for and against Java's implicit heap storage recovery, when compared with the explicit heap storage recover required in C/C++? Consider real-time systems.

Implicit eliminates the creation of dangling pointers. Disadv: cpu-time to do recovery, sometimes when there's plenty of heap storage so recovery isn't necessary. in Java there is not dangling pointer because there is not free( ); function to free memory or unallocated it when is allocated.

Reasons for Studying Programming Languages

Increased capacity to express ideas. Improved background for choosing appropriate languages. Increased ability to learn new languages Better understanding of the significance of implementation Better use of languages that are already known Overall advancement of computing

Why is it useful for a programmer to have some background in language design, even though he or she may never actually design a programming language?

It is useful for a programmer to have some background in language design because it increased capacity to express ideas, improved background for choosing appropriate languages, increased ability to learn new languages, better understanding of the significance of implementation, better use of languages that are already known and overall advancement of computing.

Strings

Must be represented as an array of characters, Operations: remove, insert, concatenate, tokanize, slice, I/O, is empty, substring, search, assignment, comparison (< > => <= == !=

variable attributes

Name type Address value scope lifetime

cost

The cost of a programming language is a function of many of its characteristics: training programmer to use the language writing programs in that language compilation execution time implementation. Expensive or runs on expensive hardware Maintainability testing/debugging

Why is type checking the parameters of a subprogram important?

Type checking is basically testing for type errors in a program. When the parameters doesn't match the type, then the language is less readable. Furthermore, failure of type checking has led to lots of program errors.

reliability

a program is said to be reliable if it performs to its specifications under all conditions: exception handling type checking, readability and writability * pointers can detract from reliability

variables

an abstraction of a memory cell that can hold some values and can be changed there are 6 attributes for each variable

explicit heap dynamic variables

are nameless (abstract) memory cell that are allocated and deallocated at run-time with instructions written by the programmer. can only be referenced by pointers or reference variables ( int *intnode // creates pointer) (intnode = new int;// creates the heap dynamic variable) (delete intnode deallocates)

design issues

are names case sensitive is there a maximum length is there a connector are the special words of the language reserved words or keywords

intrinsic attributes

are synthesized attributes of leaf nodes whose values are determined outside the parse tree

denotational semantics

are the most rigorous and most widely known formal method for describing the meaning of programs. based on recursive function theory

static variables

are those bounded to memory cells before program execution begins and remains bound to the same memory cell until program execution terminates ( static public int number;) in java

stack dynamic variables

are those whose storage binding takes place when their declartion statement are elaborated but are statically bound.. when execution reached the code to which the declaration is attached

special words

are used to make programs more readable by naming actions to be performed, some are reserved words or keywords

readability and writability

both can influence reliability. the easier a program is to write the more likely it is to be correct. programs that are difficult to read and difficult both to write and modify

dynamic vs static scoping

both uses stack, static is better in readability and its more flexible to call functions

narrowing converstion

converting one type to another where the new type doesn't include all the values of the old type (double to float) float larger range

widening conversion

converting one type to another where the new type includes all of the values of the old type (integer to float) integer smaller range

implicit heap dynamic variables

created on the heap with out explicit operations, only when assigned to values. HEAP POINT down STACK POINT UP

tuple

data type similar to a record except that the elements are not named

operational semantics

describes language construct in simple, obvious and unambigouos intermediate steps describes the meaning of a statement

explicit vs implicit binding declation

explicit is a statement in a program that list variable names and specifies that they are of a particular type, Implicit is a means of association of variables with types through default conventions

rules for static scoping (symbol reference)

find it in the block or local if its not there then is in the dynamic block, this also called lexical scoping

rules for dynamic scoping (symbol reference)

first look for a local definition of a variable name, if its not found, we look up the calling stack for a definition (variable name exist only when executing after that does not exist)

whats the difference between stack dynamic and fixed dynamic arrays

fixed stacks dynamic dimensions sizes are known at compile time to make more efficient and to reduce time and to optimize access to array FORTRAN use static arrays. wont go away java uses heap arrays int [][][]= new int [n1] [n2][n3];

reserved words

have certain meaning and cant be redefined, always the same (if, then, for)

key words

have different meaning in context, and they can be redefined ( real, real integer, integer real)

short circuiting

having a result without evaluating all operands

Aliasing

having two or more distinct names that can be used to access the same memory cell. very dangerous. some language allow it. exp. Pointers. can be used to overcome deficiencies in the language data extraction facilities. can reduced reliability

Tokenizing

identifying words/Symbols described with a regular expression processed with a finite state machine

when a language is said to be strongly type

if all type of errors are detected and caught : python

static vs dynamic binding time

if it occurs before run time begins and remains unchained througthout the program execution then is said to be static, if it occurs during run time or can change in the course of the program execution then its said to be dynamic

Orthogonality

in a programming language means that a relative small set of primitive constructs can be combined in a relatively small number of ways to build the control and data structures of the language; every possible combination is legal and meaningful

writability

is a measure of how easily a language can be used to create programs for a chosen problem domain

preprocessor

is a program that processes a program immediately before the program is compiled

name

is a string of character used to identify some entity in a program: variables, functions, methods, constants, classes, programs

binding

is an association between an attribute and an entity

Attribute Grammar

is an extension to a context grammar ( add attributes to a grammar to add context

coersion

is an implied conversion of one type to another widening vs narrowing

feature simplicity

is having more than one way to accomplish a particular operation. can affect readibility

address

is the machine memory address with which it is associated

lifestime

is the time during which the variable is bound to a specific memory location until unbound from it

type

it specifies set and range of values and operations applied to those values

issues with strings

length, case sensity

expressitivity

means that a language has relative convenient , rather than cumbersome, ways of specifying computations. exp. in C count++ is more convenient and shorter than (count= count + 1), also (and and then) or (for and while)

abstraction

means the ability to define and then use the complicated structures or operations in ways that allow many of the details to be ignored.

Functional languages

offer a good combination of simplicity and orthogonality (LISP) computations are made primarily by applying functions to given parameters. java c c++ are imperative languages that computations are specified with variables and assignment statements.

static array

range is bound and allocated before run time advantage array efficency

What is the disadvantage of having too many features in a language?

reduces readability. * It tends to lead to knowing only a subset. *It also means that a programmer may not be familiar with all the features. This may lead to an abuse of some, disuse of others and even an accidental use of an unknown feature.

fixed heap dynamic array

same as stack fixed after storage is allocated, but done during execution, storage allocated from heap instead.. advantage is array flexibility

reference type

similar to a pointer but instead of referring an address in memory referes to an object or a value in memory

static semantic

state the language type constrains, analysis check is done at compile time

exception handling

the ability of a program to to intercept run-time errors as well as other unusual conditions detectable by the program ( not available in C and Fortran)

Fixed stack- dynamic array

the array size is know at compile time and cannot change. advantage is space efficiency

advantages of orthogonality

the more orthogonal the design of a language; the fewer exceptions, the fewer exceptions means higher degree of regularity, which makes the language easier to learn, read and understand. too much can cause problems. (ALGOL 68) and can lead to unnecessary complexity

optimization

the name giving to the collection of techniques programmer use to decrease the size and increase the execution time of the code they produce

overall simplicity

the overall simplicity of a programming language strongly affects tits readability. A language with large number of basic constructs is more difficult to learn than one with a smaller number

deallocation

the process of placing a memory cell that has been unbounded from a variable back to into the pool of available memory

scope

the range (or set) of program statements where a variable is visible , valid and accessible (spatial)

stack dynamic array

the size and bound are not known until run time , but still doesn't change

binding time

the time at which binding takes place and can taake place at: design time implementation time compile time load time link time or run time

Parsing

translate into program statements grammar describe the semantics parse with a push down Automata PDA Creating a parse tree

compilation

translating the program into machine language (compiler) tokenizing Parsing

overloading

two methods with the same name. but behaves differently. using the same operator for multiple uses (+) adding number or concatenated strings is helpful reducing the number of unique symbold but can detract readability

pointers

two operations dereference: go to address reference: take the address of

primitive types

types that are not defined in terms of other types: booleans, char, int, double, float, short, long, long double, unsigned int, byte

What are the arguments for and against representing Boolean values as single bits in memory?

using a single bit instead of an entire byte will conserve memory

pointer

variable that has a range if values that consist of memory addresses and a special value NIL

operator overloading

when a single operator symbol has more than one meaning, this can reduce readibility

allocation

when a variable is bound to a memory cell and somehow must be taken from a pool of available memory

arrays

when we create arrays we need to be able to to find the location of a reference to the array such as A[I][J][K]


Kaugnay na mga set ng pag-aaral

Chapter 18: Emotional and Social Development in Late Adulthood

View Set

NCLEX 10000 MUSCULOSKELETAL DISORDERS

View Set

Exprimer son opinion en francais

View Set

ACCT 211 Ch6 - Cash, Fraud and Internal Controls

View Set

economics chapter 7 Measuring the Aggregate Economy Quiz

View Set

Потребление и сбережение

View Set

Ch 26 - Phylogeny and the Tree of Life

View Set