Hello ever one


I need to answer these question I did my best please correct my answer?


1-what is the difference between a variable reference and a variable pointer?
a-A reference is the entire object while a pointer is only the address of it.
b-Reference can only be used as parameters to function or methods.
c-the syntax used to access the object.
d-pointers are simple address to the object while a reference uses the virtual table.
e-There is no difference.

I think the answer is b.


1. A pointer can be re-assigned any number of times while a reference cannot be reassigned after initialization.
2. A pointer can point to NULL while reference can never point to NULL
3. You can't take the address of a reference like you can with pointers
4. There's no "reference arithmetic's" (but you can take the address of an object pointed by a reference and do pointer arithmetic's on it as in &obj + 5).


What is one of the benefits of object oriented programming?

a) Make programming easier.
b) Encapsulation handling.
c) Exception handling.
d) Provide scoping of variables.
e) Allow separate compilation

I think the answer is c .
How can I simplify error handling?
We can use exceptions to improve error handling. These allow us to separate errors from what the main intent of the program is. When you write code to list objects in an array, checking for null or invalid numbers may not be its primary purpose. With exception handling, we can separate the error handling from the really important thrust of the program. Clearer code makes maintenance, and future improvements, easier




3-Given the declaration int i =5 ,j= -1,k=0 ;and the expression i+=j -=k*=i++;
what is are the values after the expression is executed?
a) i=5,j=-1,k=0
b) i=0,j=-6,k=5
c) i=-1,j=-7,k=6
d) i=5,j=0,k=0
e) The expression will not execute. It is not syntactically correct.
I think the answer is a .

4- If tow functions have the same name then when the name is used in the program, what happens?
a) C++ does not allow two functions to have the same name.
b) The functions will be selected based on the return type needed.
c) The functions are both called in the order that they are declared.
d) The first function is always called that is declared first.
e) The functions will be selected based on the parameters.
I think the answer is e .

5-when is the following true? x==y ==x
a) X is 1 and y is 1.
b) X is 0 and y is 0
c) Any values of x and y as long as x==y
d) The expression is never true.
e) The expression is always true.
I think the answer is D .


6-Declared variable with no initialization has what value?
A. 0 for all bytes
B. Null
C. No value
D. Will not compile without initialization
E. A value that is garbage.
I think the answer is D .





7-which loop structure is guaranteed to execute the body of the loop at least once?
A. For loop
B. While loop
C. Do wile loop
D. Non of the avove
E. All of the above.
I think the answer is c.


8- Over loaded functions are
A. Very long functions that can hardly run.
B. One function containing another one or more functions inside it.
C. Tow or more functions with the same name but different number of parameters or parameters of different type.
D. Functions that can use two or more parameters.
E. None of above.
I think the answer is c.


9-which of the STL containers store the elements contiguously (in adjacent memory locations)?
A. Std::vector
B. Std::list
C. Std::map
D. Std::set

I think the answer is c.

10-Which of the following is not recommended in a header file?
A. Type definitions(typedefs)
B. Class definitions
C. Function definitions.
D. Template definitions.
E. Macro definitions.
I think the answer is D or maybe E.