What will the following code display?cout << "Four" << "score" << endl;cout << "and" << "seven" << endl;cout << "years" << "ago" << endl;A) Fourscoreandsevenyearsago B) Four score and seven years ago C) Fourscoreandsevenyearsago D) Fourscoreandsevenyearsago
  • D) Fourscoreandsevenyearsago
  • A) Fourscoreandsevenyears ago
  • C) MondayTuesdayWednesday
  • B) The number is number
What is the value of donuts after the following code executes?int donuts = 10;if (donuts != 10) donuts = 0;else donuts += 2;A) 12 B) 10 C) 0 D) 2
  • D) 1
  • A) 12
  • C) 0
  • 202
What will be the output of the following code segment after the user enters 0 at the keyboard?int x = -1;cout << "Enter a 0 or a 1 from the keyboard: ";cin >> x;if (x) cout << "true" << endl;else cout << "false" << endl;A) Nothing will be displayed B) false C) x D) true
  • A) C++ is fun
  • B) 4.0
  • B) False
  • A) 20
Given that x = 2, y = 1, and z = 0, what will the following cout statement display?cout << "answer = " << (x || !y && z) << endl;A) answer = 0 B) answer = 1 C) answer = 2 D) None of these
  • B) False
  • 15 (end chapter 6)
  • A) 12
  • B) answer = 1
What is the output of the following program?#include using namespace std;void doSomething(int);int main(){ int x = 2; cout << x << endl; doSomething(x); cout << x << endl; return 0;}void doSomething(int num){ num = 0; cout << num << endl;}
  • 4 2
  • A) 12
  • C) 0
  • 202
What is the output of the following program?#include using namespace std;void doSomething(int&);int main(){ int x = 2; cout << x << endl; doSomething(x); cout << x << endl; return 0;}void doSomething(int& num){ num = 0; cout << num << endl;}
  • A) 20
  • B) 0
  • C) 0
  • 200
What will the following code display?int number = 6;cout << ++number << endl;
  • D) Fourscoreandsevenyearsago
  • 7 (chapter 5 end)
  • Each element in the array, except the first and the last, is initialized to 0.0
  • C) Four score and seven/nyearsago
What is the output of the following program?#include using namespace std;void showDub(int);int main(){ int x = 2; showDub(x); cout << x << endl; return 0;}void showDub(int num){ cout << (num * 2) << endl;}
  • C) 0
  • A) 12
  • C) 13
  • 4 2
What is the output of the following segment of code if 4 is input by the user when asked to enter a number?int num;int total = 0;cout << "Enter a number from 1 to 10: ";cin >> num;switch (num){ case 1: case 2: total = 5; case 3: total = 10; case 4: total = total + 3; case 8: total = total + 6; default: total = total + 4;}cout << total << endl;A) 0 B) 3 C) 13 D) 28 E) None of these
  • C) 14
  • 4 2
  • C) 13
  • 200
What will the following code display?int number = 6;int x = 0;x = number--;cout << x << endl;
  • 5
  • 0
  • 7
  • 6
What will the following code display?int number = 6;number++;cout << number << endl;
  • 7
  • 5
  • 6
  • 0
What will the following code display?int number = 6;int x = 0;x = --number;cout << x << endl;
  • 0
  • 3
  • 5
  • 7
What is the output of the following code segment?n = 1;for ( ; n <= 5; )cout << n << ' ';n++;
  • 1 1 1 ... and on forever
  • 7 (chapter 5 end)
  • C) MondayTuesdayWednesday
  • Each element in the array, except the first and the last, is initialized to 0.0
How many times will the following loop display "Hello"?for (int i = 0; i <= 20; i++) cout << "Hello!" << endl;
  • 3
  • 21
  • 10
  • 20
What is the output of the following code?int w = 98;int x = 99;int y = 0;int z = 1;if (x >= 99){ if (x < 99) cout << y << endl; else cout << z << endl;}else{ if (x == 99) cout << x << endl; else cout << w << endl;}A) 98 B) 99 C) 0 D) 1
  • 202
  • 4 2
  • C) 13
  • D) 1
Which line in the following program will cause a compiler error?1 #include 2 using namespace std;3 4 int main()5 {6 int number = 5;7 8 if (number >= 0 && <= 100)9 cout << "passed.\n";10 else11 cout << "failed.\n";12 return 0;13 }A) 6 B) 8 C) 10 D) 9
  • B) 8
  • A) 6
  • D) 1
  • B) 0
What will the following code display?cout << "Monday";cout << "Tuesday";cout << "Wednesday";A) MondayTuesdayWednesday B) Monday Tuesday Wednesday C) MondayTuesdayWednesday D) "Monday""Tuesday""Wednesday"
  • C) Four score and seven/nyearsago
  • D) Fourscoreandsevenyearsago
  • B) The number is number
  • C) MondayTuesdayWednesday
Which line in the following program contains the header for the showDub function?1 #include 2 using namespace std;3 4 void showDub(int);5 6 int main()7 {8 int x = 2;9 10 showDub(x);11 cout << x << endl;12 return 0;13 }14 15 void showDub(int num)16 {17 cout << (num * 2) << endl;18 }
  • A) 0 1 1 0
  • B) 8
  • 15 (end chapter 6)
  • A) C++ is fun
