Need help with multiple choice question (1 Viewer)

Danneo

Member
Joined
Sep 12, 2016
Messages
46
Gender
Male
HSC
2018
A well written library module will...

a) be both a black and white utility
b) preferably use global variables
c) have well documented parameter requirements
d) have no internal methods

Not too sure about the answer, can someone help and explain how they got to the solution? No answers were provided for this question sadly
 

titanium_man23

New Member
Joined
Jul 19, 2017
Messages
21
Gender
Male
HSC
2018
This question in my opinion is worded with too little information TBQH. I believe it was a toss up between B and C. C is quite obvious as you should have extensive documentation on how to use the module, however i think its B.

In the SDD syllabus, this dot point appears up

• making the same data available to different
modules
– global variables
– parameter passing
(SDD syllabus, Page 24)


The fact that global variables is explicitly mentioned here makes me beleve its the right answer. As i said before, it could go the other way, but that is my reasoning.
 

BLIT2014

The pessimistic optimist.
Moderator
Joined
Jul 11, 2012
Messages
11,591
Location
l'appel du vide
Gender
Undisclosed
HSC
2014
Uni Grad
2018
This question in my opinion is worded with too little information TBQH. I believe it was a toss up between B and C. C is quite obvious as you should have extensive documentation on how to use the module, however i think its B.

In the SDD syllabus, this dot point appears up

• making the same data available to different
modules
– global variables
– parameter passing
(SDD syllabus, Page 24)


The fact that global variables is explicitly mentioned here makes me beleve its the right answer. As i said before, it could go the other way, but that is my reasoning.
I would've thought it would be c rather then b using global variables as I thought you should try and avoid using global variables?
 

Drdusk

Moderator
Moderator
Joined
Feb 24, 2017
Messages
2,022
Location
a VM
Gender
Male
HSC
2018
Uni Grad
2023
I would've thought it would be c rather then b using global variables as I thought you should try and avoid using global variables?
Yep I would also say C, a well written library module needs Local Variables so that any other developer can quickly pick it up and insert it into their code without the need to worry about any external variables influencing the module. This makes it more compact and easier to integrate

Also well documented parameters is needed so that the developer can quickly understand any external factors that may influence the output and performance of the module, again making it easier to integrate and use
 
Last edited:

titanium_man23

New Member
Joined
Jul 19, 2017
Messages
21
Gender
Male
HSC
2018
Yep I would also say C, a well written library module needs Local Variables so that any other developer can quickly pick it up and insert it into their code without the need to worry about any external variables influencing the module. This makes it more compact and easier to integrate
Once again, this question needs more information. If you talk about a larger program, that is represented as a structure chart, then a global variable needs to be used to go between module. A good question that shows the difference is the 2017 HSC SDD exam, question 20. It is known that (Im not sure about most languages, but i do know about Python) global variables are used in more situations than necessary and that it makes the program less efficient. Really, its about what you want the program to do, and if the variable is used multiple times will depend if you use global or local.

I could quite possibly be wrong, and i'm not saying that i' right, or that Answer B is wrong but i would like to see the answer to this question. I would also like to see other people's interpretation TBH.

I'm either right, or i learnt something new (completely not trying to be arrogant, but being humble).
 

Drdusk

Moderator
Moderator
Joined
Feb 24, 2017
Messages
2,022
Location
a VM
Gender
Male
HSC
2018
Uni Grad
2023
Once again, this question needs more information. If you talk about a larger program, that is represented as a structure chart, then a global variable needs to be used to go between module. A good question that shows the difference is the 2017 HSC SDD exam, question 20. It is known that (Im not sure about most languages, but i do know about Python) global variables are used in more situations than necessary and that it makes the program less efficient. Really, its about what you want the program to do, and if the variable is used multiple times will depend if you use global or local.

I could quite possibly be wrong, and i'm not saying that i' right, or that Answer B is wrong but i would like to see the answer to this question. I would also like to see other people's interpretation TBH.

I'm either right, or i learnt something new (completely not trying to be arrogant, but being humble).
You make a fair point, however what I would say is that Library routines are usually considered as a small function that performs a specific task.
In SDD we take a library routine as a small well documented function. Hence I would say C, however if were talking outside the context of this course then yes your answer would be correct.

Not saying I'm certainly correct but this is what I've learn personally from my teacher and the Sam Davis textbook.

If I am wrong, then I've been deluded about Library routines for a whole year even though I wrote that in my exams and got full marks lol r.i.p
 
Last edited:

BLIT2014

The pessimistic optimist.
Moderator
Joined
Jul 11, 2012
Messages
11,591
Location
l'appel du vide
Gender
Undisclosed
HSC
2014
Uni Grad
2018
In the HSC you are also looking for the "best answer". Multiple answers can be technically correct. However, global variables present a lot of problems in various programming languages and in practice a lot of people actually reccomend not using them.

These problems include i) Implicit coupling
ii) Bugs that arise due to the interference
 

BLIT2014

The pessimistic optimist.
Moderator
Joined
Jul 11, 2012
Messages
11,591
Location
l'appel du vide
Gender
Undisclosed
HSC
2014
Uni Grad
2018
Having well-documented parameter requirements would also be a method of reducing the problems that may arise from global variables.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top