Cop4530 Comprehensive

37 Questions | Attempts: 191
Share

SettingsSettingsSettings
Cop4530 Comprehensive - Quiz

.


Questions and Answers
  • 1. 

    To find a pointer max to the largest element in the array a we can use the following genericalgorithm call (there are size elements in a)

    • A.

      Max = fsu::g_max_element (a);

    • B.

      Max = fsu::g_max_element (a, a + size);

    • C.

      Max = fsu::g_max_element (a.Begin());

    • D.

      Max = fsu::g_max_element (a.Begin(), a.End());

    Correct Answer
    B. Max = fsu::g_max_element (a, a + size);
  • 2. 

    Select the answer that best describes the asymptotic runtime of the operationfsu::Deque:: bracket operator [i]Here i is an item of type size_t and n is the size of the deque. 

    • A.

      Amortized O(1)

    • B.

      O(n)

    • C.

      Amortized O(n)

    • D.

      O(1)

    Correct Answer
    D. O(1)
  • 3. 

    The following illustrates the contents of the control stack S during a depth-first search of a tree [tree3],beginning at vertex R = root and searching for the vertex X = goal. (Search left before right, beginning at the root.) The search process is started but not complete.

    • A.

      S --> ------------ ... RAD RADG RAD RA R RB RBX

    • B.

      S --> ------------ ... RAD RADG RADGB RADGBX

    • C.

      None of the other choices

    • D.

      S --> ------------ ... RADFGB RADFGBX

    • E.

      S --> ------------ ... C CD CDX

    Correct Answer
    A. S --> ------------ ... RAD RADG RAD RA R RB RBX
  • 4. 

    Declare a vector object widgetVector with elements of type Widget, size 15, and initialelement values equal to ZED.

    • A.

      fsu::Vector widgetVector;

    • B.

      WidgetVector widgetVector (15,ZED);

    • C.

      Fsu::Vector widgetVector (15,ZED);

    • D.

      Fsu::Vector(15,ZED) widgetVector;

    • E.

      None of the other choices

    Correct Answer
    C. Fsu::Vector widgetVector (15,ZED);
  • 5. 

    This is an illustration of a vector of characters to be used in answering the question:element: B D F F F H K Q W Yindex: 0 1 2 3 4 5 6 7 8 9What is the return value of the call lower_bound('F') ?

    • A.

      1

    • B.

      2

    • C.

      3

    • D.

      4

    • E.

      5

    • F.

      D

    • G.

      F

    • H.

      H

    Correct Answer
    B. 2
  • 6. 

    Declare a Deque object d with elements of type String.

    • A.

      None of the other choices

    • B.

      D = new fsu::Deque < char >;

    • C.

      Fsu::Deque < char , fsu::List < char > > d;

    • D.

      D fsu::Deque < char >;

    • E.

      Fsu::Deque < char > d;

    Correct Answer
    A. None of the other choices
  • 7. 

    Select a minimal set of operations that distinguish fsu::Vector from other fsu:: sequentialcontainers.(Here i is an iterator, t is a container element, and n is an integer.)

    • A.

      PushBack(t)

    • B.

      PushFront(t)

    • C.

      Insert(i,t)

    • D.

      [n] (bracket operator)

    • E.

      SetSize(n)

    • F.

      Front()

    • G.

      Back()

    • H.

      Begin()

    Correct Answer
    E. SetSize(n)
  • 8. 

    The following represents output from the call d.Dump() from the fsu::Deque<char> object d:What is the result of the following output statement?std::cout << d[5];

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    • E.

      E

    • F.

      F

    • G.

      G

    • H.

      H

    • I.

      I

    • J.

      J

    Correct Answer
    B. B
  • 9. 

    Write a traversal loop for an fsu::Vector object v .

    • A.

      For (size_t i = 0; i

    • B.

      For (size_t i = 0; i

    • C.

      For (size_t i = 0; i < size; ++i) { /* whatever */ }

    • D.

      For (size_t i = 0; i < v.Size(); ++i) { /* whatever */ }

    Correct Answer
    D. For (size_t i = 0; i < v.Size(); ++i) { /* whatever */ }
  • 10. 

    Select the most appropriate statement of the asymptotic runtime for the sequential_searchalgorithm with input size n.

    • A.

      O(log n)

    • B.

      Θ(log n)

    • C.

      O(n)

    • D.

      Θ(n)

    Correct Answer
    C. O(n)
  • 11. 

    To copy the elements from an fsu::Deque<> d to an fsu::Vector<> v we can use the following generic algorithm call:

    • A.

      Fsu::g_copy (d.Begin(), d.End(), v.Begin());

    • B.

      Fsu::g_copy (d.Begin(), d.End(), v);

    • C.

      None of the other choices

    • D.

      Fsu::g_copy (d.Begin(), d.End(), v, v + d.Size);

    • E.

      Fsu::g_copy (d.Begin(), d.End(), v.Begin(), v.End());

    Correct Answer
    A. Fsu::g_copy (d.Begin(), d.End(), v.Begin());
  • 12. 

    Select the answer that best describes the asymptotic runtime of the operationfsu::List:: DestructorHere n is the size of the list.

    • A.

      O(1)

    • B.

      Amortized O(1)

    • C.

      O(n)

    • D.

      Amortized O(n)

    Correct Answer
    C. O(n)
  • 13. 

    Select a minimal set of operations that distinguish fsu::List from other fsu:: sequentialcontainers.

    • A.

      PushBack(t)

    • B.

      PushFront(t)

    • C.

      Insert(i,t)

    • D.

      [n] (bracket operator)

    • E.

      SetSize(n)

    • F.

      Front()

    • G.

      Back()

    • H.

      Begin()

    Correct Answer
    C. Insert(i,t)
  • 14. 

    Select a minimal set of operations that distinguish fsu::Deque from other fsu:: sequentialcontainers.

    • A.

      PushBack(t)

    • B.

      PushFront(t)

    • C.

      Insert(i,t)

    • D.

      [n] (bracket operator)

    • E.

      SetSize(n)

    • F.

      Front()

    • G.

      Back()

    • H.

      Begin()

    Correct Answer(s)
    B. PushFront(t)
    D. [n] (bracket operator)
  • 15. 

    An abstract data type [ADT] consists of the following (select all that apply):

    • A.

      A set of operations on the data

    • B.

      Axioms, or rules, governing the way operations interact

    • C.

      A collection of data of some type T

    • D.

      An implementation in a modern programming language

    • E.

      Theorems, or provable behaviors derived from the axioms

    Correct Answer(s)
    A. A set of operations on the data
    B. Axioms, or rules, governing the way operations interact
    C. A collection of data of some type T
  • 16. 

    Declare an fsu::Stack object S with elements of type fsu::String and underlyingcontainer fsu::Vector.

    • A.

      fsu::Stack < fsu::String , fsu::Vector < fsu::String > > S;

    • B.

      Fsu::Vector < fsu::String , Stack < fsu::String > > S;

    • C.

      None of the other choices

    • D.

      Fsu::Stack < fsu::String > S;

    • E.

      Fsu::Deque < fsu::String , fsu::Vector < fsu::String > > S;

    Correct Answer
    A. fsu::Stack < fsu::String , fsu::Vector < fsu::String > > S;
  • 17. 

    Select the answer that best describes the asymptotic runtime of the operationfsu::Vector::PushBack(t)Here t is an item of type fsu::Vector::ValueType and n is the size of the vector.

    • A.

      O(1)

    • B.

      Amortized O(1)

    • C.

      O(n)

    • D.

      Amortized O(n)

    Correct Answer
    B. Amortized O(1)
  • 18. 

    Select the most appropriate statement for the asymptotic runtime for the binary_searchalgorithm with input size n.

    • A.

      Θ(log n)

    • B.

      O(log n)

    • C.

      O(n)

    • D.

      Θ(n)

    Correct Answer
    A. Θ(log n)
  • 19. 

    This is an illustration of a vector of characters to be used in answering the question:element: B D F F F H K Q W Yindex:     0 1 2 3 4 5 6 7 8 9What is the return value of the call lower_bound('Z') ?

    • A.

      7

    • B.

      8

    • C.

      9

    • D.

      10

    • E.

      K

    • F.

      Q

    • G.

      W

    • H.

      Y

    Correct Answer
    D. 10
  • 20. 

    This is an illustration of a vector of characters to be used in answering the question:element: B D F F F H K Q W Yindex:      0 1 2 3 4 5 6 7 8 9What is the return value of the call upper_bound('F') ?

    • A.

      1

    • B.

      2

    • C.

      3

    • D.

      4

    • E.

      5

    • F.

      D

    • G.

      F

    • H.

      H

    Correct Answer
    E. 5
  • 21. 

    The following represents output from the call d.Dump() from the fsu::Deque object d:What is the result of the following output statement?std::cout << d;

    • A.

      G H I J A B C

    • B.

      G H I J A B

    • C.

      None of the other choices

    • D.

      C D E F

    • E.

      C D E F G

    Correct Answer
    B. G H I J A B
  • 22. 

    This is an illustration of a vector of characters to be used in answering the question:element: B D F F F H K Q W Yindex:     0 1 2 3 4 5 6 7 8 9What is the return value of the call upper_bound('X') ?

    • A.

      7

    • B.

      8

    • C.

      9

    • D.

      10

    • E.

      K

    • F.

      Q

    • G.

      W

    • H.

      Y

    Correct Answer
    C. 9
  • 23. 

    Suppose the fsu::Deque<> d has elements in sorted order and we wish to insert the element x in correct order in d. The following generic algorithm call returns an iterator to the first correct location to insert x:

    • A.

      I = fsu::g_upper_bound(d, x);

    • B.

      I = fsu::g_upper_bound(d.Begin(), d.End(), x);

    • C.

      I = fsu::g_lower_bound(d.Begin(), d.End(), x);

    • D.

      I = fsu::g_lower_bound(d, x);

    • E.

      None of the other choices

    Correct Answer
    C. I = fsu::g_lower_bound(d.Begin(), d.End(), x);
  • 24. 

    Declare an fsu::List object L with elements of type fsu::String.

    • A.

      None of the other choices

    • B.
    • C.
    • D.
    • E.
    Correct Answer
    B.
  • 25. 

    Given the type definitiontypedef fsu::Pair < String , int > PairType;and instances:

    • A.

      P1 == p1

    • B.

      P1 == p2

    • C.

      P1 == p3

    • D.

      P1 == p4

    Correct Answer(s)
    A. P1 == p1
    C. P1 == p3
  • 26. 

    What is the result of a postorder traversal of the following tree?

    • A.

      A B C D E

    • B.

      A B D C E

    • C.

      D B E C A

    • D.

      D B A C E

    Correct Answer
    C. D B E C A
  • 27. 

    What is the worstcase runtime for the Search algorithm in a RedBlack LeftLeaningBinary Search Tree? (Select all that apply)

    • A.

      Theta(N)

    • B.

      Theta(H)

    • C.

      Theta(log N)

    • D.

      Theta(log H)

    Correct Answer(s)
    B. Theta(H)
    C. Theta(log N)
  • 28. 

    The adaptor template defining fsu::Stack < T , C > defines an implementation of ADT Stackby redefining the user interface of the container C. Which of the operations listed below must C possess for this adaptation to compile? (Check all that apply.)

    • A.

      PushFront(t)

    • B.

      PushBack(t)

    • C.

      PopFront()

    • D.

      PopBack()

    Correct Answer(s)
    B. PushBack(t)
    D. PopBack()
  • 29. 

    The following represents output from the call d.Dump() from the fsu::Deque<char> object d:What is the result of the d.Dump() after the call d.PushFront('X') ? 

    • A.

      None of the other choices

    • B.
    • C.
    • D.
    • E.
    Correct Answer
    C.
  • 30. 

    Declare an ordered table object otable as an ordered set of pairs consisting of a key of typeKeyType and some data of type DataType. (Assume namespace fsu.)

    • A.
    • B.
    • C.
    • D.
    • E.

      All of the above

    • F.

      None of the above

    Correct Answer
    E. All of the above
  • 31. 

    What is the result of a levelorder traversal of the following tree?

    • A.

      A B C D E

    • B.

      A B D C E

    • C.

      D B E C A

    • D.

      D B A C E

    Correct Answer
    A. A B C D E
  • 32. 

    What is the worstcase runtime for the Search algorithm in a AVL Binary Search Tree? (Select all that apply)

    • A.

      Theta(N)

    • B.

      Theta(H)

    • C.

      Theta(log N)

    • D.

      Theta(log H)

    Correct Answer(s)
    B. Theta(H)
    C. Theta(log N)
  • 33. 

    What is the result of a pre-order traversal of the following tree?

    • A.

      15 30 25 95 80 50

    • B.

      50 25 80 15 30 95

    • C.

      50 25 15 30 80 95

    • D.

      15 25 30 50 80 95

    Correct Answer
    C. 50 25 15 30 80 95
  • 34. 

    What is the worst-case runtime for the Search algorithm in a Red-Black Binary Search Tree? (Select all that apply)

    • A.

      Theta(N)

    • B.

      Theta(H)

    • C.

      Theta(log N)

    • D.

      Theta(log H)

    Correct Answer(s)
    B. Theta(H)
    C. Theta(log N)
  • 35. 

    What is the result of a pre-order traversal of the following tree?

    • A.

      A B C D E

    • B.

      A B D C E

    • C.

      D B E C A

    • D.

      D B A C E

    Correct Answer
    B. A B D C E
  • 36. 

    Select the answer that best describes the asymptotic runtime of the operationfsu::List::PushBack(t)Here t is an item of type  fsu::List::ValueType and n is the size of the list.

    • A.

      O(1)

    • B.

      Amortized O(1)

    • C.

      O(n)

    • D.

      Amortized O(n)

    Correct Answer
    A. O(1)
  • 37. 

    Select the operations that define the associative container (Set) API. Here tval is a value anditer is an iterator.

    • A.

      Includes(tval)

    • B.

      Remove(iter)

    • C.

      Insert(iter,tval)

    • D.

      Insert(tval)

    • E.

      Remove(tval)

    Correct Answer(s)
    A. Includes(tval)
    D. Insert(tval)
    E. Remove(tval)

Quiz Review Timeline +

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

  • Current Version
  • Aug 03, 2016
    Quiz Edited by
    ProProfs Editorial Team
  • Jun 09, 2016
    Quiz Created by
    Victorfolz
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.