1 / 0

Informatik I (D-ITET) Group 7, 15:00-17:00, ETZ H91 Assistant: Ercan Ucan

Informatik I (D-ITET) Group 7, 15:00-17:00, ETZ H91 Assistant: Ercan Ucan. Slides at http://people.inf.ethz.ch/eucan/inf-1 /. Final Session ( 17/12/2012 ) . Exam Issues. 1 hour written examination . Any documentation is allowed (I think).

xylia
Download Presentation

Informatik I (D-ITET) Group 7, 15:00-17:00, ETZ H91 Assistant: Ercan Ucan

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Informatik I (D-ITET)Group 7, 15:00-17:00, ETZ H91Assistant: Ercan Ucan Slides at http://people.inf.ethz.ch/eucan/inf-1/ Final Session (17/12/2012)
  2. Exam Issues 1 hour written examination. Any documentation is allowed (I think). 70 points in total (approx. 1 point/min, also approx. 30 pts for a 4). So you have to be fast !! Read the questions carefully in order to answer exactly and only what you are asked to. Go through the exercises you solved during the semester and try to understand your errors. Try to solve yourselves the previous years exams you are given, in order to get an estimate of the complexity and the time needed. Your code should match the standard C++ syntax . ( no pseudo-code will be accepted, unless stated otherwise in the exercise ) There are different levels of mistakes in the code you provide: Forgotten semicolons (;) will not cost you as much as if you forget to dereference a pointer. It’s better to completely answer a few questions, than partially cover more.
  3. Exam Topics (JUST HINTS) Understanding code / programs / C++ syntax. Write your own code to perform a task ( + recursion). Data structures with pointers ( + recursion). Classes and Object-Oriented question.
  4. Previous Exam Example (Herbst 2009 - Herbstsemester 2008) Arrays and the Tour de France 1a) (1 Punkt) int d[8] = {2,3,5,7,11,13,14,19}; d[6] = 17; 1b) (2 Punkte) d[6] = *d; d[7] = (int)d; 1c) (2 Punkte) int* h = &d[2]; inti = 0; while (i < 3) h[i] = i++;
  5. Previous Exam Example (Herbst 2009 - Herbstsemester 2008) Arrays and the Tour de France (26 points)
  6. Previous Exam Example (Herbst 2009 - Herbstsemester 2008) Arrays and the Tour de France (26 points)
  7. Previous Exam Example (Herbst 2009 - Herbstsemester 2008) Arrays and the Tour de France (26 points) What is function foo() calculating? The maximum value in data
  8. Previous Exam Example (Herbst 2009 - Herbstsemester 2008) Arrays and the Tour de France (26 points) 1g) How many times foo() reads from Array data (in the worst case) for n = 5? 1h) Function foo() is not efficiently implemented. Write foo() such that in only needs 1 loop
  9. Previous Exam Example (Herbst 2009 - Herbstsemester 2008) Arrays and the Tour de France 1i) Let’s suppose that we are only interested in the stage section where you have the longest monotonically increasing tracks. Write a function intlongestAscent (int data[], int n) which calculates that.
  10. Previous Exam Example (Herbst 2009 - Herbstsemester 2008) Pointer-Data structures: Friendship Network (26 points) A mobile operator offers its customers a special subscription offer: Everyone is allowed a maximum of N = 3 to choose his dearest friends and make phone calls with them then free. It is clear that a friendship network can be described as a directed graph.
  11. Previous Exam Example (Herbst 2009 - Herbstsemester 2008) Pointer-Data structures: Friendship Network (26 points) 2a) The graph can be implemented as a pointer data structure. The basic data element is a struct depicted with the rectangles here. In the struct we have to store the name and telephone number asintegers. Moreover, the data structure contains a Boolean auxiliary variable with the name flag, its use will be seen later.Define the struct with the name "member". Make this the fact thatstruct for arbitrary constant values of N is valid (the same for 2c and 2d).
  12. Previous Exam Example (Herbst 2009 - Herbstsemester 2008) Pointer-Data structures: Friendship Network (26 points) 2b) Suppose that the different struct instances are created dynamically on the heap and that you are given pointers to the persons Rafael, Andrew and Novak. They point to instances of valid values. Add the persons Roger and Juan and make sure that all the arrows (pointers) in the image are coded in your implementation.
  13. Previous Exam Example (Herbst 2009 - Herbstsemester 2008) Pointer-Data structures: Friendship Network (26 points) 2c) Implement a function intgetCloseFriends(member* p) which finds the number of the close friends of a specific person, who also have them tagged as friends (mutual friends).
  14. Previous Exam Example (Herbst 2009 - Herbstsemester 2008) Pointer-Data structures: Friendship Network (26 points) 2d) Implement a recursive function bool Connection (member * source, * target member)which tests if there is a connection between 2 members. Tipp: In order to avoid endless recursions use the helping variable flag in a proper way (stopping criterion).
  15. Previous Exam Example (Herbst 2009 - Herbstsemester 2008) Object-Oriented Programming: Set of Integers (18 points) The following class represents an unordered set of integers Each element can be contained only once in the set.
  16. Previous Exam Example (Herbst 2009 - Herbstsemester 2008) Object-Oriented Programming: Set of Integers (18 points) Destructor 3a) With which technical term you call the method ~Set() ? 3b) Can we declare the method~Set() as virtual ? 3c) Can we declare the method Set() as virtual ? 3d) The class Set can be assumed as given. Below you have to implement a class MySet that inherits from Set. Objects of this class will inherit from the base class and also provide the following public methods: Yes No
  17. Previous Exam Example (Herbst 2009 - Herbstsemester 2008) Object-Oriented Programming: Set of Integers (18 points) 3e+f) Implement the functions union() and intersect():
  18. Previous Exam Example (Herbst 2009 - Herbstsemester 2008) Object-Oriented Programming: Set of Integers (18 points) 3g) Overload the * operator for the intersection, so that the following notation is possible: MySet a, b, c; a = b * c; Where a should correspond to the intersection of b and c, while b and c remain unchanged. Suppose that the overloading is already declared, and provide here the implementation. Of course you will have to use the intersect() method you have already implemented:
More Related