forked from uva-cs/pdr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
final-f20.html
1420 lines (1420 loc) · 58 KB
/
final-f20.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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Linux version 5.6.0">
<meta http-equiv="content-type" content=
"text/html; charset=utf-8">
<title>Exam for mst3k</title>
<script src="final-f20_files/jquery.js"></script>
<script>
console.log("loaded previous responses")
</script>
<script>
var num_questions=27;
var saved_color='lightblue';
var modified_color='lightgoldenrodyellow';
var error_color='red';
</script>
<script>
valStrs=["","","^[0-9]+$","^[0-9]+(\ [0-9]+)*$","^(no output|[0-9]+(\ [0-9]+)*(\ )?)$","","","^-?\\d+(\\.\\d+)?$","^-?\\d+(\\.\\d+)?$","^0x[0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z]$","","","","","","^[A-Z]( [A-Z])+$","^((#|\\d) )+(#|\\d)$","","","^[0-9]+(\ [0-9]+)*$","","^[01]+$","","^[A-L]( [A-L])+$","","",""];
</script>
<link rel="stylesheet" type="text/css" href=
"final-f20_files/examstyle.css">
</head>
<body onload="fill_in_answers();">
<div class="javascript_test" id="javascript_test" style=
"background-color: red; width: 100%; display: none;">
<h1>Javascript is disabled!</h1>
<p>This exam will <b>NOT</b> work unless you enable
Javascript.</p>
<p> </p>
</div>
<div class="navbar">
<table class="navbar">
<tbody>
<tr>
<td>
<h2>CS 2150 Final Exam, fall 2020 for mst3k (27
questions, 102 total points)</h2>
</td>
<td class="right">
<table class="subnavbar">
<tbody>
<tr>
<td>Exam time has ended; no answer changes will
be recorded.<br></td>
</tr>
<tr>
<td>Progress: <span id="progress">N/A</span></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class="main">
<div class='score'>
<p><b>READ THIS:</b> This page is an example of a final exam given at the end of the fall 2020 semester. Students had different questions -- either different values for some of them (the coding questions or graph questions), entirely different questions entirely (for the multiple choice questions), etc. It's not feasible to provide all 500 exams given in the fall 2020 semester, and what is here is meant to give students an idea of the format that the current semester's final exam will be in, and an example of the types of questions that might be asked. There will be all different questions this semester, though. <br> <br>A week or two before the final exam, all students will be provided with a sample exam to test out this exam system. In particular, all the questions are auto-graded, and if the formatting the fill-in answers is not <i>exactly</i> what is expected, it will be marked wrong. To help with this, the exam system provides the answer validation -- it ensures that the answer is in the right format; whether the answer is correct or not is a separate issue. This validation is what the 'answer color codes' box, below, is referring to. Students will be able to test-drive this exam system, and understand the the answer validation aspect, about a week or two prior to taking the actual final exam. More explanation about the answer formats and answer validation will be available then.</p>
</div>
<table class="toptable">
<tbody>
<tr class="toptable">
<td class="toptable">
<div class="toptablediv">
<table class="questionstable">
<tbody>
<tr>
<td colspan="9">
<h2>Question types</h2>
</td>
</tr>
<tr>
<td>
<table class="onequestable">
<tbody>
<tr>
<td class="questionsampletop">
Multiple choice</td>
</tr>
<tr>
<td class="questionsamplemid">
<input type="radio" disabled=
"disabled">A<br>
<input type="radio" disabled=
"disabled">B<br>
<input type="radio" disabled=
"disabled">C<br>
<input type="radio" disabled=
"disabled">D<br>
<input type="radio" disabled=
"disabled">E</td>
</tr>
<tr>
<td class="questionsamplebot">1
correct<br>
answer</td>
</tr>
</tbody>
</table>
</td>
<td class="questionspacer"></td>
<td>
<table class="onequestable">
<tbody>
<tr>
<td class="questionsampletop">
True/false</td>
</tr>
<tr>
<td class="questionsamplemid">
<input type="radio" disabled=
"disabled">True<br>
<input type="radio" disabled=
"disabled">False</td>
</tr>
<tr>
<td class="questionsamplebot">1
correct<br>
answer</td>
</tr>
</tbody>
</table>
</td>
<td class="questionspacer"></td>
<td>
<table class="onequestable">
<tbody>
<tr>
<td class="questionsampletop">
Multiple answer</td>
</tr>
<tr>
<td class="questionsamplemid">
<input type="checkbox" disabled=
"disabled">A<br>
<input type="checkbox" disabled=
"disabled">B<br>
<input type="checkbox" disabled=
"disabled">C<br>
<input type="checkbox" disabled=
"disabled">D<br>
<input type="checkbox" disabled=
"disabled">E</td>
</tr>
<tr>
<td class="questionsamplebot">2+
correct<br>
answers</td>
</tr>
</tbody>
</table>
</td>
<td class="questionspacer"></td>
<td>
<table class="onequestable">
<tbody>
<tr>
<td class="questionsampletop">
Numerical fill-in</td>
</tr>
<tr>
<td class="questionsamplemid">
<input type="text" disabled=
"disabled"></td>
</tr>
<tr>
<td class="questionsamplebot">Must be
a<br>
number</td>
</tr>
</tbody>
</table>
</td>
<td class="questionspacer"></td>
<td>
<table class="onequestable">
<tbody>
<tr>
<td class="questionsampletop">
Text fill-in</td>
</tr>
<tr>
<td class="questionsamplemid">
<input type="text" disabled=
"disabled"></td>
</tr>
<tr>
<td class="questionsamplebot">Question
specific<br>
format</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td class="toptable">
<div class="toptablediv">
<table class="colorcodes">
<tbody>
<tr>
<td colspan="3">
<h2>Answer color codes</h2>
</td>
</tr>
<tr>
<td colspan="3" style="text-align:center">The
answer is bordered by a black line for each
question.</td>
</tr>
<tr>
<td colspan="3" style="text-align:center">The
background color of the answer indicates it's
status:</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td class="colorblock" id="whitespan">
White</td>
<td class="questionspacer"></td>
<td>means an answer has not yet been entered or
it is blank</td>
</tr>
<tr>
<td class="colorblock" id="modified_span"
style="background-color: lightgoldenrodyellow;">
Yellow</td>
<td class="questionspacer"></td>
<td>means an answer has been entered but
<i>not</i> yet auto-saved</td>
</tr>
<tr>
<td class="colorblock" id="saved_span" style=
"background-color: lightblue;">Blue</td>
<td class="questionspacer"></td>
<td>means the answer has been entered <i>and
also</i> auto-saved</td>
</tr>
<tr>
<td class="colorblock" id="error_span" style=
"background-color: red;">Red</td>
<td class="questionspacer"></td>
<td>means there is an error with the formatting
of the answer</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
<h2 class="maintitle">CS 2150 Final Exam, fall 2020 for mst3k
(27 questions, 102 total points)</h2>
<div class="intro">
<h3 id="introduction">Introduction</h3>
<p>This is the final exam for CS 2150, fall 2020. The
question types are shown above. Note that you can tell
multiple choice from multiple answer based on the shape of
the buttons (circles or squares), as shown above. The
background color of the answers will color themselves to
indicate the saved or error status; these colors are
described above. Note that fill-in questions, both numeric
and text, have very specific formats that the exam will
check.</p>
<p>There is a save button at the bottom of this page, and it
auto-saves every 30 seconds.</p>
<p>Good luck on the exam!</p>
</div>
<form name="examForm" id="examForm" action=
"./php/SaveAnswers.php" method="post">
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 1. (3 points): C++ question
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>Where in your C++ code would you see <code>int*
num</code>?</p>
<div class="answer" id="div_answer1" style=
"background-color:white">
<div class="choice_container" id="choice_container1">
<p><input type="checkbox" id="question1.0" name=
"question1[]" onchange="writeMCStatus(1);" value=
"in a variable declaration">in a variable declaration
</p>
<p><input type="checkbox" id="question1.1" name=
"question1[]" onchange="writeMCStatus(1);" value=
"when dereferencing a pointer">when dereferencing a
pointer</p>
<p><input type="checkbox" id="question1.2" name=
"question1[]" onchange="writeMCStatus(1);" value=
"in a function header / prototype">in a function header
/ prototype </p>
<p><input type="checkbox" id="question1.3" name=
"question1[]" onchange="writeMCStatus(1);" value=
"in a mathematical formula">in a mathematical
formula</p>
</div>
<div class="status_div" id="question1_status_div">
<p id="question1_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 2. (3 points): C++ question
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>Suppose we have come up with a new data type called:
<code>mint</code> (short for mini int). Mints represent 24
bit signed integers. Perfect for those moments when ints
are too long are shorts are too short. What would the
following theoretical code snippet print out to the
console? (You may use a calculator -- online or otherwise
-- to determine a power of 2 for this question)</p>
<p><img src="final-f20_files/pdr_exam_f20_2.jpg" alt="Q6"
class="inlineimage"></p>
<div class="answer" id="div_answer2" style=
"background-color:white">
<div class="choice_container" id="choice_container2">
<p><input type="radio" id="question2.0" name=
"question2[]" onchange="writeMCStatus(2);" value=
"-8388602">-8388602 </p>
<p><input type="radio" id="question2.1" name=
"question2[]" onchange="writeMCStatus(2);" value=
"8388602">8388602</p>
<p><input type="radio" id="question2.2" name=
"question2[]" onchange="writeMCStatus(2);" value=
"8388604">8388604</p>
<p><input type="radio" id="question2.3" name=
"question2[]" onchange="writeMCStatus(2);" value=
"-8388604">-8388604</p>
</div>
<div class="status_div" id="question2_status_div">
<p id="question2_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 3. (3 points): C++ question -- swap.cpp
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>Consider the swap function below. If <code>a</code> and
<code>b</code> are both passed to <code>swap()</code>, what
will the contents of the variable that <code>a</code>
points to be after the function returns? The answer is an
integer.</p>
<p><img alt="code" src=
"final-f20_files/visible_003.jpg"></p>
<div class="answer" id="div_answer3" style=
"background-color:white">
<div class="choice_container" id="choice_container3">
<input type="text" id="question3" name="question3"
oninput=
"document.getElementById('div_answer3').style.backgroundColor=modified_color;"
onfocusout="validateEntry('question3','^[0-9]+$');">
<br>
</div>
<div class="status_div" id="question3_status_div">
<p id="question3_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 4. (6 points): C++ question --
VectorResize.cpp
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>Consider the custom vector shown below (not everything
is shown to you) with the resize method provided. If the
code segment at the bottom is executed, list out the size,
capacity, and value at index size/2 of this vector (space
separated, see example in comments below).</p>
<p><img alt="code" src=
"final-f20_files/visible_004.jpg"></p>
<div class="answer" id="div_answer4" style=
"background-color:white">
<div class="choice_container" id="choice_container4">
<input type="text" id="question4" name="question4"
oninput=
"document.getElementById('div_answer4').style.backgroundColor=modified_color;"
onfocusout=
"validateEntry('question4','^[0-9]+(\ [0-9]+)*$');"><br>
</div>
<div class="status_div" id="question4_status_div">
<p id="question4_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 5. (6 points): C++ question --
LLInsert.cpp
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>Consider a singly-linked list with a pointer to a head
node (NO dummy node); the head node is initially set to
<code>nullptr</code>. Given the <code>insertAtHead()</code>
method below (which may contain bugs), what would the
following code segment print? If the program produces no
output, write "no output" (without the quotes).</p>
<p><img alt="code" src="final-f20_files/visible.jpg"></p>
<div class="answer" id="div_answer5" style=
"background-color:white">
<div class="choice_container" id="choice_container5">
<input type="text" id="question5" name="question5"
oninput=
"document.getElementById('div_answer5').style.backgroundColor=modified_color;"
onfocusout=
"validateEntry('question5','^(no output|[0-9]+(\ [0-9]+)*(\ )?)$');">
<br>
</div>
<div class="status_div" id="question5_status_div">
<p id="question5_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 6. (3 points): List question
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>Why would you ever want to use a singly linked list over
a doubly linked list?</p>
<div class="answer" id="div_answer6" style=
"background-color:white">
<div class="choice_container" id="choice_container6">
<p><input type="checkbox" id="question6.0" name=
"question6[]" onchange="writeMCStatus(6);" value=
"Faster look-up times">Faster look-up times</p>
<p><input type="checkbox" id="question6.1" name=
"question6[]" onchange="writeMCStatus(6);" value=
"Doubly linked lists are always better">Doubly linked
lists are always better</p>
<p><input type="checkbox" id="question6.2" name=
"question6[]" onchange="writeMCStatus(6);" value=
"When you are heavily constrained for memory">When you
are heavily constrained for memory </p>
<p><input type="checkbox" id="question6.3" name=
"question6[]" onchange="writeMCStatus(6);" value=
"When you are implementing a Huffman tree">When you are
implementing a Huffman tree</p>
<p><input type="checkbox" id="question6.4" name=
"question6[]" onchange="writeMCStatus(6);" value=
"When you only need to access one end of the list">When
you only need to access one end of the list</p>
<p><input type="checkbox" id="question6.5" name=
"question6[]" onchange="writeMCStatus(6);" value=
"When you are implementing a postfix tree">When you are
implementing a postfix tree</p>
</div>
<div class="status_div" id="question6_status_div">
<p id="question6_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 7. (3 points): List question
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>Assume a linked list implementation the same as Lab 2.
What is wrong with this implementation of
<code>insertAtTail()</code>?</p>
<p><img src="final-f20_files/pdr_exam_f20_4.jpg" alt="Q13"
class="inlineimage"></p>
<div class="answer" id="div_answer7" style=
"background-color:white">
<div class="choice_container" id="choice_container7">
<p><input type="radio" id="question7.0" name=
"question7[]" onchange="writeMCStatus(7);" value=
"The pointers are set incorrectly">The pointers are set
incorrectly</p>
<p><input type="radio" id="question7.1" name=
"question7[]" onchange="writeMCStatus(7);" value=
"The new node is statically allocated, possibly causing future errors">The
new node is statically allocated, possibly causing
future errors </p>
<p><input type="radio" id="question7.2" name=
"question7[]" onchange="writeMCStatus(7);" value=
"There is nothing wrong">There is nothing wrong</p>
<p><input type="radio" id="question7.3" name=
"question7[]" onchange="writeMCStatus(7);" value=
"The the node is missing "this" before "tail"">The
the node is missing "this" before "tail"</p>
<p><input type="radio" id="question7.4" name=
"question7[]" onchange="writeMCStatus(7);" value=
"The pointers are set in the wrong order, causing some to be set incorrectly">The
pointers are set in the wrong order, causing some to be
set incorrectly</p>
</div>
<div class="status_div" id="question7_status_div">
<p id="question7_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 8. (3 points): Numbers question binary
-> octal
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>Consider the two binary values 011010 and 110010 (these
are just regular binary values, not two's complement binary
values). Add them together, and convert the result to octal
(base 8). Your answer should just be the octal digits of
the number; no leading '0' digits.</p>
<div class="answer" id="div_answer8" style=
"background-color:white">
<div class="choice_container" id="choice_container8">
<input type="text" id="question8" name="question8"
oninput=
"document.getElementById('div_answer8').style.backgroundColor=modified_color;"
onfocusout=
"validateEntry('question8','^-?\\d+(\\.\\d+)?$');">
<br>
</div>
<div class="status_div" id="question8_status_div">
<p id="question8_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 9. (3 points): Numbers question --
largest value in a base
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>What is the largest possible value that a 3 digit number
in base 7 can hold? Put your answer in base 10.</p>
<div class="answer" id="div_answer9" style=
"background-color:white">
<div class="choice_container" id="choice_container9">
<input type="text" id="question9" name="question9"
oninput=
"document.getElementById('div_answer9').style.backgroundColor=modified_color;"
onfocusout=
"validateEntry('question9','^-?\\d+(\\.\\d+)?$');">
<br>
</div>
<div class="status_div" id="question9_status_div">
<p id="question9_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 10. (6 points): Numbers question --
minimum negative float
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>Consider a new floating point format with 14 mantissa
bits, 7 exponent bits, and 1 sign bit, for a total of 22
bits. The 10 remaining bits (the least significant bits) in
the 32-bit word should all be 0 bits. Other than the size
of the exponent and mantissa, it encodes the same way as
what we studied in class (although with a different
exponent offset (aka exponent bias)). Find the big-Endian
32-bit hex corresponding to the <strong>minimum negative
value</strong> (meaning the negative value with the
smallest absolute value). Your answer should be in the
format "0x12345678"; use lower case for hex digits a-f.</p>
<div class="answer" id="div_answer10" style=
"background-color:white">
<div class="choice_container" id="choice_container10">
<input type="text" id="question10" name="question10"
oninput=
"document.getElementById('div_answer10').style.backgroundColor=modified_color;"
onfocusout=
"validateEntry('question10','^0x[0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z]$');">
<br>
</div>
<div class="status_div" id="question10_status_div">
<p id="question10_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 11. (3 points): Numbers question --
valid number in base
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>Is 111 a valid number in base 6?</p>
<div class="answer" id="div_answer11" style=
"background-color:white">
<div class="choice_container" id="choice_container11">
<p><input type="radio" id="question11.0" name=
"question11[]" onchange="writeMCStatus(11);" value=
"True">True </p>
<p><input type="radio" id="question11.1" name=
"question11[]" onchange="writeMCStatus(11);" value=
"False">False</p>
</div>
<div class="status_div" id="question11_status_div">
<p id="question11_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 12. (3 points): Arrays question --
integer memory location
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>The following (4 byte) 2-D integer array starts at 0x30:
{{77, 98, 51, 1}, {81, 29, 20, 15}, {14, 68, 6, 32}, {58,
11, 8, 69}}. What is the memory address of the value 32?
(if 32 appears multiple times, then the address of the
first occurrence)</p>
<div class="answer" id="div_answer12" style=
"background-color:white">
<div class="choice_container" id="choice_container12">
<p><input type="radio" id="question12.0" name=
"question12[]" onchange="writeMCStatus(12);" value=
"0x58">0x58</p>
<p><input type="radio" id="question12.1" name=
"question12[]" onchange="writeMCStatus(12);" value=
"0x60">0x60</p>
<p><input type="radio" id="question12.2" name=
"question12[]" onchange="writeMCStatus(12);" value=
"0x54">0x54</p>
<p><input type="radio" id="question12.3" name=
"question12[]" onchange="writeMCStatus(12);" value=
"0x50">0x50</p>
<p><input type="radio" id="question12.4" name=
"question12[]" onchange="writeMCStatus(12);" value=
"0x5c">0x5c </p>
</div>
<div class="status_div" id="question12_status_div">
<p id="question12_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 13. (3 points): big-Oh question -- is F
big-Oh of G
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>Is f(n) = <img src="final-f20_files/equation_143.png"
alt="equation" class="equation"> big-OH of g(n) = <img src=
"final-f20_files/equation_144.png" alt="equation" class=
"equation">?</p>
<div class="answer" id="div_answer13" style=
"background-color:white">
<div class="choice_container" id="choice_container13">
<p><input type="radio" id="question13.0" name=
"question13[]" onchange="writeMCStatus(13);" value=
"True">True </p>
<p><input type="radio" id="question13.1" name=
"question13[]" onchange="writeMCStatus(13);" value=
"False">False</p>
</div>
<div class="status_div" id="question13_status_div">
<p id="question13_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 14. (3 points): Big-Oh question
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>What is the runtime of the x86 code snippet below?
Assume the input is passed into <code>rdi</code> and
<code>rsi</code>.</p>
<p><img src="final-f20_files/pdr_exam_f20_7.jpg" alt="Q7"
class="inlineimage"></p>
<div class="answer" id="div_answer14" style=
"background-color:white">
<div class="choice_container" id="choice_container14">
<p><input type="radio" id="question14.0" name=
"question14[]" onchange="writeMCStatus(14);" value=
"Linear">Linear</p>
<p><input type="radio" id="question14.1" name=
"question14[]" onchange="writeMCStatus(14);" value=
"Logarithmic">Logarithmic </p>
<p><input type="radio" id="question14.2" name=
"question14[]" onchange="writeMCStatus(14);" value=
"LogLinear">LogLinear</p>
<p><input type="radio" id="question14.3" name=
"question14[]" onchange="writeMCStatus(14);" value=
"Quadratic">Quadratic</p>
</div>
<div class="status_div" id="question14_status_div">
<p id="question14_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 15. (3 points): Trees question -- AVL
tree rotations
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>Consider the following AVL tree:</p>
<p><img src="final-f20_files/tree_792.jpg" class=
"inlineimage" alt="avl tree"></p>
<p>What type of rotation would be performed, if any, when
14 is inserted?</p>
<div class="answer" id="div_answer15" style=
"background-color:white">
<div class="choice_container" id="choice_container15">
<p><input type="radio" id="question15.0" name=
"question15[]" onchange="writeMCStatus(15);" value=
"Single left">Single left</p>
<p><input type="radio" id="question15.1" name=
"question15[]" onchange="writeMCStatus(15);" value=
"Single right">Single right</p>
<p><input type="radio" id="question15.2" name=
"question15[]" onchange="writeMCStatus(15);" value=
"Double (right first, then left)">Double (right first,
then left) </p>
<p><input type="radio" id="question15.3" name=
"question15[]" onchange="writeMCStatus(15);" value=
"Double (left first, then right)">Double (left first,
then right)</p>
<p><input type="radio" id="question15.4" name=
"question15[]" onchange="writeMCStatus(15);" value=
"None">None</p>
</div>
<div class="status_div" id="question15_status_div">
<p id="question15_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 16. (3 points): Trees question --
traversals
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>Given the following tree:</p><img src=
"final-f20_files/tree_19983.jpg" class="inlineimage">
<p>What is the postorder traversal of this tree? Your
answer must be in a space-separated list of the values,
such as "A B C D E F G H I J". The letters must be
capitalized.</p>
<div class="answer" id="div_answer16" style=
"background-color:white">
<div class="choice_container" id="choice_container16">
<input type="text" id="question16" name="question16"
oninput=
"document.getElementById('div_answer16').style.backgroundColor=modified_color;"
onfocusout=
"validateEntry('question16','^[A-Z]( [A-Z])+$');"><br>
</div>
<div class="status_div" id="question16_status_div">
<p id="question16_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 17. (6 points): Hashes question --
insertion
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>Assume a hash table that uses quadratic probing has a
size of 10 with the hash funtion of h(x) = x * 6 + 3. What
is the resultant hash table after inserting the following
integer values: [4, 9, 3, 7, 0, 6, 2]? There will not be
any rehashing with the inserting of those values. Your
answer must be in a space-separated list of the values in
the hash table array of size 10 with '#' for an empty cell.
For example: "1 # 2 # 3 # 4 # 5 # 6" (without the quotes,
of course).</p>
<div class="answer" id="div_answer17" style=
"background-color:white">
<div class="choice_container" id="choice_container17">
<input type="text" id="question17" name="question17"
oninput=
"document.getElementById('div_answer17').style.backgroundColor=modified_color;"
onfocusout=
"validateEntry('question17','^((#|\\d) )+(#|\\d)$');"><br>
</div>
<div class="status_div" id="question17_status_div">
<p id="question17_status" style="text-align: center;">
</p>
</div>
</div><br>
</div>
<div class="question">
<table class="questiontitletable">
<tbody>
<tr>
<td>
<div class="questiontitle">
Question 18. (3 points): Assembly question
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p>What is the result of the recursive code shown below?
Assume the function prototype is <code>int recur(int
x);</code>? Note that the formuals in the answers use the
floor (<code>⌊⌋</code>) and ceiling (<code>⌈⌉</code>)
functions, and the log functions in the answers are all
base 2..</p>
<p><img src="final-f20_files/pdr_exam_f20_13.jpg" alt="Q12"
class="inlineimage"></p>
<div class="answer" id="div_answer18" style=
"background-color:white">
<div class="choice_container" id="choice_container18">
<p><input type="radio" id="question18.0" name=
"question18[]" onchange="writeMCStatus(18);" value=
"⌊ log (x) ⌋">⌊ log (x) ⌋</p>
<p><input type="radio" id="question18.1" name=
"question18[]" onchange="writeMCStatus(18);" value=
"⌈ log (x) ⌉">⌈ log (x) ⌉ </p>
<p><input type="radio" id="question18.2" name=
"question18[]" onchange="writeMCStatus(18);" value=
"⌈ x / 2 ⌉">⌈ x / 2 ⌉</p>
<p><input type="radio" id="question18.3" name=
"question18[]" onchange="writeMCStatus(18);" value=
"1 + x / 2">1 + x / 2</p>
<p><input type="radio" id="question18.4" name=
"question18[]" onchange="writeMCStatus(18);" value=