Cs 10 Cumulative Test

14 Questions | Attempts: 51
Share

SettingsSettingsSettings
Cumulative Test Quizzes & Trivia

UCR CS 10 Cumulative Review


Questions and Answers
  • 1. 

    #include [iostream] using namespace std; // What goes here? {     return 0; }

  • 2. 

    What is the most appropriate data type with which to store the value 90032 Beers on the Wall?

  • 3. 

    Which of the following is a declaration statement.

    • A.

      Foo = "bar";

    • B.

      Cin >> foo;

    • C.

      String foo;

    • D.

      Foo += "bar";

    Correct Answer
    C. String foo;
  • 4. 

    Which of the following is an assignment statement?

    • A.

      Foo = "bar";

    • B.

      String foo = "bar";

    • C.

      String foo;

    • D.

      If (foo == "bar") { cout

    Correct Answer
    A. Foo = "bar";
  • 5. 

    Which of the following has a syntax error? 1. string H, K; cout << "Enter your hat's name and your kat's name: "; cin >> h >> k; 2. double s, q; cout << "Enter your first and last name: "; cin >> s >> q; 3. string s, q; cout << "Enter your first and last name: "; cin >> s >> q; 4. int i; cout << "Enter the number of shoes you have: "; if (i == 0)     cout << "I'm very sorry."; else if (i > 1)     cout << "Can I borrow one?"; cout << endl;

    • A.

      1

    • B.

      2

    • C.

      3

    • D.

      4

    Correct Answer
    A. 1
  • 6. 

    Int a = 5; if (false) {     if (a == 5)     {         cout << "foo ";     } } cout << "bar"; What is the output of the above program?

    Correct Answer
    bar
  • 7. 

    String player = "Michael"; cout << player << "," << setfill('-') << right << setw(10) << player << ","; player = "Kobe"; cout << setw(10) << player << setfill('*'); What is the output of the above program. Make sure to be exact!

    Correct Answer
    Michael,---Michael,------Kobe
  • 8. 

    #include [iostream]        // 1 using namespace std;       // 2 int main()                 // 3 {                          // 4     string s, p;           // 5     cin >> s >> p;         // 6     if (s = "foo")         // 7     {                      // 8         cout << p; cout << // 9         "Foo";             // 10     }                      // 11     else                   // 12     {                      // 13         cout << s;         // 14     }                      // 15 }                          // 16 Which of the above line(s) contain an error? If multiple lines have errors, seperate each line with a comma (but no space). So if 14 and 15 had errors, you would write 14,15.

    Correct Answer
    7
  • 9. 

    String s = "Hello"; s += "World!"; int p = s.find('o'); cout << s.substr(0, p); What is the output of the above code fragment?

    Correct Answer
    Hell
  • 10. 

    Int i = 5; while (i > 0) {     i -= 2;     cout << i;     i++; } What is the output of the above code fragment?

    Correct Answer
    3210-1
  • 11. 

    For (int i = 0; i < 3; i++)     for (int j = 0; j < 3; j++)         cout << i * j; What is the output of the above code fragment?

    Correct Answer
    000012024
  • 12. 

    True && !(true || false) && (false || (true && true))

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
  • 13. 

    Int foo() {     return 4; } int bar(double z) {     return static_cast[int](z / foo()); } int qux(int a, int b) {     return (bar(a) * foo()) % b; } int main() {     cout << qux(4, 9);     return 0; } What is the output of the above program?

    Correct Answer
    4
  • 14. 

    Int foo(int & a, int & b) {     if (a > b)         b = a;     else         a = b;     return a + b; } int main() {     int a = 5, b = 4;     cout << foo(a, b) << a << b;     return 0; } What is the output of the above program?

    Correct Answer
    1055

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 20, 2022
    Quiz Edited by
    ProProfs Editorial Team
  • Nov 15, 2011
    Quiz Created by
    Brownhead
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.