Shared Flashcard Set

Details

Homework 1
Principles of Programming Languages
71
Computer Science
Undergraduate 2
03/24/2016

Additional Computer Science Flashcards

 


 

Cards

Term
Languages such as C and Java distinguish between uppercase and lowercase in specifying identifiers. What are the pros and cons of this design decision?
Pros: _____ range of _____, can utilize _____ to signify meaning to identifiers, _____ of code when calling identifiers
Cons: differences in _____ _____ between programmers, confusion between identifiers whose only _____ is case, programming _____ encountered when _____ variable case
Definition
greater, identifiers, case, uniformity, naming conventions, difference, bugs, mistyping
Term
Write EBNF of a C programming language switch statement.
Definition
switch -> "switch" expr {"case" expr "then" stmt} ["default" stmt]
Term
Write EBNF of a C for loop statement.
Definition
for_loop -> "for" expr [stmt]
Term
Write EBNF of a Java class construct.
Definition
class_construct -> ("public"|"private"|"protected") class_name [("extends"|"implements") class_name] [{var_type var}] stmt
Term
Give the order of the representation of a non-array variable and an array variable.
Definition
Non-array: Selector, Type, Reference
Array: Type, Constructor, Index type, Lower bound, Upper bound, Range type, Reference
Term
Why are there are so many programming languages? We are trying to improve _____ languages, For certain _____ of applications, For specific _____, Don't agree with the ways certain programming _____ are implemented in certain languages
Definition
previous, domains, hardware, constructs
Term
What makes a language successful? Easy to _____, _____, Easy to _____, Easy to _____, Who is _____ the language, _____
Definition
learn, Familiarity, use, implement, pushing, popularity
Term
Scientific applications, business applications, artificial intelligence, systems programming, scripting languages, and special purpose languages are examples of _____ _____
Definition
programming domains
Term
Most conventional programming languages can be viewed as _____ of an underlying Von Neumann architecture
Definition
abstraction
Term
_____ or _____: Procedures are the main thing
_____: Everything is a function call
_____ _____ _____: Like Ada packages
_____-_____: C Program Modules
_____-_____: C++/Java Classes
_____: Like Ada Generics/C++ Templates
_____: Functional and logic programming languages
Definition
Imperative, procedural, Functional, Abstract Data Types, Module-Based, Object-Oriented, Generic, Declarative
Term
The compiler translates the high-level source program into an equivalent target program (typically in machine language)
Definition
pure compilation
Term
Interpreter stays around for the execution of the program. Interpreter is the locus of control during execution
Definition
pure interpretation
Term
The ability to group related features into a single unit. Use subroutines to group related computations units so they can be re-used in different parts of the application.
Definition
factoring
Term
The ability to implement information hiding so that changes to a grouping (either control or data) are transparent
Definition
locality
Term
What does a program look like? It is a set of rules that formally describe the form or structure of the expressions, statements, and program units
Definition
syntax
Term
What does a program mean? It is the meaning of any syntactically valid program written in the language, e.g., expressions, statements, and program units. Note that all syntactically correct programs have valid meaning
Definition
semantics
Term
Describe in English the meaning of a construct
Definition
informal description of the meaning of a language
Term
A mathematical model using formal notation to describe each construct
Definition
formal description of the meaning of a language
Term
It helps the programmer know how to write a syntactically correct program. Compiler developers use syntax rules to write syntax analyzer or parser to check the validity of a program. Availability of tools to generate lexical and syntax analyzers: Lex and Yacc
Definition
lexical rules
Term
V* is the set of all words over V. V* is called the _____ of V
Definition
closure
Term
A set of rules for forming the words in a language is called a _____
Definition
grammar
Term
A language that is used to describe other languages
Definition
Meta-Language
Term
Examples of _____: "a""b""c""+""-"";""begin""end"
Definition
terminals
Term
Examples of _____: < prog > < stmt_list > < stmt > < var > < exp >
Definition
nonterminals
Term
A pictorial representation of the syntax of a language
Definition
syntax diagram
Term
Two syntax rules have the same _____ _____ if they only differ at the lexical level or _____ _____
Definition
abstract syntax, concrete syntax
Term
Rules that are enforced by the compiler at compile time. Example: Type checking, check functions/methods formal and actual parameters, etc.
Definition
static semantics
Term
Rules of a given construct that are enforced at the runtime
Definition
dynamic semantics
Term
Describe the meaning of a program by executing its statements on an abstract machine. Each program statement is described by a set of operations of this machine
Definition
operational semantics
Term
Semantics based on formal logic (First order predicate calculus)
Definition
axiomatic semantics
Term
What is the weakest precondition of a=b+1 P={a>1}?
Definition
Q={b>0}
Term
In _____ semantics, the state changes are defined by coded algorithms; in _____ semantics, they are defined by rigorous mathematical functions
Definition
operational, denotational
Term
It takes all the independent object files and links them together: your program in assembly language and the assembly version of all libraries used by your program
Definition
linker
Term
The output of the linker is the _____ _____ or _____
Definition
executable file, executable
Term
The _____ performs the following tasks:
1. Reads the executable and create an address space large enough for the program and its data
2. Copies the instructions and data into memory
3. Initializes the machines registers and sets the stack pointer
4. Load the Program Counter with the address of the entry point of the program (main method in Java or C)
5. Start the execution
Definition
loader
Term
Source code is translated into an intermediate form and run by a software virtual machine. E.g., Java compiler produces byte code that can be run on any Java virtual machine (JVM)
Definition
hybrid implementation systems
Term
A set of tools that help programmers develop applications
Definition
Programming Environment
Term
A set of properties used to describe a program entity, e.g., variable and function
Definition
attributes
Term
Where the values of the attributes of an element are stored
Definition
descriptors
Term
The process of assigning a value to the attribute of an element
Definition
binding
Term
At what time a value is assigned an attribute
Definition
binding time
Term
A binding is _____ if it first occurs before run time and remains unchanged throughout program execution
Definition
static
Term
A binding is _____ if it first occurs during execution or can change during execution of the program
Definition
dynamic
Term
Is the assignment of a value fixed or modifiable?
Definition
stability
Term
Memory _____ with an _____ and a _____
Definition
cell, address, value
Term
Five Semantic Attributes of Variables
Definition
Name, Type, Scope, l-value, r-value
Term
_____ _____ is the activity of ensuring that the operands of an operator are of compatible types
Definition
Type checking
Term
_____ or _____: A compatible type is one that is either legal for the operator, or is allowed under language rules to be implicitly converted, by compiler-generated code, to a legal type
Definition
Casting, Coercion
Term
The _____ of a variable is the range of statements over which it is visible. The _____ rules of a _____ determine how references to names are associated with variables
Definition
scope, scope, language
Term
The _____-_____ _____ of a program unit are those that are visible but not declared in the program
Definition
non-local variables
Term
A pointer or reference: it is when the r-value of a variable is used to access another variable
Definition
reference
Term
Subprograms, subroutines, procedures, functions, and methods are all _____
Definition
routines
Term
Some programming languages have _____ method and _____ for binding actual parameters to formal parameters in routine calls
Definition
positional, named
Term
Routine _____: This specifies the types of parameters and the return type
Definition
Signature
Term
Method _____ is commonly used to create several methods with the same name that perform similar tasks
Definition
overloading
Term
Two names are _____ if they refer to the same entity at the same program points
Definition
aliases
Term
_____ routines allow the same code to be used for multiple data types
Definition
Generic
Term
Language errors are _____ _____ in how a language's syntax and semantics are defined
Definition
programmer errors
Term
Guarantee no type errors
Definition
Type Safety
Term
Languages that have strong type systems
Definition
strongly typed languages
Term
Languages that are not strongly typed
Definition
weakly typed languages
Term
_____ _____ languages are _____ _____ languages
Definition
Statically typed, strongly typed
Term
Two variables can have compatible types only if they are in either the same declaration or in declarations that use the same type name
Definition
name compatibility
Term
Two variables have compatible types if their types have identical structures
Definition
structure type compatibility
Term
A type is defined by: a set of _____, a set of _____
Definition
values, operations
Term
A _____ ST of a basic type T (also called parent type or supertype) can be defined as: a subset of the values of T, assume that operations of T are _____ by ST
Definition
subtype, inherited
Term
A strict type system
Definition
monomorphic
Term
It is the case where an object can have more than one type
Definition
polymorphic
Term
Functions work on a finite small set of types and may behave differently for each: overloading, coercion
Definition
ad hoc
Term
Work uniformly for an infinite set of types, all of which have common structure: parametric, inclusion
Definition
universal
Term
The implementation of each data object requires the _____ (structures used to store the attributes of the data) and _____ _____ (memory locations to store the actual values)
Definition
descriptor, data object
Supporting users have an ad free experience!