SUBJECTS
|
BROWSE
|
CAREER CENTER
|
POPULAR
|
JOIN
|
LOGIN
Business Skills
|
Soft Skills
|
Basic Literacy
|
Certifications
About
|
Help
|
Privacy
|
Terms
|
Email
Search
Test your basic knowledge |
Data Structures Using C++
Start Test
Study First
Subject
:
it-skills
Instructions:
Answer 50 questions in 15 minutes.
If you are not ready to take this test, you can
study here
.
Match each statement with the correct term.
Don't refresh. All questions and answers are randomly picked and ordered every time you load a test.
This is a study tool. The 3 wrong answers for each question are randomly chosen from answers to other questions. So, you might find at times the answers obvious, but you will see it re-enforces your understanding as you take the test each time.
1. In a(n) ____ copy - each pointer refers to its own data.
=
a pointer not in the list
deep
dynamic
2. The increment operator ______ increments the value of a pointer variable by twice the size of the memory to which it is pointing.
is-a
copy
dynamic
does not
3. Building a linked list forward places the item to be added at the ____ of the linked list.
end
node
25 21 18
reverse_iterator
4. Given container ct - what is the effect of ct.rbegin()?
Returns a pointer to the last element in container ct
function template
address of p (1200)
isFull & listSize
5. What are containers used for?
O(1)
Returns a pointer to the last element in container ct
To manage objects of a given type
=
6. Inheritance is an example of the ____ relationship.
does not
is-a
deep copy
Returns a pointer to the last element in container ct
7. Which statement must be included in a program in order to use a deque container?
function template
deep copy
#include <deque>
double-ended queue
8. Which of the following should be used to traverse a list?
a pointer not in the list
num
prevent memory leaks
25 21 18
9. If you applied the operation pop to the stack above - which book would be left on top of the stack?
5 2 7
infix
2nd book from the top
public members of a base class
10. A class that contains a pointer variable as one of its data members should contain an overloaded assignment operator to
2
end
x y - v w + *
prevent memory leaks
11. Which answer most accurately completes the following sentence: A linked list is made up of ____.
copy
dynamic
nodes
=
12. A derived class can directly access ____.
protected
public members of a base class
prevent shallow copying of data
memory
13. In a(n) ____ copy - two or more pointers of the same type point to the same memory
shallow
isFull & listSize
first 1
deep
14. The time complexity of the linear search function in an array list is ____.
#include <deque>
O(n)
deep copy
a pointer not in the list
15. If you don't want a pointer to point to anything you should initialize it by setting it to
node
a pointer not in the list
shallow
16. vector<int> v (1 - 10); vector<int> w (1 -20); v.swap (w); cout << v[0]; What is the output of the code fragment above?
deep copy
To manage objects of a given type
20
constructor
17. vector<int> v (1 - 2); int value = v.back (); cout << value << endl; What is the output of the code fragment above?
copy
2
=
prevent shallow copying of data
18. Each pointer refers to its own data
Returns a pointer to the last element in container ct
copy
nodes
deep copy
19. Every container contains the type
O(1)
5 2 7
end
reverse_iterator
20. v[0] = 5; v[1] = 2; v[2] = 7; vector<int>::iterator first = v.begin(); vector<int>::iterator last = v.end();
pop_back
prevent memory leaks
5 2 7
25 21 18
21. Suppose your class contains a pointer variable as one of its data members. When performing member-wise copies between two objects of the same class - its important to have an overloaded ____ operator to prevent shallow copying of data.
address of p (1200)
shallow
does not
=
22. Which function is common to all sequence containers but NOT all containers?
pop_back
copy
O(n)
shallow
23. If your class contains a pointer variable as one of its data members - having a destructor would prevent ____ leaks.
memory
double-ended queue
function template
dynamic array
24. With templates - you can write a single code segment for a set of related functions - called a ____.
shallow
function template
protected
Returns a pointer to the last element in container ct
25. An array created during the execution of a program is called a
dynamic array
address of p (1200)
To manage objects of a given type
prevent shallow copying of data
26. intStack.push(18); intStack.push(21); intStack.push(25); cout<<tempStack.top()<<"";
Returns a pointer to the last element in container ct
deep copy
O(n)
25 21 18
27. What does the term deque stand for?
class templates
end
double-ended queue
is-a
28. In a single inheritance - the derived class is derived from ____base class(es).
isFull & listSize
prevent memory leaks
one
num
29. The function _____ can be used with any container type including arrays.
protected
8
copy
23
30. Which of the following notations requires the use of parentheses?
reverse_iterator
one
infix
#include <deque>
31. template<class inputIterator -class outputIterator>outputItr copy(inputIteratorfirst1 - inputIterator last - outputIterator first2); From the function prototype copy above - which parameter specifies the position from which to begin copying the eleme
num
first 1
is-a
2nd book from the top
32. An array created during the execution of a program is called a ____ array.
class templates
O(1)
constructor
dynamic
33. The statement "q++" increments the value of q by ____ bytes. (double *q;)
a pointer not in the list
23
memory
8
34. You can initialize a pointer variable by setting it to ____
23
protected
infix
a or b
35. A class that contains a pointer variable as one of its data members should contain a destructor to
=
Returns a pointer to the last element in container ct
prevent shallow copying of data
protected
36. The _______ member function is common to all containers.
destructor
shallow
25 21 18
The element at the bottom
37. Which element of a stack has been in the stack the longest?
The element at the bottom
nodes
does not
a or b
38. The assignment statement *p=78; changes the content of memory location 1800 and therefore also changes the content of ____.
x y - v w + *
memory
O(1)
num
39. Suppose your class contains a pointer variable as one of its data members. When performing member-wise copies between two objects of the same class - its important to have an overloaded ____ operator to prevent shallow copying of data.
=
shallow
O(1)
memory
40. What is the time-complexity of the overloaded assignment operator?
O(n)
shallow
23
isFull & listSize
41. What is the effect of the following expression: rAccessIterator - n?
protected
x y - v w + *
pop_back
Returns the iterator of the previous nth element
42. When initializing the object of a derived class - the ____ of the base class is executed first.
protected
shallow
constructor
address of p (1200)
43. In an array list the time complexity of the isEmpty function is identical to the time complexity of the ____ function.
function template
isFull & listSize
prevent shallow copying of data
memory
44. The time complexity of the function isEmpty in an array list is
O(1)
5 2 7
prevent shallow copying of data
first 1
45. A base class wants to allow a derived class to access one of its data members. However - the base class does not want this member to be directly accessed outside the class. The base class should declare the member using the ____ access specifier.
5 2 7
deep
protected
The element at the bottom
46. &p is equivalent to: 1200 *p means the content of the memory location 1800 - pointed to by p; that is - pointed to by the content of memory location ____.
class templates
2nd book from the top
#include <deque>
address of p (1200)
47. The data type of each ____ depends on the specific application.
a or b
O(n)
copy
node
48. What is the value of the postfix expression: 5 4 * 3 + ?
deep
#include <deque>
23
memory
49. Like function templates - ____ are used to write a single code segment for a set of related classes.
class templates
a pointer not in the list
function template
infix
50. What is the equivalent postfix expression for the infix expression: (x - y) * (v + w)?
x y - v w + *
memory
double-ended queue
2