Final: Quiz 1-6, Final: Quiz 1 - 5

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

among other things, a Regular Expression can be...

(a & c) a. the concatenation of two Regular Expressions c. a character

Lexical scoping ...

(a) can be determined by the compiler. (and) (c) is defined in terms of the textual layout of the program.

Heap storage is preferred to stack storage when ...

(a) the size of an object may vary., (and) (b) the object may outlive the function that creates it.

Alias Analysis can be used to determine when it is safe to...

(a, b, and c) a. allow access by concurrent threads b. cache values in registers c. evaluate expressions out of order

modularization has...

(a, b, and c) a. less change of came of name collision b. improved chance of data integrity c. improved compartmentalization of run-time errors

bindings may be made at...

(a, b, and c) a. runtime b. compile time c. load time

the Chomsky Language Hierarchy can be used to differentiate grammars on the basis of...

(a, b, and c) a. the level of automation required to recognize the grammar's language b. the storage required to recognize the grammar's language c. the complexity of the language that can be expressed by the grammar

Which of the following is/are trye about dynamic scoping?

(b and c) b) In general, compiled languages do not use dynamic scoping c) The bindings cannot be resolved by examining the program text.

In two's complement, the four-bit representation of zero is

0000

In two's complement, the four-bit representation of zero is ...

0000

In two's complement, a negative number's highest bit is ...

1

Creating the first FORTRAN compiler took about _________________ because ____________________.

18 staff years ///// it was the first compiler written.

Floating point numbers are generally...

4 or 8 bytes in length

floating point numbers are generally...

4 or 8 bytes in length

Polymorphism allows....

A Single subroutine to accept arguments of multiples types

Lexical scoping....

A and B (is defined in terms of the textual layout of the program. Can be determined by the compiler).

Heap storage is preferred to stack storage when...

A and C (The size of the object may vary, The object may outlive the function that creates it)

A Postcondition failure indicates a problem with ________

A callee

A precondition failure indicates a problem with ___

A caller

A precondition failure indicates a problem with _____

A caller

Dynamic dispatch is when....

A child class overrides a method in a parent and the selection is made at run time

FORTRAN

A self hosting compiler ...

Polymorphism allows....

A single subroutine to accept arguments of multiple types

Expected to be true when execution reaches them

A static analyzer is said to be precise if it allows the compiler to determine whether a program will always follow a rule

Generally, the semantic Analyzer produces the ____ used by the ____

Annotated syntax tree //// Code Generation phase of compilation

Roles of the Semantic Analyzer include...

Annotating the parse tree with any information needed by the Intermediate Code Generator.

In concurrency, multiple sections of code....

Are executed "at the same time"

Are usually disabled after debugging

Are implemented with a marco

In C and C++, asserts ...

Are usually disabled after debugging Are implemented with a macro

Variables are never used in an expression unless they have been given a value

Arithmetic operations do not overflow

A function with a non-void return type returns a value explicitly

Array subscript expressions lie within the bounds of the arrays

In dynamic scoping, two common ways to keep track of bindings are...

Association Lists and Central Reference Tables.

In C and C++, asserts...

B and C ( Are usually disabled after debugging, Are implemented with a macro)

Loop invariants are normally checked ...

Before and after each loop iteration

Loop invariants are normally checked...

Before and after each loop iteration

The fetch execute cycle is the process of fetching...

Bits from memory, decoding them as an instruction, and executing a standard operation.

Lisp uses...

Cambridge Polish Notion

Modules into which name must be imported explicitly are called.

Closed scopes

The process by which a compiler automatically converts a value from one type to another is called...

Coercion

Binding may be made at....

Compile time

A binding to an object that is no longer alive is called a...

Dangling reference

Is written in its own language

Declarative languages generally include some imperative constructs

JIT (Just in Time) Compiler is ....

Delaying compilation until the last possible moment

In dynamic scoping, the bindings are...

Dependent on calling sequences.

Languages _____ in the kinds of semantic rules they enforce

Differ greatly

The bindings cannot be resolved by examining the program text

Dynamic Scoping is a formalization of lexical scoping

