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