Skip to content

expectocode/ProgrammingIITutorialQuestions

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Programming 2: Ally's Tutorial Questions

(You will see a number of TODOs in this README; these will disappear as the term progresses.)

The best way to learn a programming language and the concepts that underlie the language's design is to do lots of programming.

The aim of these tutorial questions is to give you the opportunity to write, inspect, debug and play with a bunch of reasonably small programs. There are quite a lot of questions, they form part of the examinable material for the course, and thus I strongly encourage you to attempt all of them.

I also encourage you to explore your own variations of and extensions to the tutorial questions. Think of extra features you could add to some of the programs, and try to add them.

When are these tutorials?

There aren't any. I'm calling them "tutorial questions", but really the questions are for your own self-study. I won't be running tutorial sessions during my part of the course; instead we will do lots of live coding in class. While I might touch on a few of these questions, the vast majority of them won't be discussed. Similarly, your programming tutor or undergraduate teaching assistant might choose to go over some of these questions during PPT sessions, but they are not part of the core material to be covered in PPT groups.

So, once again: do try out all the questions in your own time before the final test!

When should I attempt each question?

The questions are presented in a reasonably logical order, but this order might not match exactly the order we cover material during the lectures. I suggest that you try out each question as soon as you feel you've learned enough to have a stab at it. I've indicated using links where there are dependencies between questions, and have tagged each question with one or more topic areas.

Reporting errors

For everyone's benefit (including the benefit of future students), please email me (afd) if you find errors in these sheets or the sample solutions.

If you get stuck

  • Ask me for help after lectures and tutorials
  • Attend the lab sessions and ask the lab helpers for advice
  • Send me an email (afd)

However, before you ask for help do make sure you have spent a significant amount of time scratching your head and thinking about your problem, and looking for solutions in the lecture notes and other available sources. You will likely learn a lot by really trying to figure things out for yourself. If you are still stuck after this then I, and the others involved in the course, will be very happy to help.

Question labels, dependencies and tags

Each question is labelled with a 4-digit hex identifier, e.g. 98e3.

Some of the questions depend on other questions; I have indicated wherever this is the case, linking to the prerequisite question.

To help you decide how you should prioritise working through the questions, I have attached one or more tags to each question in the list below. The tags are as follows:

TODO: There will be more tags once all questions have been added.

  • Recap: focuses on recapping basic imperative concepts of Java: loops, recursion, variables, arrays and enumerations.
  • SimpleObjects: covers basic use of objects (with little or no use of interfaces, inheritance, etc.).
  • Interfaces: covers concepts relating to Java interfaces.

The questions!

You can access the questions via the table below. Solutions are provided for all questions (TODO: they will be provided shortly if not already), and code solutions for all questions are available at solutions/code.

It is totally up to you when to look at these. I suggest you attempt each question without reference to its solution, and start to peek at the solutions when you get stuck, or when you believe you have made good progress on a question.

Much of Object Oriented Programming is not an exact science: there is a lot of room for creativity, and when designing an application one often has to make a choice between multiple imperfect approaches, each with different pros and cons.

As a result, you will likely find that some of your answers differ from the sample solutions. When this is the case, think hard about whether the sample solution is better than your solution, whether your solution is better than the sample solution, or whether they are both viable alternatives.

I'm very happy to discuss alternative solutions. Also, please get in touch if there are parts of the solutions that you do not understand, of if you spot errors.

Label Name Topic tag(s) Depends on Solution
98e3 ... 1 4 2 1 4 2 1 ... Recap Solution
f79b Perfect palindromic cubes Recap Solution
4c70 Lottery numbers Recap Solution
014e Random numbers Recap Solution
2d33 Reversed order of input Recap Solution
f7c3 Pig Latin Recap Solution
67dd Word count Recap Solution
7ec8 Battling fighters Recap, SimpleObjects Solution
8d24 Lucky battling fighters Recap, SimpleObjects 7ec8 Solution
bec2 Music collection Recap, SimpleObjects Solution
c2b8 Irresponsible rectangle SimpleObjects Solution
d363 Bloated person SimpleObjects Solution
7206 Understanding references SimpleObjects Solution
937d Flawed rectangle SimpleObjects Solution
bdb4 Flawed house SimpleObjects Solution
0378 Comparing people Interfaces Solution
6346 Depth of arithmetic expressions Interfaces Solution
e6fd Bit sets Interfaces Solution

TODO: I am in the process of migrating tutorial questions from a different format. More questions will be added soon!

More hex strings

When I am gone, if someone wants to add more questions then please consume the remaining hex strings here.

About

Tutorial Questions for the C202.2 Programmig II course at Imperial College London

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%