I have a few questions i need help on. It's practice exams for the AP test.
here they are --
Consider the following function:
bool Mystery(int k)
Which of the following best describes what function Mystery does?
A. Always returns true.
B. Always returns false.
C. Returns true if any of the k number it reads is positive.
D. Returns true if any of the k numbers it reads is negative.
E. Returns ture if the last of the k nubmers it reads is positive.
i dont even get that one..... how can you cin something that the user doesn't input. and flag=flag && (n>=0)..... aren't those for "if" statements?
A program is being written by a team of programmers. One programmer is implementing a class called Employee; another programmer is writing code that will use the Employee class. Which of the following aspects of the public member functions of the Employee class does not need to be known by both programmers?
A. The functions' names.
B. The functions' return types.
C. What the functions do.
D. How the functions are implemented.
E. The numbers and types of the functions' parameters.
Questions 26 and 27 refer to the following code segment (line numbers are included for reference):
1. int x, sum;
2. x = 1;
3. sum = 1;
4. cin >> x;
5. while (x >= 0)
7. if (( x % 2) == 0 )
8. sum += x;
9. cin >> x;
11. cout << sum << endl
The code segment given above was intended to read values until a negative value was read and then to print the sum of the even values read. However, the code does not work as intended. Which of the following best describes the error?
A. Variable x is not initialized correctly.
B. Variable sum is not initialized correctly.
C. Variable x is used before being initialized.
D. Variable sum is used before being initialized.
E. The negative value intended to signal the end of input is included in the sum.
thanks for any help!!