







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A comprehensive overview of the fundamental concepts related to data types and variable handling in programming. It covers topics such as the definition of data types, explicit and implicit declaration, type inferencing, memory allocation and deallocation, variable storage types, variable scope, binding, and more. The document also delves into the details of primitive data types, ordinal types, array types, record types, pointer types, and reference types. Additionally, it discusses type checking, type errors, expressions, assignment statements, function side effects, operator overloading, and type conversions. This information is crucial for understanding the core principles of programming language design and implementation, and would be highly valuable for students studying computer science, software engineering, or related fields.
Typology: Exams
1 / 13
This page cannot be seen from the preview
Don't miss anything!








data types determine: - Answer: the range of values of variables the set of operations defined for that type explicit declaration - Answer: a program statement used for declaring variable types (int x;) implicit declaration - Answer: a default mechanism for specifying types of variables (the first appearance of the variable in the program, FORTRAN and Perl)
type inferencing - Answer: determine the data types of variables (Java ArrayList
dynamic binding - Answer: if binding occurs during execution or can change during execution of the program non-local variables - Answer: variables that are visible but not declared in the program unit (method or function) global variable - Answer: A variable whose scope is "global" to the program, it can be used and updated by any part of the code. Its global scope is typically derived from the variable being declared (created) outside of any function, object, or method. static lexical scope - Answer: variables can be hidden from a unit by having a "closer" variable with the same name (Java this.num = num) dynamic lexical scope - Answer: based on calling sequences of program units, not their textual layout, references to variables are connected to declarations by searching back through the chain of subprogram calls that forced execution to this point referencing environment - Answer: the collection of all names that are visible when executing the statement, the referencing environment consists of a function's local variables and parameters, as well as the static and dynamic scoped language
named constant - Answer: a variable that is bound to a value only when it is bound to storage data type - Answer: defines a collection of data objects and a set of predefined operations on those objects descriptor - Answer: the collection of the attributes of a variable primitive data types - Answer: data types not defined in terms of other data types (CLOSE to being implemented directly by hardware) PDT: Integer - Answer: almost always an exact reflection of the hardware: int, long, byte, short PDT: Floating Point - Answer: models real numbers, but only as approximations: float and double PDT: Decimal - Answer: for business applications only PDT: Boolean - Answer: range of values: true and false, could be implemented as bits, but often as bytes PDT: Character - Answer: stored as codings: ASCII, one character per byte, modern languages use unicode
rectangular array - Answer: rectangular matrix is a two-dimensional array in which all of the rows must have the same number of elements jagged array - Answer: jagged matrix has rows or columns that might vary in the number of elements, possible when multi-dimensional arrays actually implemented as arrays of arrays array slices - Answer: some substructure of an array (sub array) row major array - Answer: arrays stored as first row, second row, etc. Location (a[i,j]) = address of a [row_lb,col_lb] + (((i - row_lb) * n) + (j - col_lb)) * element_size column major array - Answer: FORTRAN stores arrays as column one, column two, etc associative array - Answer: an unordered collection of data elements that are indexed by an equal number of values called keys, user defined keys must be stored (Perl, Python, Ruby) record types - Answer: a possibly heterogeneous aggregate of data elements in which the individual elements are identified by names
pointer types - Answer: has a range of values that consists of memory addresses and a special value, nil (or null), provide a way to dynamically access heap memory dangling pointers - Answer: pointer points to a heap-dynamic variable that has been de-allocated memory leakage - Answer: the process of losing heap-dynamic variables reference types - Answer: types that store references to objects, or instances of classes. Reference types are sometimes called class types because they are the names of classes. String, Scanner, and System are all examples of reference types. type checking - Answer: the activity of ensuring that the operands of an operator are of compatible types, also applies to checking that arguments of subprogram are compatible with parameters, and applies when we think of assignment (=) as an operator type error - Answer: the attempted application of an operator to an operand of an inappropriate type strongly typed programming language - Answer: type errors are always detected, allows the detection of the misuses of variables that result in type errors
operator precedence - Answer: rules for expression evaluation define the order in which "adjacent" operators of different precedence levels are evaluated. parentheses unary operators ** (exponentiation, if the language supports it) *, / +, - operator associativity - Answer: rules for expression evaluation define the order in which adjacent operators with the same precedence level are evaluated, can be overridden with parenthesis conditional expressions - Answer: if, else blocks. can also be written as -> average = (count == 0)? 0 : sum / count interpreted the same as -> if (count == 0) average = 0 else average = sum /count logical post-test loop - Answer: do while loop - execute the loop body FIRST, check condition, if true execute body,..., if false exit loop logical pre-test-loop - Answer: while loop - check condition, if true execute body,..., if false skip loop
break statement - Answer: exits the innermost loop, Java includes labeled breaks continue statement - Answer: skips the remainder of the loop iteration (Ruby next) iterator - Answer: control mechanism is a call to an iterator function that returns the next element in some chosen order, if there is one; else loop is terminated Java iterator - Answer: any class implementing java.util.Iterator interface. next() returns the next element, hasNext() returns a bool indicating whether there is remaining data, Iterator() method returns an iterator object functional side effects - Answer: when a function changes a two-way (e.g., C++ reference) parameter or an ancestor variable declarative function - Answer: a function that for given input parameter values always returns the same value function written in declarative style - Answer: function without any assignment statements,either explicit or implicit via changes to mutable data structures operator overloading - Answer: Use of an operator for more than one purpose
control structure - Answer: a control statement and the statements whose execution it controls (for loops, while loops, do while) selection statement - Answer: provides the means of choosing between two or more paths of execution (if, else, else if, switch) (switch (expression) { case const_expr_1: stmt_1; ... case const_expr_n: stmt_n; [default: stmt_n+1] })