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