Continuing on my series looking at some university exams, today
i'm going to look at a computer science course.
So this is a real exam with solutions from Cornell University
and it was uploaded to their website.
So the first link in the description will be a link to download this exam, and you can read through it at your own pace.
It's an introduction to computer science
so it's going to cover
sort of some basic things like what is a programming language, some style and structure and then getting into
some more basic
algorithms and data structures. These are going to lay a ground base or a theory to write better code.
It can be the difference between good and bad code, or code that's fast to run and code that takes ages.
So it's kind of algorithms that
keep you using the best practices so you can write code that's efficient.
That's the difference between some of these theory courses in computer science that you'll see and
just trying to learn a language straight up without a bit more of this theory, is that yeah it helps you write better code.
So this is an introductory course like I said
which means that for someone who's coming in to the study having already a bit of computer science knowledge,
they might find it a breeze and that was what I saw happening when I took a course like this. That some people definitely
found it easier than others. They found it easier than the people that hadn't had any experience in the topic
but it should be manageable for
anyone if they pay attention in class
and
give it their best shot. So let's have a look at what you'd be expected to do in this exam.
We've got nine questions to do in two and a half hours. The first question deals with Big O notation
which talks about how
costly a certain algorithm is to implement. It gives an upper bound or a worst case scenario
of the growth rate of a certain function
depending on how much data
you're dealing with. It should be a reasonably straight forward question to pick out
how costly some of these certain actions are. In this question we are given some
functions in code
and we're asked to
tell what the output is going to be.
There's kind of only a few options on what can be returned so it's just a matter of making sure we know how to read
this language. You wouldn't have to worry about learning a whole bunch of languages,
usually the language you'd see in an exam for a course like this is going to be
what you've been learning throughout the course and what you've been using.
So these two should be reasonably straightforward as long as you read the questions really carefully. In this question
we're looking at an algorithm
specifically Dijkstra's algorithm which
concerns trying to find the shortest path between a bunch of nodes. So it's sort of a question of if you're trying to
drop off a bunch of people
at their houses, what's going to be a good path to take to drop off those people?
So in the question, which is this section,
you're sort of asked to show how you're going to implement this algorithm
and how you're going to make updates to it,
and then everything in the box is kind of an expected solution here. Obviously this is the model solution so
demonstrating an understanding that you'd have a plan of implementing this algorithm, you should do all right.
Then on the next page. I think these should be reasonably simple as well if you've paid attention during class
but you're being asked questions about
spanning trees.
So these are algorithms
that connect a bunch of dots, so connecting a bunch of trees in a forest with
let's say the least possible amount of edges between the trees. Some of these questions are quite basic
because the purpose of this exam is not for you to show that you can
write complex code or long and
involved work, what you're trying to do is just show that you've understood the basic concepts that have gone on in class.
You're going to be tested on your ability to write more complex code in the course, but that's going to come through things like
assignments or weekly homework, something like that where you can actually
have a lot more time to think and implement things the way you want to and actually
like get out a lot of code and work on it for a long time. An
exam is not that time, an exam has a different purpose. It's not for you to show off your code,
it's just for you to show,
yes, you've you've understood some of these basic ideas that
your lecturer is trying to communicate to you.
That's why some of these exams might look easy, I
don't think that'd be the hardest part of the course,
I think in computer science the hardest part of the course is doing those assignments
which can be sometimes quite long and quite a lot of lines of coding.
Then we're moving on to some data structures, so these are ways that
you would store data in an efficient manner.
This particular question is about something called a hash table, so you've essentially got
here
eight buckets that you can put data into and in this case data is some numbers and
there's a few ways that these hash tables can work.
Say you're putting numbers into each bucket by some assignment process and this question here is asking you to show the difference
between what happens if you're trying to put two numbers into the same box. In (a)
you deal with that by chaining,
so you just sort of append the second number onto the end of the first one and then (b)
you deal with that by
linear probing, so if one box is full you move on to the next box and keep looking for boxes until you find one
that's empty and place the number in there. So different ways to deal with storing data in a table.
Then we've got a bunch of true/false questions,
some relating specifically to what would have been the programming language used in this course
which looks like it was Java, and then a few more questions about algorithms and a few statements.
You've got another big O notation down the bottom.
One really useful thing in computer science is something called a binary tree
and that's what some of these questions are all about. A binary tree is something where you have say a
parent node, and then you can have
children coming off of that parent node
so you can have one or two children and those are going to be related in some way and
these binary trees are a way to
organize data so that you can look up values, say the maximum or a minimum value in a set of data,
they're quite efficient at doing that. So we've got a bunch of questions here, again,
they're reasonably simple, you're not being asked to write a bunch of code. You're just being asked to understand
what something like this can help you do.
So just a few questions about maybe manipulating these or understanding them.
This is a question where you are actually asked to write a bit of code as your answer and  it
might be a little bit daunting, I guess, but it's a
reasonably simple function compared to what you've probably done during the assignments, so it shouldn't be too bad.
This is a written exam so
some people would find it weird to be writing code down with a pen and paper rather than typing it.
You've just got to be neat with your notation
but usually it's kind of good actually to write code in an exam in this sense because if you do
forget something like a semicolon, your lecture is probably going to be a bit more lenient
because they understood what you meant to do. Compared to a computer who will just completely reject your answer.
So I guess it has a benefit in that way. My uni where I did
computer science in undergrad were phasing to
not use paper exams at all and to do it all online on the computer
so in that sense you would have to pay more attention to making sure the code you write in an exam is
correct,
but there's benefits to both.
So here yeah, we just have a few more questions about
the structure of binary trees and then a final question
which is maybe one of the most mathematical in here, it's a proof by induction and
again it relates to binary trees. So it again relates to
the idea of
efficiently dealing with data, how to sort through it, how to store it,
and just how to write good code.
I hope that wasn't
Scary and I hope it didn't look too easy either, but yeah, it's an introductory computer science course.
There's definitely a lot more advanced things you can do with this.
Hopefully it was a good snippet at what you can expect,
thanks for watching.
