It is a tradition among programmers that the first program you write in any language produces "____" as its output.

A. Hi, your name!
B. Hello, world!
C. My first program!
D. Hello, your name!

Answer: B

Computer Science & Information Technology

You might also like to view...

The goal of the planning phase for an information system project is to create a(n) ____________.

A. iterative SDLC B. systems analysis and design C. project development plan D. system development life cycle

Computer Science & Information Technology

Given the class definition and associated code.

a) Modify the code implementing the operator[] to throw an int exception if the index is out of the declared array range. The exception object is to have the value of the out-of-range index. Be sure you add an exception specification to the operator function. b) Modify the code in main that calls operator[] to catch the exception and terminate the program using exit(1). ``` #include using namespace std; class intVec { public: intVec(); intVec(int n); // other members int& operator[](int index); private: int* v; int size; }; intVec::intVec(int n): v(new int[n]) { for (int i=0; i < n; i++) v[i] =0; } int& intVec::operator[](int index) { return v[index]; } int main() { intVec myVec(10); { //Block enclosing "for" is because VC++ does not //define for loop control variables inside the //"for" loop block as the C++ Standard requires for(int i = 0; i < 10; i++) myVec[i] = (i-5)*(i-5); } { for(int i = 0; i < 10; i++) cout << myVec[i] << " "; cout << endl; } int i = -1; cout << "accessing myVec[" << i << "]" << endl; cout << myVec[i] << endl; return 0; } ```

Computer Science & Information Technology