ps2 - 1.124J Foundations of Software Engineering Problem...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1.124J Foundations of Software Engineering Problem Set 2 Due Date: Tuesday 9/26/00 Reference Readings: From C++ Primer (in addition to the reference reading from PS1): Chapters 6, 7, 8 Problem 1:[10%] This is a multiple choice question. You need to select the correct answer(s), or provide the answer, as indicated in the following questions. There may be one or more than one correct answers in the multiple choice questions. Please submit this page, stapled together with the hardcopies for the other problems, with the selected answer(s) to each question circled. Please, write your name and username clearly on this page as well. Each question counts for 2 point. 1. Which of the following functions, whose declarations are given below, will be called: float myF; printMyF(2.0*myF); a. void printMyF(void) b. void printMyF(double) c. void printMyF(float) d. float printMyF(float) e. none of the above 2. If you declare members inside a class without labeling them public, private, or protected a. they are assumed to be private. b. they are assumed to be protected c. they are assumed to be public d. it is illegal not to explicitly specify the access level
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
e. none of the above 3. Which of the following is/are True? a. The definition, and not only the declaration, of an inline function needs to be available in each source code file that uses that function. b. Only a member function or a friend function can access a private member of the class. c. The memory location where the object which invoked a member function is given by &this inside the member function. d. Pointers of different types may not be assigned to one another without a cast operation. e. All of the above 4. Which of the following is/are True? a. Since in a member function " this " is a pointer to an object of that class it can be used to store a dynamically allocated object in the body of the member function definition. b. It is not allowable to define (i.e. allocate memory) a static data member within the declaration of the class. c. The copy constructor takes an object of the same class as argument passed by value. d. All of the above e. None of the above 5. Which of the following is/are True? a. The division operator(/) can be overloaded as a member function with no parameters. b. The return data type of a type conversion operator may optionally be specified. c. The statement: delete px; deletes the pointer px (i.e. release the memory allocated to store px ). d. Member data and functions defined in the private part of a class are accessible by member functions of a class derived from the former class. e. None of the above 6. Which of the following give(s) the element A[3][4] of an array A of size 10x10?
Background image of page 2
a. *(&A[0][0]+3*4) b. *(A[3]+4) c. (*(A+3))[4] d. *((*(A+3))+4) e. All of the above. 7. 8,9,10. Indicate which of the following statements are True and which are False:
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/04/2011 for the course ESD 1.124 taught by Professor Kevinamaratunga during the Fall '00 term at MIT.

Page1 / 13

ps2 - 1.124J Foundations of Software Engineering Problem...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online