468,512 Members | 971 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

True or False C questions

8
I have got some question for which iam a bit confused with it. It is True or false question. Here are they:

1. Using binary search in a sorted array of 512 elements may require upto 12 comparisons to determine whether a given element is present in the array.

2. The statment efficiency = Entry::getEfficiency(); calls the method getEfficiency() of the Entry-objects and assigns the return value to the variable named efficiency.

3. Declaring an array and declaring a pointer looks different, but the effect for the program is exactly the same.

Please reply as soon as possible.
Oct 19 '06 #1
1 4001
arne
315 Expert 100+
I have got some question for which iam a bit confused with it. It is True or false question. Here are they:

1. Using binary search in a sorted array of 512 elements may require upto 12 comparisons to determine whether a given element is present in the array.

2. The statment efficiency = Entry::getEfficiency(); calls the method getEfficiency() of the Entry-objects and assigns the return value to the variable named efficiency.

3. Declaring an array and declaring a pointer looks different, but the effect for the program is exactly the same.

Please reply as soon as possible.
1. Use Google to find the complexity algorithm for binary search. This will answer your question. Or code binary search yourself and count the comparisons you need. Or imagine an array of 512 elements and apply binary search on a piece of paper ;-)

2. Hmm. This is a question that you have to answer since you have attended a C++ class? Shouldn't be too hard then.

3. This may be a difficult question in the sense that it will depend on the knowledge of the person who will check your answer if you get points for it or not. But the answer is "NO", it's not the same (with one exception which are the formal parameters in function definitions). You may refer to
http://c-faq.com/aryptr/aryptr2.html
in order to convince people if they have difficulties to understand your answer ...
Oct 19 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

46 posts views Thread by Scott Chapman | last post: by
3 posts views Thread by drs | last post: by
35 posts views Thread by Steven Bethard | last post: by
14 posts views Thread by Walter Dnes (delete the 'z' to get my real address | last post: by
48 posts views Thread by Skybuck Flying | last post: by
30 posts views Thread by Jason | last post: by
71 posts views Thread by David T. Ashley | last post: by
40 posts views Thread by nufuhsus | last post: by
3 posts views Thread by copelane | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.