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