This repository was archived by the owner on Jan 27, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquiz.html
341 lines (267 loc) · 16.3 KB
/
quiz.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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<!-- seems to be needed -->
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
<title>Quiz – Objective-C Runtime in Pictures</title>
<meta name="description" content="Armed with this knowledge, here is an example project. Assume that
you are only linking against the mulle-objc-runtime, which doesn’t provide
any classes.
">
<meta name="keywords" content="">
<!-- Twitter Cards -->
<meta name="twitter:title" content="Quiz">
<meta name="twitter:description" content="Armed with this knowledge, here is an example project. Assume that
you are only linking against the mulle-objc-runtime, which doesn’t provide
any classes.
">
<meta name="twitter:site" content="@mulle_nat">
<meta name="twitter:creator" content="@mulle_nat">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="/objc-runtime-in-pictures/images/default-thumb.png">
<!-- Open Graph -->
<meta property="og:locale" content="en_US">
<meta property="og:type" content="article">
<meta property="og:title" content="Quiz">
<meta property="og:description" content="Armed with this knowledge, here is an example project. Assume that
you are only linking against the mulle-objc-runtime, which doesn’t provide
any classes.
">
<meta property="og:url" content="https://www.mulle-kybernetik.com/quiz.html">
<meta property="og:site_name" content="Objective-C Runtime in Pictures">
<link href="/objc-runtime-in-pictures/atom.xml" type="application/atom+xml" rel="alternate" title="Objective-C Runtime in Pictures Feed">
<link href="/objc-runtime-in-pictures/index.rdf" type="application/rss+xml" rel="alternate" title="Objective-C Runtime in Pictures Feed">
<link rel="canonical" href="https://www.mulle-kybernetik.com/quiz.html">
<!-- Mobile Specific Metas
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSS
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/skeleton.css">
<!-- Code Color
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="css/monokai.css">
<!-- Site custom css -->
<link rel="stylesheet" href="css/custom.css">
<!-- local FONT
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="css/junction.css">
<!-- Favicon
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="icon" type="image/svg" href="images/favicon.svg">
<!-- This tag allows for activation of ClearType in Mobile IE for smoothing fonts.-->
<meta http-equiv="cleartype" content="on">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- For all browsers -->
<link rel="stylesheet" href="css/quiz.css">
</head>
<body class="post">
<div class="container">
<div class="row">
<div id="post-first" class="four columns">
<div class="sideline">
<div class="bio">
<div class="bio-photo-container" style="display: inline-block">
<img src="/objc-runtime-in-pictures/images/dog-pic.jpg" class="bio-photo" alt="Nat! bio photo">
</div>
<div style="display: inline-block; padding-left: 8px">
<h4>Nat!</h4>
<p>Senior Mull</p>
</div>
<div class="author-social"><a href="//www.mulle-kybernetik.com" target="_blank" class="link"><img class="inline-img" src="/objc-runtime-in-pictures/images/homepage-svgrepo-com.svg"></a> <a href="//www.mulle-kybernetik.com" target="_blank" class="link">WWW</a></div>
<div class="author-social"><a href="mailto:[email protected]" target="_blank"><img class="inline-img" src="/objc-runtime-in-pictures/images/email-svgrepo-com.svg"></a> <a href="mailto:[email protected]" target="_blank" class="link">Email</a></div>
<div class="author-social"><a href="//twitter.com/mulle_nat" target="_blank"><img class="inline-img" src="/objc-runtime-in-pictures/images/twitter-svgrepo-com.svg"></a> <a href="//twitter.com/mulle_nat" target="_blank" class="link">Twitter</a></div>
<div class="author-social"><a href="//github.com/mulle-nat" target="_blank"><img class="inline-img" src="/objc-runtime-in-pictures/images/github-svgrepo-com.svg"></a> <a href="//github.com/mulle-nat" target="_blank" class="link">Github</a></div>
<div class="author-social"><a href="//twitch.tv/Mulle_kybernetiK_TV" target="_blank"><img class="inline-img" src="/objc-runtime-in-pictures/images/twitch-svgrepo-com.svg"></a> <a href="//twitch.tv/Mulle_kybernetiK_TV" target="_blank" class="link">Twitch</a></div>
</div> <!-- bio -->
<div class="title">
<div>
<h2>Objective-C Runtime in Pictures <a href="/objc-runtime-in-pictures/feed.xml"><img class="inline-img" src="/objc-runtime-in-pictures/images/feed-icon-28x28.png"></a></h2>
</div>
<h6>© 2024 by Nat!, Mulle kybernetiK. All rights reserved.</h6>
<p>
</div> <!-- title -->
<div class="contents">
<h4>Contents</h4>
<ul>
<article>
<li class="no-bullet"><a class="internal-link" href="/objc-runtime-in-pictures/intro.html" title="Intro">Intro</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/objc-runtime-in-pictures/class.html" title="Class">Class</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/objc-runtime-in-pictures/ivar.html" title="Ivar">Ivar</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/objc-runtime-in-pictures/method.html" title="Method">Method</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/objc-runtime-in-pictures/property.html" title="Property">Property</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/objc-runtime-in-pictures/category.html" title="Category">Category</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/objc-runtime-in-pictures/protocol.html" title="Protocol">Protocol</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/objc-runtime-in-pictures/inheritance.html" title="Inheritance">Inheritance</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/objc-runtime-in-pictures/protocolclass.html" title="Protocolclass">Protocolclass</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/objc-runtime-in-pictures/quiz.html" title="Quiz">Quiz</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/objc-runtime-in-pictures/outro.html" title="Outro">Outro</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/objc-runtime-in-pictures/appendix.html" title="Appendix">Appendix</a>
</article>
</ul>
</div> <!-- contents -->
</div> <!-- sideline -->
</div>
<div id="post-second" class="eight columns">
<div class="title">
<div>
<h2>Objective-C Runtime in Pictures <a href="/objc-runtime-in-pictures/feed.xml"><img class="inline-img" src="/objc-runtime-in-pictures/images/feed-icon-28x28.png"></a></h2>
</div>
<h6>© 2024 by Nat!, Mulle kybernetiK. All rights reserved.</h6>
<p>
</div> <!-- title -->
<p>
<div id="main" role="main">
<article>
<h1>Quiz</h1>
<div>
<p>Armed with this knowledge, here is an example project. Assume that
you are only linking against the <code class="language-plaintext highlighter-rouge">mulle-objc-runtime</code>, which doesn’t provide
any classes.</p>
<div class="language-objc highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">@interface</span> <span class="nc">A</span>
<span class="k">@property</span> <span class="kt">char</span> <span class="o">*</span><span class="n">x</span><span class="p">;</span>
<span class="k">+</span> <span class="p">(</span><span class="n">instancetype</span><span class="p">)</span> <span class="n">new</span><span class="p">;</span>
<span class="k">@end</span>
<span class="k">@implementation</span> <span class="nc">A</span>
<span class="k">+</span> <span class="p">(</span><span class="n">instancetype</span><span class="p">)</span> <span class="n">new</span>
<span class="p">{</span>
<span class="k">return</span><span class="p">(</span> <span class="n">mulle_objc_infraclass_alloc_instance</span><span class="p">(</span> <span class="n">self</span><span class="p">));</span>
<span class="p">}</span>
<span class="k">-</span> <span class="p">(</span><span class="kt">char</span> <span class="o">*</span><span class="p">)</span> <span class="n">x</span> <span class="p">{</span> <span class="k">return</span><span class="p">(</span> <span class="p">(</span><span class="kt">char</span> <span class="o">*</span><span class="p">)</span> <span class="n">__FUNCTION__</span><span class="p">);</span> <span class="p">}</span>
<span class="k">@end</span>
<span class="k">@protocol</span> <span class="nc">B</span>
<span class="k">@optional</span>
<span class="k">-</span> <span class="p">(</span><span class="kt">char</span> <span class="o">*</span><span class="p">)</span> <span class="n">x</span><span class="p">;</span>
<span class="k">@end</span>
<span class="k">@interface</span> <span class="nc">B</span>
<span class="k">-</span> <span class="p">(</span><span class="kt">char</span> <span class="o">*</span><span class="p">)</span> <span class="n">x</span><span class="p">;</span>
<span class="k">@end</span>
<span class="k">@implementation</span> <span class="nc">B</span>
<span class="k">-</span> <span class="p">(</span><span class="kt">char</span> <span class="o">*</span><span class="p">)</span> <span class="n">x</span> <span class="p">{</span> <span class="k">return</span><span class="p">(</span> <span class="p">(</span><span class="kt">char</span> <span class="o">*</span><span class="p">)</span> <span class="n">__FUNCTION__</span><span class="p">);</span> <span class="p">}</span>
<span class="k">@end</span>
<span class="k">@interface</span> <span class="nc">C</span> <span class="p">:</span> <span class="nc">A</span> <span class="o"><</span> <span class="n">B</span> <span class="o">></span>
<span class="k">@end</span>
<span class="k">@implementation</span> <span class="nc">C</span>
<span class="k">@end</span>
</code></pre></div></div>
<div class="quiz_container">
<!-- Question 1 -->
<div class="quiz_question">
<p>1. How many <i>metaclasses</i> will exist at runtime ?</p>
<label class="quiz_label"><input type="radio" name="q1" value="wrong" /> none</label>
<label class="quiz_label"><input type="radio" name="q1" value="wrong" /> two</label>
<label class="quiz_label"><input type="radio" name="q1" value="right" /> three</label>
<label class="quiz_label"><input type="radio" name="q1" value="wrong" /> four</label>
</div>
<!-- Question 2 -->
<div class="quiz_question">
<p>2. How many <i>methods</i> does <i>infraclass</i> <b>C</b> have in its <i>methodlists</i> ?</p>
<label class="quiz_label"><input type="radio" name="q2" value="right" /> none</label>
<label class="quiz_label"><input type="radio" name="q2" value="wrong" /> one</label>
<label class="quiz_label"><input type="radio" name="q2" value="wrong" /> two</label>
<label class="quiz_label"><input type="radio" name="q2" value="wrong" /> <b>C</b> has no methodlists</label>
</div>
<!-- Question 3 -->
<div class="quiz_question">
<p>3. What is the result of <code>[[C new] x]</code> ?</p>
<label class="quiz_label"><input type="radio" name="q3" value="right" /> -[A x]</label>
<label class="quiz_label"><input type="radio" name="q3" value="wrong" /> -[B x]</label>
<label class="quiz_label"><input type="radio" name="q3" value="wrong" /> NULL</label>
<label class="quiz_label"><input type="radio" name="q3" value="wrong" /> a crash</label>
</div>
<!-- Question 4 -->
<div class="quiz_question">
<p>4. What is the result of <code>[C x]</code> ?</p>
<label class="quiz_label"><input type="radio" name="q4" value="wrong" /> +[A x]</label>
<label class="quiz_label"><input type="radio" name="q4" value="right" /> -[A x]</label>
<label class="quiz_label"><input type="radio" name="q4" value="wrong" /> -[B x]</label>
<label class="quiz_label"><input type="radio" name="q4" value="wrong" /> a crash</label>
</div>
<!-- Submit Button -->
<button class="quiz_button" onclick="calculateScore()">Submit Quiz</button>
<!-- Result -->
<div class="quiz_result" id="quiz_result"></div>
</div>
<script>
function calculateScore() {
let score = 0;
let allAnswered = true;
const questions = ["q1", "q2", "q3", "q4"];
questions.forEach((question) => {
const selectedAnswer = document.querySelector(`input[name="${question}"]:checked`);
if (!selectedAnswer) {
allAnswered = false;
} else if (selectedAnswer.value === "right") {
score++;
}
});
const resultDiv = document.getElementById("quiz_result");
// Array of messages for each possible score
const messages = [
"Why don't you find yourself a nice scripting language ?",
"Don't worry, there are other programming languages in the sea. Maybe rather checkout Go or Rust.",
"Well the test is tricky, it can't hurt to peruse the pamphlet one more time.",
"Almost there, but you had to guess at one time. And you chose poorly.",
"Welcome to the Objective-C Pantheon!"
];
// Check if all questions were answered
if (!allAnswered) {
resultDiv.textContent = "Please answer all questions before submitting.";
} else {
// Display result with corresponding message
resultDiv.textContent = `${messages[score]}`;
}
}
document.querySelector('.quiz_button').addEventListener('click', function(e) {
this.classList.add('clicked');
setTimeout(() => this.classList.remove('clicked'), 300);
});
</script>
</div>
</article>
</div>
<p>
<div class="left-right" id="pn-container">
<div class="left-half">
<span class="link">
Back to <a rel="prev" class="internal-link" href="/objc-runtime-in-pictures/protocolclass.html">Protocolclass</a>
</span>
</div>
<div class="right-half">
<span class="link">
Next <a rel="next" class="internal-link" href="/objc-runtime-in-pictures/outro.html">Outro</a>
</span>
</div>
</div> <!-- left_right -->
</div> <!-- eight columns -->
</div> <!-- row -->
</div> <!-- container -->
</body>
</html>