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