Exam questions Flashcards
2 reasons why studying programming languages can also be useful for legacy development projects
1: It can help you understand low level bugs
2: To better understand different coding paradigms
Why is C good for systems programming?
1: efficient
2: Very flexible/powerful
Give an example in which cost of compiling is a concern.
When writing programs that should still be able to run on older devices or with devices with weak cpu’s
. Describe main tradeoff between language evaluation criteria, which is illustrated by APL:
reliability vs writability
readability vs readability
reliability vs cost of execution
APL = writeability vs readability
it is very writeable/expressive but it makes it difficult to read
Pure interpreted languages are slower than compiled languages. why?
Translation happens at run time.
More storage is needed to check referencing environments and scoping
Comment on the orthogonality of functional programming languages
It is very orthogonal since there arent really data types to define but rather implicit variables usually
What was the 1st high-level programming language?
Zuse’s plankalkul
What was the first true OOP language?
smalltalk
First language based on formal logic inferencing process, used to answer queries
prolog
What effect does target users have on COBOL
It is more business oriented since it was made to be a business language.
Business people also needed it to be easy to understand and close to english
PL/I vs Algol 68. Which has superior approach to supporting general purpose data structures?
PL/I
Focused more on practicality and usability
How is Pascal and C++ similar
Structured programming. Static typeing
Influancial
i = 12
Explain difference between implicit declaration and dynamic type binding.
With dynamic type binding, the type of i would be able to change after the initial assignment, but with implicit declaration the type of i cant change whenever it wants
What effect does keywords instead of reserved words have of readability?
Keywords name actions thus it would increase the readability
int arr = new int[50]
What category is arr in terms of variable lifetime?
what is the advantage of this type over static
heap-dynamic
flexibility + life time control
fun1 {
var x
var y
call fun3
fun2 {
print x “ “ y
}
fun3 {
var x
call fun2
}
}
reference environment if statically scoped vs dynamically scoped
static = fun 1
dynamic = fun 3
3 characteristics of a variable that the type of the variable determines
How it is stored.
What values it can hold
Set of operations that can be performed on it
What is the advantage of decimal data types?
Accuracy
What is the disadvantage of decimal data types?
Range
What is the impliation if enueration types can be coerced to integer values?
weak type safety
Why is heterogeneous array operations less efficient than homogeneous?
Because a hetro can store different types of elements while a homogeneous only stores one type. SO the operation has to be defined for all type in hetro arrays
Why can pointers be bad for readability in comparison to references
Constantly need to dereference the pointers.
Assignment for pointers is also worse that for reference variables
When must a value from memory always be performed for a constant value?
When the constant is defined externally, in a different scope, or if it is a complex data structure
3 reasons why C is not referentially transparent:
1: Side effect
2: Mutable data
3: Input out operations