## 2015 AP CS FRQ Solutions

Today the 2015 APCS FRQs were released. Here are my solutions. I did create all the extra code to test all these classes and interfaces out as well. But these are just the answers to the questions. If you want a BlueJ project with classes for testing the code, click here. If you just want to browse the classes, click here.

Question 1

//part A
public static int arraySum(int[] arr)
{
int sum = 0;

for(int n : arr)
sum += n;

return sum;
}

//part B
public static int[] rowSums(int[][] arr2D)
{
int[] sums = new int[arr2D.length];

for(int i = 0; i < sums.length; i++)
{
sums[i] = arraySum(arr2D[i]);
}

return sums;
}

//part C
public static boolean isDiverse(int[][] arr2D)
{
int[] sums = rowSums(arr2D);

for(int i = 0; i < sums.length; i++)
for(int j = i+1; j < sums.length; j++)
if(sums[i] == sums[j])
return false;

return true;
}

Question 2

public class HiddenWord
{
private String hidden;

public HiddenWord(String h)
{
hidden = h;
}

public String getHint(String hint)
{
String r = "";

for(int i = 0; i < hint.length(); i++)
{
if(hint.charAt(i) == hidden.charAt(i))
r += ""+hint.charAt(i);
else if(hidden.indexOf(hint.charAt(i)) > -1)
r += "+";
else
r += "*";
}

return r;
}
}

Question 3

// part A
public int getValueAt(int row, int col)
{
for(SparseArrayEntry e : entries)
{
if(e.getRow() == row && e.getCol() == col)
return e.getValue();
}

return 0;
}

// part B
public void removeColumn(int col)
{
numCols--;

for(int i = entries.size()-1; i >= 0; i--)
if(entries.get(i).getCol() == col)
entries.remove(i);

for(int i = 0; i < entries.size(); i++)
if(entries.get(i).getCol() >= col)
{
SparseArrayEntry h = entries.get(i);
SparseArrayEntry e =
new SparseArrayEntry(h.getRow(),(h.getCol()-1),h.getValue());
entries.set(i, e);
}
}

Question 4

// part A
public interface NumberGroup
{
public boolean contains(int num);
}

// part B
public class Range implements NumberGroup
{
private int[] list;

public Range(int min, int max)
{
list = new int[Math.abs(max-min+1)];
for(int i = 0; i < list.length; i++)
list[i] = min + i;
}

public boolean contains(int num)
{
for(int n: list)
if(num == n)
return true;
return false;
}
}

// part C
public boolean contains(int num)
{
for(NumberGroup n : groupList)
if(n.contains(num))
return true;
return false;
}

## Jess Hester brings SpaceX to Bellaire

My first ever astronomy class at Bellaire was one period and very mixed group of students. Some were all AP/IB and some took no advanced classes at all. It was, essentially, an experiment. I had no idea what I was doing really, but it was a fun, fun class. Jess Hester heard during her junior year that I’d be teaching astronomy and was the first person to sign up. Even though the course wasn’t weighted like the AP and IB courses, she was my most enthusiastic supporter. We’ve stayed in touch. She went to Harvey Mudd College in California and majored in mathematics and computer science. She got a job at SpaceX, the Elon Musk owned commercial space company.

Today she came to my current astronomy classes which are now IB astronomy and represent the a more rigorous course. The students are still a mix. She brought some SpaceX giveaway stuff too. Patches, pens, lanyards, and stickers. Awesome stuff. The kids asked great questions and Jess was smart and informed and very impressive. We all had a great time and I’m glad she agreed to come talk.

## Bellaire Students Find Possible Asteroid Family

In the fall of 2014, I sought out some students to participate in a 6-month long research project related to asteroid science. The program is called Exploration of the Moon and Asteroids by Secondary Students (ExMASS) and is managed by the Center for Lunar Science and Exploration (CLSE) and administered at the Lunar and Planetary Institute in Houston.

