Lecture 4 Flashcards
What are variables in programming?
Variables are abstractions in a language for the memory cells of a machine.
What are the main attributes of a variable?
Type, Scope, Lifetime.
What are names associated with in programming?
Names are associated with subprograms, formal parameters, and other program constructs.
What is an Identifier?
Identifier is another term for a name.
What are some design issues for names?
Whether names are case sensitive and whether special words are reserved words or keywords.
What are the forms of names(name forms) in programming languages?
Names are strings of characters used to identify entities in a program, with different length limitations and naming conventions depending on the language.
What are common naming conventions?
Underscore characters and Camel notation.
What is the controversy around case sensitivity in programming languages?
Some believe it detracts from readability, while others do not see it as a problem.
What are special words in programming languages used for?
To make programs more readable and to separate syntactic parts of statements and programs.
What is the difference between a keyword and a reserved word?
A keyword is special only in certain contexts, while a reserved word cannot be used as a name.
What attributes characterize a variable?
Name, address, type, lifetime, and scope.
What is the address of a variable?
The machine memory address associated with the variable.
What are aliases?
When more than one variable name can access the same memory location.
What does the type of a variable determine?
The type determines the set of values the variable can store and the operations that can be performed on those values.
What is the value of a variable?
The contents of the memory cell(s) associated with the variable.
What is binding in programming?
The association between an attribute and an entity.
When can binding occur?
Language design time, implementation time, compile time, load time, link time, and run time.
What is static binding?
Binding that occurs before run time and remains unchanged during program execution.
What is dynamic binding?
Binding that occurs during run time or can change during program execution.
What must happen before a variable can be referenced in a program?
It must be bound to a data type.
What are explicit and implicit declarations in static type binding?
Explicit declaration specifies variable names and types; implicit declaration uses default conventions to associate variables with types.
What is dynamic type binding?
The type of a variable is bound when it is assigned a value in an assignment statement.
What is an advantage of dynamic type binding?
Provides more programming flexibility.
What is a disadvantage of dynamic type binding?
It diminishes the error-detection capability of the compiler and requires run-time type checking.