Computer Science and C++ Test Answers, Page 2

Question #11
  • What character terminates all strings composed of character arrays?

    \0
    .
    \END

    Question #12

  • If you push 1, 3, and 5 - in that order - onto a stack, which number is popped out first?

    5
    1
    3

    Question #13

  • What does the code strcat(an_array, "This"); do?

    Copies "This" into an_array
    Adds "This" to the end of an_array
    Compares an_array and "This"

    Question #14

  • Evaluate the following:
    int fn(int v)
    {
    if(v==1 || v==0)
    return 1;
    if(v%2==0)
    return fn(v/2)+2;
    else
    return fn(v-1)+3;
    }
    for fn(7);

    10
    11
    1

    Question #15

  • Evaulate the following: 22%5

    2
    4
    0

  • Question #16
  • Which of the following data structures is on average the fastest for retrieving data:

    Binary Tree
    Hash Table
    Stack

    Question #17

  • What is the output of the following code:
    int v()
    {
    int m=0;
    return m++;
    }
    int main()
    {
    cout<<v();
    }

    1
    0
    Code cannot compile

    Question #18

  • Which of the following functions initalizes the variables contained in a class:

    Constructor
    Destructor
    Constitutor

    Question #19

  • Is C++ case sensitive?

    No
    Case sensitivity is compiler-determined
    Yes

    Question #20

  • Which datatype can store decimal numbers?

    unsigned int
    char
    float

  • Next Answers