Nondeterminacy

Exception Handling

A symbol table must maintain information about only one binding for a given name.

FALSE

All programming languages with nested scopes provide a scope resolution operator

FALSE

All programming languages with nested scopes provide a scope resolution operator. (T/F)

FALSE

Conservative compilers insert Dynamic Checks to undo the effects of unsafe code when it goes wrong.

FALSE

External fragmentation of a heap is when requests overflow the bounds of the stack

FALSE

Java performs all type checking at compile time.

FALSE

A Regular Expression may refer back to an earlier matching

FALSE (only 5 items that discussed)

What was the first High Level Programming Language?

FORTRAN

A processor is able to determine the type of data in memory by examining it

False

Compilation and Interpretation are so different they cannot be used together

False

Context Free Grammars can match counted lists easily

False

Different implementations of the same architecture will all have identical machine languages

False

Dynamic type checking can never be completely safe

False

Internal Fragmentation of a heal is when 2 blocks overlap

False

Once a binding is created between a name and an object, it persists until both the name and the object are destroyed.

False

Optimistic compilers insert Static Checks to undo the effects of unsafe code when it goes wrong

False

The Kleene Plus operator extends Regular Expression to the expressiveness of the Context free Grammars

False

The von Neumann, object oriented, and scripting language families are distinct and not overlap

False

IEEE 754 is a standard measuring

Floating point operations

Syntax concerns the ___ of a program, while semantics concerns its ___

Form////meaning

Reference Counting, Mark / Sweep, Copying, and Generational are kinds of ...

Garbage collection.

Correctness

Generally, the Semantic Analyzer produces the ______ used by the __________

Short-circuit operators

Have a defined evaluation order and may leave operands unevaluated

Java has what level of dynamic semantic checking?

High

A machine's macro architecture is...

How it is structured as a collection of discrete units

An implementation of a machine's architecture is ...

How the architecture is realized as a specific machine.

Annotated syntax tree//// Code Generation phase of compilation

In C and C++ , asserts ....

Which of the following is/are true about dynamic scooping

In general, compiled languages do not use dynamic scooping

Running the null job

Integer numbers can be ...

Form//// meaning

Invariants, Precondition, and Post conditions are statements about the ____of the program

In two's complement representation, there ...

Is one more negative number than positive numbers

Which one of the following best describe P_code?

It is an intermediate code

A scope hole occurs for a name when

Its binding is overriden by another declaration

A function call may be executed for ...

Its return value

True

Java performs all type checking at compile time

Which one of the following is not example of static semantic check ?

Labels on the arms of a switch statement are distinct constant

In selectively open scope modules...

Names are automatically exported but require qualification

C's dynamic semantic checking helps prevent inadvertent errors.

No, C has no dynamic semantic checking at all

A function's local variables must always be allocated on the stack

No, not necessarily depending on the language

A functions local variables must always be allocated on the stack.

No, not necessarily depending on the language.

Tape storage is useful because it is ...

Non-volatile and essentially unlimited in capacity

C has what level of dynamic semantic checking?

None, C does no dynamic semantic checking

C has what level dynamic type checking

None, C has no dynamic type checking

All of the following are phases of a compiler, __except__ ...

Numerical Analysis.

Classes are better than Modules when...

One needs multiple instances

The Kleen plus operator represents .....

One or more repetitions of a regular expressions

Most languages have ____ modules.

Open scope

A name that can refer to two or more objects is said to be

Overloaded

A regular expression is not allowed to

Recurse, even indirectly

The size of the object may vary

Reference counting, Mark /Sweep, Copying and Generalization are kinds of ...

Commonly, unintended aliasing occurs because of

Reference parameters

Commonly, unintended aliasing occurs because of..

Reference parameters

Programmers generally can distinguish ___ at the functional level

Register from main memory from peripherals

Programmers generally can distinguish _____at the functional level

Register from main memory from peripherals

Compliers try to keep as much as possible in registers because

Registers are much faster than other types of memory

Assignment operators are generally...

Right-associative, binding from right-to-left

The first assembler was written ...

in machine code directly

