Professional Documents
Culture Documents
Concept EDX Questions
Concept EDX Questions
Explanation We have browsed M, a procedure of 2 arguments. ‘What is printed with: Test = M5} {Browse (Test)) Answer: S#8it;P/Taat; or Si#
Explanation The function Test returns a tuple containing two elements: § and the function returned by the call {M 4). What s printed with: (Browse (M SI} Answer: ⁢P/18at; or
Explanation
Mretums a function without argument, which is a procedure with one argument.Consider the following record:
Menus = menu_of_this_course(
menu(entree: ‘salad’
meal: ‘steak’
cost: 10)
menu(entree: ‘fruits’
meal: ‘salmon’
cost: 12)
menu(mes
cost: 9))
: hamburger!
‘What is the meal of the second menu?
Answer: salmon
‘What is the type of this value (the meal of the second menu}?
Answer: atom
Consider that X persons take the first menu, Y persons take the second menu and Z persons take the third
‘menu. Use each cost value in the formula, not the way to accessit in the record.
What formula represents the total cost?
Answer: 10*K+12°Y+9*Z,How to access these costs in 02? (Use the dot operation)
For instance, to access the meal ofthe first menu, the answer would be:
Menus.1.meal
How to access the cost of the first menu?
Answer: Menus..cost
How to access the cost of the second menu?
Answer: Monus.2.cost
How to access the cost of the thitd menu?
‘Answer: Menus.3.cost
What is the width of the record identified by menus?
Answer: 3
What is the width of the first menu?
‘Answer: 3
What is the width of the third menu?
Answer: 2Consider the two following programs:
1) First program:
local Res in
local Argi Arg2 in
Argl = 7
Arg2 = 6
Res = Arg] * Arg2
end
{Browse Res}
end
2) Second program:
local Res in
local Argi Arg2 in
Argl = 7
Res = Arg] * Arg2
Arg2 = 6
end
{Browse Res}
end
You will be asked to write what is printed by both programs.
I you think there is an infinite loop, write "-1" (without the quotes).
I you think the program waits for something, write "-2" (without the quotes)
‘And finally, if you think the program has crashed, write "~3" (without the quotes).
What is printed by the first program?
Answer: 42
‘And what is printed by the second program?
Answer: -2‘You will be asked to give the created variables of each program.
‘Consider that a variable has the same name as its identifier, but beginning with a lowercase.
Please write the variablo names in lexical order, separated by only one space.
‘Which variables are created by the first program?
Answer: arg! arg? res
Which variables are created by the second program?
Answer: arg! arg2 res
Consider the following tree:
T = tree(42
leaf
leaf
leaf
tree(42
leaf
leaf
leaf
tree(42 leaf)
leaf)
leaf
leaf)How man leaves has the tee T?
Oo
oO.
O2
Os
O4«
Os
ose
O7
Oe
Oe
Ow
Ou
How many leaves has the troe 75.5?
Oo
On
v
Os
O7
Oe
Os
Ow
OnConsider the fllowing grammar rule that defines a representaion of binary trees: