





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Test 2 Practice Form A Material Type: Exam; Professor: Walker; Class: Engrg Prob Solving: C++; Subject: Engineering Education; University: Virginia Polytechnic Institute And State University; Term: Fall 2006;
Typology: Exams
1 / 9
This page cannot be seen from the preview
Don't miss anything!






x = y * 10; y = y + 1; z = z * (y + 5); (1) x = y + 1 * 10; z *= y * 5; (2) x = y + 1 * 10; z = ++y + 5 * z; (3) x = ++y * 10; z *= y + 5; (4) x = ++y * 10; z = ++x - 1; (5) x = y++ * 10; z *= y + 5; (6) x = y++ * 10; z = ++y + 5; (7) y = z + 1 * 10; x = z-- * y + 5; (8) y = z + 1 * 10; x = ++y + 5 * --z; (9) y *= 10 + x ++ 10; z *= y + 5; (10) y *= 10 + x ++ 10; z = y++ + 5 * z;
for (int i=0; i<5; i++) for (int j=0; j<i; ++j) cout << i << j << endl; (1) 4 (2) 5 (3) 6 (4) 9 (5) 10
(6) pointless (7) prototype (8) returnless (9) valueless (10) void
(6) proxy (7) reference (8) storage (9) value (10) wire
#include
int main () { int blue = 1; int pink = 2; doSomething ( pink, blue ); cout <<setw(4) << blue << setw(4) << pink << endl; return 0; } (1) 1 2 (2) 1 7 (3) 1 35 (4) 2 2 (5) 2 7
(1) int Free() const; (2) const int Myclass::Free(); (3) int Myclass::Free() const; (4) Myclass::int Free(); (5) const int Free() const; (6) void Free() const; (7) const int Free(); (8) none of the above
(1) Define new data members (2) Write a member function, AddBoxes, for adding the data members (3) Write an operator overloading member function for the “+” operator (4) Create a larger object by calling the constructor function of class Box and initializing the data members appropriately for the new size box (5) Define a new class, Double_Box, and initialize it with the sum of Redbox and Bluebox (6) You don’t have to do anything, in the driver program you can just write “Box Thirdbox = Redbox + Bluebox;” (7) None of the above
#include
(10) Program will not compile.
Consider the following class declaration for answering questions 22 – 24:
class Someclass // Line 1 { // Line 2 public: // Line 3 void Func1(int n);// Line 4 int Func2()const; // Line 5 int Someclass(); // Line 6 private: // Line 7 int privateint; // Line 8 }; // Line 9
int Func1(int a) { privateint = a;}
void Func1(int ) { privateint = int;}
void Func1(int b) { privateint = a;}
int Func1(int n) { n = privateint;}
void Func1(int k) { privateint = k;}