The questions of Test_2

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

Mark the syntax correct/incorrect statements. k is an integer variable.
(yes)if (k == 1) k++;
(no) if [k == 0] k--;

Is the following relation true?
(yes) "Harry" < "Hurry"
(no)  8 < -5

Mark the correct/incorrect assertions about functions.
(no)  Each function receives input parameters only from number types.
(yes) Functions need to be defined before they can be used.


We have the following function declaration:
    int test(int n, int& m);
Mark the correct/incorrect statements. We suppose that an integer variable ind is defined and it's initial value is 0.
(yes) cout << test(10, ind);
(no)  cout << test(ind, 2);

We have the following function definition:
    int fun(int n)
    { if (n % 3 > 1) return n;
      else           return n + 1;
    }
Does the statement prints out an even number?
(no)  cout << fun(0);
(yes) cout << fun(1);

Mark with "yes'' the statements in which the loop body executes exactly once. An integer variable ah has value 0.
(no) while (ah > 0) ah++;
(yes) while (ah <= 0) ah++;

Mark with "yes'' the program excerpt where the body of the loop statement executes 3 times
exactly.
(yes) i=1; while(i<4) i++;
(no)  i=1; while(i<=4) i++;

Mark the correct/incorrect assertions about classes.
(yes) A constructor always has the same name as the class name.
(no) The main function can access directly the private data fields of a class.

Mark with "yes'' the function declaration which can be used as a constructor (of a class).
(yes) Point(double x, double y);
(no)  int Time();

We have a class:
class Product {
public:
Product();
Product(string n, double p, int s);
void read();
string get_name() const;
double get_price() const;
void print() const;
private:
string name;
double price;
int score;
};
and an object p of this class, constructed in main function. Mark the correct/incorrect statements in the body of main function.
(yes) Product p22();

(no)  cout << p.name;