Recently, increases in machine performance have been because of ...

increases in the number of functional units / cores.

With Dynamic scoping, every routine

inherits binding of every routine in the calling sequence

_________ are expected to be true at the beginning and end of all subroutines

invariants

___________ are expected to be true at all "clean points" of a given body of code

invariants

In two's complement representation, there ...

is one more negative number than positive numbers

a self-hosting compiler...

is written in its own language

Saying that a programming language is Turing Comlete means ...

it has the same computational power as a Turing machine.

which _one_ of the the following doe a preprocessor do?

it performs macro expansions

which one of the following does a pre-processor do?

it performs macro expressions

the set of strings defined by a regular expression is known as its...

language

The x86 architecture is ...

little-endian

why are Central Reference Tables preferred to Association Lists?

lookup is fast because each slot is a linked list with the most recent binding in front

Right most and left most derivations from context free grammar

may produce the same parse tree. it depends on the grammar

Semantics is the ________________ as opposed to its __________________.

meaning ///// form

In a regular expression, the Kleene Plus operator represents...

one or more repetitions of a regular expression

Most languages have _______________ modules.

open scope

modules into which name must be imported implicitly are called...

open scopes

big-endian and little-endian are different...

orders for storing multiple-byte values in memory

operator precedence is...

organized into levels

Historically, the ______________ increased faster than the ______________.

processor speed ///// memory's speed

A regular expression is not allowed to ...

recurse, even indirectly.

The expressiveness of Regular Expressions may be expanded to that of Context-Free Grammars by adding...

recursion

commonly, unintended aliasing occurs because of...

reference parameters

the fastest access memory available to the processor is...

registers

compilers try to keep as much as possible in registers because...

registers are much faster than other types of memory

most of the time, the processor is...

ruling the null job (and) waiting for the user to do something

Generally, any rule requiring comparing separated items or counting items will be a ________________ check rather than a ________________ check.

semantic ///// syntactic

integer numbers can be...

signed two's complement 2, 4, 8, or 16 bytes in length unsigned

Fundamental data types include ...

signed and unsigned integers as well as floating point numbers.

nested blocks...

sometimes cause scope holes

an optimization is said to be ________ if _________

speculative //// it usually improves performance but may degrade in some cases

semantic rules may be either _______ or ________

static //// dynamic

what type or types of binding does C have?

static binding

identifying the use of an undeclared variable is an example of a _______ check

static semantic

Operator associativity is a ________________ property of a programming language's definition.

syntactic

Formal notation is used to describe a languages ____ and _____

syntax /// semantics

Languages tend to differ greatly in _________________ but often have very similar aspects of _______________.

syntax /// semantics

to avoid ambiguity in a derivation from a Context-Free Grammar...

the CFG must be defined so that in any derivation, one one parse tree can result

the Referencing Environment is...

the set of active bindings

Values have a type only in how ...

they are used

The best reason to study programming languages is

to get some background on how to understand all programming languages

C and C++ differentiate declarations and definitions

to support recursive and mutually-referential types

Symbol table information may be made available at run time

to support symbolic debugging

Numbers, identifiers, keywords, operators, punctuation marks, are different types of

tokens

Syntactical analysis converts ____ into _____

tokens/// a parse tree

a compiler...

translates a source program into a target program and then goes away

An interpreter ...

translates the source program every time it is to run.

Escape Analysis helps in determining whether heap allocation must be used instead of stack allocation. (T/F)

true

Object lifetimes and name lifetimes do not have to be the same

true

Semantic Analysis can require the presence of a return statement in a function easily

true

all patterns of bits represent legal floating point values

true

the same bits in memory might form both a legal integer and a legal floating-point number

true

Declarative programming languages

try to get away from irrelevant implementation details (and) focus on what the program should do

C, Ada, and FORTRAN are examples of ___________ programming languages

von Neumann

aliasing is...

when an object can be referred by two or more names

Context free grammars are more expressive than regular expressions

yes

Java's dynamic semantic checking helps prevent inadvertent errors

yes, that was a prime goal in the design of the language

Which of the following is/are true about static scoping?

