Uploaded by bishoy fahim

concept Sheet 4 answers

advertisement
Helwan University
Faculty of Computers &
Artificial Intelligence
Computer Science
Department
Concepts of Programming
Language
Fall 2022
Dr. Salwa Osama
Sheet4
1.
Consider the procedure definition. Which of these identifiers (A, B, C, D, E, F, G) are free
identifiers?
2. Does the concept of Free Identifiers only apply to identifiers within the body of a
function or procedure?
3. Consider the following code, what is the value of a? where a is a variable in memory that
refers to the identifier Add.
4. Write the definition, It contains all the identifiers that are used inside the function but
declared outside of the function.
5. What is the output of the following code?
Helwan University
Faculty of Computers &
Artificial Intelligence
Computer Science
Department
Concepts of Programming
Language
Fall 2022
Dr. Salwa Osama
6. Complete, A procedure value in Oz is a .... The left member is …... and the right member is
….....
7. Why $ symbol is used the in procedure value?
8. The following code is the form of procedure in …..
9. What is printed if I write: {Browse Browse}?
10. According to the following code,
a. What is printed with: {Browse M}?
b. What is printed with: {Browse {M 5}}
c. Test = {M 5} {Browse {Test}}
11. What is the order of function Q in Q5?
12. What is the order of function M in Q10?
13. What is the output of the following code?
14. Complete,
a. the function Map in Q13 is called …{Genericity, Instantiation}
b. …. is used to hide Accumulator
c. ….. is used to hide value inside a function
15. What is the output of the following code?
Helwan University
Faculty of Computers &
Artificial Intelligence
Computer Science
Department
Concepts of Programming
Language
Fall 2022
Dr. Salwa Osama
16. Consider the following record,
Menus = menu_of_this_course(
menu(entree: 'salad'
meal: 'steak'
cost: 10)
menu(entree: 'fruits'
meal: 'salmon'
cost: 12)
menu(meal: 'hamburger'
cost: 9))
a. what is the meal of the second menu?
b. what is the type of thit value?
c. How to access the cost of the third menu?
d. What is the width of the first menu?
17. Given the following records, are they tuples or lists?
18. What is EBNF grammar of procedure as a procedure value?
19. How can we convert list as a record?
Download