| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Calling out C++ Pros! Mutliple Ques. Help Needed.
TYTYTYTYTYTY
|
|
#2
|
|||
|
|||
|
Are you seriously asking someone on these forums to waste their time filling in YOUR quiz? I mean, if you had actually tried and posted your answers I'd be at least somewhat convinced you'd looked at it.
If I really wanted to waste my time in order to give you the answers you can bet I wouldn't give you the right answers. Here's a tip: Crack open the book, start at chapter 1. You'll find the answers there. |
|
#3
|
|||
|
|||
|
Quote:
Lol. this is not a quiz or a hw. This is a review questions for the test coming up. I should of written my situation here earlier, sorry about that. Trying to study in library but I had no ways to correct myself if I was wrong or not... so heres my answers, hopefully someone can help me out here. 1. A 2. E 3. D 4. C 5. A 6. (No clue ) 7. (No clue ) 8. B 9. D 10. D (Unsure) 11. D counts the " " space as well. 12. B 13. F 14. A 15. E (Unsure) 16. D 17. D! 18. A 19. E! it runs till user inputs negative # 20. E 21. E 21. C because the sequential search starts from first to last. 23. B |
|
#4
|
|||
|
|||
|
bump~
|
|
#5
|
||||
|
||||
|
Quote:
1. A -- correct 2. E -- There are only 4 alternatives, but the last one is the one that handles it best. 3. D -- correct 4. C -- correct 5. A -- correct 6. (No clue ) -- E is the correct answer. The runtime error in question is checking A[k] when k==N, which is right outside the array. This results in "undefined behavior". If you're lucky the program just crashes right then and there. (Since this is off-by-one, that's not very likely.) The usual way to write that function is to have an if (...) { return true;} as part of the loop, rather than in the loop condition (and then after). 7. (No clue ) -- E. Assuming "protype" should be prototype. The full truth is far more involved, and is that function prototypes are basically just the "declaration" of a function like a variable; and that the types (parameter list, return type) can be checked to see if they are valid and what conversions needs to be made. 8. B -- correct. If flag was initialized true, it would not fit any of the options. (false if any negative) 9. D -- Wrong. By the time it reaches the second statement, n<=0. The correct answer is A. 10. D (Unsure) -- correct 11. D counts the " " space as well. -- A. Unless there's some significant corruption of what's shown on the way of your posting it here, the ‘’ will have the compiler complain. It needs to be ', and there needs to be a character in between them. 12. B -- correct. Except there should be spaces between the outputs. 13. F -- correct. (Where did E go?) 14. A -- This question does not give enough detail - in many cases, it is a requirement to give (position of) the first value where there are multiple. In that case, D. Or a modified/composite search and A. Else A. 15. E (Unsure) -- correct 16. D -- correct 17. D! -- E. Often, runtime errors are very dependent on inputs. Programming such that D is true is an ideal; which we don't reach all that often. 18. A -- correct. 19. E! it runs till user inputs negative # -- B. It is initialized to 1 instead of 0, thus the sum of these even numbers would be an odd number. 20. E -- correct. Horrible programming practice though ![]() 21. E -- C. The idea is that the binary search has to do the full log(n) to reach the first element, while the sequential search will check it in its first operation. 21. C because the sequential search starts from first to last. -- err... why was this repeated? I noticed there was no 22 there. The correct answer to 22 is B. 23. B -- correct. On a last note, I see you calling this C++ at the top. I call this C with iostreams which is a different language from C++ altogether. It just needs most of a C++ compiler to compile. IMNSHO anyway.
__________________
Quote:
|
|
#6
|
|||
|
|||
|
Wow genius.
Thank you very much! If there were points to give you on this forum. for ( i = 1; i > 0; i++) { give points to MaHuJa } ![]() |
|
#7
|
|||
|
|||
|
Quote:
I apologize. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Calling out C++ Pros! Mutliple Ques. Help Needed. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|