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