Link to home
Start Free TrialLog in
Avatar of collinng
collinng

asked on

meaning of an english word

Hi, i am interpreting a question for someone, and what is the meaning of 'safe assumption' ? Any guess ?

THe question is here below :

 
Write a Pseudocode which read a file containing the name, classcode, and GPA of each student in a class. A classcode of 1 means Freshman, and a classcode of 2 means Sophomore. Write out the name, class name (freshman sophomore), and GPA for each input record. This Pseudocode should be written in 2 different modules.

a)  Assume that it is a safe assumption
b)  Rewrite the Pseudocode when that is not a safe assumption
c)  Rewrite the Pseudocode for which an error message is desired.

Avatar of prashant_n_mhatre
prashant_n_mhatre

Nice question...I'll get back to see responses....
Hmmm. Safe assumption in and of itself refers to an assumption that is overwhelming likely to be correct. I'm a bit puzzled however, in that the text you provide doesn't list what, or about what, one should be assuming anything......

An example might be the existence of the file. You could write code in which the existence of the file is a safe assumption.
On the other hand you could write code, in which you should not assume that the file exists, and so you have to check for that first, and provide error message in the case where it doesn't.
I agree that the question is lacking in information.  It is almost as if the questioner has defined the term "safe assumption" in a particular way for the students.  A safe assumption would most likely be that each student record does have a valid classcode of 1 or 2.  The pseudocode would be different if you did not assume this.
Avatar of dbrunton
Check with tutor.

I'll presume that the safe assumption is that the classcode will always be 1 or 2 and no variations can occur.
ASKER CERTIFIED SOLUTION
Avatar of dkloes
dkloes

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Example: A safe assumption is that a boolean can either hold true or false.

Even an else statement is a safe assumption. In your example it would mean that the classcode can be either 1 or 2. To complete it you add an else statement

if(classcode==1)
{

}
else if(classcode==2)
{

}
else
{

}

Regards,
CJ
Hmm.

Missed your posting dkloes cause I duplicated what was in your post.
Is it 'safe to assume' that all students are accounted for, and that each of three fields is already spelled out correctly? And that there are no other fields of information such as student ID#?:

> "containing the name, classcode, and GPA of each student"

Names can be mispelled, "1" can be a number, a letter representing a number, visually similar (like 0 & O, 1 & l), fields may be default, blank, null, invalid, or erroneously typed or typed.

Your question "c" gives a main clue, that this is mainly about checking for errors or not, and if errors are found, will then be done. Hasty code, whether pseudocode or not, may not check for error conditions in many different areas, 'assuming' there is no need to.

Consider, that in another program, "3" means Junior and "4" means Senior. So a table lookup could return, could retrieve, twice the possibilities. Yet lookup/translation on "classcode of 1" is different from that for "classcode of 4" which is different from that for "classcode of 6". While latter two are erroneous, they may yield different progammatic results.

Consider code like:
  if "classcode of 1" then student is a freshman, otherwise student is a sophomore.

           or

  all students are sophomore (level), but if "classcode is 1" then call student a freshman anyway.

Now you do not need more than one condition, leading to binary or even boolean possibilities.

Now consider situation where class had three graders. One graded on four point scale. One on five point scale. One called in sick (no input). One student was graded by both graders.

Is it safe to assume anything about the content of any field of data? Suppose one grader used excel, leaving GPA as a number, and other grader used MS-Word, leaving GPA as alphabetic.

What is it "safe to assume"? Is there exactly one record per student? Exactly one student per record? That is often assumed.

Class exercises are sanitized compared to real world. What sounds so simple at first, checking for error(s) or not, can have several levels of complexity. Some code translaters, for example, behave differently for traditional 'if-then-else' when other conditions arise concerning erroneous data, leading to supposed boolean  results of true, false, invalid, error, incomplete, ... (etc.).

;) You do know the old saying, do you not, that
"When you 'assume'  "
you make an
"________________"

Why three steps, a-b-c? Like imladris and the file. Consider step c)
Is it safe to assume that there is I/O device, monitor, printer, file, etc. that is available to use for producing the error message that is desired?

(a trick question?  naw, i doubt)

Generally, better documentation will state up front in the code commentary just what is or is not... safely assumed.
Hope it was not for course in English. Or other language.
In the context of a teaching environment, a 'safe assumption' generally refers to assuming that all data is valid with no errors.

That is, each record that is read will have correct data for each reference item such as classcode will always be a valid classcode.

So part 1 is assume all data supplied is valid.
Part 2 is assume can have invalid data so include error trapping.
Part 3 is include error messages to part 2.

Cheers
ditto
;-) actually, the main assumption is the test or exercise does not care about reality and is limited in focus and scope, so trick is to identify the goal that they are trying to achieve, and to do it simple and elegantly. They have not the time for handling complexities, hence, their common use of this 'safe assumption' which helps most to retain focus.

Although on occasion... one may get extra credit for a little more, it does not pay to either confuse a grader or make them feel inferior (I achieved both ends of scale rather successfully)