SDD Marathon 2013 (1 Viewer)

SpiralFlex

Well-Known Member
Joined
Dec 18, 2010
Messages
6,960
Gender
Female
HSC
N/A
Hello and enjoy. =)

Rules are quite simple, post questions then a person responds and then they in turn posts another question.

Q1. Write a function that outputs a right isosceles triangle of height and width n. (Eg when n = 3)

*
**
***

Q2. Write a function to calculate if a number is prime. Return a message "//number// is a prime" if it is, if not return "//number// is not a prime".


Q3. A perfect number is a positive integer equal to the sum of its positive divisors excluding the number itself (aliquot sum). For example 6 is a perfect number. 1+2+3 = 6. Write a function to determine if a number is a perfect number.
 
Last edited:

GoldyOrNugget

Señor Member
Joined
Jul 14, 2012
Messages
583
Gender
Male
HSC
2012
W00T

John tries to program a standard integer sorting algorithm (to sort in ascending order), and produces the following (see below). a) What algorithm did John try to program? b) John messed up the algorithm. Correct the pseudocode to make the algorithm correct.

Code:
INPUT Array // 0-indexed
IsSorted := FALSE
WHILE IsSorted = FALSE DO
    i := 0
    IsSorted = TRUE
    WHILE i < length of Array DO
        IF Array[i] < Array[i+1] THEN
            Temp := Array[i]
            Array[i] := Array[i+1]
            Array[i+1] := Temp
            IsSorted := FALSE
        ENDIF
        i := i + 1
    ENDWHILE
ENDWHILE
 

GoldyOrNugget

Señor Member
Joined
Jul 14, 2012
Messages
583
Gender
Male
HSC
2012
Question.
What is the value of this signed binary number (1100110)?
Someone replied! :party:

Alas, you don't specify how many bits long the binary number is, so your question is ambiguous :confused2: :uhoh: :confused:

True story, I lost a mark in last year's HSC paper because I did one of these binary interpretation questions wrong. trollface.jpg
 

schlep16

Member
Joined
Nov 17, 2009
Messages
37
Gender
Undisclosed
HSC
2013
fuck me guys, started with easier questions yeh, to get the thread going...

Question.
What is the value of this signed binary number (1100110)?
Why the hell have u done 7 bits...and not even specified if u want it for 8 or 7 or 6 or whatever.
Presuming the 7 bits..
The first 1 is a minus.
SO already its -64
Then 32, nothing nothing, 4, 2, nothing
= -26

OR

2's comp:
0011001

0011010
=
2+8+16
=
26
...

SO THERE U GO!!!!!!!!!
 

schlep16

Member
Joined
Nov 17, 2009
Messages
37
Gender
Undisclosed
HSC
2013
Next up!
Turn this decimal number into its single precision form:
26.125
 

Shazer2

Member
Joined
Feb 16, 2012
Messages
439
Gender
Male
HSC
2013
26.125 = 11010.001

Change to scientific notation to get 1.1010001 x 2^4 so the bold part is our mantissa. Now we need to get the exponent by adding 127 to the power, so we get 131 which is 10000011. We can write our final number as:

SignExponentMantissa
01000001110100010000000000000000

Next question:
What has the development of unicode allowed over ASCII?
 
Last edited:

hjed

Member
Joined
Nov 10, 2011
Messages
211
Gender
Undisclosed
HSC
2013
Next question:
What has the development of unicode allowed over ASCII?
(Treating as 3 marks)

Unicode, where characters can be up to 32-bits, as supposed to ASCII's 7-bits, allows for a far greater range of characters to be produced. Due to this greater range it also allows multiple different language's character sets to be represented in a single format. This is far superior to ASCII which allows only latin characters, numbers, and a small range of other characters to be represented.
This allows for greater compatibility between computer systems and long term support for retrieving data in languages that could become obsolete.

Next Question
A company developing a graphing program decide to use an interpreted language. Justify this choice. (4 marks)
 

Shazer2

Member
Joined
Feb 16, 2012
Messages
439
Gender
Male
HSC
2013
Next Question
A company developing a graphing program decide to use an interpreted language. Justify this choice. (4 marks)
A company may decide to use an interpreted language for a number of reasons. Firstly, the use of an interpreted language allows for great flexibility. It also makes syntax checking a much easier process and makes the location of syntax errors far easier than a compiled language. Another advantage of using an interpreted language in this situation is that file size is greatly reduced in the final build. Finally, the use of an interpreted language means the company can rapidly prototype the program, allowing for increased speed of development.
 

schlep16

Member
Joined
Nov 17, 2009
Messages
37
Gender
Undisclosed
HSC
2013
Yeah ,the unicode...fucks up wit that...idk the answer to that. SO cheers for the question...and i guess answer.
 

schlep16

Member
Joined
Nov 17, 2009
Messages
37
Gender
Undisclosed
HSC
2013
Wait is the interpreted to do with compilation and reading it line by line...i never really understand that stuff.
 

hjed

Member
Joined
Nov 10, 2011
Messages
211
Gender
Undisclosed
HSC
2013
A company may decide to use an interpreted language for a number of reasons. Firstly, the use of an interpreted language allows for great flexibility. It also makes syntax checking a much easier process and makes the location of syntax errors far easier than a compiled language. Another advantage of using an interpreted language in this situation is that file size is greatly reduced in the final build. Finally, the use of an interpreted language means the company can rapidly prototype the program, allowing for increased speed of development.
That's really good. I actually had in mind an answer about being able to run on different hardware and platforms (more flexibility), but yours works well too.
 

Shazer2

Member
Joined
Feb 16, 2012
Messages
439
Gender
Male
HSC
2013
Yeah interpretation is reading in code line by line and executing but compilation is translating the whole code to object code then executing. (I think). Imagine the translation of an English book to Spanish, interpretation you translate each line, compilation you translate the whole book.
 

hjed

Member
Joined
Nov 10, 2011
Messages
211
Gender
Undisclosed
HSC
2013
Wait is the interpreted to do with compilation and reading it line by line...i never really understand that stuff.
Interpreted is when the code is compiled at run time, line by line. It means you have to distribute source code instead of machine code, but it runs on lots of different platforms.

Edit: ninja'd
 

schlep16

Member
Joined
Nov 17, 2009
Messages
37
Gender
Undisclosed
HSC
2013
Next questions:
i. Out of the Header, Data and Trailer which would a parity bit NOT be seen/used? (1)
ii. How does a Checksum differ to that of CRC? (3)
iii. Explain TWO advantages and TWO disadvantages of the three types of error checking techniques. (6)

/10 Marks
GO!!!!!
(hope they all make sense)
 

hjed

Member
Joined
Nov 10, 2011
Messages
211
Gender
Undisclosed
HSC
2013
Hey working on your question.... in part 3 do you mean error checking techniques in data streams, or error checking techniques for software solutions? :)
 

Shazer2

Member
Joined
Feb 16, 2012
Messages
439
Gender
Male
HSC
2013
Hey working on your question.... in part 3 do you mean error checking techniques in data streams, or error checking techniques for software solutions? :)
I'd say data streams, considering the previous 2 questions are data stream related.
 

Shazer2

Member
Joined
Feb 16, 2012
Messages
439
Gender
Male
HSC
2013
Hey working on your question.... in part 3 do you mean error checking techniques in data streams, or error checking techniques for software solutions? :)
I'd say data streams, considering the previous 2 questions are data stream related.
 

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

Top