-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEasyQuestions.java
237 lines (196 loc) · 10.6 KB
/
EasyQuestions.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
package com.charchit;
/*
Class to create a set of easy questions
for the quiz.
It defines one Question data member and implements the Base interface
The constructor is also provided
*/
import java.util.*;
public class EasyQuestions implements Base{
private Questions easyQuestions;
public EasyQuestions() {
// The maps are used for same functioning as mentioned in the Questions class
Map<StringBuffer, ArrayList<StringBuffer>> questions = new HashMap<>();
Map<StringBuffer, StringBuffer> answer = new HashMap<>();
Map<Integer, List<StringBuffer>> score = new HashMap<>();
Map<StringBuffer,Boolean> isVisited = new HashMap<>();
// List to store questions
List<StringBuffer> questionsList= new ArrayList<>();
StringBuffer solution;
StringBuffer questionTitle = new StringBuffer("Which of the following is/are the levels of implementation of data structure");
// ArrayList created to hold options for the questions
ArrayList<StringBuffer> options = new ArrayList<>();
options.add(new StringBuffer("a. Abstract level"));
options.add(new StringBuffer("b. Application level"));
options.add(new StringBuffer("c. Implementation level"));
options.add(solution = new StringBuffer("d. All of the above"));
// Question added to the question list
questionsList.add(questionTitle);
// Question and its answer added to the map answer
answer.put(questionTitle,solution);
// Questions and its options added to the map questions
questions.put(questionTitle,options);
// Questions and its status added to the map isVisited
isVisited.put(questionTitle,false);
questionTitle = new StringBuffer("………………. is where the model becomes compatible executable code.");
options = new ArrayList<>();
options.add(new StringBuffer("a. Abstract"));
options.add(new StringBuffer("b. Application"));
options.add(solution = new StringBuffer("c. Implementation"));
options.add(new StringBuffer("d. All of the above"));
questionsList.add(questionTitle);
answer.put(questionTitle,solution);
questions.put(questionTitle,options);
isVisited.put(questionTitle,false);
questionTitle = new StringBuffer("…………… is not the component of data structure.");
options = new ArrayList<>();
options.add(new StringBuffer("a. Operations"));
options.add(new StringBuffer("b. Storage Structures"));
options.add(new StringBuffer("c. Algorithms"));
options.add(solution = new StringBuffer("d. None of the above"));
questionsList.add(questionTitle);
answer.put(questionTitle,solution);
questions.put(questionTitle,options);
isVisited.put(questionTitle,false);
questionTitle = new StringBuffer(" Which of the following is not the part of ADT description?");
options = new ArrayList<>();
options.add(new StringBuffer("a. Data"));
options.add(new StringBuffer("b. Operations"));
options.add(new StringBuffer("c. Both of the above"));
options.add(solution = new StringBuffer("d. None of the above"));
questionsList.add(questionTitle);
answer.put(questionTitle,solution);
questions.put(questionTitle,options);
isVisited.put(questionTitle,false);
questionTitle = new StringBuffer("Which of the following is non-linear data structure?");
options = new ArrayList<>();
options.add(new StringBuffer("a. String"));
options.add(new StringBuffer("b. Lists"));
options.add(new StringBuffer("c. Stack"));
options.add(solution = new StringBuffer("d. Graph"));
questionsList.add(questionTitle);
answer.put(questionTitle,solution);
questions.put(questionTitle,options);
isVisited.put(questionTitle,false);
// Questions List added to the map score
score.put(1,questionsList);
questionsList.clear();
questionTitle = new StringBuffer("Which of the following data structure is linear type?");
options = new ArrayList<>();
options.add(new StringBuffer("a. Trees"));
options.add(new StringBuffer("b. Graphs"));
options.add(new StringBuffer("c. BST"));
options.add(solution = new StringBuffer("d. Stack"));
questionsList.add(questionTitle);
answer.put(questionTitle,solution);
questions.put(questionTitle,options);
isVisited.put(questionTitle,false);
questionTitle = new StringBuffer("Which of the following data structure is non linear type?");
options = new ArrayList<>();
options.add(new StringBuffer("a. Stack"));
options.add(new StringBuffer("b. Deque"));
options.add(solution =new StringBuffer("c. Priority Queue"));
options.add(new StringBuffer("d. None of the above"));
questionsList.add(questionTitle);
answer.put(questionTitle,solution);
questions.put(questionTitle,options);
isVisited.put(questionTitle,false);
questionTitle = new StringBuffer("To represent hierarchical relationship between elements, Which data structure is suitable?");
options = new ArrayList<>();
options.add(new StringBuffer("a. Deque"));
options.add(new StringBuffer("b. Priority Queue"));
options.add(solution = new StringBuffer("c. Tree"));
options.add(new StringBuffer("d. Graph"));
questionsList.add(questionTitle);
answer.put(questionTitle,solution);
questions.put(questionTitle,options);
isVisited.put(questionTitle,false);
questionTitle = new StringBuffer("When new data are to be inserted into a data structure, but there is not available space; this situation is usually called ….");
options = new ArrayList<>();
options.add(new StringBuffer("a. Underflow"));
options.add(solution = new StringBuffer("b. Overflow"));
options.add(new StringBuffer("c. Housefull"));
options.add(new StringBuffer("d. Saturated"));
questionsList.add(questionTitle);
answer.put(questionTitle,solution);
questions.put(questionTitle,options);
isVisited.put(questionTitle,false);
questionTitle = new StringBuffer("The way in which the data item are logically related defines …..");
options = new ArrayList<>();
options.add(new StringBuffer("a. Storage Structure"));
options.add(solution = new StringBuffer("b. Data Structure"));
options.add(new StringBuffer("c. Data relationship"));
options.add(new StringBuffer("d. Data Operation"));
questionsList.add(questionTitle);
answer.put(questionTitle,solution);
questions.put(questionTitle,options);
isVisited.put(questionTitle,false);
questionTitle = new StringBuffer("The simplest type of data structure is ………………");
options = new ArrayList<>();
options.add(new StringBuffer("a. Multidimensional Array"));
options.add(solution = new StringBuffer("b. One dimensional Array"));
options.add(new StringBuffer("c. Two dimensional Array"));
options.add(new StringBuffer("d. Three Dimensional Array"));
questionsList.add(questionTitle);
answer.put(questionTitle,solution);
questions.put(questionTitle,options);
isVisited.put(questionTitle,false);
score.put(2,questionsList);
questionsList.clear();
questionTitle = new StringBuffer("Linear arrays are also called ……………….");
options = new ArrayList<>();
options.add(new StringBuffer("a. Straight Line Array"));
options.add(solution = new StringBuffer("b. One Dimensional Array"));
options.add(new StringBuffer("c. Horizontal array"));
options.add(new StringBuffer("d. Vertical Array"));
questionsList.add(questionTitle);
answer.put(questionTitle,solution);
questions.put(questionTitle,options);
isVisited.put(questionTitle,false);
questionTitle = new StringBuffer("Which of the following data structure is not a linear data structure?");
options = new ArrayList<>();
options.add(new StringBuffer("a. Arrays"));
options.add(new StringBuffer("b. Linked List"));
options.add(new StringBuffer("c. Both of the above"));
options.add(solution = new StringBuffer("d. None of the above"));
questionsList.add(questionTitle);
answer.put(questionTitle,solution);
questions.put(questionTitle,options);
isVisited.put(questionTitle,false);
questionTitle = new StringBuffer("Which of the following data structure is linear data structure?");
options = new ArrayList<>();
options.add(new StringBuffer("a. Trees"));
options.add(new StringBuffer("b. Graphs"));
options.add(solution = new StringBuffer("c. Arrays"));
options.add(new StringBuffer("d. All of the above"));
questionsList.add(questionTitle);
answer.put(questionTitle,solution);
questions.put(questionTitle,options);
isVisited.put(questionTitle,false);
questionTitle = new StringBuffer("Which of the following sorting algorithm is of divide-and-conquer type?");
options = new ArrayList<>();
options.add(new StringBuffer("a. Bubble Sort"));
options.add(new StringBuffer("b. Insertion Sort"));
options.add(solution = new StringBuffer("c. QuickSort"));
options.add(new StringBuffer("d. All of the above"));
questionsList.add(questionTitle);
answer.put(questionTitle,solution);
questions.put(questionTitle,options);
isVisited.put(questionTitle,false);
questionTitle = new StringBuffer("Which of the following data structures are indexed structures?");
options = new ArrayList<>();
options.add(solution = new StringBuffer("a. Linear Arrays"));
options.add(new StringBuffer("b. Linked Lists"));
options.add(new StringBuffer("c. Queues"));
options.add(new StringBuffer("d. Stack"));
questionsList.add(questionTitle);
answer.put(questionTitle,solution);
questions.put(questionTitle,options);
isVisited.put(questionTitle,false);
score.put(3,questionsList);
easyQuestions = new Questions(questions,answer,score,isVisited);
}
public Questions getQuestions() {
return easyQuestions;
}
}