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