The questions of Final Test

with two model answers - one correct (yes) and one incorrect (no)

Mark the syntax correct/incorrect loop statements. Variables t, y, h and k have int type.
(yes) for(t = -1; t < 4; t++) cout << t;
(no) for{y = 1; y < 10; y++} cout << h;

We have the following function declaration:
    int verb(double&, double);
Mark the correct/incorrect statements. We suppose that a double variable mode is defined and initialized with 0.0.
(yes) cout << verb(mode, 2.5);
(no) cout << verb(0, 2.5);

Mark with "yes" infinite loops and with "no" finite loops. The value of the integer variable far is obtained from the input stream.
(yes) do far++; while (far != 0);
(no) do far--; while(far > -3200);

Mark with "yes" the statements in which the loop body executes exactly once. The integer variable beep has value 1.
(yes) while(beep == 1) beep++;
(no) while(false) beep--;

Mark the correct/incorrect statements about the class Employee (as it is defined in our textbook) and an object merry of this class.
(yes) merry.set_salary(2000);
(no) Employee maya = set_salary(2000.00);

We have a class
  class Prod {
  public:
    Prod();
    Prod(string n, int s);
    void read();
    string get_name() const;
    void print() const;
  private:
    string name;
    int sc;
  };
 and a global object p of this class. Mark the correct/incorrect statements from the body of
main function.
(yes) Prod q;
(no) Prod x();


We have the following variable definitions:
  string num = "2008";
  const string ABC = "abc";
Mark the syntax correct/incorrect statements.
(yes) cout << num.substr(0,2);
(no) cout << length(ABC);

Mark the correct/incorrect assertions about vectors.
(yes) A vector is a collection of data items of the same type.
(no) The statement vector b[2]; defines a vector of two elements.

We have a vector and values of its elements:
  vector<int> num(2);
  sol[0] = 1;
  sol[1] = 3;
Mark correct/incorrect statements.
(yes) cout << sol.size();
(no) cin >> sol.size();

Mark with "yes" the equivalent logical expressions (1) and (2).
(yes) (1) country == "USA" and state != "AK" (2) not (country != "USA" or state == "AK")
(no) (1) country == "USA" and state != "HI" (2) not (country != "USA" and state == "HI")

We have:
   double a, x;
   bool flag1, flag2;
Does C++ run-time system compute the following logical expressions using lazy evaluations?
(yes) cin.fail() (a < 0)
(no) !(x >= 0)

We have the following variable definitions:
  int ten = 10;
  int nine = 9;
  int eight = 8;
Calculate the arithmetic expression and mark it "yes" if it has value 1.
(yes) ten / nine
(no) ten / nine / 2