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