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