Term
Plankalkul Syntax | A + 1 => A V | 4 5 S | 1.n 1.n |
|
Definition
An assignment statement to assign the expression A[4] + 1 to A[5] |
|
|
Term
Short Code 03 -> =, 20 -> SORT, 06 -> abs value 00 X0 03 20 06 Y0 |
|
Definition
|
|
Term
C# What is the type of the following variables? var = sum 0; var total = 0.0; var name = "CSCI"; |
|
Definition
|
|
Term
Fill in the blanks with the following terms: global, local, non-local
var y = 0; // y: _____ variable function outer() { var x = 1; // x: _____ to outer() function inner() { x += 1; // x: _____ to inner() } } |
|
Definition
|
|
Term
A method of creating _____ scopes inside program units
void sub() { int count; while(...) { int count; count++; ... } ... } |
|
Definition
|
|
Term
A global variable can be _____ in functions but can be _____ in a function only if it has been declared to be _____ in the function
def func(): global g print g g = "reset to default" # reset global var print g
g = "set global var's val" # update global var func() g = "update global var's val again" print g |
|
Definition
referenced, assigned, global |
|
|
Term
function big() { function sub1() { var x = 7; sub2(); } function sub2() { var y = x; ...; } var x = 3; }
Static scoping: Reference to x in sub2 is to _____ Dynamic scoping: Reference to x in sub2 is to _____ |
|
Definition
big's x = 3, sub1's x = 7 |
|
|
Term
Literal form (in Python): (7 + 3j), where 7 is the _____ part and 3 is the _____ part |
|
Definition
|
|
Term
What are the indices in this code snippet?
$array = array( "foo" => "bar", "bar" => "foo" ); |
|
Definition
|
|
Term
Which of the following terms describes the code snippets below? Terms: fixed heap-dynamic, fixed stack-dynamic, heap-dynamic, static
static myClass anAry[100]; myClass anAry[100]; myClass* heapAry = new myClass[100]; @schools = ("GMU", "GWU"); |
|
Definition
static, fixed stack-dynamic, fixed heap-dynamic, heap-dynamic |
|
|
Term
list = [x ** 2 for x in range(12) if x % 3 == 0] |
|
Definition
assign [0, 9, 36, 81] to list |
|
|
Term
Python vector = [2, 4, 6, 8, 10, 12, 14, 16] mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] vector[3:6] = ? mat[0][0:2] = ? |
|
Definition
|
|
Term
Ruby What elements of list does list.slice(2, 2) return? |
|
Definition
|
|
Term
COBOL uses _____ _____ to show nested records |
|
Definition
|
|
Term
ML val myTuple = (3, 5.8, 'apple');
Which element does #1(myTuple) access? |
|
Definition
|
|
Term
ML type intReal = int * real;
What has been defined above? |
|
Definition
|
|
Term
F# let tup = (3, 5, 7) let a, b, c = tup
This assigns a _____ to a _____ _____ _____ |
|
Definition
tuple, tuple pattern (a, b, c) |
|
|
Term
Lisp and Scheme Lists are delimited by _____ Data is quoted with an _____. Give an example |
|
Definition
parentheses, apostrophe, '(A B C) |
|
|
Term
What does the following return? (CAR '(A B C)) (CDR '(A B C)) (CONS 'A (B C)) (LIST 'A 'B '(C D)) |
|
Definition
A, (B C), (A B C), (A B (C D)) |
|
|
Term
|
Definition
|
|
Term
Python What does the following create? range(7) [x * x for x in range(7) if x % 3 == 0] |
|
Definition
[0, 1, 2, 3, 4, 5, 6] [0, 9, 36] |
|
|
Term
F# let myArray = [for i in 1..5 -> (i * i)] printf "%A" myArray
What is printed? |
|
Definition
|
|
Term
Haskell [n * n | n <- [1..10]] |
|
Definition
[1, 4, 9, 16, 25, 36, 49, 64, 81, 100] |
|
|
Term
F# What is the type of the following? type intReal = | IntValue of int | RealValue of float;; |
|
Definition
|
|
Term
F# let a = 7;; let b = "grape";; let x = match (a, b) with | 4, "apple" -> apple | _, "grape" -> grape | _ -> fruit;; // apple, grape, fruit: variable let filter123 x = match x with | 1 | 2 | 3 -> printfn "Found 1, 2, or 3!" | a -> printfn "%d" a |
|
Definition
x matches with grape 7 is printed |
|
|
Term
|
Definition
j = the value located at ptr |
|
|
Term
What is this an example of? int *p1 = new int; int *p2 = p1; delete p1; |
|
Definition
|
|
Term
What is this an example of? int *p1 = new int; p1 = new int; |
|
Definition
Lost heap-dynamic variable (memory leakage) |
|
|
Term
void * can point to _____ type, can be _____-_____, and cannot be _____-_____ |
|
Definition
any, type-checked, de-referenced |
|
|
Term
C and C++ float stuff[100]; float *p; p = stuff;
*(p + i) is equivalent to _____ and _____ |
|
Definition
|
|
Term
Lisp: What is (+ a (* b c))? |
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
2 ** 2 ** 3 = 2 ** 8 = 256 |
|
|
Term
|
Definition
|
|
Term
int g = 10; int fun() { g = 20; return g; } int main(int arg, char* args[]) { printf("%d\n", fun() + g); printf("%d\n", g + fun()); return 0; }
What is printed? |
|
Definition
|
|
Term
result1 = (fun(a) + b) / (fun(a) - c); temp = fun(a); result2 = (temp + b) / (temp - c);
If fun() has no side effects, result1 _____ result2 |
|
Definition
|
|
Term
Perl Write equivalent code: ($flag ? $total : $subtotal) = 0 |
|
Definition
if($flag) { $total = 0 } else { $subtotal = 0 } |
|
|
Term
C-based languages Describe what's happening in each of the following: sum = ++count sum = count++ count++ -count++ |
|
Definition
count incremented, then assigned to sum count assigned to sum, then incremented count incremented count incremented then negated |
|
|
Term
C or C++? Any number of segments can be executed in one execution of the switch statement construct |
|
Definition
|
|
Term
C or C++? Disallows the implicit execution of more than one segment |
|
Definition
|
|