Which Of The Following Is A Repetition Structure In C++



The flashcards below were created by user caldreaming on FreezingBlue Flashcards.
  1. With reference to Figure 6, which kind of icon would you use to represent a communication path between systems or between a human and a system? Choose only one option.
    A) B
    B) C
    C) A
    B) C
    (this multiple choice question has been scrambled)
  2. With reference to Figure 6, which kind of icon would you use to represent an object that coordinates a system process, creates objects or retrieves objects? Choose only one option.
    A) A
    B) C
    C) B
    A) A
    (this multiple choice question has been scrambled)
  3. In Figure 7, what does the arrow hitting the p:PMember box indicate? Choose only one option.
    A) p is a local object, accessible only to the calling method.
    B) p is created at that moment in time.
    C) The message is sent to a class.
    D) p is a temporary object.
    E) p is hosted by a separate thread.
    B) p is created at that moment in time.
    (this multiple choice question has been scrambled)
  4. What kind of diagram is shown in Figure 7? Choose only one option.
    A) Deployment diagram.
    B) Use case diagram.
    C) Communication diagram.
    D) Activity diagram.
    E) Class diagram.
    F) Sequence diagram.
    G) State machine diagram.
    F) Sequence diagram.
    (this multiple choice question has been scrambled)
  5. Which of the following statements are true? Choose all options that apply.
    a) Most superclasses are abstract.
    b) Inheritance is preferable to composition.
    c) Most superclasses are concrete.
    d) Composition is preferable to inheritance.
    • a) Most superclasses are abstract.
    • d) Composition is preferable to inheritance.
  6. In UML diagrams, how are abstract classes distinguished from concrete classes? Choose only one option.
    A) Labels on concrete classes are shown in italics.
    B) Abstract classes are shown as boxes with dashed outlines.
    C) Labels on abstract classes are shown in italics.
    D) Concrete classes are shown as boxes with dashed outlines.
    C) Labels on abstract classes are shown in italics.
    (this multiple choice question has been scrambled)
  7. What is 'design by contract'? Choose only one option.
    A) Reinforcing the contract between every pair of objects by increasing the amount of error-checking.
    B) Designing code as if there were a contract between an object that sends a message and the object that receives it.
    C) Designing a software system under contract.
    D) Protecting your software using a contract with a firewall.
    B) Designing code as if there were a contract between an object that sends a message and the object that receives it.
    (this multiple choice question has been scrambled)
  8. What does the term 'polymorphism' refer to? Choose all options that apply.
    a) The ability of a variable to point at different classes of object at different times.
    b) The fact that a message with the same signature can invoke different methods at different times.
    c) All object-oriented programming languages are different.
    d) All object-oriented methodologies use a different notation.
    • a) The ability of a variable to point at different classes of object at different times.
    • b) The fact that a message with the same signature can invoke different methods at different times.
  9. In UML diagrams, how are classmessages distinguished from instance messages? Choose only one option.
    A) Class messages are underlined.
    B) Class messages are shown in brackets.
    C) Class messages are shown with the keyword <<static>>.
    D) Class messages are shown in italics.
    A) Class messages are underlined.
    (this multiple choice question has been scrambled)
  10. What is a 'generic' class? Choose only one option.
    A) A class with no declared copyright.
    B) A class that represents all objects.
    C) A class that has other classes as parameters.
    C) A class that has other classes as parameters.
    (this multiple choice question has been scrambled)
  11. With reference to Figure 8, what is Z? Choose only one option.
    A) An interface.
    B) An event.
    C) A property.
    D) A class.
    E) A boundary.
    A) An interface.
    (this multiple choice question has been scrambled)
  12. What is an 'abstract' class? Choose only one option.
    A) A class with no concrete subclasses.
    B) An object.
    C) A class with no methods.
    D) A class with at least one undefined message.
    E) An interface.
    D) A class with at least one undefined message.
    (this multiple choice question has been scrambled)
  13. What are the traditional steps in software production? Choose all options that apply.
    a) Maintenance.
    b) Design.
    c) Iteration.
    d) Incrementation.
    e) Deployment.
    f) Analysis.
    g) Requirements capture.
    h) Testing.
    i) Reuse.
    j) Implementation.
    k) Specification.
    • a) Maintenance.
    • b) Design.
    • e) Deployment.
    • f) Analysis.
    • g) Requirements capture.
    • h) Testing.
    • j) Implementation.
    • k) Specification.
  14. What is 'encapsulation'? Choose only one option.
    A) Putting objects into a collection.
    B) Depicting objects using state machine diagrams.
    C) Sealing the state of an object so that it cannot be changed.
    D) Ensuring that the data inside an object can only be accessed via operations.
    D) Ensuring that the data inside an object can only be accessed via operations.
    (this multiple choice question has been scrambled)
  15. In UML, which diagrams are used to show messages sent between objects? Choose all options that apply.
    a) Activity diagrams.
    b) Object diagrams.
    c) Communication diagrams.
    d) State machine diagrams.
    e) Sequence diagrams.
    f) Deployment diagrams.
  16. What is meant by the term 'deadlock'? Choose only one option.
    A) Two processes or threads refuse to talk to each other.
    B) An object's monitor allows its lock to terminate early.
    C) An object is waiting for a resource, which is being used by an object waiting for a resource used by the first object.
    C) An object is waiting for a resource, which is being used by an object waiting for a resource used by the first object.
    (this multiple choice question has been scrambled)
  17. Servlets are a direct replacement for what? Choose only one option.
    A) Applets.
    B) XML.
    C) CGI scripts.
    D) CORBA.
    E) ActiveX controls.
    C) CGI scripts.
    (this multiple choice question has been scrambled)
  18. Which of the following UML artifacts is used to show the steps involved in getting value from a system? Choose only one option.
    A) Use cases.
    B) Deployment diagrams.
    C) State machine diagrams.
    D) Class diagrams.
    E) Glossaries.
    F) User interface sketches.
    A) Use cases.
    (this multiple choice question has been scrambled)
  19. What is an association class? Choose only one option.
    A) It associates an object with the class of which it is an instance.
    B) It adds attributes and/or behaviour to an association between two other classes.
    C) It describes the various kinds of relationship that can exist between classes.
    B) It adds attributes and/or behaviour to an association between two other classes.
    (this multiple choice question has been scrambled)
  20. Which of the following terms best describes the case where a Stack class is implemented using an internal instance of List? Choose only one option.
    A) Association.
    B) Genericity.
    C) Composition.
    D) Specialization.
    E) Singularity.
    C) Composition.
    (this multiple choice question has been scrambled)
  21. What is a 'thread'? Choose only one option.
    A) An independent process running on a node, with its own memory and IO.
    B) A designer's thought process.
    C) An activity within a process that shares memory with other activities.
    C) An activity within a process that shares memory with other activities.
    (this multiple choice question has been scrambled)
  22. All of the following are true about classes, except:
    A) Classes have attributes and behaviors.
    B) A class’s functions hide from the user the complex tasks they perform.
    C) An object must be created from a class before it can be used.
    D) The first class in any C++ program is main.
    D) The first class in any C++ program is main.
    (this multiple choice question has been scrambled)
  23. C++ functions other than main are executed:
    A) When they are explicitly called by another function.
    B) Never.
    C) Before main executes.
    D) After main completes execution.
    A) When they are explicitly called by another function.
    (this multiple choice question has been scrambled)
  24. Function headers contain all of the following except:
    A) Left brace.
    B) Parentheses.
    C) Return type.
    D) Name of function.
    A) Left brace.
    (this multiple choice question has been scrambled)
  25. An object creation expression contains:
    A) All of the above.
    B) Parentheses.
    C) The name of the object.
    D) The name of the class.
    A) All of the above.
    (this multiple choice question has been scrambled)
  26. Calling a member function of an object requires which item?
    a) The dot separator.
    b) Open and close braces.
    c) None of the above.
    d) The class name.
  27. In the UML, the top compartment of the rectangle modeling a class contains:
    a) The class’s name.
    b) All of the above.
    c) The class’s behaviors.
    d) The class’s attributes.
  28. What is the name of the values the method call passes to the method for the parameters?
    A) Arguments.
    B) Values.
    C) Objects.
    D) References.
    A) Arguments.
    (this multiple choice question has been scrambled)
  29. Assuming that text is a variable of type string, what will be the contents of text after the statement cin >> text; is executed if the user types “Hello World!” and then presses Enter?
    A) Hello World
    B) Hello
    C) Hello World!
    D) H
    B) Hello
    (this multiple choice question has been scrambled)
  30. Multiple parameters are separated by what symbol?
    A) Parentheses.
    B) Commas.
    C) Braces.
    D) The dot separator.
    B) Commas.
    (this multiple choice question has been scrambled)
  31. Attributes of a class are also known as:
    A) Classes.
    B) Constructors.
    C) Data members.
    D) Local variables.
    C) Data members.
    (this multiple choice question has been scrambled)
  32. What is the default initial value of a String in C++?
    A) default
    B) 'default'
    C) '
    D) null
    C) '
    (this multiple choice question has been scrambled)
  33. What type of member functions allow a client of a class to assign values to private data members?
    A) Assign member functions.
    B) Client member functions.
    C) Access member functions.
    D) Set member functions.
    D) Set member functions.
    (this multiple choice question has been scrambled)
  34. A default constructor has how many parameters?
    A) Variable.
    B) 0.
    C) 2.
    D) 1.
    B) 0.
    (this multiple choice question has been scrambled)
  35. A constructor can specify the return type:
    A) A constructor cannot specify a return type.
    B) void.
    C) string.
    D) int.
    A) A constructor cannot specify a return type.
    (this multiple choice question has been scrambled)
  36. The compiler will implicitly create a default constructor if:
    A) The programmer specifically requests that the compiler do so.
    B) The class does not define any constructors.
    C) The class does not contain any data members.
    D) The class already defines a default constructor.
    B) The class does not define any constructors.
    (this multiple choice question has been scrambled)
  37. A header file is typically given the filename extension:
    A) .cpp.
    B) .h.
    C) .header.
    D) .hdr.
    B) .h.
    (this multiple choice question has been scrambled)
  38. Assuming that GradeBook.h is found in the current directory and the iostream header file is found in the C++ Standard Library header file directory, which of the following preprocessor directives will fail to find its desired header file?
    a) #include 'iostream'.
    b) #include .
    c) #include 'GradeBook.h'.
    d) #include .
    • d) #include . OR
    • b) #include .

    (Typo somewhere in the original print of this question.)
  39. In the source-code file containing a class’s member function definitions, each member function definition must be tied to the class definition by preceding the member function name with the class name and ::, which is known as the:
    A) Class implementation connector.
    B) Source code resolver.
    C) Member definition linker.
    D) Binary scope resolution operator.
    D) Binary scope resolution operator.
    (this multiple choice question has been scrambled)
  40. When compiling a class’s source code file (which does not contain a main function), the information in the class’s header file is used for all of the following, except:
    a) Ensuring that each member function knows about the class’s data members and other member functions.
    b) Determining the correct amount of memory to allocate for each object of the class.
    c) All of the above are uses that the compiler has for the header file information.
    d) Ensuring that the first line of each member function matches its prototype.
    b) Determining the correct amount of memory to allocate for each object of the class.
  41. 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:
    A) Linking phase.
    B) Programming phase.
    C) Compiling phase.
    D) Executing phase.
    A) Linking phase.
    (this multiple choice question has been scrambled)
  42. To execute multiple statements when an if statement’s condition is true, enclose those statements in a pair of:
    A) Braces, { }.
    B) Square Brackets, [ ].
    C) Parentheses, ( ).
    D) Angle brackets, < >.
    A) Braces, { }.
    (this multiple choice question has been scrambled)
  43. Assuming that the string object text contains the string “Hello!!!”, the expression text.substr( 2 , 5 ) would return a string object containing the string:
    A) “llo!”.
    B) “ello!”.
    C) “ello”.
    D) “llo!!”.
    D) “llo!!”.
    (this multiple choice question has been scrambled)
  44. A solid line representing an association between two classes can be accompanied by any of the following details, except:
    A) An aggregation relationship with another association line.
    B) A name and direction for the association.
    C) A number near the end of each line indicating multiplicity values.
    D) A role name for one or both of the objects.
    A) An aggregation relationship with another association line.
    (this multiple choice question has been scrambled)
  45. A composition or “has-a” relationship is represented in the UML by:
    A) Attaching a solid triangle to the association line.
    B) Making the association line dashed
    C) Making the association line bolded.
    D) Attaching a solid diamond to the association line.
    D) Attaching a solid diamond to the association line.
    (this multiple choice question has been scrambled)
  46. Specifying the order in which statements are to be executed in a computer program is called:
    A) Transfer of control.
    B) Pseudocode.
    C) An algorithm.
    D) Program control.
    D) Program control.
    (this multiple choice question has been scrambled)
  47. Which of the following is true of a pseudocode program?
    A) They are executed by the computer.
    B) They help the programmer “think out” a program.
    C) All of the above are false.
    D) They include declarations and all types of statements.
    B) They help the programmer “think out” a program.
    (this multiple choice question has been scrambled)
  48. Pseudocode does not include:
    A) Control structures.
    B) Declarations.
    C) Algorithms.
    D) Input/output.
    B) Declarations.
    (this multiple choice question has been scrambled)
  49. Which of the following encompasses the other three?
    A) Repetition structure.
    B) Sequence structure.
    C) Selection structure.
    D) Control structure.
    D) Control structure.
    (this multiple choice question has been scrambled)
  50. In an activity diagram for an algorithm, what does a solid circle surrounded by a hollow circle represent?
    A) Action state.
    B) Final state.
    C) Transition.
    D) Initial state.
    B) Final state.
    (this multiple choice question has been scrambled)
  51. Which of the following is a double-selection statement?
    A) if…else.
    B) do…while.
    C) switch.
    D) if.
    A) if…else.
    (this multiple choice question has been scrambled)
  52. Which of the following is a repetition structure?
    A) if.
    B) switch.
    C) do…while.
    D) if…else.
    C) do…while.
    (this multiple choice question has been scrambled)
  53. If grade has the value of 60, what will the following code print?
    If ( grade >= 60 )
    Cout << 'Passed';
    A) 60.
    B) nothing.
    C) c. Passed.
    D) cout << 'Passed';.
    C) c. Passed.
    (this multiple choice question has been scrambled)
  54. The data type bool:
    A) Can take on values -1, 0 or 1.
    B) Can only be used in a selection statement.
    C) Can take on any expression as a value.
    D) Can take on values true and false.
    D) Can take on values true and false.
    (this multiple choice question has been scrambled)
  55. The conditional operator (?:):
    A) Is a unary operator.
    B) Associates from left to right.
    C) Is the only ternary operator in C++.
    D) Accepts two operands.
    C) Is the only ternary operator in C++.
    (this multiple choice question has been scrambled)
  56. Which of the following does not perform the following task: print correct if answer is equal to 7 and incorrect if answer is not equal to 7?
    a) If ( answer 7 )
    cout << 'correct';
    else
    cout << 'incorrect';
    b) answer 7 ? cout << 'correct' : cout << 'incorrect';
    c) cout << ( answer 7 ? 'correct' : 'incorrect' );
    d) cout << answer 7 ? 'correct' : 'incorrect';
    c) cout << ( answer 7 ? 'correct' : 'incorrect' );
    or
    d) cout << answer 7 ? 'correct' : 'incorrect';
    Somewhere there is a typo in the original publication of this question example.
  57. A block:
    A) Cannot contain declarations.
    B) Must contain exactly three statements.
    C) Is a compound statement.
    D) Is represented by placing a semicolon (;) where a statement would normally be.
    C) Is a compound statement.
    (this multiple choice question has been scrambled)
  58. What is wrong with the following while loop?
    while ( sum <= 1000 )
    sum = sum – 30;
    A) The parentheses should be braces.
    B) There should be a semicolon after while ( sum <= 1000 ).
    C) Braces are required around sum = sum – 30;.
    D) sum = sum – 30 should be sum = sum + 30 or else the loop may never end.
    D) sum = sum – 30 should be sum = sum + 30 or else the loop may never end.
    (this multiple choice question has been scrambled)
  59. How many times will the following loop print hello?
    i = 1;
    while ( i <= 10 )
    cout << 'hello';
    A) 9.
    B) 10.
    C) 0.
    D) An infinite number of times.
    D) An infinite number of times.
    (this multiple choice question has been scrambled)
  60. An uninitialized local variable contains:
    A) The value last stored in the memory location reserved for that variable.
    B) A randomly assigned value.
    C) No value.
    D) A value of zero.
    A) The value last stored in the memory location reserved for that variable.
    (this multiple choice question has been scrambled)
  61. Using a loop’s counter-control variable in a calculation after the loop ends often causes a common logic error called:
    A) A counter exception.
    B) A syntax error.
    C) An off-by-one error.
    D) A fatal logic error.
    C) An off-by-one error.
    (this multiple choice question has been scrambled)
  62. Indefinite repetition is controlled by a:
    A) Absence of a condition.
    B) Sentinel value.
    C) Counter.
    D) Non-constant condition.
    B) Sentinel value.
    (this multiple choice question has been scrambled)
  63. A fatal logic error can be caused by:
    A) An attempt to divide by zero.
    B) Using a counter variable in a calculation after the loop.
    C) Choosing a sentinel value that is also a data value.
    D) Not initializing variables before executing a repetition structure.
    A) An attempt to divide by zero.
    (this multiple choice question has been scrambled)
  64. In indefinite repetition, an input value:
    A) Should always be evaluated before being processed.
    B) Should always be processed directly after it is entered.
    C) Should never be modified.
    D) Can be entered, processed, and evaluated in any order.
    A) Should always be evaluated before being processed.
    (this multiple choice question has been scrambled)
  65. What is the final value of x after performing the following operations?
    int x = 21;
    double y = 6;
    double z = 14;
    y = x / z;
    x = 5.5 * y;
    A) 8.
    B) 8.25.
    C) 5.
    D) 5.5.
    A) 8.
    (this multiple choice question has been scrambled)
  66. Which operation does not take place in the following example?
    int x = 21;
    double y = 6;
    double z = 14;
    y = x / z;
    x = 5.5 * y;
    A) Implicit conversion.
    B) Truncation.
    C) Explicit conversion.
    D) Promotion.
    A) Implicit conversion.
    (this multiple choice question has been scrambled)
  67. Having a loop within a loop is known as:
    A) Doubling up.
    B) A redundancy.
    C) Recursive.
    D) Nesting.
    D) Nesting.
    (this multiple choice question has been scrambled)
  68. To handle situations where a loop must reinitialize a variable at the beginning of each iteration, such reinitialization could be performed by:
    A) A declaration after the loop body.
    B) An assignment statement after the loop body.
    C) A declaration inside the loop body.
    D) An assignment statement before the loop body.
    C) A declaration inside the loop body.
    (this multiple choice question has been scrambled)
  69. If x initially contains the value 3, which of the following sets x to 7?
    A) x ++ 4;
    B) x += 4;
    C) x + 4 = x;
    D) x =+ 4;
    B) x += 4;
    (this multiple choice question has been scrambled)
  70. Assuming that x and y are equal to 3 and 2, respectively, after the statement x -= y executes, the values of x and y will be:
    A) x: 5; y: 3.
    B) x: 3; y: 5.
    C) x: 3; y: -1.
    D) x: 1; y: 2.
    D) x: 1; y: 2.
    (this multiple choice question has been scrambled)
  71. Which of the following will not increment c by 1?
    A) c++;.
    B) ++c;.
    C) c += 1;.
    D) c + 1;.
    D) c + 1;.
    (this multiple choice question has been scrambled)
  72. Assuming that x is equal to 4, which of the following statements will not result in y containing the value 5 after execution?
    A) y = 5;.
    B) d. y = x + 1.
    C) y = x++;.
    D) y = ++x;.
    C) y = x++;.
    (this multiple choice question has been scrambled)
  73. Which of the following operations has the highest precedence?
    A) Multiplication.
    B) Assignment.
    C) Addition.
    D) Postincrement.
    D) Postincrement.
    (this multiple choice question has been scrambled)
  74. Which of the following is not a piece of information that could be found in the attribute compartment of a class’s rectangle in the UML?
    A) The attribute’s memory location.
    B) The attribute’s name.
    C) The attribute’s initial value.
    D) The attribute’s type.
    A) The attribute’s memory location.
    (this multiple choice question has been scrambled)
  75. A class-type attribute is best modeled by:
    A) Breaking the class down into its fundamental-type components.
    B) A composition association.
    C) Encapsulating both classes in a third, larger class.
    D) An inheritance association.
    B) A composition association.
    (this multiple choice question has been scrambled)
  76. Which of the following does counter-controlled repetition require?
    A) An initial value.
    B) Counter-controlled repetition requires all of these mentioned.
    C) A condition that tests for the final value.
    D) An increment or decrement by which the control variable is modified each time through the loop.
    B) Counter-controlled repetition requires all of these mentioned.
    (this multiple choice question has been scrambled)
  77. The statement;
    while ( --counter >= 1 )
    counter % 2 ? cout << 'A' : cout << 'B';
    cannot be rewritten as:
    a) while ( --counter >= 1 )
    counter % 2 0 ? cout << 'B' : cout << 'A';.
    b) while ( counter > 1 )
    {
    --counter;
    if ( counter % 2 )
    cout << 'A';
    else
    cout << 'B';
    }.
    c) while ( counter >= 1 )
    if ( counter % 2 )
    cout << 'A';
    else
    cout << 'B';
    --counter;
    d) while ( --counter >= 1 )
    if ( counter % 2 )
    cout << 'A';
    else
    cout << 'B';.
    • c) while ( counter >= 1 )
    • if ( counter % 2 )
    • cout << 'A';
    • else
    • cout << 'B';
    • --counter;
  78. Which of the following is a bad programming practice?
    a) Indenting the statements in the body of each control structure.
    b) Placing vertical spacing above and below control structures.
    c) Using floating-point values for counters in counter-controlled repetition.
    d) Nesting multiple repetition structures one within another.
    c) Using floating-point values for counters in counter-controlled repetition.
  79. If a variable is declared in the initialization expression of a for structure, then:
    A) It can not be used in any structures that are nested in that for structure.
    B) It is automatically reinitialized to zero once the loop is finished.
    C) It retains its final value after the loop is finished.
    D) The scope of the variable is restricted to that particular for loop.
    D) The scope of the variable is restricted to that particular for loop.
    (this multiple choice question has been scrambled)
  80. Which of the following is not true?
    A) You must declare the control variable outside of the for loop.
    B) A for loop can always be used to replace a while loop, and vice versa.
    C) The three expressions in the for structure are optional.
    D) The initialization and increment expressions can be comma-separated lists.
    A) You must declare the control variable outside of the for loop.
    (this multiple choice question has been scrambled)
  81. Consider the execution of the following for loop;
    for (int x = 1; x < 5; increment )
    cout << x + 1 << endl;
    If the last value printed is 5, which of the following might have been used for increment?
    A) Any of these mentioned.
    B) x += 1.
    C) a. x++.
    D) ++x.
    A) Any of these mentioned.
    (this multiple choice question has been scrambled)
  82. Which of the following for headers is not valid?
    A) for ( int i = 0; i < 10; i++ ).
    B) for ( int i = 0; int j = 5; ; i++ ).
    C) for ( int i = 0: i < 10; ).
    D) int i = 0; for ( ; i < 10; i++ ).
    B) for ( int i = 0; int j = 5; ; i++ ).
    (this multiple choice question has been scrambled)
  83. float and double variables should be used:
    A) To perform monetary calculations.
    B) To store true/false values.
    C) As imprecise representations of decimal numbers.
    D) As counters.
    C) As imprecise representations of decimal numbers.
    (this multiple choice question has been scrambled)
  84. Which of the following is a parameterized stream manipulator used to format output?
    A) setw.
    B) right.
    C) left.
    D) fixed.
    A) setw.
    (this multiple choice question has been scrambled)
  85. If a do…while structure is used:
    A) An infinite loop will not take place.
    B) Counter-controlled repetition is not possible.
    C) An off-by-one error will not occur.
    D) The body of the loop will execute at least once.
    D) The body of the loop will execute at least once.
    (this multiple choice question has been scrambled)
  86. What will the following program segment do?
    int counter = 1;
    do {
    cout << counter << ' ';
    } while ( ++counter <= 10 );
    A) Print the numbers 1 through 11.
    B) Print the numbers 1 through 10.
    C) Print the numbers 1 through 9.
    D) Cause a syntax error.
    B) Print the numbers 1 through 10.
    (this multiple choice question has been scrambled)
  87. A switch statement should be used:
    A) As a single-selection structure.
    B) As a multiple-selection structure.
    C) As a double-selection structure.
    D) To replace all if and if…else statements.
    B) As a multiple-selection structure.
    (this multiple choice question has been scrambled)
  88. In a switch structure:
    A) A default case is required.
    B) A break is required after the default case.
    C) Multiple actions do not need to be enclosed in braces.
    D) A break is required after each case.
    C) Multiple actions do not need to be enclosed in braces.
    (this multiple choice question has been scrambled)
  89. Which of the following is correct when labeling cases in a switch structure?
    A) case1.
    B) Case1.
    C) case 1.
    D) Case 1.
    C) case 1.
    (this multiple choice question has been scrambled)
  90. switch can be used to test:
    A) float constants.
    B) string constants.
    C) all types of constants.
    D) int constants.
    D) int constants.
    (this multiple choice question has been scrambled)
  91. Which of the following data types can be used to represent integers?
    A) short.
    B) All of these mentioned.
    C) long.
    D) char.
    B) All of these mentioned.
    (this multiple choice question has been scrambled)
  92. Which of the following is false?
    A) continue statements skip the remaining statements in current iteration of the body of the loop in which they are embedded.
    B) break and continue statements alter the flow of control.
    C) break statements exit from the loop in which they are embedded.
    D) continue and break statements may be embedded within all C++ structures.
    D) continue and break statements may be embedded within all C++ structures.
    (this multiple choice question has been scrambled)
  93. Which of the following is false?
    A) You should always try to write the fastest, smallest code possible before attempting to make it simple and correct.
    B) The effects of break and continue statements can be achieved by structured programming techniques.
    C) Many programmers feel that break and continue violate structured programming.
    D) break and continue statements can perform faster than their corresponding structured techniques.
    A) You should always try to write the fastest, smallest code possible before attempting to make it simple and correct.
    (this multiple choice question has been scrambled)
  94. In C++, the condition ( 4 > y > 1 ):
    A) Evaluates correctly and could not be replaced by ( 4 > y && y > 1 ).
    B) Does not evaluate correctly and should be replaced by ( 4 > y && y > 1 ).
    C) Does not evaluate correctly and should not be replaced by ( 4 > y && y > 1 ).
    D) Evaluates correctly and could be replaced by ( 4 > y && y > 1 ).
    B) Does not evaluate correctly and should be replaced by ( 4 > y && y > 1 ).
    (this multiple choice question has been scrambled)
  95. The OR (||) operator:
    A) Stops evaluation upon finding one condition to be true.
    B) Associates from right to left.
    C) Is a ternary operator.
    D) Has higher precedence than the AND (&&) operator.
    A) Stops evaluation upon finding one condition to be true.
    (this multiple choice question has been scrambled)
  96. An operator that associates from right to left is:
    A) ,.
    B) ?:.
    C) ().
    D) !=.
    B) ?:.
    (this multiple choice question has been scrambled)
  97. The expression if ( num != 65 ) cannot be replaced by:
    A) if ( num > 65 || num < 65 ).
    B) if ( num – 65 ).
    C) if ( !( num 65 ) ).
    D) if ( !( num – 65 ) ).
    D) if ( !( num – 65 ) ).
    (this multiple choice question has been scrambled)
  98. An example of a unary operator is:
    A) The ! logical operator.
    B) The = assignment operator.
    C) The < relational operator.
    D) The % arithmetic operator.
    A) The ! logical operator.
    (this multiple choice question has been scrambled)
  99. Variables are also known as:
    A) lvalues, and cannot be used as rvalues.
    B) lvalues, but can be used as rvalues.
    C) Constant variables.
    D) rvalues, and cannot be used as lvalues.
    B) lvalues, but can be used as rvalues.
    (this multiple choice question has been scrambled)
  100. Consider the following code, assuming that x is an int with an initial value of 12;
    if( x = 6 )
    cout << x;
    What is the output?
    A) A syntax error is produced.
    B) Nothing.
    C) 6.
    D) 12.
    C) 6.
    (this multiple choice question has been scrambled)
  101. Of the following, which is not a logic error?
    A) Failing to initialize counter and total variables before the body of a loop.
    B) Using to assign a value to a variable.
    C) Using commas instead of the two required semicolons in a for header.
    D) Not placing curly braces around the body of an if that contains two statements.
    C) Using commas instead of the two required semicolons in a for header.
    (this multiple choice question has been scrambled)
  102. The ____________, __________ and ____________ are the only three forms of control necessary.
    A) break, continue, if…else.
    B) for, while, do…while.
    C) switch, if, else.
    D) sequence, selection, repetition.
    D) sequence, selection, repetition.
    (this multiple choice question has been scrambled)
  103. Which of the following is not one of the C++ control structures?
    A) main.
    B) if.
    C) switch.
    D) do…while.
    A) main.
    (this multiple choice question has been scrambled)
  104. Which of the following is not one the rules for forming structured programs?
    A) Any action state can be replaced by two action states in sequence
    B) Any transition arrow can be reversed.
    C) Any action state can be replaced by any control statement.
    D) Begin with the “simplest activity diagram.”
    B) Any transition arrow can be reversed.
    (this multiple choice question has been scrambled)
  105. Which of the following is not a part of a UML state diagram?
    A) A solid circle indicating the initial state.
    B) Rounded rectangles representing states.
    C) Arrows with accompanying event description text representing transitions.
    D) Fractions beside each state indicating the likelihood of entering that state.
    D) Fractions beside each state indicating the likelihood of entering that state.
    (this multiple choice question has been scrambled)
  106. An activity diagram for modeling the actions involved in executing a balance inquiry transaction using the BalanceInquiry object should not include:
    A) Retrieving the user’s balance information from the database of accounts.
    B) All of these mentioned should be modeled in this activity diagram.
    C) Displaying the user’s balance information on the screen.
    D) Receiving the user’s main menu input indicating a desire to inquire the amount of his or her balance.
    D) Receiving the user’s main menu input indicating a desire to inquire the amount of his or her balance.
    (this multiple choice question has been scrambled)
  107. All of the following are true of functions except:
    A) The implementation of a function is hidden from the caller.
    B) A function call must specify the name and arguments of the function.
    C) The definition of a function usually is visible to other functions.
    D) They define specific tasks that can be used at many points in a program.
    C) The definition of a function usually is visible to other functions.
    (this multiple choice question has been scrambled)
  108. Functions can:
    A) Return a result to the caller function.
    B) Do any of these mentioned.
    C) Be reused any number of times.
    D) Be used as building blocks to create new programs.
    B) Do any of these mentioned.
    (this multiple choice question has been scrambled)
  109. All math library functions:
    A) Return data type int.
    B) Can only be called after creating a math object.
    C) Are global functions.
    D) Must be called by preceding the function name by cmath::.
    C) Are global functions.
    (this multiple choice question has been scrambled)
  110. Which of the following expressions returns the trigonometric sine of x?
    A) sin( x ).
    B) trig_sine( x ).
    C) sine( x ).
    D) trig_sin( x ).
    A) sin( x ).
    (this multiple choice question has been scrambled)
  111. Which of the following is not included in .math?
    a) ln.
    b) pow.
    c) floor.
    d) log.
  112. The function prototype double mySqrt( int x );
    A) Declares a function called mySqrt which takes an integer as an argument and returns a double.
    B) Defines a function called double which calculates square roots.
    C) Defines a function called mySqrt which takes an argument of type x and returns a double.
    D) Declares a function called mySqrt which takes a double as an argument and returns an integer.
    A) Declares a function called mySqrt which takes an integer as an argument and returns a double.
    (this multiple choice question has been scrambled)
  113. Using the following function definition, the parameter list is represented by:
    A B ( C )
    {
    D
    }
    A) D.
    B) B.
    C) C.
    D) A.
    C) C.
    (this multiple choice question has been scrambled)
  114. A function prototype does not have to:
    A) Include parameter names.
    B) Terminate with a semicolon.
    C) Agree with the function definition.
    D) Match with all calls to the function.
    A) Include parameter names.
    (this multiple choice question has been scrambled)
  115. A function prototype can always be omitted when:
    A) A function is invoked before it is first defined.
    B) A function takes no arguments.
    C) A function does not return a value.
    D) A function is defined before it is first invoked.
    D) A function is defined before it is first invoked.
    (this multiple choice question has been scrambled)
  116. Converting from type ________ to type ________ will result in the loss of data.
    A) float, double.
    B) int, char.
    C) bool, char.
    D) short, long.
    B) int, char.
    (this multiple choice question has been scrambled)
  117. Each standard library has a corresponding:
    A) Header file.
    B) Function.
    C) Variable type.
    D) Cd-rom.
    A) Header file.
    (this multiple choice question has been scrambled)
  118. Which of the following C++ Standard Library header files does not contain a C++ Standard Library container class?
    A) <list>.
    B) <stack>.
    C) <vector>.
    D) <string>.
    D) <string>.
    (this multiple choice question has been scrambled)
  119. The rand function generates a data value of the type:
    A) short int.
    B) long int.
    C) int.
    D) unsigned int.
    D) unsigned int.
    (this multiple choice question has been scrambled)
  120. A variable that can only have values in the range 0 to 65535 is a:
    A) Four-byte unsigned int.
    B) Two-byte unsigned int.
    C) Two-byte int.
    D) Four-byte int.
    B) Two-byte unsigned int.
    (this multiple choice question has been scrambled)
  121. In the expression n = x + rand() % y;
    A) y is the shifting value.
    B) x is the scaling value.
    C) Both (a) and (b).
    D) y is the scaling value.
    D) y is the scaling value.
    (this multiple choice question has been scrambled)
  122. srand:
    A) Can use the time function’s return value as an optimal seed value.
    B) Is unnecessary in C++.
    C) Should be used instead of rand to generate truly random numbers.
    D) Should be called before each call to rand.
    A) Can use the time function’s return value as an optimal seed value.
    (this multiple choice question has been scrambled)
  123. Enumeration constants:
    A) Can be assigned other values once they have been defined.
    B) Are declared using the keyword const.
    C) Must have unique integer values.
    D) Must have unique identifiers.
    D) Must have unique identifiers.
    (this multiple choice question has been scrambled)
  124. An identifier’s storage class:
    A) Determines the period during which that identifier exists in memory.
    B) Determines whether an identifier is known only in the current source file or in any source file with proper declarations.
    C) All of these mentioned.
    D) Determines where the identifier can be referenced in a program.
    A) Determines the period during which that identifier exists in memory.
    (this multiple choice question has been scrambled)
  125. Depending on the circumstances, the compiler may ignore the storage class specifier:
    A) extern.
    B) auto.
    C) static.
    D) register.
    D) register.
    (this multiple choice question has been scrambled)
  126. Which of the following is not true of static local variables?
    A) They can be of type int.
    B) They are initialized to zero if not explicitly initialized by the programmer.
    C) They retain their values when the function in which they are defined terminates.
    D) They are accessible outside of the function in which they are defined.
    D) They are accessible outside of the function in which they are defined.
    (this multiple choice question has been scrambled)
  127. Labels are the only identifiers with:
    A) Function scope.
    B) File scope.
    C) Function-prototype scope.
    D) Block scope.
    A) Function scope.
    (this multiple choice question has been scrambled)
  128. The only identifiers that can be reused elsewhere in a program without any ambiguity are:
    A) static local variables.
    B) Those in the parameter list of a function definition.
    C) Global variables.
    D) Those in the parameter list of a function prototype.
    D) Those in the parameter list of a function prototype.
    (this multiple choice question has been scrambled)
  129. An activation record will be popped off the function call stack whenever:
    A) A function declares a local variable.
    B) A function calls another function.
    C) A function returns control to its caller.
    D) A function calls itself.
    C) A function returns control to its caller.
    (this multiple choice question has been scrambled)
  130. Which of the following is not included in a function’s activation record?
    A) Local variables it has declared.
    B) The name of the function.
    C) The return address of its caller function.
    D) Parameter values received from its caller.
    B) The name of the function.
    (this multiple choice question has been scrambled)
  131. Which of the following is false about the following function prototype?
    void functionA( void );
    A) It does not receive any arguments.
    B) It does not return a value.
    C) It could have been written void functionA( );.
    D) It could have been written functionA( void );.
    D) It could have been written functionA( void );.
    (this multiple choice question has been scrambled)
  132. The inline keyword:
    A) Increases function-call overhead.
    B) Should be used with all frequently used functions.
    C) Can reduce a function’s execution time but increase program size.
    D) Can decrease program size but increase the function’s execution time.
    C) Can reduce a function’s execution time but increase program size.
    (this multiple choice question has been scrambled)
  133. 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.
    A) Do, do.
    B) Do not, do not.
    C) Do, do not.
    D) Do not, do.
    D) Do not, do.
    (this multiple choice question has been scrambled)
  134. A reference parameter:
    A) Is declared by following the parameter’s type in the function prototype by an ampersand (&).
    B) Both (a) and (b).
    C) Is an alias for its corresponding argument.
    D) Cannot be modified.
    B) Both (a) and (b).
    (this multiple choice question has been scrambled)
  135. Call-by-reference can achieve the security of call-by-value when:
    A) A pointer to the argument is used.
    B) The value being passed is small.
    C) A large argument is passed in order to improve performance.
    D) The const qualifier is used.
    D) The const qualifier is used.
    (this multiple choice question has been scrambled)
  136. In regards to default arguments, which of the following is false?
    A) When an argument is omitted in a function call, the default value of that argument is automatically inserted by the compiler and passed in the function call.
    B) Default values cannot be global variables or function calls.
    C) Default values can be constants.
    D) They must be the rightmost (trailing) arguments in a function’s parameter list.
    B) Default values cannot be global variables or function calls.
    (this multiple choice question has been scrambled)
  137. 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?
    A) One.
    B) Three.
    C) Two.
    D) None.
    C) Two.
    (this multiple choice question has been scrambled)
  138. The unary scope resolution operator is used:
    A) To access a global variable when it is out of scope.
    B) To access a global variable when a local variable of the same name is in scope.
    C) To access a local variable with the same name as a global variable.
    D) To access any variable in an outer block when a local variable of the same name is in scope.
    B) To access a global variable when a local variable of the same name is in scope.
    (this multiple choice question has been scrambled)
  139. Which of the following does the C++ compiler not examine in order to select the proper overloaded function to call?
    A) The return type of the function.
    B) The number of arguments in the function call.
    C) It examines all of these mentioned.
    D) Types and order of the arguments in the function call.
    A) The return type of the function.
    (this multiple choice question has been scrambled)
  140. If a function’s program logic and operations are identical for each data type it could receive as argument(s) then a __________ should be used.
    A) Recursive function.
    B) Macro.
    C) Function template.
    D) Overloaded function.
    C) Function template.
    (this multiple choice question has been scrambled)
  141. A recursive function is a function that:
    A) Is inside of another function.
    B) Returns a double.
    C) Takes 3 arguments.
    D) Calls itself, directly or indirectly.
    D) Calls itself, directly or indirectly.
    (this multiple choice question has been scrambled)
  142. Assuming the following pseudocode for the Fibonacci series, what is the value of the 5th Fibonacci number (fibonacci ( 5 ))?
    fibonacci( 0 ) = 0
    fibonacci( 1 ) = 1
    fibonacci( n ) = fibonacci( n – 1 ) + fibonacci( n – 2 )
    A) 5.
    B) 3.
    C) 1.
    D) 7.
    A) 5.
    (this multiple choice question has been scrambled)
  143. Recursion is to the base case as iteration is to what:
    A) The counter.
    B) A selection structure.
    C) A repetition structure.
    D) Failure of the loop continuation test.
    D) Failure of the loop continuation test.
    (this multiple choice question has been scrambled)
  144. An array is not:
    A) Made up of different data types.
    B) Subscripted by integers.
    C) Declared using braces, [].
    D) A consecutive group of memory locations.
    A) Made up of different data types.
    (this multiple choice question has been scrambled)
  145. Assuming that int a has a value of 3 and that integer array b has 7 elements, what is the correct way to assign the value of the third element plus 3, to the fifth element of the array:
    A) b[ a + 2 ] = b[ a ] + 3;.
    B) b[ a + 1 ] = b[ a ] + 3;.
    C) b[ a ] + 1 = b[ a + 3];.
    D) b[ a + 1 ] = b[ a - 1 ] + 3;.
    D) b[ a + 1 ] = b[ a - 1 ] + 3;.
    (this multiple choice question has been scrambled)
  146. Which of the following is not true?
    A) The position number contained within square brackets is called a subscript.
    B) A subscript cannot be an expression.
    C) The first element of an array is the zeroth.
    D) The last element of an array has position number one less than the array size.
    B) A subscript cannot be an expression.
    (this multiple choice question has been scrambled)
  147. Which statement would be used to declare a 10-element integer array c?
    A) array c = int[ 10 ];.
    B) c = int[ 10 ];.
    C) int c[ 10 ];.
    D) int array c[ 10 ];.
    C) int c[ 10 ];.
    (this multiple choice question has been scrambled)
  148. Which of the following is not a correct way to initialize an array?
    A) int n[ 5 ] = { 7 };.
    B) int n[ 5 ] = { 9, 1, 9 };.
    C) int n[] = { 0, 7, 0, 3, 8, 2 };.
    D) int n[ 5 ] = { 0, 7, 0, 3, 8, 2 };.
    D) int n[ 5 ] = { 0, 7, 0, 3, 8, 2 };.
    (this multiple choice question has been scrambled)
  149. Constant variables:
    A) Can be assigned values in executable statements.
    B) Can be used to specify array sizes, but this makes programs harder to understand.
    C) Can be used to specify array sizes, thereby making programs more scalable.
    D) Do not have to be initialized when they are declared.
    C) Can be used to specify array sizes, thereby making programs more scalable.
    (this multiple choice question has been scrambled)
  150. Referencing elements outside the array bounds:
    A) Is impossible because C++ checks to make sure it does not happen.
    B) Is a syntax error.
    C) Enlarges the size of the array.
    D) Can result in changes to the value of an unrelated variable.
    D) Can result in changes to the value of an unrelated variable.
    (this multiple choice question has been scrambled)
  151. Strings represented as character arrays cannot:
    A) Be initialized with initializer lists.
    B) Be used with cout and cin.
    C) Grow or shrink dynamically.
    D) Be initialized using string literals.
    C) Grow or shrink dynamically.
    (this multiple choice question has been scrambled)
289101
C++ and UML - Exam Prep.txt
A combination of question for preparing for C++ and UML exams

Which Of The Following Is A Repetition Structure In C++ Group Of Answer Choices

C++

Which of the following is a repetition structure? A) if b) if else c) do while d) switch. The data type boo: a) can take values 'true' and 'false'.

Which Of The Following Is A Repetition Structure In C++ Cell

In structures, the computer repeats particular statements a certain number of times depending on some condition(s). Looping It is possible that the body of a while loop may not execute at all, but the body of a for loop executes at least once. Control Sructures - Repetition Repetition Statements. Repetition statements are called loops, and are used to repeat the same code mulitple times in succession. The number of repetitions is based on criteria defined in the loop structure, usually a true/false expression; The three loop structures in C are: while loops; do-while loops; for loops.

Which Of The Following Is A Repetition Structure In C++ Text

The following is a note about the types of control structures and the control structure used in every program. The repetition is a control structure in which it is used to repeat the statements in the program if required. The selection is a control structure in which only certain statements gets executed based on. Which of the following is not a function of the break statement? To exit early from a loop b. To skip the remainder of a switch structure c. To eliminate the use of certain bool variables in a loop d. To ignore certain values for variables and continue with the next iteration of a loop.