Scope determination can be made by the compiler.

Perl, Python, and PHP are examples of __________________ programming languages.

Scripting

Resolution of overloaded names is carried out by the ...

Semantic Analyzer

Resolution of overloaded names i carried out by the ...

Semantic Analyzer.

Comparing argument list in function calls to that given in the function's declaration is an example of a ...

Semantic check

Comparing argument list in function calls to that given in the function's declaration is an example of a ....

Sematic check

Two's complement

Signed

Nested blocks...

Sometimes cause scope holes

Operators are

Special, short names for certain functions

Ada assigns a _______ to every numeric variable and _________

Specific type //// requires the user to make explicit conversions

Ada assigns a ______ to every numeric variable and _____

Specific type/// requires the suer ti make explicit conversions

Various kinds of control flow include ....

Speculation

If a language permits recursions....

Static allocation of local variables may not be used

If a language permits recursion ...

Static allocation of local variables may not be used.

Compile-time algorithms that predict run-time behaviors are known as...

Static analyzers

What type of types of binding does C have?

Static binding

False

Static semantic rules are those that can be enforced at

The three lifetime spans are...

Static, stack, heap

Pointers are never dereferenced unless they refer to a valid object

Subroutines call provide correct number and types of argument

"Design by Contract" interface specifications are _____

Syntactic, semantic, and dynamic

Compile time

Syntax concerns the _________ of a program, while semantics concerns its ________

Semantic Analysis can require the presence of a return statement in a function easily

TRUE

Static and Precise type checking ensures that a variable will always be used in a type-safe manner

TRUE

The slowest access memory available to the processor is...

Tape storage

To avoid ambiguity in a derivation of the context free grammar ...

The CFG must be defined so that in any derivation, only one parse tree can result

An Invariant failure indicates a problem with ________

The Encompassed Code

Numerical Analysis

The best reason to study Programming Language is

Aliasing can cause inefficient code because...

The compiler cannot depends on values kept in the registers

The complexity of the language that can be expressed by the grammar

The level of automation required to recognize the grammar's language

Heap storage is preferred to stack storage when

The object may outlive the function that creates it

The best programming language for any application is ...

The one your boss tells you to use The one you might learn something from The one your colleagues are using

A binding scope is....

The part of the program where it is active

The Chomsky Language Hierarchy can be used to differentiate grammars on the basis of ...

The storage required to recognize the grammar's language

Symbol table information may be made available at run time...

To support symbolic debugging.

Regular expressions are used to specify ...

Tokens formats

A compiler might generate different machine code for different implementations of the same architecture

True

A static analyzer is said to be precise if it allows the compiler to determine whether a program will always follow a rule

True

Delcaritive languages generally include some imperative constructs

True

In general, all programming languages have the same computational power. (T/F)

True

In pascal and C, all data must have names.

True

Internal fragmentation of a heap is when the allocated block is larger than the requested size

True

Optimistic compilers insert Dynamic Checks to undo the effects of unsafe code when it goes wrong

True

Semantic Analysis can match counted lists easily

True

Semantic analysis can match counted lists easily

True

Static and precise type checking ensures that a variable will always be used in a type-safe manner

True

Subtype Analysis helps in determining whether dynamic method dispatch can be avoided.

True

Subtype analysis helps in determining whether dynamic method dispatch can be avoided

True

with dynamic scoping, a symbol table must be maintained at run time

True

Floating point representation has how many representations for 0?

Two +0, -0

Floating point representation has how many representations for infinity?

Two +infinity, -infinity

Overloading is when....

Two or more different objects have the same name.

Unlike natural languages, programming languages must be ____ so that____

Unambiguous and precise// the computer knows what to do and the user knows what to expect.

An optimization is said to be __________ if ____________

Unsafe//// it might led to incorrect code in a program

2,4,8,or 16 bytes in length

Unsigned

The order of operand and function call argument evaluation is ....

Unspecified

Assertions are ....

Used to check the correctness of a program Expected to be true when execution reaches them

Assertions are .....

Used to check2 the correctness of a program

"Boxing" and "Unboxing" are used when _____ must be used together

