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