The students were juniors and seniors. My experience has been that juniors have the desire and most of the needed knowledge, and seniors have the needed knowledge and most of the desire. So mixing juniors and seniors is often a winning combination when it comes to academic programs. After a bit of shifting around, we ended up with a final team of 3 seniors and 2 juniors. I have taught each of the students in the 5-member team in at least 2 courses: AP Physics C, AP Computer Science, and IB Astronomy. Some of them have had all three courses.

The initial objective is for the team to analyze some known data about asteroids and present their findings to one of the program administrators. This means a web-based presentation to a scientist about a topic the students only recently explored. This is called the asteroid 101 presentation. Once that’s done, a bit of a debrief is in order. How did the students answer the scientist’s questions? What was good and what was bad about the actual presentation? What science skills do the students still lack?

Next up the team gets to know their science advisor. The start and stop process of trying to choose a direction for actual research can be very frustrating. This is where I feel like the mentor’s role (that’s me) is critical. The students lose focus. They don’t really have enough experience. They need encouragement. They need face-to-face meetings to brainstorm. Eventually one of the team members dug a bit deeper and came up with some possible avenues of research. She presented her findings, and the team debated and discussed. Then they simply picked one of the ideas and ran with it.

This is when things got interesting. The positive feedback loop between the team and the science advisor seriously allowed the team to have ownership of their research. They needed to learn some science skills, some math skills, and some tech skills to put the question and the answer together. Eventually the team realized they had found the possible fingerprints of an ancient asteroid catastrophe. They tracked down data on a series of asteroids that could possibly have come from a disrupted parent body. Perhaps it was broken up by collisions or tidal forces.

So did the team actually discover the remnants of an asteroid? Well, they named it just in case. They decided on Zhuque (sometimes also called the Vermillion Bird) since Bellaire’s mascot is a cardinal. The name also has mythological roots which is consistent with naming conventions from the IAU Minor Planet Center.

They sent their preliminary results to the advisor. She was very encouraging and also gave them plenty more to chew on to clarify their findings. Then all of a sudden it was time to put an actual poster together and write an abstract. This stage was surreal. The team was a cohesive science team. The advisor seemed to think they might have actually found something. What’s interesting about the discovery is how much of an afterthought it was. They were having a blast just digging around in this area.

Once the poster and abstract were done, it didn’t matter to me if they won because the project had been a success. This team had put a serious scientific effort into a question that interested them all and had a great piece of work to show for it. The full size poster is available, but it’s really big (~26mb).

Other schools also submitted posters and abstracts. They also had great products to show for the months of work. So when the Bellaire team learned that they and 3 other teams were going to present their work to the judges in a video conference format, we were all very pleased. There was a rush of work at the end to build a presentation out of the poster findings, but when the day came what the teams put together for the judges showed just how creative high schoolers can be when asked to do real science. None of these kids were even out of high school yet, but here they were showing off fantastic work. All 4 finalist teams will have their work displayed at a national conference on planetary science. One team would be asked to actually present in person at the National Exploration Science Forum.

The 30 minutes the judges spent in deliberation were very tough for some of the team members. That’s why when the judges decided the Bellaire team had earned the privilege to present their findings they couldn’t contain their glee. I’m so proud of the work the Bellaire team has done on this project. It’s been great for all involved. Each of us learned stuff and got an improved set of science skills from the experience. Even though all I did was essentially keep them on track, I still feel like I was a part of team, even if just as a minor player. I hope Bellaire gets a chance like this again. I look forward to other research project opportunities in the future!

Here are some photos of the presentation to the judges.

## Physics With Portals Spring 2014

Above is a demonstration of harmonic motion using the game physics of Portal 2. I think the motion is more likely a general harmonic oscillator than a simple one but you get the idea. Yes, I know I made a grammar error in the annotation. Meh…