Value types and reference types

In Java, primitive type are _____ and object types are _______

Values /// references

As there are ______ machine architecture in general use, there are _________machine languages

Very few /// very few

As there are ___ machine architectures in general use, there are ___ machine languages

Very few///very few

Most of the time, the processor is...

Waiting for the user to do something

To get some background on how to understand all programming languages

What was the first Higher Level Programming Language

Aliasing is...

When an object can be referred by two or more names

True

Which of the following is not an example of a dynamic semantic check?

an association list (A-List) is

a, b, and c -a list of key value pairs -a linked list -a list of linked lists

Bindings may be made at...

a, b, c (link time, run time, compile time)

For an object to be used, it must be reachable by

a, b, or c -being pointed to by a reachable object -existing in an active stack frame -being a global object

In the object-oriented model of computation, a program is ...

an interaction among (semi) independent entities, each with its own state and routines that modify that state

Generally, the Semantic Analyzer produces the ______________ used by the _________________.

annotated syntax tree ///// Code Generation phase of compilation

Roles of the Semantic Analyzer include ...

annotating the parse tree with any information needed by the Intermediate Code Generator. Enforcing all static rules

Regular Expressions cannot express strings that have ...

arbitrary matching pairs.

the fetch-execute cycle is the process of fetching...

bits from memory, decoding them as an instruction, and executing it

dynamic semantic checks...

cannot be enforced until runtime

lexical analysis converts ________ into _________

characters //// tokens

lexical analysis converts __________ into ____________

characters //// tokens

modules into which name must be imported explicitly are called...

closed scopes

the process by which compiler automatically converts a value from one type to another is called..

coercion

the initial goal of ALGOL included

communicating numerical procedure between people (and) realizing procedures on a variety of machines

generally only ___________ have to care about machine language

compilers (and interpreters)

Semantic analysis includes items that can not be covered by a languages

context free grammar

operator precedence is usually expressed in a programming language's...

context-free grammar

invariants, preconditions, and postconditions are statements about the _______ of the program

correctness

a binding to an object that is no longer alive is called a

dangling reference

JIT compilation is...

delaying compilation until the last possible moment

static semantic checks...

depend solely on the structure of the program and can be enforced at compile time

The front end of a compiler is concerned with ...

determining what a program means.

languages ________ the kind of semantic rules they enforce

differ greatly

Languages _________________ the kinds of semantic rules they enforce.

differ greatly in

Operator associativity is ...

either left-to-right, right-to-left, or does-not-apply.

many common processors (ARM, IA-64, MIPS, PowerPC, SPARC) are...

ether little- or big-endian

A compiler is optimistic if it applies only optimizations that re both safe and effective. (T/F)

false

A symbol table must maintain information about only one binding fora given name. (T/F)

false

Conservative compilers insert static checks to undo the effects of unsafe code when it goes wrong

false

Java performs all type checking at compile time

false

Subtype analysis helps in determining whether heap allocation can be used instead of stack allocation

false

The von neumann, object orientated, and scripted language families are distinct and do not overlap

false

a Regular Expression may refer back to an earlier matched string

false

a static analyzer is said to be precise if it allows the compiler to determine whether a program will sometimes follow a rule

false

escape analysis helps in determine whether dynamic method dispatch can be avoided

false

in pascal and c all data must have names

false

internal fragmentation of a heap is when the allocated block is too small

false

optimistic compilers insert Static Checks to undo the effects of unsafe code when it goes wrong

false

Syntax is the __________ as opposed to its ____________

form //// meaning

"Design by Contract" interface specifications are ...

formal, precise and verifiable

Values stored in memory have no particular ...

format or type, only a size

LISP, Scheme, ML, and Haskel are examples of _________ programming languages

functional

An object that outlives all of its references is known as

garbage

Floating point operations are generally executed in ...

hardware

Imperative programming languages ...

Align better with the structure of the underling hardware. (and) Focus on __how__ the program is to accomplish its function.

Every Identifier is declared before it is used

All of the following are phases of a compiler, except

The C for statement ....

