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