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