Allows any changes the user wants to variables inside its body

the initial goals for lisp included...

a and c -supporting the investigation of artificial intelligence -being a practical mathematical notion for computer programs

almost all modern machines at the macro level are ...

a collection of devices connected by a bus

In a function model of computation, a program is...

a function written in terms of simpler functions eventually based on primitives

in the Functional model of computation, a program is...

a function written in terms of simpler functions, eventually based on primitives

a forward reference is...

a reference to a name that has not yet been declared

In the logic/constraint-based model of computation, a program is...

a set of specified relationships solved via goal directed search through logical rules

Scientific Notation includes ...

a sign, a mantissa, an exponent

Scientific notation includes...

a sign, a mantissa, an exponent

Floating point numbers are represented as ...

a sign, an exponent, and a significand.

A grammar specification includes all of the following __except__ ...

a stop symbol.

Semantics analysis is required for....

A&B. Enforcement of the rules for a valid program that go beyond the form of the program. Determining information required for the generation of the output program.

Which of the following is/are true about static scoping?

A&C. The bindings cannot be evolved by examining the program text. In general , compiled is an improvement on lexical scoping.

Assertions are...

A, B (Expected to be true when execution reaches them. Used to check the correctness of a program)

For an object to be used, it must be reachable by...

A, B, C (Being pointed to by a reachable object. Existing in an active stack frame. Being a global object).

Which of the following is/are not known until runtime?

A, B, C (Explicitly allocated object sizes, Higher-order functions constructions, Recursion limits)

Alias Analysis can be used to determine when it is safe to...

A, B, and C (Allow access by concurrent threads, Cache values in Registers, Evaluate expressions out of order).

An Association List (A-List) is...

A, B, and C (A linked list. A list of linked lists. A list of key, value pairs)

Modularization has....

A, B, and C (Less chance of name collision, Improved compartmentalization of run-time errors, Improved chance of data integrity).

A C/C++ double usually has about how many decimal digits of precision?

About 16

Module facilitate _____ by ______

Abstraction ////// allowing data to be made private

Semantic analysis includes items that are not convenient to capture in the language's...

Context free Grammar.

Operator associativity and precedence are usually expressed in a language's

Context free grammar

Semantic analysis includes items that cannot be covered by the language's....

Context free grammar.

Subroutines are______ abstractions and classes are ______ abstractions.

Controll ///// data

Invariants, Preconditions, and Postconditions are statements about the ____ of the program

Correctness.

Program write time

Load time

Assertions are _____________ regarding _______________.

Logical Formulae ///// the Values of Program Data

Why are Central Reference Tables preferred to Association List?

Lookup is fast because each slot is a linked list with the most recent binding in front

A distinguishing feature of a compiler is that it ....

Make a non trivial translation of the source program

The most important device in a machine's macro architecture is its...

Processor

Context free Grammar are more expressive than regular expressions

Yes

The definition of the Regular Expressions is often extended by string processing programming languages

Yes ( Awk, Perl, Python, Ruby, Sed , .... Do this

In Java, can a name be used before it is declared?

Yes, for class methods or class properties

Java's dynamic semantic checking helps catch malicious errors.

Yes, that was a prime goal in the design of the language.

Is it generally possible to compile a program written in an interpreted language?

Yes, when assumptions are made and there is a fall back process to handle violations.

The Kleene star operator represents.....

Zero or more repetitions of a regular expression

In a regular expression the ? operator represents

Zero or one occurences of a regular expression

Floating Point limits for loops are OK because ....

[No, floating point arithmetic is NOT OK for loop limit]


Kaugnay na mga set ng pag-aaral

MANA3335 MindTap Assignment: Chapter 15: Managing Operations, Quality, and Productivity

View Set

Theories of human motivation and behavior

View Set

Chapter 31: Skin Integrity and Wound Care

View Set

Real Estate Brokerage: Unit Exams

View Set

Power Engineering 4th Class Chapter 82

View Set

Pos psych - Book notes Ch. 7 (pg. 267 - 301)

View Set

Google Data Analytics - Process Data from Dirty to Clean - Course 4

View Set