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