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