Bonjour,
On m'a donne un questionnaire a remplir est ce que quelq'un connait les reponses ?
Merci!
Multiple choice questions may have more than one correct answer.
Q1:
You need to use a data structure for storing many data elements by a unique key. The key values are sparse, and you need quick retrieval of the data elements by key. What container class(es) could you use?
A) Double linked list
B) Array \ Vector
C) AVL Tree
D) Hash Table
E) None of the above
Q2:
Which of the following implicitly invokes a c++ copy constructor?
A) Passing a class instance by value as a function\method argument.
B) Initializing one class instance to another in its declaration.
C) Returning a class instance from a function\method by value.
D) Copying one class instance to another in an assignment statement when an assignment operator is provided.
E) Copying one class instance to another in an assignment statement.
Q3:
You need to remove an item from a container class, which of the following containers will remove the item in constant time?
A) Double Linked List
B) Single Linked List
C) Array \ Vector
D) Hash Table
E) RB Tree
F) Dongle Tree
Q4:
One way to implement a scene graph culling system is to have an array of structs where the struct has a sphere member and object pointer. Another way is to have a list of objects where the object contains a sphere. What are some of the tradeoffs?
A) array of structs is cache friendly and is easy to work with; list of objects is cache friendly but is difficult to maintain and use
B) array of structs is not cache friendly and is easy to work with; list of objects is not cache friendly and is difficult to maintain and use.
C) array of structs is cache friendly, hard to maintain and work with; list of objects is not cache friendly but is easy to maintain and work with.
D) array of structs is cache friendly and is easy to maintain and work with; list of objects is cache friendly and is easy to maintain and work with.
Q5:
You have added some virtual function to a class, which do you incur?
A) a small constant memory footprint cost for each virtual function to each class instantiation
B) a small constant memory footprint cost to each class instantiation
C) no cost to the memory footprint whatsoever
D) a small constant memory footprint cost to each class instantiation and a once off memory footprint for a virtual function pointer table
E) if the virtual function is pure virtual, no cost.
Q6:
You need to write a reference counted base class and want to stop users from manually calling delete on the object. How would you do this?
A) Override the delete operator in the reference counted base class.
B) Declare the class destructor in the protected or private scope.
C) Declare the class destructor using the "const" declaration modifier.
D) Declare the class destructor using the "static" declaration modifier.
E) Don't provide a class destructor.
Q7:
If a vector A = (1, 0, 0), and vector B = (0, 1, 0), what would be the approximate value of a linear interpolation from A to B, when t = 0.5?
A) 0.5
B) (0, 0, 1)
C) (0.5, 0.5, 0)
D) (0.7, 0.7, 0)
E) (0, 0, 0)
Q8:
How is the number 0x12345678 stored on a big-endian machine:
A) 12 34 56 78
B) 78 56 34 12
C) 87 65 43 21
D) 56 78 12 34
Q9:
You have added static members and methods to a class; do they contribute to the byte size of an instantiation of that class?
A) Yes
B) No
C) It Depends
Q10:
You have written a template class in c++ and use the class templated with 3 types. Does the compiler
A) Generate code for the 3 instantiations at runtime
B) Generate code and symbol table information once
C) Generate code and symbol table information for all 3 types
D) Depends if you force instantiated the class by using function prototypes or typedefs
Q11:
Create a Sphere class with the following capabilities:
1) Write a collision function that will return true if two spheres intersect.
2) Write a collision function that will return true if a sphere and a point intersec. Use the Point structure supplied below.
struct Point
{
float x;
float y;
float z;
};
Please type working C++ code. In other words, use standard C++, make certain that it is free of syntax errors, and is reasonably complete.
Type your code below: