The Student Room Group

A level homework help

I am doing computing at sixth form this year and know very little about it. I am learning at home but still in the process of doing this. My programming knowledge is very basic and I was given some homework to complete before school starts. I am not sure on most of the answers but can give it a go. Can someone check my answers? I have attached the homework to this post
My answers(questions attached)


Data Type Length
1. Student ID integer 10
2. Forename String 10
3. Surname String 10
4. DOB Date 10
5. Gender String 6
6. MobileNumber Integer 11
7. Email String 20
8. Age Integer 3

2)
A)False
B) False
C) True
D) False
E) False
F) False

3) Equal.

Are these answers correct?
Reply 1
Question 1 - Correct
Question 2 - a, b, c, and d are correct (not sure about e and f)
Question 3 - Incorrect I think (notice how the 'roll' is in caps, not lowercase - the program will print out "not equal because of this)
Original post by andylowes9
I am doing computing at sixth form this year and know very little about it. I am learning at home but still in the process of doing this. My programming knowledge is very basic and I was given some homework to complete before school starts. I am not sure on most of the answers but can give it a go. Can someone check my answers? I have attached the homework to this post
My answers(questions attached)


Data Type Length
1. Student ID integer 10
2. Forename String 10
3. Surname String 10
4. DOB Date 10
5. Gender String 6
6. MobileNumber Integer 11
7. Email String 20
8. Age Integer 3

2)
A)False
B) False
C) True
D) False
E) False
F) False

3) Equal.

Are these answers correct?


Question 1: Almost all correct, there are only a few with problems:

1. StudentID should be a string, not an integer. The reason for this is if you have an ID that begins with a 0, then the 0 is truncated if stored as an integer. The same goes for phones numbers, bank cards and any kind of ID.

4.DOB is usually in the form xx/xx/xxxx, so this would make it 8 bytes of length (discluding the /).

5. Whilst you could store "Male" and "Female" as genders, it would probably be more appropriate to use "M" and "F". This will make it a "character" with length 1.

6. For the same reason as 1, mobile number should be a string.

Question 2: From what I have checked, all are correct :smile:

Question 3: Incorrect :frown:. But I will tell you why. The string "Rock n ROLL" is not exactly the same as "Rock n Roll". This is because when a computer compares characters, it compares the character codes of the characters in ASCII. Therefore, the code for "o" and "O" are different, so the computer will print "Not Equal".

I finished my A2 in Computing this year and got an A*, any more questions feel free to ask :smile:
(edited 7 years ago)
Original post by iHammmy
Question 1 - Correct
Question 2 - a, b, c, and d are correct (not sure about e and f)
Question 3 - Incorrect I think (notice how the 'roll' is in caps, not lowercase - the program will print out "not equal because of this)


Some were incorrect in Question 1, for very specific reasons I outlined in my reply.
Reply 4
Original post by Dapperblook22
Some were incorrect in Question 1, for very specific reasons I outlined in my reply.


1) My student ID is a string, not an integer - so i guess it could be either :P

4) tru

5) Basically the markers opinion - either could be correct
Reply 5
Original post by Dapperblook22
Question 1: Almost all correct, there are only a few with problems:

1. StudentID should be a string, not an integer. The reason for this is if you have an ID that begins with a 0, then the 0 is truncated if stored as an integer. The same goes for phones numbers, bank cards and any kind of ID.

5. Whilst you could store "Male" and "Female" as genders, it would probably be more appropriate to use "M" and "F". This will make it a "character" with length 1.

6. For the same reason as 1, mobile number should be a string.

Question 2: From what I have checked, all are correct :smile:

Question 3: Incorrect :frown:. But I will tell you why. The string "Rock n ROLL" is not exactly the same as "Rock n Roll". This is because when a computer compares characters, it compares the character codes of the characters in ASCII. Therefore, the code for "o" and "O" are different, so the computer will print "Not Equal".

I finished my A2 in Computing this year and got an A*, any more questions feel free to ask :smile:


Thanks for your help :smile: didn't want to embarrass myself on my first day
Original post by iHammmy
1) My student ID is a string, not an integer - so i guess it could be either :P

4) tru

5) Basically the markers opinion - either could be correct


1) Although the number is an integer, it would be stored as a string in the computer. For example, suppose I have an ID, 012345. If this is stored as an integer or a float, it would be stored as 12345, as the 0 is meaningless (integers and floats are typically used for calculating, so the 0 serves no purpose anyway). However, because it is an ID, it must be stored as a string to avoid the 0 being deleted (truncated) to save memory. If the 0 is removed, data integrity is compromised. I am just trying to drive this point forward, as so many people forget this when it comes to the exam :tongue:.

5) Typically when programmers can use a single character to store data, they do :tongue:, it just simplifies things and the encoded form is just as easy to understand as the non encoded form, and less memory is needed due to only storing a single character (1 byte).
Original post by andylowes9
Thanks for your help :smile: didn't want to embarrass myself on my first day


No problem, and with little experience you did quite well. Some questions are common pitfalls, like the phone number one. No harm in getting things wrong, as you will learn what the correct way is anyway over the year :smile:.
Reply 8
Original post by Dapperblook22

1. StudentID should be a string, not an integer. The reason for this is if you have an ID that begins with a 0, then the 0 is truncated if stored as an integer. The same goes for phones numbers, bank cards and any kind of ID.


