SEN632 Java Software Architecture Application - Exam Prep - Part Two

Card Set Information

Author:
caldreaming
ID:
288873
Filename:
SEN632 Java Software Architecture Application - Exam Prep - Part Two
Updated:
2014-11-13 12:18:48
Tags:
java code software program architecture system computer design engineering UML object oriented oop programming model view controller mvc
Folders:

Description:
An in-depth study of software architecture. Defines and discusses object-oriented design, modeling and programming at an advanced level using UML. An advanced study of a standard implementation of a distributed, object-oriented middleware technology (e.g., J2EE, Microsoft.NET, etc. ). Students design and implement an architecture using modern technologies such as J2EE, .NET.
Show Answers:

Home > Flashcards > Print Preview

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


  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) A
    B) C
    C) B
    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 temporary object.  
    B) p is hosted by a separate thread.  
    C) p is created at that moment in time.  
    D) The message is sent to a class.
    E) p is a local object, accessible only to the calling method.  
    C) 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) State machine diagram.  
    B) Use case diagram. 
    C) Activity diagram. 
    D) Deployment diagram.
    E) Communication diagram. 
    F) Class diagram. 
    G) Sequence diagram. 
    G) 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) Designing code as if there were a contract between an object that sends a message and the object that receives it.  
    B) Reinforcing the contract between every pair of objects by increasing the amount of error-checking.  
    C) Protecting your software using a contract with a firewall.  
    D) Designing a software system under contract.
    A) 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 in italics.  
    D) Class messages are shown with the keyword <<static>>.
    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 event.  
    B) A boundary.  
    C) A class.  
    D) An interface.  
    E) A property.
    D) An interface.
    (this multiple choice question has been scrambled)
  12. What is an "abstract" class? Choose only one option.  

    A) A class with at least one undefined message.  
    B) A class with no concrete subclasses.  
    C) An interface.
    D) An object.  
    E) A class with no methods.  
    A) 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) Ensuring that the data inside an object can only be accessed via operations.  
    B) Depicting objects using state machine diagrams.  
    C) Putting objects into a collection.
    D) Sealing the state of an object so that it cannot be changed.  
    A) 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.
    • c) Communication diagrams.
    • e) Sequence diagrams.
  16. What is meant by the term "deadlock"? Choose only one option.  

    A) An object is waiting for a resource, which is being used by an object waiting for a resource used by the first object.
    B) Two processes or threads refuse to talk to each other.  
    C) An object's monitor allows its lock to terminate early.  
    A) 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) ActiveX controls.  
    B) CGI scripts.  
    C) XML.  
    D) Applets.  
    E) CORBA.
    B) 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)  User interface sketches.  
    B) Deployment diagrams.
    C) State machine diagrams.  
    D) Class diagrams.  
    E) Glossaries.  
    F) Use cases.  
    F) Use cases.
    (this multiple choice question has been scrambled)
  19. What is an association class? Choose only one option.  

    A) 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.  
    C) 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.
    (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) Specialization.  
    B) Composition.  
    C) Singularity.
    D) Genericity.  
    E) Association.  
    B) Composition.
    (this multiple choice question has been scrambled)
  21. What is a "thread"? Choose only one option.  

    A) An activity within a process that shares memory with other activities.  
    B) A designer's thought process.
    C) An independent process running on a node, with its own memory and IO.  
    A) 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) A class’s functions hide from the user the complex tasks they perform.  
    B) An object must be created from a class before it can be used.  
    C) Classes have attributes and behaviors.  
    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) Before main executes.  
    B) When they are explicitly called by another function.
    C) Never.  
    D) After main completes execution.  
    B) 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) Name of function.
    C) Return type.  
    D) Parentheses.  
    A) Left brace.
    (this multiple choice question has been scrambled)
  25. An object creation expression contains:    

    A) Parentheses.  
    B) The name of the class.  
    C) All of the above.  
    D) The name of the object.
    C) 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.
    a) The dot separator.
  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.
    a) The class’s name.
  28. What is the name of the values the method call passes to the method for the parameters?   

    A) Objects.  
    B) Arguments.
    C) Values.  
    D) References.  
    B) 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 World
    C)  H 
    D)  Hello 
    D)  Hello
    (this multiple choice question has been scrambled)
  30. Multiple parameters are separated by what symbol?   

    A) Parentheses. 
    B) Commas.
    C) The dot separator. 
    D) Braces. 
    B) Commas.
    (this multiple choice question has been scrambled)
  31. Attributes of a class are also known as:   

    A) Local variables.
    B) Classes. 
    C) Data members. 
    D) Constructors.
    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) ""
    C) null 
    D) "default" 
    B) ""
    (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) Client member functions.
    B) Access member functions.
    C) Set member functions. 
    D) Assign member functions. 
    C) Set member functions.
    (this multiple choice question has been scrambled)
  34. A default constructor has how many parameters?  

    A) 2. 
    B) Variable.
    C) 1. 
    D) 0. 
    D) 0.
    (this multiple choice question has been scrambled)
  35. A constructor can specify the return type:   

    A) int. 
    B) string.
    C) A constructor cannot specify a return type.  
    D) void. 
    C) 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)  .header.
    C)  .hdr.
    D)  .h.
    D)  .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) Source code resolver. 
    B) Class implementation connector.
    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) Programming phase. 
    B) Executing phase.
    C) Compiling phase. 
    D) Linking phase. 
    D) 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) Square Brackets, [ ]. 
    B) Angle brackets, < >. 
    C) Parentheses, ( ). 
    D) Braces, { }.
    D) 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)  “llo!”.
    D)  “ello”. 
    A)  “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) A name and direction for the association. 
    B) A number near the end of each line indicating multiplicity values.
    C) An aggregation relationship with another association line. 
    D) A role name for one or both of the objects.  
    C) 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 bolded.  
    C) Attaching a solid diamond to the association line. 
    D) Making the association line dashed
    C) 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) Pseudocode. 
    B) Transfer of control. 
    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 help the programmer “think out” a program. 
    B) All of the above are false. 
    C) They are executed by the computer. 
    D) They include declarations and all types of statements.
    A) They help the programmer “think out” a program.
    (this multiple choice question has been scrambled)
  48. Pseudocode does not include:  

    A) Input/output. 
    B) Control structures. 
    C) Declarations.
    D) Algorithms. 
    C) Declarations.
    (this multiple choice question has been scrambled)
  49. Which of the following encompasses the other three?  

    A) Control structure. 
    B) Selection structure.
    C) Repetition structure. 
    D) Sequence structure. 
    A) 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) Initial state. 
    D) Transition.
    B) Final state.
    (this multiple choice question has been scrambled)
  51. Which of the following is a double-selection statement?  

    A)  do…while.
    B)  if. 
    C)  switch. 
    D)  if…else. 
    D)  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)  c. Passed.
    B)  60. 
    C)  cout << "Passed";. 
    D)  nothing. 
    A)  c. Passed.
    (this multiple choice question has been scrambled)
  54. The data type bool:  

    A) Can take on values true and false.
    B) Can take on any expression as a value.  
    C) Can take on values -1, 0 or 1. 
    D) Can only be used in a selection statement.  
    A) Can take on values true and false.
    (this multiple choice question has been scrambled)
  55. The conditional operator (?:):  

    A) Is the only ternary operator in C++. 
    B) Accepts two operands.
    C) Is a unary operator. 
    D) Associates from left to right. 
    A) 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) Is represented by placing a semicolon (;) where a statement would normally be.
    C) Is a compound statement. 
    D) Must contain exactly three statements. 
    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) sum = sum – 30 should be sum = sum + 30 or else the loop may never end.  
    B) The parentheses should be braces. 
    C) There should be a semicolon after while ( sum <= 1000 ). 
    D) Braces are required around sum = sum – 30;.
    A) 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)  An infinite number of times. 
    B)  0.
    C)  10.
    D)  9.  
    A)  An infinite number of times.
    (this multiple choice question has been scrambled)
  60. An uninitialized local variable contains:  

    A) No value.
    B) A randomly assigned value.
    C) A value of zero. 
    D) The value last stored in the memory location reserved for that variable. 
    D) 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 fatal logic error.
    B) A counter exception. 
    C) An off-by-one error. 
    D) A syntax error. 
    C) An off-by-one error.
    (this multiple choice question has been scrambled)
  62. Indefinite repetition is controlled by a:   

    A) Counter. 
    B) Sentinel value. 
    C) Absence of a condition.
    D) Non-constant condition. 
    B) Sentinel value.
    (this multiple choice question has been scrambled)
  63. A fatal logic error can be caused by:  

    A) Choosing a sentinel value that is also a data value. 
    B) Using a counter variable in a calculation after the loop. 
    C) An attempt to divide by zero. 
    D) Not initializing variables before executing a repetition structure.
    C) An attempt to divide by zero.
    (this multiple choice question has been scrambled)
  64. In indefinite repetition, an input value:  

    A) Should always be processed directly after it is entered. 
    B) Can be entered, processed, and evaluated in any order. 
    C) Should never be modified. 
    D) Should always be evaluated before being processed.
    D) 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.25.
    B)  5.5. 
    C)  5. 
    D)  8. 
    D)  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) Truncation. 
    B) Promotion.  
    C) Explicit conversion.
    D) Implicit conversion. 
    D) Implicit conversion.
    (this multiple choice question has been scrambled)
  67. Having a loop within a loop is known as:   

    A) Recursive.
    B) A redundancy. 
    C) Nesting. 
    D) Doubling up. 
    C) 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) A declaration inside the loop body. 
    C) An assignment statement before the loop body.
    D) An assignment statement after the loop body. 
    B) 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 = x;
    B) x ++ 4;
    C) x =+ 4; 
    D) x += 4;
    D) 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: 1; y: 2. 
    B)  x: 5; y: 3.
    C)  x: 3; y: -1. 
    D)  x: 3; y: 5. 
    A)  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 + 1;. 
    C) c++;. 
    D) c += 1;. 
    B)  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 = x++;. 
    B) d. y = x + 1. 
    C) y = ++x;.
    D) y = 5;. 
    A) y = x++;.
    (this multiple choice question has been scrambled)
  73. Which of the following operations has the highest precedence?  

    A) Addition. 
    B) Assignment. 
    C) Postincrement. 
    D) Multiplication.
    C) 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 type. 
    B) The attribute’s initial value.
    C) The attribute’s name. 
    D) The attribute’s memory location. 
    D) The attribute’s memory location.
    (this multiple choice question has been scrambled)
  75. A class-type attribute is best modeled by: 

    A)  A composition association. 
    B) Breaking the class down into its fundamental-type components.
    C)  An inheritance association. 
    D)  Encapsulating both classes in a third, larger class. 
    A)  A composition association.
    (this multiple choice question has been scrambled)
  76. Which of the following does counter-controlled repetition require?  

    A) 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. 
    C) An initial value.
    D) A condition that tests for the final value.
    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 is automatically reinitialized to zero once the loop is finished. 
    B) The scope of the variable is restricted to that particular for loop.
    C) It can not be used in any structures that are nested in that for structure. 
    D) It retains its final value after the loop is finished. 
    B) 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) A for loop can always be used to replace a while loop, and vice versa.
    B) The three expressions in the for structure are optional. 
    C) You must declare the control variable outside of the for loop. 
    D) The initialization and increment expressions can be comma-separated lists.  
    C) 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. 
    C) x += 1.
    D) a. 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; ). 
    B) for ( int i = 0; int j = 5; ; i++ ). 
    C) int i = 0; for ( ; i < 10; i++ ).
    D) for ( int i = 0; 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) As imprecise representations of decimal numbers. 
    B) To store true/false values. 
    C) To perform monetary calculations. 
    D) As counters.
    A) 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) fixed.
    C) right. 
    D) left. 
    A) setw.
    (this multiple choice question has been scrambled)
  85. If a do…while structure is used:  

    A) An off-by-one error will not occur. 
    B) Counter-controlled repetition is not possible. 
    C) An infinite loop will not take place.
    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 9. 
    B) Print the numbers 1 through 10. 
    C) Cause a syntax error.
    D) Print the numbers 1 through 11. 
    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 double-selection structure.  
    C) As a multiple-selection structure.
    D) To replace all if and if…else statements. 
    C) As a multiple-selection structure.
    (this multiple choice question has been scrambled)
  88. In a switch structure:  

    A) A break is required after the default case.  
    B) A default case is required.
    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) Case 1.
    B) case 1. 
    C) case1. 
    D) Case1. 
    B) case 1.
    (this multiple choice question has been scrambled)
  90. switch can be used to test:  

    A) int constants.
    B) all types of constants. 
    C) float constants. 
    D) string constants. 
    A) int constants.
    (this multiple choice question has been scrambled)
  91. Which of the following data types can be used to represent integers?  

    A) long.
    B) char. 
    C) short. 
    D) All of these mentioned. 
    D) All of these mentioned.
    (this multiple choice question has been scrambled)
  92. Which of the following is false?  

    A) break statements exit from the loop in which they are embedded. 
    B) continue and break statements may be embedded within all C++ structures.
    C) continue statements skip the remaining statements in current iteration of the body of the loop in which they are embedded.  
    D) break and continue statements alter the flow of control. 
    B) 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) break and continue statements can perform faster than their corresponding structured techniques. 
    B) You should always try to write the fastest, smallest code possible before attempting to make it simple and correct. 
    C) The effects of break and continue statements can be achieved by structured programming techniques. 
    D) Many programmers feel that break and continue violate structured programming.
    B) 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 be replaced by ( 4 > y && y > 1 ).
    B) Evaluates correctly and could not be replaced by ( 4 > y && y > 1 ). 
    C) Does not evaluate correctly and should be replaced by ( 4 > y && y > 1 ). 
    D) Does not evaluate correctly and should not be replaced by ( 4 > y && y > 1 ). 
    C) 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) Associates from right to left. 
    B) Has higher precedence than the AND (&&) operator. 
    C) Stops evaluation upon finding one condition to be true. 
    D) Is a ternary operator.
    C) 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 = assignment operator. 
    B) The < relational operator. 
    C) The % arithmetic operator.  
    D) The ! logical operator.
    D) The ! logical operator.
    (this multiple choice question has been scrambled)
  99. Variables are also known as:  

    A) lvalues, but can be used as rvalues.
    B) Constant variables. 
    C) rvalues, and cannot be used as lvalues.  
    D) lvalues, and cannot be used as rvalues.  
    A) 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) 6.
    B) Nothing. 
    C) 12. 
    D) A syntax error is produced. 
    A) 6.
    (this multiple choice question has been scrambled)
  101. Of the following, which is not a logic error?   

    A) Using commas instead of the two required semicolons in a for header. 
    B) Failing to initialize counter and total variables before the body of a loop. 
    C) Using == to assign a value to a variable.
    D) Not placing curly braces around the body of an if that contains two statements. 
    A) 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) for, while, do…while. 
    B) switch, if, else.
    C) break, continue, 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) if. 
    B) switch.
    C) main. 
    D) do…while. 
    C) 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) Begin with the “simplest activity diagram.”  
    C) Any transition arrow can be reversed.
    D) Any action state can be replaced by any control statement. 
    C) 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) Rounded rectangles representing states.
    B) Fractions beside each state indicating the likelihood of entering that state. 
    C) A solid circle indicating the initial state.  
    D) Arrows with accompanying event description text representing transitions.  
    B) 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) All of these mentioned should be modeled in this activity diagram.
    B) Displaying the user’s balance information on the screen. 
    C) Receiving the user’s main menu input indicating a desire to inquire the amount of his or her balance. 
    D) Retrieving the user’s balance information from the database of accounts. 
    C) 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) 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. 
    D) A function call must specify the name and arguments of the function.  
    C) The definition of a function usually is visible to other functions.
    (this multiple choice question has been scrambled)
  108. Functions can:  

    A) Be used as building blocks to create new programs. 
    B) Be reused any number of times. 
    C) Return a result to the caller function.
    D) Do any of these mentioned. 
    D) Do any of these mentioned.
    (this multiple choice question has been scrambled)
  109. All math library functions:  

    A) Must be called by preceding the function name by cmath::. 
    B) Are global functions.
    C) Return data type int. 
    D) Can only be called after creating a math object. 
    B) 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) sine( x ).
    C) trig_sin( x ). 
    D) trig_sine( 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.
    • d) log.
    • a) ln.
  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) Declares a function called mySqrt which takes a double as an argument and returns an integer. 
    C) Defines a function called double which calculates square roots. 
    D) Defines a function called mySqrt which takes an argument of type x and returns a double.
    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) B. 
    B) A. 
    C) D. 
    D) C.
    D) C.
    (this multiple choice question has been scrambled)
  114. A function prototype does not have to:   

    A) Include parameter names. 
    B) Match with all calls to the function. 
    C) Terminate with a semicolon. 
    D) Agree with the function definition.
    A) Include parameter names.
    (this multiple choice question has been scrambled)
  115. A function prototype can always be omitted when:  

    A) A function is defined before it is first invoked. 
    B) A function does not return a value.
    C) A function takes no arguments. 
    D) A function is invoked before it is first defined. 
    A) 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) bool, char.
    B) float, double. 
    C) int, char. 
    D) short, long. 
    C) int, char.
    (this multiple choice question has been scrambled)
  117. Each standard library has a corresponding:   

    A) Header file. 
    B) Cd-rom.
    C) Variable type. 
    D) Function. 
    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) <string>.  
    B) <list>.
    C) <vector>.  
    D) <stack>.  
    A) <string>.
    (this multiple choice question has been scrambled)
  119. The rand function generates a data value of the type:  

    A) int. 
    B) long int. 
    C) short 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 int.
    B) Two-byte int. 
    C) Two-byte unsigned int. 
    D) Four-byte unsigned int. 
    C) Two-byte unsigned int.
    (this multiple choice question has been scrambled)
  121. In the expression n = x + rand() % y;  

    A) x is the scaling value. 
    B) y is the shifting value.
    C) y is the scaling value. 
    D) Both (a) and (b). 
    C) y is the scaling value.
    (this multiple choice question has been scrambled)
  122. srand:  

    A) Should be used instead of rand to generate truly random numbers. 
    B) Can use the time function’s return value as an optimal seed value. 
    C) Should be called before each call to rand.
    D) Is unnecessary in C++. 
    B) 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) All of these mentioned. 
    B) Determines where the identifier can be referenced in a program. 
    C) Determines the period during which that identifier exists in memory. 
    D) Determines whether an identifier is known only in the current source file or in any source file with proper declarations.
    C) 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) auto. 
    B) extern. 
    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 are initialized to zero if not explicitly initialized by the programmer. 
    B) They can be of type int. 
    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) Block scope. 
    B) Function scope. 
    C) File scope.
    D) Function-prototype scope. 
    B) 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) Those in the parameter list of a function prototype. 
    B) Those in the parameter list of a function definition.
    C) Global variables. 
    D) static local variables. 
    A) 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 calls another function. 
    B) A function returns control to its caller.
    C) A function calls itself. 
    D) A function declares a local variable. 
    B) 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) Parameter values received from its caller.  
    B) The return address of its caller function.  
    C) The name of the function.
    D) Local variables it has declared.  
    C) 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 could have been written functionA( void );. 
    B) It does not return a value.
    C) It does not receive any arguments. 
    D) It could have been written void functionA( );. 
    A) It could have been written functionA( void );.
    (this multiple choice question has been scrambled)
  132. The inline keyword:  

    A) Should be used with all frequently used functions. 
    B) Increases function-call overhead. 
    C) Can decrease program size but increase the function’s execution time.
    D) Can reduce a function’s execution time but increase program size. 
    D) 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 not, do. 
    B) Do, do.
    C) Do, do not. 
    D) Do not, do not. 
    A) Do not, do.
    (this multiple choice question has been scrambled)
  134. A reference parameter:  

    A) Is an alias for its corresponding argument.  
    B) Is declared by following the parameter’s type in the function prototype by an ampersand (&).
    C) Both (a) and (b). 
    D) Cannot be modified.  
    C) 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) The value being passed is small. 
    B) A large argument is passed in order to improve performance. 
    C) A pointer to the argument is used.
    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) They must be the rightmost (trailing) arguments in a function’s parameter list.  
    B) 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.
    C) Default values can be constants. 
    D) Default values cannot be global variables or function calls. 
    D) 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) None. 
    B) Two.
    C) One. 
    D) Three. 
    B) Two.
    (this multiple choice question has been scrambled)
  138. The unary scope resolution operator is used:   

    A) To access a global variable when a local variable of the same name is in scope.
    B) To access any variable in an outer block when a local variable of the same name is in scope. 
    C) To access a global variable when it is out of scope. 
    D) To access a local variable with the same name as a global variable. 
    A) 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) It examines all of these mentioned.
    B) The number of arguments in the function call.  
    C) Types and order of the arguments in the function call. 
    D) The return type of the function.  
    D) 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) Overloaded function. 
    B) Macro. 
    C) Recursive function.
    D) Function template. 
    D) Function template.
    (this multiple choice question has been scrambled)
  141. A recursive function is a function that:  

    A) Takes 3 arguments.
    B) Calls itself, directly or indirectly. 
    C) Is inside of another function. 
    D) Returns a double. 
    B) 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) 3. 
    B) 5.  
    C) 1.
    D) 7. 
    B) 5.
    (this multiple choice question has been scrambled)
  143. Recursion is to the base case as iteration is to what: 

    A) The counter.
    B) Failure of the loop continuation test. 
    C) A selection structure. 
    D) A repetition structure. 
    B) Failure of the loop continuation test.
    (this multiple choice question has been scrambled)
  144. An array is not:   

    A) Declared using braces, [].  
    B) Subscripted by integers. 
    C) A consecutive group of memory locations.  
    D) Made up of different data types.
    D) 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 + 1 ] = b[ a - 1 ] + 3;. 
    B) b[ a ] + 1 = b[ a + 3];.
    C) b[ a + 2 ] = b[ a ] + 3;. 
    D) b[ a + 1 ] = b[ a ] + 3;. 
    A) b[ a + 1 ] = b[ a - 1 ] + 3;.
    (this multiple choice question has been scrambled)
  146. Which of the following is not true?  

    A) The last element of an array has position number one less than the array size. 
    B) The first element of an array is the zeroth.
    C) A subscript cannot be an expression. 
    D) The position number contained within square brackets is called a subscript. 
    C) 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) int c[ 10 ];. 
    C) c = int[ 10 ];. 
    D) int array c[ 10 ];. 
    B) 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[] = { 0, 7, 0, 3, 8, 2 };. 
    B) int n[ 5 ] = { 9, 1, 9 };.
    C) int n[ 5 ] = { 7 };.  
    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) Do not have to be initialized when they are declared. 
    C) Can be used to specify array sizes, thereby making programs more scalable. 
    D) 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.
    (this multiple choice question has been scrambled)
  150. Referencing elements outside the array bounds:    

    A) Enlarges the size of the array. 
    B) Is a syntax error. 
    C) Is impossible because C++ checks to make sure it does not happen.
    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 initialized using string literals. 
    C) Grow or shrink dynamically.  
    D) Be used with cout and cin.
    C) Grow or shrink dynamically.
    (this multiple choice question has been scrambled)

What would you like to do?

Home > Flashcards > Print Preview