ASSESSMENT EXAM QUESTIONS AND CORRECT ANSWERS
WITH RATIONALES
Question 1
Which data type is appropriate for this array to store the given data?
a = ["AF", "71", "BC", "157", "BA", "253"]
A.) Byte
B.) Char
C.) Short
D.) String
Correct Answer
D
Question 2
An array soc of size 1009 is used where the index is an integer in [0,1008] and the hash-function
key%1009.
Where will the data associated with the key given by the last 4 social security digits '2023' be
stored?
A.) In soc[4]
B.) In soc[5]
C.) In soc[1009]
D.) In soc[2023]
Correct Answer
B
Question 3
,Which data structure allows inserting and deleting data elements at both the front and the
rear?
A.) Trees
B.) Deques
C.) Stacks
D.) Queues
Correct Answer
B
Question 4
Which data structure allows insertion and removal from only one end of the data structure?
A.) List
B.) Queue
C.) Stack
D.) Deque
Correct Answer
C
Question 5
Which command will insert object x at position index in a list?
A.) Get(int index)
B.) Remove(int index)
C.) Add(int index, Object x)
D.) Set(int index, Object x)
Correct Answer
C
Question 6
,Items were added sequentially onto the stack starting with 'red':
'green'
'yellow'
'blue'
'red'
What is the stack after a pop operation?
A.) 'yellow'
'blue'
'red'
B.) 'green'
'yellow'
'blue'
C.) 'purple'
'green'
'yellow'
'blue'
'red'
D.) 'green'
'yellow'
'blue'
'red'
'purple'
Correct Answer
A
Question 7
Which value is appropriate for the variable middle given the pseudocode?
function mystery()
{
string last;
string first;
, char middle;
int phone;
float rate;
}
A.) 'D'
B.) 'Da'
C.) "david"
D.) "David"
Correct Answer
A
Question 8
What is true about garbage collection?
A.) It is often portrayed as the same as manual memory management.
B.) It is no longer a primary concern since memory is very inexpensive.
C.) It is scheduled to take place at regular time intervals to reclaim memory.
D.) It reclaims memory from data structures implemented using linked allocations.
Correct Answer
D
Question 9
Which type of operation is represented in the pseudocode?
int x,y,z;
x=y=z=100;
A.) Ternary
B.) Assignment
C.) Comparison
D. Equality
Correct Answer