[Year 12 SofDev] Arrays with mixed data types

Kevork Krozian kevork at edulists.com.au
Fri Jun 12 18:25:07 AEST 2015


Hi Folks

 

This issue takes me back to the 2012 MC16 exam question :

 

Question 16 

The name, date of birth, membership number, address, suburb, postcode and phone number of one person is to be stored in memory. 

Which one of the following would be the best data structure? 

A. record 

B. random file 
C. sequential file 
D. one-dimensional array

 

The concession that an associative array could just as easily store this information as a record made this question inexact.  

To quote just PHP as an example of a language that uses associative arrays overlooks the fact the list of 39 programming languages http://en.wikipedia.org/wiki/Comparison_of_programming_languages_(mapping)#Language_support clearly shows most have support for an associative array, in one form or another. 

An associative array is still an array.    

 

“Associative arrays can be implemented in any programming language as a package and many language systems provide them as part of their standard library. In some languages, they are not only built into the standard system, but have special syntax, often using array-like subscripting. “  http://en.wikipedia.org/wiki/Associative_array

 

Also Robert I distinctly remember Pascal requiring an enumerated type for the index of an array – even a user declared one, but only after this was declared when not inbuilt such as integer, string etc.

Excuse syntax as it’s been 20 years since I wrote a Pascal program but roughly the idea was.

Eg.  month = enum{ jan, feb, mar, apr, …… nov, dec} ;

          Rainfall    = Array [month];

 

 

Kind Regards

 

 

Kevork Krozian

Edulists Creator Administrator

www.edulists.com.au

tel: 0419 356 034

 

From: sofdev-bounces at edulists.com.au [mailto:sofdev-bounces at edulists.com.au] On Behalf Of timmer at westnet.com.au
Sent: Friday, 12 June 2015 5:57 PM
To: Year 12 Software Development Teachers' Mailing List
Subject: Re: [Year 12 SofDev] Arrays with mixed data types

 

Hello again Mark

As an after though to my last post, I don't know if it's useful for what you are doing but the new SoftDev study design makes a distinction between the two types of 'array': U3 OC1 'data and information' dot point 2 - good ol' fashioned proper array; U4 OC1 'data and information' dot point 2 associative arrays.

Regards

Robert T-A


----- Original Message -----

From:

"Year 12 Software Development Teachers' Mailing List" <sofdev at edulists.com.au>

 

To:

"Year 12 Software Development Teachers' Mailing List" <sofdev at edulists.com.au>

Cc:

 

Sent:

Fri, 12 Jun 2015 14:25:58 +1000

Subject:

Re: [Year 12 SofDev] Arrays with mixed data types



I'm not familiar with the inner workings of PHP, but my research suggests their 'arrays' are not exactly the same nature as most other languages.

 

It's sort of like when TV guides categorise 'Big Brother' as 'entertainment' ... a non-classical use of the term.

 

I ask because I'm writing an exam with a question about whether a 2D array with mixed data types is possible (or wise).

 

Cheers

Mark

 

 

On 12 June 2015 at 14:09, Laurie Savage <08327998 at pvgc.vic.edu.au> wrote:

If it quacks like an array ...? Could you elaborate on why Python lists ain't arrayz?

Laurie




Laurie Savage
https://sites.google.com/a/pvgc.vic.edu.au/mr-savage/home

 

On 12 June 2015 at 13:27, Mark <mark at vceit.com> wrote:

Hi, codemakers.

 

Most languages require all elements of an array to have a single data type, but I have a nagging suspicion that there is an exception or two.

 

e.g. Apparently PHP allows mixed data types in its 'arrays' but I believe PHP 'arrays' are actually more like the lists found in Perl or Python and so are not classical arrays.

 

Is there a language that allows true arrays with mixed data types?

 

Cheers

Mark


 

-- 

 

Before Facebook, how many people would take a picture of their dinner on a disposable camera, get the photos developed, then go round to your friends' houses and show them all the photo?

 

-- 

 

Mark Kelly

 

http://vceit.com


_______________________________________________
http://www.edulists.com.au - FAQ, Subscribe, Unsubscribe
IT Software Development Mailing List kindly supported by
http://www.vcaa.vic.edu.au - Victorian Curriculum and Assessment Authority and
http://www.vcaa.vic.edu.au/vce/studies/infotech/softwaredevel3-4.html
http://www.vitta.org.au  - VITTA Victorian Information Technology Teachers Association Inc
http://www.swinburne.edu.au/ict/schools - Swinburne University

 


_______________________________________________
http://www.edulists.com.au - FAQ, Subscribe, Unsubscribe
IT Software Development Mailing List kindly supported by
http://www.vcaa.vic.edu.au - Victorian Curriculum and Assessment Authority and
http://www.vcaa.vic.edu.au/vce/studies/infotech/softwaredevel3-4.html
http://www.vitta.org.au  - VITTA Victorian Information Technology Teachers Association Inc
http://www.swinburne.edu.au/ict/schools - Swinburne University





 

-- 

 

>> Witty sig goes HERE <<

 

Mark Kelly

 

http://vceit.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.edulists.com.au/pipermail/sofdev/attachments/20150612/2efa61a3/attachment-0001.html 


More information about the sofdev mailing list