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