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