-
Notifications
You must be signed in to change notification settings - Fork 0
/
dsaquiz.html
214 lines (181 loc) · 9.07 KB
/
dsaquiz.html
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
<!DOCTYPE html>
<html>
<head>
<title>DSA Quiz</title>
<style>
body {
margin: 0;
padding: 0;
background: linear-gradient(to bottom right, #00bfff, #008000);
font-family: Arial, sans-serif;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 40px;
background-color: rgba(0, 0, 0, 0.7);
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}
h1 {
text-align: center;
color: white;
margin-bottom: 30px;
}
.question {
margin-bottom: 20px;
}
.question p {
margin: 0;
font-weight: bold;
color: white;
}
.options {
display: flex;
flex-wrap: wrap;
margin-top: 10px;
}
.option {
width: 50%;
padding: 10px;
border-radius: 5px;
background-color: #eee;
cursor: pointer;
transition: background-color 0.3s ease;
}
.option:hover {
background-color: #ddd;
}
.submit-btn {
display: block;
width: 100%;
padding: 10px;
margin-top: 20px;
background-color: #4CAF50;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
}
.submit-btn:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="container">
<h1>DSA Quiz</h1>
<form action="formsubmitted.html" method="post" >
<div class="question">
<p>Question 1: What is the time complexity of searching in a sorted array?</p>
<div class="options">
<label class="option"><input type="radio" name="q1"> O(1)</label>
<label class="option"><input type="radio" name="q1"> O(n)</label>
<label class="option"><input type="radio" name="q1"> O(log n)</label>
<label class="option"><input type="radio" name="q1"> O(n log n)</label>
</div>
</div>
<div class="question">
<p>Question 2: Which data structure uses LIFO (Last-In-First-Out) order?</p>
<div class="options">
<label class="option"><input type="radio" name="q2"> Stack</label>
<label class="option"><input type="radio" name="q2"> Queue</label>
<label class="option"><input type="radio" name="q2"> Linked List</label>
<label class="option"><input type="radio" name="q2"> Tree</label>
</div>
</div>
<div class="question">
<p>Question 3: What is the time complexity of inserting a node at the beginning of a singly linked list?</p>
<div class="options">
<label class="option"><input type="radio" name="q3"> O(1)</label>
<label class="option"><input type="radio" name="q3"> O(n)</label>
<label class="option"><input type="radio" name="q3"> O(log n)</label>
<label class="option"><input type="radio" name="q3"> O(n log n)</label>
</div>
</div>
<div class="question">
<p>Question 4: Which sorting algorithm has the best time complexity in the average case?</p>
<div class="options">
<label class="option"><input type="radio" name="q4"> Bubble Sort</label>
<label class="option"><input type="radio" name="q4"> Merge Sort</label>
<label class="option"><input type="radio" name="q4"> Insertion Sort</label>
<label class="option"><input type="radio" name="q4"> Selection Sort</label>
</div>
</div>
<div class="question">
<p>Question 5: What is the maximum number of nodes at level "k" of a binary tree?</p>
<div class="options">
<label class="option"><input type="radio" name="q5"> k</label>
<label class="option"><input type="radio" name="q5"> 2^k</label>
<label class="option"><input type="radio" name="q5"> 2^(k-1)</label>
<label class="option"><input type="radio" name="q5"> 2^(k+1)</label>
</div>
</div>
<div class="question">
<p>Question 6: Which data structure uses a First-In-First-Out (FIFO) order?</p>
<div class="options">
<label class="option"><input type="radio" name="q6"> Stack</label>
<label class="option"><input type="radio" name="q6"> Queue</label>
<label class="option"><input type="radio" name="q6"> Linked List</label>
<label class="option"><input type="radio" name="q6"> Tree</label>
</div>
</div>
<div class="question">
<p>Question 7: Which data structure allows rapid access to elements based on their values?</p>
<div class="options">
<label class="option"><input type="radio" name="q7"> Stack</label>
<label class="option"><input type="radio" name="q7"> Queue</label>
<label class="option"><input type="radio" name="q7"> Array</label>
<label class="option"><input type="radio" name="q7"> Hash Table</label>
</div>
</div>
<div class="question">
<p>Question 8: Which searching algorithm is used for searching elements in a sorted and rotated array?</p>
<div class="options">
<label class="option"><input type="radio" name="q8"> Linear Search</label>
<label class="option"><input type="radio" name="q8"> Binary Search</label>
<label class="option"><input type="radio" name="q8"> Jump Search</label>
<label class="option"><input type="radio" name="q8"> Interpolation Search</label>
</div>
</div>
<div class="question">
<p>Question 9: Which sorting algorithm has the worst-case time complexity of O(n^2)?</p>
<div class="options">
<label class="option"><input type="radio" name="q9"> Quick Sort</label>
<label class="option"><input type="radio" name="q9"> Merge Sort</label>
<label class="option"><input type="radio" name="q9"> Bubble Sort</label>
<label class="option"><input type="radio" name="q9"> Insertion Sort</label>
</div>
</div>
<div class="question">
<p>Question 10: Which data structure is used to implement a Breadth-First Search (BFS)?</p>
<div class="options">
<label class="option"><input type="radio" name="q10"> Stack</label>
<label class="option"><input type="radio" name="q10"> Queue</label>
<label class="option"><input type="radio" name="q10"> Linked List</label>
<label class="option"><input type="radio" name="q10"> Tree</label>
</div>
</div>
<div class="question">
<p>Question 11: In a binary heap, the key at each node is __________ the keys at its child nodes.</p>
<div class="options">
<label class="option"><input type="radio" name="q11"> Less than or equal to</label>
<label class="option"><input type="radio" name="q11"> Greater than or equal to</label>
<label class="option"><input type="radio" name="q11"> Less than</label>
<label class="option"><input type="radio" name="q11"> Greater than</label>
</div>
</div>
<div class="question">
<p>Question 12: Which data structure is used to implement Depth-First Search (DFS)?</p>
<div class="options">
<label class="option"><input type="radio" name="q12"> Stack</label>
<label class="option"><input type="radio" name="q12"> Queue</label>
<label class="option"><input type="radio" name="q12"> Linked List</label>
<label class="option"><input type="radio" name="q12"> Tree</label>
</div>
<input type="submit" value="Submit" class="submit-btn">
</div>
</form>
</body>