COP3014 final

Card Set Information

Author:
Ryno2333
ID:
228608
Filename:
COP3014 final
Updated:
2013-07-30 15:11:38
Tags:

Folders:

Description:
final exam for FSU COP3014
Show Answers:

Home > Flashcards > Print Preview

The flashcards below were created by user Ryno2333 on FreezingBlue Flashcards. What would you like to do?


  1. Which statement is false?
    A class is an instance of its object.
  2. Which of the following is not one of the three general types of computer languages?
      Machine languages.
      High-level languages.
      Assembly languages.
      Spoken languages.
    Spoken languages.
  3. In phase 4 of a C++ program, the linker links:
       The primary memory with the CPU
      The executable code with primary memory
      The object code with the external libraries
      The source code with the object code
    The object code with the external libraries.
  4. Which of the following statements is false?
    The vast majority of the microprocessors produced each year are used in general-purpose computers.
  5. Which of the following is not a goal stated by the creator of C++ for the new C++ standard?
    Make C++ an open source programming language.
  6. Which statement about the Boost C++ Libraries is false?
    Smart pointers are used to match specific character patterns in text.
  7. Which of the following statements is false?
    Information in the memory unit is persistent—it is retained when the computer's power is turned off.
  8. ________ helps Internet-based applications perform like desktop applications.
    Ajax
  9. The ________ creates object code and stores it on disk.
    Compiler
  10. Which of the following is most closely associated with Moore's Law?
    Every year or two, the capacities of computers have approximately doubled without any increase in price.
  11. Each of the following is a relational or equality operator except:
          =!
          <=
          >
          ==
    =!
  12. Which of the following is not a valid C++ identifier?
          m_x
          width
          _AAA1
          my Value
    my Value
  13. Which of the following characters is the escape character?
          \
          \n
          "
          *
    \
  14. What will be the output after the following C++ statements have been executed?
    int a, b, c, d;    a=4, b=12, c=37, d=51
           if ( a < b )
           cout << "a < b" << endl;
        if ( a > b )
           cout << "a > b" << endl;
        if ( d <= c )
           cout << "d <= c" << endl;
        if ( c != d )
           cout << "c != d" << endl;a < b
    • a < b
    • c != d
  15. Which of the following is a compilation error?
    All of the above.
  16. The std::endl stream manipulator:
          outputs a newline.
          flushes the output buffer.
          terminates the program.
          outputs a newline and flushes the output buffer.
    outputs a newline and flushes the output buffer
  17. The escape sequence for a newline is:
          \r
          \n
          \a
          \t
    \n
  18. Which of the following statements would display the phrase C++ is fun?
          std::cout << "Thisis fun\rC++ ";
          std::cout << '++ is fun';
          std::cout << C++ is fun;
          std::cout << "\"C++ is fun\"";
    std::cout << "C++ is fun";
  19. Which of the following statements does not overwrite a preexisting value stored in a memory location?
          number = 12;.
          int a;.
          y = y + 2;.
          width = length;.
    int a;
  20. End-of-line comments that should be ignored by the compiler are denoted using:
          Two forward slashes ( // ).
          Three forward slashes ( /// ).
          A slash and a star ( /* ).
          A slash and two stars ( /** ).
    Two forward slashes ( // ).
  21. When a client code programmer uses a class whose implementation is in a separate file from its interface, that implementation code is merged with the client’s code during the:
          Programming phase.
          Compiling phase.
          Executing phase.
          Linking phase.
    Linking phase
  22. The compiler will implicitly create a default constructor if:
          The programmer specifically requests that the compiler do so.
          The class does not define any constructors.
          The class does not contain any data members.
          The class already defines a default constructor.
    The class does not define any constructors.
  23. Function headers contain all of the following except:
          Parentheses.
          Left brace.
          Name of function.
          Return type.
    Left brace
  24. Assuming that the string object text contains the string “Hello!!!”, the expression text.substr( 2 , 5 ) would return a string object containing the string:
          “ello”.
          “ello!”.
          “llo!”.
          “llo!!”.
    "llo!! "
  25. What is the default initial value of a String?
          default
          empty sting
          "default"
          null
    empty sting
  26. C++ functions other than main are executed:
          When they are explicitly called by another function.
          After main completes execution.
          Before main executes.
          Never.
    When they are explicitly called by another function.
  27. A header file is typically given the filename extension:
    .h
  28. What is the name of the values the method call passes to the method for the parameters?
          Arguments.
          Values.
          References.
          Objects.
    Arguments
  29. Attributes of a class are also known as:
          Constructors.
          Data members.
          Classes.
          Local variables.
    Data members.
  30. A default constructor has how many parameters?
    0
  31. The conditional operator (?:):
          Associates from left to right.
          Accepts two operands.
          Is the only ternary operator in C++.
          Is a unary operator.
    Is the only ternary operator in C++.
  32. What is wrong with the following while loop?
    while ( sum <= 1000 )
    sum = sum – 30;
          Braces are required around sum = sum – 30;.
          sum = sum – 30 should be sum = sum + 30 or else the loop may never end.
          The parentheses should be braces.
          There should be a semicolon after while ( sum <= 1000 ).
    sum = sum – 30 should be sum = sum + 30 or else the loop may never end
  33. Of the following, which is not a logic error?
          Using commas instead of the two required semicolons in a for header.
          Using == to assign a value to a variable.
          Failing to initialize counter and total variables before the body of a loop.
          Not placing curly braces around the body of an if that contains two statements.
    Using commas instead of the two required semicolons in a for header
  34. A switch statement should be used:
           To replace all if and if…else statements.
          As a multiple-selection structure.
          As a single-selection structure.
          As a double-selection structure.
    As a multiple-selection structure.
  35. The data type bool:
          Can take on values true and false.
          Can take on values -1, 0 or 1.
          Can only be used in a selection statement.
          Can take on any expression as a value.
    Can take on values true and false
  36. If a do…while structure is used:
          An off-by-one error will not occur.
          Counter-controlled repetition is not possible.
          An infinite loop will not take place.
          The body of the loop will execute at least once.
    The body of the loop will execute at least once
  37. How many times will the following loop print hello?

    i = 1;
    while ( i <= 10 )
        cout << "hello";
    An infinite number of times
  38. float and double variables should be used:
          As imprecise representations of decimal numbers.
          To store true/false values.
          To perform monetary calculations.
          As counters.
    As approximate representations of decimal numbers
  39. If a variable is declared in the initialization expression of a for structure, then:
          It can not be used in any structures that are nested in that for structure.
          It retains its final value after the loop is finished.
          The scope of the variable is restricted to that particular for loop.
          It is automatically reinitialized to zero once the loop is finished.
    The scope of the variable is restricted to that for loop
  40. An example of a unary operator is:
          The = assignment operator.
          The < relational operator.
          The % arithmetic operator.
          The ! logical operator.
    The ! logical operator.
  41. The inline keyword:
          Can reduce a function’s execution time but increase program size.
          Increases function-call overhead.
          Should be used with all frequently used functions.
          Can decrease program size but increase the function’s execution time.
    Can reduce a function’s execution time but increase program size
  42. When an argument is passed-by-value, changes in the calling function __________ affect the original variable’s value; when an argument is passed call-by-reference, changes __________ affect the original variable’s value.
          Do, do not.
          Do not, do not.
          Do, do.
          Do not, do.
    Do not, do
  43. Each standard library has a corresponding:
          Variable type.
          Function.
          Cd-rom.
          Header file.
    Header file.
  44. A B ( C )
    {
       D
    }
          B.
          C.
          D.
          A.
    C.
  45. Which of the following expressions returns the trigonometric sine of x?
          trig_sine( x ).
          trig_sin( x ).
          sine( x ).
          sin( x ).
    sin( x )
  46. A recursive function is a function that:
          Takes 3 arguments.
          Calls itself, directly or indirectly.
          Returns a double.
          Is inside of another function.
    Calls itself, directly or indirectly.
  47. An identifier’s storage class:
          Determines where the identifier can be referenced in a program.
          Determines the period during which that identifier exists in memory.
          Determines whether an identifier is known only in the current source file or in any source file with proper declarations.
          All of the above.
    Determines the period during which that identifier exists in memory
  48. If the function int volume( int x = 1, int y = 1, int z = 1 ); is called by the expression volume( 3 ), how many default arguments are used?
          Two.
          One.
          Three.
          None.
    Two
  49. The argument list of a function call must match, or be consistent with, the parameter list of the called function in all of the following details, except:
    The names of arguments/parameters in the list
  50. The unary scope resolution operator is used:
          To access a local variable with the same name as a global variable.
          To access a global variable when a local variable of the same name is in scope.
          To access a global variable when it is out of scope.
          To access any variable in an outer block when a local variable of the same name is in scope.
    To access a global variable when a local variable of the same name is in scope
  51. An array is not:
          A consecutive group of memory locations.
          Made up of different data types.
          Subscripted by integers.
          Declared using braces, [].
    Made up of different data types.
  52. Unless otherwise specified, entire arrays are passed __________ and individual array elements are passed
          By value, by value.
          By reference, by reference.
          By reference, by value.
          By value, by reference.
    By reference, by value
  53. In a typical nested for loop structure used to process a two-dimensional array, following the end of the each execution of the inner for loop:
          The inner for loop increments its counter variable.
          The outer for loop increments its counter variable.
          The inner for loop initializes its counter variable.
          The outer for loop initializes its counter variable.
    The outer for loop increments its counter variable
  54. Linear search is highly inefficient compared to binary search when dealing with:
          Large, unsorted arrays.
          Small, sorted arrays.
          Small, unsorted arrays.
          Large, sorted arrays.
    Large, sorted arrays
  55. Constant variables:
          Can be assigned values in executable statements.
          Do not have to be initialized when they are declared.
          Can be used to specify array sizes, thereby making programs more scalable.
          Can be used to specify array sizes, but this makes programs harder to understand.
    Can be used to specify array sizes, thereby making programs more scalable
  56. Which of the following is not a correct way to initialize an array?
          int n[] = { 0, 7, 0, 3, 8, 2 };.
          int n[ 5 ] = { 9, 1, 9 };.
          int n[ 5 ] = { 0, 7, 0, 3, 8, 2 };.
          int n[ 5 ] = { 7 };.
    int n[ 5 ] = { 0, 7, 0, 3, 8, 2 };
  57. When using exception handling, place any code that might throw an exception in a __________.
    try statement
  58. Which of the following is false about a function to which an array is being passed?
          It knows the size of the array that is being passed.
          The array name is used as an argument in the function call.
          It is able to modify the values stored in the array.
          It is being passed the address of the first element in the array.
    It always knows the size of the array that is being passed
  59. Given the following declaration, what is the value of b[ 1 ][ 0 ]?
         int b[ 2 ][ 2 ] = { { 1 }, { 3 , 4 } };
          3.
          This is not a valid declaration.
          0.
          1.
    3.
  60. To prevent modification of array values passed to a function:
          The array must be passed by reference.
          A copy of the array must be made inside the function.
          The array parameter can be preceded by the const qualifier.
          The array must be declared static in the function.
    The array parameter can be preceded by the const qualifier
  61. Which of the following is not true of pointers to functions?
          They are dereferenced in order to call the function.
          They can be stored in arrays.
          They contain the starting address of the function code.
          They can not be assigned to other function pointers.
    They can not be assigned to other function pointers
  62. Consider the following function:
    void reverse( char * string1, const char * string2 )
    {
       int stringsize = sizeof( string1 )/sizeof( char );
       *( string1 + stringsize –1 ) = '\0';
       string1 = string1 + stringsize – 2;
       for ( ; *string2 != '\0'; string1--, string2++ )
          *string1 = *string2;
    }
    What method does the function use to refer to array elements?
          Pointer subscript notation.
          Pointer/offset notation where the pointer is actually the name of the array.
          Array subscript notation.
          Pointer/offset notation.
    Pointer/offset notation
  63. What method should be used to pass an array to a function that does not modify the array and only looks at it using array subscript notation:
          A nonconstant pointer to constant data.
          A nonconstant pointer to nonconstant data.
          A constant pointer to nonconstant data.
          A constant pointer to constant data.
    A constant pointer to constant data
  64. A string array:
          Is actually an array of pointers.
          Stores an actual string in each of its elements.
          Can only provide access to strings of a certain length.
          Is always less memory efficient than an equivalent double-subscripted array.
    Is actually an array of pointers
  65. Which of the following can have a pointer as an operand?
          %.
          *=.
          /.
          ++.
    ++
  66. Which of the following gives the number of elements in the int array r[ ]?
          sizeof ( *r ).
          sizeof r.
          sizeof ( *r ) / sizeof ( int ).
          sizeof r / sizeof ( int ).
    sizeof r / sizeof ( int )
  67. The & operator can be applied to:
          rvalues.
          constants.
          lvalues.
          string literals.
    lvalues.
  68. A pointer can not be assigned to:
            Any other pointer by using the cast operator.
          A pointer to void without using the cast operator.
          Another pointer of the same type without using the cast operator.
          A pointer of a type other than its own type and void without using the cast operator.
    A pointer of a type other than its own type and void without using the cast operator
  69. To follow the principle of least privilege, the selectionSort function should receive the array to be sorted as:
          A constant pointer to constant data.
          A constant pointer to nonconstant data.
          A nonconstant pointer to nonconstant data.
          A nonconstant pointer to constant data.
    A constant pointer to nonconstant data
  70. sizeof:
          Is a binary operator.
          Usually returns a double.
          Returns the total number of elements in an array.
          Returns the total number of bytes in a variable.
    Returns the total number of bytes in a variable

What would you like to do?

Home > Flashcards > Print Preview