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