Partial preview of the text
Download Programming Languages final exam and more Exams Programming Languages in PDF only on Docsity!
American University of Beirut Faculty of Arts and Science, Department of Mathematics and Computer Science CMPS258 final exam Programming Languages Exam duration: 2 hours Name: . Exam guidelines: «students must submit this booklet as their answer sheet. 6. students must use ink ¢. exam total marks ts 51/56 Part 1; (12 marks) Tick True (T) er False (F) cach question is worth 0.5 mark. . Any object file contains a symbol table . Lazy evaluation is essential to implement functions The linking process gencrates an executable file . C++ references are easier to use than C pointers . A symbol table in code.o has a list of the names of all variables declared in code.c . Not all object files become input to the linking process. . The linking process builds a combined symbol table . All pointers to void need to be cast before they can be used to reference an object . The linking process searches library files for undefined symbols 10. The default access modes for C'+~ structures and C++ classes are different 11. Currying is using partially implemented functions 12.C++ references arc used to pass parameters to functions 13. The linking process checks for storage space 14. ‘Cipcasting’ is a mechanism underlying inheritance in any OO language 18.C ++ structures cannot be used to implement inheritance 16.C++ references are a useful alisasing mechanism 17. Pointers to void are the same size as any other pointer 18. Under some conditions an object file can be executed 19.C—+ references are generally easier lo use than C pointers 20.Pointers to void can be used as an information hiding mechanism 21.C- + structures are used less offen than Cl | classes 22. Type variables in Haskell implement polymorphism jowncasting’ allows access of a base class through a pointer to a derived class Any C++ reference requires four bytes of memory TT oi ey li || t | PELLET EEEE ELT ol Mid I i Sod 4S4e Se SHS ase aaa Part 2: Short questions on C++ (7 marks) only one answer for a multiple choice question must be chosen. Each question is | mark 1, C++ uses static binding for a function fot a derived class 2 it * fis dectared virtual =f inthe base class is virtual © fis virtual in both, D and the base class of D « fis not virtual anywhere