Quiz 1.6: Other Data StructuresQ1: Data structures theoryWhich of the following sentences are correct? Arrays, tuples, dictionaries, named tuples, sets are all examples of data structure to manage data offering different functionalities For an array, a tuple, a dictionary, a named tuple, or a set it is often more efficient, if the number of elements is known in advance, to first create the specific data structure and then edit the individual element than create an empty container and add the individual elements one by one Tuples and named tuples can efficiently host heterogeneous types differently than arrays and dictionaries where hosting different types would result in less efficient code Arrays, tuple, named tuples are data structures where the initial or insertion order is retained, contrary to dictionaries and sets Arrays and tuples support linear algebra operations, contrary to named tuples, dictionaries and sets. The function push! is supported for arrays, dictionaries and sets The function delete! is supported for arrays, dictionaries and sets The function collect returns an array of the data being "collected" RESOLUTIONA few notes concerning the incorrect sentences: tuples and named tuples being immutable can not be used in algorithms where a modification of an element is required (nor where an appending of elements is); tuples do NOT support linear algebra operations, only arrays do; delete! is not supported for arrays. Use deleteat! insteadThe correct answers are:"Arrays, tuples, dictionaries, named tuples, sets are all examples of data structure to manage data offering different functionalities""Tuples and named tuples can efficiently host heterogeneous types differently than arrays and dictionaries where hosting different types would result in less efficient code""Arrays, tuple, named tuples are data structures where the initial or insertion order is retained, contrary to dictionaries and sets""The function push! is supported for arrays, dictionaries and sets""The function collect returns an array of the data being \"collected\""Q2: Conversion between data structuresGiven the following code snippet:a = (a=1,b=2,c=3,d=4) b = Dict([k => v for (k,v) in pairs(a)] ) c1 = keys(b) c2 = values(b) d = NamedTuple([k=>v for (k,v) in zip(c1,c2)])Which is the value of d ? The same as a A named tuple different than a The script produces an error Despite the name of the function, d is a datastructure different than a named tuple RESOLUTIONThe script converts the named tuple to a dictionary, to a pair of arrays and then back to the original named tuple. However the passage through the dictionary make the order to be lost and the final named tuple has an order different than the original one.The correct answers are:A named tuple different than aQ3: Date functions (1)The following snippet computes the number of working hours (9-18, Mo-Fr) for the month of February 2030:wHours = sum(18-9 for d in Date(?₁,?₂,?₃):Day(1):?₄(d -> Dates.day(d+Day(1)) == 1, Date(?₁,?₂,?₃)) if ?₅(d) in 1:5)Where ?₁, ?₂ and ?₃ are numbers and ?₄ and ?₅ are names of functions.Which are ?₁, ?₂ and ?₃ ? Type your answer in the form (?₁,?₂,?₃), e.g. (1,2,3) without spaces and without leading zeros. RESOLUTIONWe are interested in summing the hours of February 2030. Date(?₁,?₂,?₃) represents the beginning of our range of interest, so it is the 1st of February 2030.The correct answer is: (2030,2,1)Q4: Date functions (2)The following snippet computes the number of working hours (9-18, Mo-Fr) for the month of February 2030:wHours = sum(18-9 for d in Date(?₁,?₂,?₃):Day(1):?₄(d -> Dates.day(d+Day(1)) == 1, Date(?₁,?₂,?₃)) if ?₅(d) in 1:5)Where ?₁, ?₂ and ?₃ are numbers and ?₄ and ?₅ are names of functions.Which is ?₄ ? Type your answer with just the function name, without parentheses, e.g. println RESOLUTIONOur objective is to select the last day of the range, that is the last day of the specific month requested. As we don't know a priori whether 2030 is a leap year or not, we use tonext until we find a day whose following day is the first of the month.The correct answer is: tonextQ5: Date functions (3)The following snippet computes the number of working hours (9-18, Mo-Fr) for the month of February 2030:wHours = sum(18-9 for d in Date(?₁,?₂,?₃):Day(1):?₄(d -> Dates.day(d+Day(1)) == 1, Date(?₁,?₂,?₃)) if ?₅(d) in 1:5)Where ?₁, ?₂ and ?₃ are numbers and ?₄ and ?₅ are names of functions.Which is ?₅ ? Type your answer with just the function name, without parentheses, e.g. println RESOLUTIONOur objective is to count only working hours between Monday to Friday, and the function dayofweek allows us to filter only such days.The correct answer is: dayofweek « 0103q - QUIZ 1.50104 - Control flow and functions »Powered by Documenter.jl and the Julia Programming Language.SettingsThemeAutomatic (OS)documenter-lightdocumenter-darkcatppuccin-lattecatppuccin-frappecatppuccin-macchiatocatppuccin-mochaThis document was generated with Documenter.jl version 1.19.0 on Wednesday 30 September 2026. Using Julia version 1.12.7.