Assuming x is 5, y is 6, and z is 8, which of the following is false?x == 5;7 <= (x + 2);z < = 4;(1 + x) != y;z >= 8;x >= 0;x <= (y * 2)A) 3, 4, 6, 7 are False B) Only 5 is False C) 3 and 4 are False D) All are False E) None of these are False
  • A) C++ is fun
  • C) 3 and 4 are false
  • 15 (end chapter 6)
  • A) 0 1 1 0
What is the output of the following code segment?n = 1;while (n <= 5) cout << n << ' '; n++;
  • D) 1
  • 4 2
  • 1 1 1 ... and on forever
  • 7 (chapter 5 end)
Which line in the following program will cause a compiler error?1 #include 2 using namespace std;3 4 int main()5 {6 const int MY_VAL;7 MY_VAL = 77;8 cout << MY_VAL << endl;9 return 0;10 }A) 6 B) 8 C) 9 D) 7
  • A) 6
  • A) 12
  • B) 0
  • A) 20
What will the following segment of code output if 11 is entered at the keyboard?int number;cin >> number;if (number > 0) cout << "C++";else cout << "Soccer";cout << " is ";cout << "fun" << endl;A) C++ is fun B) Soccer is fun C) C++ D) C++fun E) Soccerfun
  • B) False
  • A) 0 1 1 0
  • C) You failed the test!You passed the test!
  • A) C++ is fun
Look at the following function prototype.int myFunction(double);What is the data type of the funtion's return value?
  • 1 1
  • int
  • B) 4.0
  • <
What will the following code display?int numbers[4] = { 99, 87 };cout << numbers[3] << endl;
  • 0
  • 7
  • 3
  • 6
What is the output of the following program?#include using namespace std;int getValue(int);int main(){ int x = 2; cout << getValue(x) << endl; return 0;}int getValue(int num){ return num + 5;}
  • 3
  • 4
  • 20
  • 7
What will the following program display?#include using namespace std;int main(){ int a = 0, b = 2, x = 4, y = 0; cout << (a == b) << " "; cout << (a != b) << " "; cout << (b <=x) << " "; cout << (y > a) << endl; return 0;}A) 0 1 1 0 B) 0 0 1 0 C) 1 1 0 1 D) 1 0 0 1 E) None of these
  • C) That's a high score!This is a test question!
  • B) False
  • A) C++ is fun
  • A) 0 1 1 0
How many times will the following loop display "Hello"?for (int i = 0; i < 20; i++) cout << "Hello!" << endl;
  • 20
  • 7
  • 21
  • 0
The following code correctly determines whether x contains a value in the range of 0 through 100 .if (x >= 0 && <= 100)A) TrueB) False
  • C) Four score and seven/nyearsago
  • B) False
  • C) MondayTuesdayWednesday
  • D) Fourscoreandsevenyearsago
What will the following code do?const int SIZE = 5;double x[SIZE];for(int i = 2; i <= SIZE; i++){ x[i] = 0.0;}
  • 87 6655
  • C) MondayTuesdayWednesday
  • D) 012
  • Each element in the array, except the first and the last, is initialized to 0.0
Which line in the following program contains a call to the showDub function?1 #include 2 using namespace std;3 4 void showDub(int);5 6 int main()7 {8 int x = 2;9 10 showDub(x);11 cout << x << endl;12 return 0;13 }14 15 void showDub(int num)16 {17 cout << (num * 2) << endl;18 }
  • 163
  • 4
  • 20
  • 10
Look at the following function prototype.int myFunction(double, double, double);How many parameter variables does this function have?
  • 163
  • 3
  • <
  • 7
1 // This program displays my gross wages.2 // I worked 40 hours and I make $20.00 per hour.3 #include 4 using namespace std;56 int main()7 {8 int hours;9 double payRate, grossPay;1011 hours = 40;12 payRate = 20.0;13 grossPay = hours * payRate;14 cout << "My gross pay is $" << grossPay << endl;15 return 0;16 }Which line(s) in this program cause output to be displayed on the screen?A) 13 and 14 B) 8 and 9 C) 14e. 15 D) 13
  • C) 0
  • C) 14
  • C) 13
  • C) 99
What will the following code display?int x = 0, y = 1, z = 2;cout << x << y << z << endl;A) 0 1 2 B) 012 C) xyz D) 012
  • 87 6655
  • 7 (chapter 5 end)
  • Each element in the array, except the first and the last, is initialized to 0.0
  • D) 012
Which line in the following program contains the prototype for the showDub function?1 #include 2 using namespace std;3 4 void showDub(int);5 6 int main()7 {8 int x = 2;9 10 showDub(x);11 cout << x << endl;12 return 0;13 }14 15 void showDub(int num)16 {17 cout << (num * 2) << endl;18 }
  • 10
  • 4
  • 21
  • 163
What will the following code display?int number = 6;cout << number++ << endl;
  • 7
  • 6
  • 0
  • 87 6655
0 h : 0 m : 1 s

Answered Not Answered Not Visited Correct : 0 Incorrect : 0