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