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