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