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. The function _____ can be used with any container type including arrays.
dynamic
copy
a or b
prevent shallow copying of data
2. Which statement must be included in a program in order to use a deque container?
memory
#include <deque>
prevent memory leaks
To manage objects of a given type
3. A class that contains a pointer variable as one of its data members should contain an overloaded assignment operator to
prevent memory leaks
a or b
Returns the iterator of the previous nth element
constructor
4. The _______ member function is common to all containers.
destructor
pop_back
5 2 7
To manage objects of a given type
5. 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?
8
2nd book from the top
5 2 7
20
6. The data type of each ____ depends on the specific application.
node
memory
To manage objects of a given type
num
7. &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 ____.
8
a or b
constructor
address of p (1200)
8. If your class contains a pointer variable as one of its data members - having a destructor would prevent ____ leaks.
pop_back
prevent shallow copying of data
O(n)
memory
9. Which function is common to all sequence containers but NOT all containers?
pop_back
20
memory
x y - v w + *
10. In a single inheritance - the derived class is derived from ____base class(es).
one
25 21 18
num
class templates
11. intStack.push(18); intStack.push(21); intStack.push(25); cout<<tempStack.top()<<"";
25 21 18
prevent memory leaks
2nd book from the top
is-a
12. In a(n) ____ copy - two or more pointers of the same type point to the same memory
deep copy
shallow
Returns a pointer to the last element in container ct
function template
13. The time complexity of the linear search function in an array list is ____.
2nd book from the top
O(n)
constructor
reverse_iterator
14. What are containers used for?
5 2 7
destructor
To manage objects of a given type
#include <deque>
15. A class that contains a pointer variable as one of its data members should contain a destructor to
prevent shallow copying of data
infix
does not
O(n)
16. Which of the following should be used to traverse a list?
#include <deque>
prevent memory leaks
num
a pointer not in the list
17. 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.
Returns a pointer to the last element in container ct
memory
protected
O(n)
18. In an array list the time complexity of the isEmpty function is identical to the time complexity of the ____ function.
x y - v w + *
8
isFull & listSize
function template
19. Each pointer refers to its own data
node
deep copy
class templates
x y - v w + *
20. The increment operator ______ increments the value of a pointer variable by twice the size of the memory to which it is pointing.
does not
address of p (1200)
dynamic
x y - v w + *
21. The assignment statement *p=78; changes the content of memory location 1800 and therefore also changes the content of ____.
dynamic array
num
deep
protected
22. What is the time-complexity of the overloaded assignment operator?
num
O(n)
=
2nd book from the top
23. What is the value of the postfix expression: 5 4 * 3 + ?
23
x y - v w + *
nodes
20
24. Like function templates - ____ are used to write a single code segment for a set of related classes.
class templates
#include <deque>
num
dynamic
25. Inheritance is an example of the ____ relationship.
a or b
class templates
isFull & listSize
is-a
26. vector<int> v (1 - 2); int value = v.back (); cout << value << endl; What is the output of the code fragment above?
num
2
node
deep
27. If you applied the operation pop to the stack above - which book would be left on top of the stack?
5 2 7
O(n)
2nd book from the top
8
28. A derived class can directly access ____.
public members of a base class
dynamic array
=
first 1
29. Which answer most accurately completes the following sentence: A linked list is made up of ____.
protected
pop_back
nodes
O(1)
30. Which of the following notations requires the use of parentheses?
address of p (1200)
dynamic
infix
#include <deque>
31. What does the term deque stand for?
25 21 18
double-ended queue
function template
copy
32. Given container ct - what is the effect of ct.rbegin()?
constructor
a pointer not in the list
Returns a pointer to the last element in container ct
20
33. The statement "q++" increments the value of q by ____ bytes. (double *q;)
8
=
a or b
O(1)
34. v[0] = 5; v[1] = 2; v[2] = 7; vector<int>::iterator first = v.begin(); vector<int>::iterator last = v.end();
5 2 7
nodes
Returns a pointer to the last element in container ct
destructor
35. Building a linked list forward places the item to be added at the ____ of the linked list.
class templates
dynamic
end
reverse_iterator
36. What is the equivalent postfix expression for the infix expression: (x - y) * (v + w)?
dynamic array
copy
x y - v w + *
Returns a pointer to the last element in container ct
37. An array created during the execution of a program is called a ____ array.
25 21 18
dynamic
x y - v w + *
deep copy
38. When initializing the object of a derived class - the ____ of the base class is executed first.
double-ended queue
8
end
constructor
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.
one
=
8
prevent shallow copying of data
40. In a(n) ____ copy - each pointer refers to its own data.
23
deep
dynamic array
end
41. An array created during the execution of a program is called a
deep copy
dynamic array
destructor
x y - v w + *
42. You can initialize a pointer variable by setting it to ____
a or b
shallow
nodes
=
43. 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.
nodes
double-ended queue
x y - v w + *
=
44. 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
first 1
prevent memory leaks
5 2 7
2
45. If you don't want a pointer to point to anything you should initialize it by setting it to
pop_back
O(n)
23
46. With templates - you can write a single code segment for a set of related functions - called a ____.
#include <deque>
prevent memory leaks
function template
double-ended queue
47. Which element of a stack has been in the stack the longest?
O(1)
first 1
node
The element at the bottom
48. What is the effect of the following expression: rAccessIterator - n?
reverse_iterator
Returns the iterator of the previous nth element
deep copy
O(n)
49. The time complexity of the function isEmpty in an array list is
O(1)
To manage objects of a given type
8
prevent shallow copying of data
50. Every container contains the type
function template
reverse_iterator
protected
public members of a base class