Yes that's true, however you're wrong in saying that ID columns should be a string.. It all depends on the context on how a ID column is intended to be. For example, if the StudentID column was one that was managed by the auto_increment feature on database management system then it would be an integer. But if the StudentID was generated based upon a formula that contained alphabets then it would be a string(E.g. First letter of surname followed by first 5 letters of firstname and then random numbers). Also your example with a phone number just supports my point that it's based on context, phone numbers shouldn't be stored as an integer anyway because it would just create problems to manage.


I finished my A2 in Computing this year and got an A*, any more questions feel free to ask


No one asked for your grade
(edited 7 years ago)
Original post by Async
Yes that's true, however you're wrong in saying that ID columns should be a string.. It all depends on the context on how a ID column is intended to be. For example, if the StudentID column was one that was managed by the auto_increment feature on database management system then it would be an integer. But if the StudentID was generated based upon a formula that contained alphabets then it would be a string(E.g. First letter of surname followed by first 5 letters of firstname and then random numbers). Also your example with a phone number just supports my point that it's based on context, phone numbers shouldn't be stored as an integer anyway because it would just create problems to manage.


No one asked for your grade


IDs in DBMS software are typically represented by autonumber, not integer. Even in a database integer would cause problems with referential integrity as you would have to manually set the ID with each new record, as opposed to autonumber which does this automatically per record, such as in MS Access.This is assuming that the ID in question is the primary key field.

Past examination papers also accept string over integer for IDs. The paper can be found here and mark scheme here (question 3b).

Whilst no one asked for my grade, I know what I am talking about, hence proven by my grade. This only serves to increase my credibility.
(edited 7 years ago)
Because it does not explain how the fields they are going to be used, question one does not give enough information to specify the most appropriate data type/length.

For example - StudentID. Is it purely numeric with no leading zeros for a small college? Then unsigned 32-bit integer would work. But if it's numeric with leading zeros and has to be unique for all students in China and never get reused then a string of length 12 would be more appropriate.

Forename/Surname? Does the college accept foreign students and need to store their names in the student's native language? Then it'll be Unicode, probably UTF-16.

DOB? Is it going to be used in calculations? In which case, seconds after midnight on 1/1/1800. (Gotta allow for old students!) Is it just to be displayed? Then char[8] stored as yyyymmdd. Storing as yyyymmdd makes it easy to sort.

And so on..... do the people who set these questions actually have experience of real-world software development? :frown:
(edited 7 years ago)
Reply 11
Original post by Dapperblook22
IDs in DBMS software are typically represented by autonumber, not integer. Even in a database integer would cause problems with referential integrity as you would have to manually set the ID with each new record, as opposed to autonumber which does this automatically per record, such as in MS Access.This is assuming that the ID in question is the primary key field.

Past examination papers also accept string over integer for IDs. The paper can be found here and mark scheme here (question 3b).

Whilst no one asked for my grade, I know what I am talking about, hence proven by my grade. This only serves to increase my credibility.


No, in DBMS an auto number / auto incremented field is represented as an integer. Are you hearing yourself? And what on earth are you talking about in terms of referential integrity? You're not even making any sense.

Also your grade means nothing. It doesn't mean you know what you're talking about, it means you know how to pass an exam. Learning the exam mark scheme style to get the highest grade isn't the same as knowing what you're talking about in terms of real world experience.
If you had read what I had posted, you would have realised that I said autonumber is not the same type as integer, which it isn't. Again if you had read what I said, not using autonumber over integer means a manual key set per record. This lead to many referential integrity errors in my own ICT project which I had to fix.

Furthermore, what was the title of this thread again? "A Level Homework Help". I know what the examiners want, as shown by my grade, hence I have the relevant expertise to strengthen the credibility of my claims. OP is asking for help with regards to their A Levels, which is mostly jumping through hoops to give the answers needed, as annoying as that sounds. Therefore I know what I am talking about with regards to this situation.

This thread is no place to argue with each other, if you wish to continue this argument, please take it some place else; I am closing it off here.
Reply 13
Original post by Dapperblook22
If you had read what I had posted, you would have realised that I said autonumber is not the same type as integer, which it isn't. Again if you had read what I said, not using autonumber over integer means a manual key set per record. This lead to many referential integrity errors in my own ICT project which I had to fix.

Furthermore, what was the title of this thread again? "A Level Homework Help". I know what the examiners want, as shown by my grade, hence I have the relevant expertise to strengthen the credibility of my claims. OP is asking for help with regards to their A Levels, which is mostly jumping through hoops to give the answers needed, as annoying as that sounds. Therefore I know what I am talking about with regards to this situation.

This thread is no place to argue with each other, if you wish to continue this argument, please take it some place else; I am closing it off here.


u are wrong a dont know what youre talking about
visual basic?
rofl
Reply 15
Original post by Dapperblook22
If you had read what I had posted, you would have realised that I said autonumber is not the same type as integer, which it isn't. Again if you had read what I said, not using autonumber over integer means a manual key set per record. This lead to many referential integrity errors in my own ICT project which I had to fix.

Furthermore, what was the title of this thread again? "A Level Homework Help". I know what the examiners want, as shown by my grade, hence I have the relevant expertise to strengthen the credibility of my claims. OP is asking for help with regards to their A Levels, which is mostly jumping through hoops to give the answers needed, as annoying as that sounds. Therefore I know what I am talking about with regards to this situation.

This thread is no place to argue with each other, if you wish to continue this argument, please take it some place else; I am closing it off here.



An autonumber for the ID in a database is of type integer. Autonumber isn't a data type.... Definition of integer has nothing to do with auto incrementation.

Quick Reply

Latest

Trending

Trending