comp115/155 past paper questions (1 Viewer)

doe

Member
Joined
Jan 23, 2004
Messages
751
Gender
Undisclosed
HSC
N/A
[edit - 17 is E ]

1. E
2. C
3. C
4. D
5. C
6. E
7. D
8. C
9. B
10. A
11. B
12. D -> only one has to be false for && to fail
13. D
14. B
15. A
16. E
17. D
18. D
19. D
20. D
21. B
22. D
23. A
24. ? -> none of them
A gives "1,2,3,4,"
B gives "1,2,3,4,5,"
C gives "0,1,2,3,4,5"
D gives "0,1,2,3,4,5,5"
E gives "1, 2, 3, 4, 5"
very strange.

25. B
26. C
27. A

B - seeds is private, main cant access it.
C - color is a string, not a function
D - seeds is private
E - the constructor only takes 1 argument

28. E
29. B

i just did a truth table and got

(p && (! (q || (! (p && r))))) is true only if p = 1, q = 0, r = 1

which i think is what B says.

30. E

the code

cout << doIt(str, a);

need doIt to return a string

only C and E return a string, and C returns fx which is the integer argument.
 
Last edited:

doe

Member
Joined
Jan 23, 2004
Messages
751
Gender
Undisclosed
HSC
N/A
ill re check 24 but its simpsons time :p
 

Orange Juice

so worthless i am
Joined
Nov 23, 2002
Messages
3,886
Location
Room 112
Gender
Male
HSC
2007
Originally posted by doe
ill re check 24 but its simpsons time :p
get your priorities straight! tv is less than (for some reason less than or equal symbols dont come up...)helping first years with comp115... sheesh you think that its a written law...
 

flyin'

EDIT
Joined
Aug 21, 2002
Messages
6,677
Gender
Undisclosed
HSC
N/A
doe, 24 was "the" stuffed question.. imagine seeing that in the exam.. just had to go for what you thought they thought was right =p
 

doe

Member
Joined
Jan 23, 2004
Messages
751
Gender
Undisclosed
HSC
N/A
it has to do with the << operator.

cout << x

means "take whatever x is and print it to the stream cout"

if x is a fuction, it will evaluate that fuction and print the result, eg

cout << foo();

is equivalent to

tmp = foo();
cout << tmp;

so for q30, doIt needs to return a string cause the code would be like

int a = 20;
tmp = doIt(str, a);
cout << tmp;

the problem with a is it doesnt return a string, it returns void, it might even work, but it's not "correct".

same for q26

mumble takes an integer argument, prints it out, increments it and returns the incremented value. so in main() its going

int x = 5;
cout << x;
tmp = mumble(x); //will print out 5 and return 5 + 1
cout << tmp; //prints 6, the return value from mumble()

the first time mumble is called (with mumble(2)) the return value is just ignored, which is ok too
 
Last edited:

doe

Member
Joined
Jan 23, 2004
Messages
751
Gender
Undisclosed
HSC
N/A
ah shit, E it is

misread it, thought the b had an & ...
 

doe

Member
Joined
Jan 23, 2004
Messages
751
Gender
Undisclosed
HSC
N/A
good luck for tomorrow guys, these are some tips i have for comp exams

- take your time and read the question completely. many times comprehension of what is being asked is as hard as what they are actually asking you to do (as you no doubt discovered in the assignments :p) [ie working out what the question wants]

- for the long answer questions, break it into smaller problems, think about how you would solve the problem in your head, and try and break it into steps.

- for each step write some code, even if you cant remember the syntax, take question 4 of part c, even shit like

print "enter the number of minutes"
read num_mins //read in call time in minutes eg 2
print "enter the number of seconds"
read num_secs //read in the number of seconds eg 17

just comment everything so the marker knows what your doing, especially if your just writing psuedocode or a mix of psuedocode and c++. give examples of what you think inputs would be. if youre really stuck jusst write the steps in plain english. ie "id prompt the user for and read in the number of minutes and seconds. i would set the total sum to 22 cents initally, then multiply the number of minutes by 55 and add that to the sum. if the number of seconds was greater than 30 id add 110 to the total sum ... blah blah".

- go to the toilet about halfway through, even if you dont need to. just take a break and clear your mind as its easy to get overwhelmed with little details in comp exams.

- dont stress too much, its only uni :p

- be a time nazi, stick to the timelimits you give yourself foreach question, you might just need the 25 minutes to answer that question in part d you think you can do in 10 :p
 
Last edited:

redruM

Breathe and Stop
Joined
May 11, 2004
Messages
3,954
Gender
Male
HSC
2003
final tip: dont study and wing it!

fully tabulli cuz :p
 

flyin'

EDIT
Joined
Aug 21, 2002
Messages
6,677
Gender
Undisclosed
HSC
N/A
Originally posted by doe
- go to the toilet about halfway through, even if you dont need to. just take a break and clear your mind as its easy to get overwhelmed with little details in comp exams.
this works very well, unless you're under extreme time constraints =p and in comp115 there are no time constraints
 

redruM

Breathe and Stop
Joined
May 11, 2004
Messages
3,954
Gender
Male
HSC
2003
Originally posted by flyin'
this works very well, unless you're under extreme time constraints =p and in comp115 there are no time constraints
yeh i did the toilet break thing.
got stuck on problem, left it...30 mins later went to toilet, came back to same question and got it out:p

i went good in that exam. got everything, never know about silly mistakes, but never learnt classes, so lost few marks ther for sure.

i was very pleased....so many marks for arrays :D they were like 3/4 line solutions. getting your head around nested for loops was pretty much what you needed for the exam.
 

flyin'

EDIT
Joined
Aug 21, 2002
Messages
6,677
Gender
Undisclosed
HSC
N/A
well, we'll know whether it's just a false impression in about 30days.. cos i reemember i thought i did well in accg101 (considering i knew practically nothing.. couldnt even do cash flwo statements) and didn't
 

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

Top