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