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