Cis 324 Midterm and Answers Essay

2749 WordsMay 20, 201311 Pages
User | | Course | C++ Programming I | Test | Week 5 Midterm Exam | Started | 11/12/12 5:06 PM | Submitted | 11/13/12 10:28 PM | Status | Completed | Score | 64 out of 100 points | Time Elapsed | 2 hours, 0 minute out of 2 hours. | Instructions | The midterm exam consists of multiple choice questions. You will have 2 hours to complete it. Good Luck! | Question 1 0 out of 2 points | | | Study the following code snippet: int greater_num(int num1, int num2) { if (num1 < 0 || num2 < 0) { cout << "Only POSITIVE Numbers!!!"; return 0; } else { if (num1 <= num2) { return num1; } else { return num2; } } } Which of the following describes a constraint on the use of this…show more content…
Which of the following is the best choice for the declaration of this function?Answer | | | | | Selected Answer: | double area(double w, double h) | Correct Answer: | double area(double w, double h) | | | | | Question 12 2 out of 2 points | | | What is incorrect in the following code snippet? void display_box(string str) { cout << "--------" << endl; cout << str << endl; cout << "--------" << endl; } int main() { cout << display_box("Hello World"); return 0; }Answer | | | | | Selected Answer: | display_box does not return a value; therefore, it cannot be used with cout <<. | Correct Answer: | display_box does not return a value; therefore, it cannot be used with cout <<. | | | | | Question 13 2 out of 2 points | | | Which of the following variables is used to store a condition that can be either true or false?Answer | | | | | Selected Answer: | Boolean | Correct Answer: | Boolean | | | | | Question 14 0 out of 2 points | | | Assuming that a user enters 5 as the age, what is the output of the following code snippet? int age = 0; cout << "Please enter your age: "; cin >> age; if (age < 10) { cout << "Kid" << endl; } if (age < 30) { cout << "Young" << endl; } if (age < 70) { cout << "Aged" <<

More about Cis 324 Midterm and Answers Essay

Open Document