We spent a few days of the spring semester 2014 in AP/IB physics C/HL working on creating puzzles (game levels) for the game Portal 2 using the educational version of Portal 2.

The goal is to show that some element of physics either works as expected or does not by actually collecting some in-game data and analyzing the results. Individuals and small groups spent time learning the game mechanics, learning the basics of puzzle making (game-level design), and then learning how to test out physics ideas by collecting data. Then finally each group or person created an IB-physics-style lab report and we did a day of show and tell.

I got SO much help from Cameron Pittman at Physics With Portals including advice on capturing in-game video, lots of great examples of how to teach physics with Portal 2, and some hints and tricks on collecting data in game. Thanks Cameron! His videos are also really great for anyone interested in teaching physics with Portal 2.

Below is each level in a short video demonstration.

This one was just too crazy not to include. There was no associated paper. Just insanity…

## Screencasting for Teachers

Summary: Learn the basics of screencasting for teachers. This is a common idea in the flipped classroom model.

If you are considering attempting to flip your classroom so you can be more interactive in class and have students get some short and sweet direct instruction at home for homework, at some point you may want to be the one doing the talking for that direct instruction. Some educators use TED talks, MIT OpenCourseWare, Khan Academy, YouTube content, or other teachers’ videos.

If you want to make your own lectures for a flipped classroom, you’re going to need to record content and get it online. Then of course you have to get students to consume your content. This post is all about HOW to make your own content for such a purpose. I’m going to use the term screencasting which has come to mean recording yourself using your computer. You can have your voice over the interactions with applications on your computer and you can also have a video superimposed on the computer.

Software for screencasting ranges from expensive to free and quality varies a lot as well. If you have been in education for a while the name Kathy Schrock is likely familiar to you. She is one of the most prolific educational technology folks around. She has an entire section of her “Schrock Guide” dedicated to screencasting info including links to software downloads and HOWTO articles and videos. You can find info about software, web sites, mobile apps, and pedagogy stuff as well. It’s great.

I bought ScreenFlow a while ago for around \$100 which is a lot to spend really. I justified the expense since I do a bit of distance education. The software lets me post to YouTube and Vimeo and add a lot of cool things to the videos. Here is a screencast about one of my recent lessons where screencasting was important. ScreenFlow has been a great tool for me. There are free and cheaper apps out there that do awesome stuff too so don’t think you need something expensive to screencast.

If you are a SMART Board user, then you are in luck. There is an app that’s part of SMART Tools called recorder which can record your actions on the SMART Board and can even record your voice. You can use the SMART Recorder without being connected to a SMART Board nor do you have to even use SMART Notebook. Here is a HOWTO video on using the recorder application. It works on a Mac as well. I tested it out. 🙂

## LaTeX rendering in WordPress is very awesome!

$i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right>=H\left|\Psi(t)\right>$

## Welcome to the 2013-2014 academic year y’all!

I am going to attempt some very different techniques with all my classes this year.

For my Bellaire classes, I plan to use Edmodo for communication and some assessments. That means students will be expected to create and use an Edmodo account. Go to the respective class homepage for a link to Edmodo

The first place you should go to access files and get notes will be JimmyNewland.com. In fact you can get to my email or Edmodo from here.

How to be prepared for class:

Everyone: There will be many times that having a laptop computer in class will be beneficial. Safety and privacy are issues that each student and her family will have to work out. But in room 186 we will foster an environment of responsible and safe technology use. There will be access to power, ethernet, printing, and wifi (if possible). No one at Bellaire however will be held responsible for the equipment. Students use their own tech at their own risk.

AP Physics C: bring a working pencil, pen, and calculator everyday. You will be working in groups very often as well as taking copious notes. You need a spiral bound notebook or a binder. I also recommend engineering paper instead of regular notebook paper. There are also many handouts you will be responsible for managing. You will be better served to bring your textbook home than to bring it to class everyday.

