From: Phlip Subject: Re: homework questions Newsgroups: comp.lang.c++ Date: 1997/02/19 Some students actually copy and paste their instructor's homework assignments into their e-mail windows and post these. You would never consider doing that, would you? Did you know instructors also know how to use Netscape? And they could search for your name on DejaNews? "You came in that thing? You're braver than I thought!" - Princess Leia (censored) wrote: > 22) Moving through a linked list is called navigation. T or F Heck, that sounds like a good word for it! Like the CPU is the browser (or the Turing engine, depending on you lexual orientation), and the next node is the place in this node that makes your mouse pointer give you the finger. Mark this one True and then sue your teacher if it complains. But moving thru a tree is called brachiation. > 32) Suppose the myprog.cpp is a client of two classes, Class1 (with > files class1.hpp and class1.cpp) and Class2(with files class2.hpp and > class2.cpp). If only myprog.cpp is modified, which file(s) must be > recompiled? > > a. myprog.cpp > b. class1.cpp > c. class2.cpp Trick. What if your MAK file says your Recycle Bin is a dependency of class2.cpp? It will compile each time you recycle something! This is a physical design issue, not a logical one. Refuse to answer the question on religious grounds. > 40) What is the purpose of the C++ language feature known as a > constructor initialization list? To pass the buck, and absolve itself of responsibility. "Park this car for me, garc,on - but don't drive it!" > 49) Which of the following C++ class member functions should be provided > if class objects point to dynamic data? Again a trick question. What if it points to dynamic data that someone _else_ created and will destroy? Are there any other colleges (or high schools) in your area you could transfer to? It's not too late! > 50) In C++ terminology, which of the following is NOT considered > "initialization"? Any line of code initializes lots of tiny little values. Your CPU initializes its registers 30-200 million times a second! The non-initialization parts of your program are therefore blank space between words and lines that give your brain a chance to expand back to normal size. > 88) what is the motivation for setting up a base class with all virtual > methods? You can get an underling (assuming you ever have one) to write the contents of the functions for you while you dig a hole in the sand and chase seagulls away from your picnic basket. Until your pager goes off. > 89) Why is particularly important to use exception handling > (through-try-catch) when designing your constructors? To increase the odds that member pointers to owned data leak memory when those exceptions throw. Next obvious question! > 90) What overloaded operator should be implemented by returning a > reference? WHY? All of them. You can make readable statements unreadable by chaining them all together. That alphanumeric page you just got that looked like static (radio waves, not storage class)? It was your underling sending the expression back to you for clarification. > 92) Explain the difference between these two statements. Person p1(p); > Person p1=p; It depends on the type of 'p', the contents of Person, and what compiler you have. For example, VC++ will let you use certain kinds of 'p1=p' even when it is illegal. > 12) Structured(top-down) design begins by identifying the major actions > to be performed, whereas object-oriented design begins by identifying > the major objects and operations. T or F This is the subject of many books, web sites and flames. Smalltalk and Java proponents, for different reasons, say you write each program feature needed on an index card, drop them all in a bag, mix them up, pull one out at random, and begin the program by adding this feature. But there is still a stylistic difference between Java and Smalltalk. Java coders usually only have one index card, but Smalltalk coders always use 3M Post-Its. Pascal and FORTRAN coders (who think FORTRAN is good for power math [like Fermat's last theorem] and Pascal is a teaching language), say you must write a very small program that has the general outline of a program that works but does not, then keep adding little outlines until the program appears deep and profound. Especially if each part of the program contains many links and dependencies to each other part. The problem is there are many automated tools that do this part for you nowadays - write an outline of a program that compiles, contains literally hundreds of cross-references, but does nothing. As a result of this many Pascal and FORTRAN programmers are unemployed and reduced to writing JavaScript on a laptop on a street corner. I sincerely help this has been hopeful. PhlIp ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Delta-V... Delta-V... /Yes/!! -- ---- PhlIp (several years later) Gracious! What was I ''on''??