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