AP Computer Science: bring a working pencil and pen everyday. You will be working in groups very often as well as taking copious notes. You need a spiral bound notebook or a binder with plenty of paper. You may bring your own computer at any time. Just be aware of the above caveats. There is no physical textbook for computer science. There are however many handouts you will be responsible for managing.

The main goal is to use technology to allow students to learn in a variety of ways and to have access to content at times besides during the school day. Peer-instruction, quality group work, inquiry-based learning, and a general sense of academic awesomeness are my targets.

## Want to apply some information architecture to the web? Learn HTML5!

Summary: Using HTML5 and CSS3 is the most bang for your buck right now if you want to use semantic web ideas in the most broad way possible and Codecademy.com is the best way to learn them right now. Card sorting is a common user interface (UX) technique for websites.

I recently met with a group of law librarians at the South Texas College of Law to discuss a little information architecture theory and practice. The coolest thing about putting together something like this is how much you polish your own skills. I can attest that the best way for me to learn a thing is to attempt to teach it well.

Information architecture is a way of measuring, modeling, and quantifying information as an entity and how humans and machines interact with information. There is a long and illustrious history and the disciplines touched by the ideas here are as varied as librarianship and physics can represent.

How we design the web impacts how we interact with the information therein. I came up with the following claim: When it comes to the web, you get the most bang for your buck in terms of using information architecture by learning to use HTML5 and CSS3 effectively.

## HTML5 Makes the Web Better with Semantics

HTML5 has been a long time in the making. The W3C is in charge of putting the official stamp on a finished product. As the more nerdy among you probably know, the father of HTML and Web is Tim Berners-Lee. One of his original visions was to create a web of machine-readable information where the data ABOUT the data would help the machine parse things out. The semantic web isn’t fully realized with HTML5 but you can use HTML5 to add metadata to web content. Let’s look at an example (modified slightly) from the excellent HTML5 Doctor site.

The new HTML tag here is article. So what’s new? Well all the stuff from line 8 to line 29 is one thing. This unit is suitable for export to RSS or ready to be visually set apart from other articles or all setup to connect the time and comments directly to the content via the tags.

Big idea: good metadata makes for a more flexible web!

HTML 4.01 didn’t have this kind of ubiquitous metadata. There is a very similar tag called section which is a more generic way to break up data but the article tag is less ambiguous.

## HTML5 isn’t fully baked

HTML5 isn’t exactly finished yet but that hasn’t stopped the web movers and shakers from making this the new standard. You can see how well your particular browser understands HTML5 over at HTML5Test. And yes even Internet Explorer version 10 speaks some HTML5.

## Learn to code HTML5 & CSS3

If you want to dig in a bit more you could download the HTML5 boilerplate code, read the free Dive Into HTML5 book online, visit the HTML5 Doctor for some clear explanations of tags, or try out the W3Schools HTML5 lessons.

But one cool and very interactive way to get some HTML5 under your belt is to step through the web fundamentals lessons over at Codecademy. The code you learn isn’t necessarily the most cutting edge HTML5 but what you see there will work across browsers. There is also a cool editor and hints along the way. The lessons culminate in a little product you are to create. It’s a lot of fun! And you can also learn programming fundamentals as well, not just web code.

## Card Sorting Can Improve UX

UX and usability has really grown into a mature field of study within information architecture. I recommend taking a stroll through some of the great work over at the Norman-Nielsen Group site to get a feel for how much analysis goes into how humans interact with the web.

Big idea: Card sorting can allow the stakeholders to shape the UX of a site.

One easy to implement idea is card sorting. First find a group of stakeholders in the web project in question. They need not be web designers. Then ask them to write out on cards the topics that are most important to have on the website. There are a lot of ways to use this sort of mental inventory. You can sort them. You could ask another team to put them in piles and turn those into your menus. Or many many other things. You can also use software tools to a similar end by using a web-based card sorting tool. I also found some unrelated but cool mental map tools out there!