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